rotex_types/resource/
geometry.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2pub enum VertexFormat {
3 Float32,
4 Float32x2,
5 Float32x3,
6 Float32x4,
7 Uint32,
8}
9
10impl VertexFormat {
11 pub fn size(&self) -> u64 {
12 match self {
13 Self::Float32 => 4,
14 Self::Float32x2 => 8,
15 Self::Float32x3 => 12,
16 Self::Float32x4 => 16,
17 Self::Uint32 => 4,
18 }
19 }
20}
21
22#[derive(Debug, Clone, PartialEq, Eq)]
23pub struct VertexAttribute {
24 pub location: u32,
25 pub format: VertexFormat,
26 pub offset: u64,
27}
28
29#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
30pub enum VertexStepMode {
31 #[default]
32 Vertex,
33 Instance,
34}
35
36#[derive(Debug, Clone, PartialEq, Eq)]
37pub struct VertexBufferLayout {
38 pub array_stride: u64,
39 pub step_mode: VertexStepMode,
40 pub attributes: Vec<VertexAttribute>,
41}
42
43#[derive(Debug, Clone, Copy, PartialEq, Eq)]
44pub enum IndexFormat {
45 Uint16,
46 Uint32,
47}