From 12e0f5ffffcaa36cce3cd4fecc007b9a2955ff23 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 18 Feb 2024 19:06:44 +0100 Subject: refactor(engine): add mesh struct used by Object --- engine/src/mesh.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 engine/src/mesh.rs (limited to 'engine/src/mesh.rs') 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, + indices: Option>, +} + +impl Mesh +{ + #[must_use] + pub fn new(vertices: Vec, indices: Option>) -> 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() + } +} -- cgit v1.2.3-18-g5258