Skip to main content

rotex_types/resource/
geometry.rs

1#[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, PartialEq, Eq)]
30pub struct VertexBufferLayout {
31    pub array_stride: u64,
32    pub attributes: Vec<VertexAttribute>,
33}
34
35#[derive(Debug, Clone, Copy, PartialEq, Eq)]
36pub enum IndexFormat {
37    Uint16,
38    Uint32,
39}