diff options
author | HampusM <hampus@hampusmat.com> | 2024-02-18 19:06:44 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-02-18 19:06:44 +0100 |
commit | 12e0f5ffffcaa36cce3cd4fecc007b9a2955ff23 (patch) | |
tree | dab821bd25eaf3ee5eea98adefb6edd5585db9fa /engine/src/mesh.rs | |
parent | de5c3ff1320ea0f0452afde4c1f42676d9eeab52 (diff) |
refactor(engine): add mesh struct used by Object
Diffstat (limited to 'engine/src/mesh.rs')
-rw-r--r-- | engine/src/mesh.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/engine/src/mesh.rs b/engine/src/mesh.rs new file mode 100644 index 0000000..67b26cc --- /dev/null +++ b/engine/src/mesh.rs @@ -0,0 +1,29 @@ +use crate::vertex::Vertex; + +#[derive(Debug)] +pub struct Mesh +{ + vertices: Vec<Vertex>, + indices: Option<Vec<u32>>, +} + +impl Mesh +{ + #[must_use] + pub fn new(vertices: Vec<Vertex>, indices: Option<Vec<u32>>) -> Self + { + Self { vertices, indices } + } + + #[must_use] + pub fn vertices(&self) -> &[Vertex] + { + &self.vertices + } + + #[must_use] + pub fn indices(&self) -> Option<&[u32]> + { + self.indices.as_deref() + } +} |