rotex_types/resource/
batch.rs1use crate::resource::descriptors::{MaterialDescriptor, MeshDescriptor, TextureDescriptor};
2use crate::resource::geometry::{IndexFormat, VertexBufferLayout};
3use crate::resource::ids::{MaterialId, MeshId, TextureId};
4
5#[derive(Debug, Clone)]
6pub enum ResourceCreateDescriptor {
7 Mesh(MeshDescriptor),
8 Texture(TextureDescriptor),
9 Material(MaterialDescriptor),
10}
11
12#[derive(Debug, Clone)]
13pub struct ResourceBatchCreate {
14 pub resources: Vec<ResourceCreateDescriptor>,
15}
16
17impl ResourceBatchCreate {
18 pub fn new(resources: Vec<ResourceCreateDescriptor>) -> Self {
19 Self { resources }
20 }
21}
22
23#[derive(Debug, Clone, Copy)]
24pub enum ResourceHandle {
25 Mesh(MeshId),
26 Texture(TextureId),
27 Material(MaterialId),
28}
29
30#[derive(Debug, Clone)]
31pub struct CreatedResources {
32 pub handles: Vec<ResourceHandle>,
33}
34
35#[derive(Debug, Clone)]
36pub enum ResourceUpdateDescriptor {
37 Mesh {
38 id: MeshId,
39 vertex_data: Vec<u8>,
40 vertex_layout: VertexBufferLayout,
41 index_data: Vec<u8>,
42 index_format: IndexFormat,
43 index_count: u32,
44 },
45 Texture {
46 id: TextureId,
47 data: Vec<u8>,
48 },
49 Material {
50 id: MaterialId,
51 enable_depth: Option<bool>,
52 texture: Option<Option<TextureId>>,
53 },
54}
55
56#[derive(Debug, Clone)]
57pub struct ResourceBatchUpdate {
58 pub updates: Vec<ResourceUpdateDescriptor>,
59}
60
61impl ResourceBatchUpdate {
62 pub fn new(updates: Vec<ResourceUpdateDescriptor>) -> Self {
63 Self { updates }
64 }
65}