diff options
| author | HampusM <hampus@hampusmat.com> | 2026-06-05 21:47:17 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-06-05 21:47:17 +0200 |
| commit | 87015a4abcd45d6c69b289467c9e37426e1f0930 (patch) | |
| tree | e175f8c7e59178050a248916745a24407860d9e1 /engine/src/mesh.rs | |
| parent | e69aa8a01bdb6f547fa78a146a6398a093576445 (diff) | |
feat(engine): add fns for changing mesh data
Diffstat (limited to 'engine/src/mesh.rs')
| -rw-r--r-- | engine/src/mesh.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/engine/src/mesh.rs b/engine/src/mesh.rs index a223f60..9aa1f80 100644 --- a/engine/src/mesh.rs +++ b/engine/src/mesh.rs @@ -26,6 +26,11 @@ impl Mesh &self.vertex_buf } + pub fn vertex_buf_mut(&mut self) -> &mut vertex_buffer::VertexBuffer + { + &mut self.vertex_buf + } + #[must_use] pub fn indices(&self) -> Option<&[u32]> { @@ -38,6 +43,15 @@ impl Mesh self.indices.as_deref_mut() } + pub fn set_indices(&mut self, indices: impl IntoIterator<Item = u32>) + { + let curr_indices = self.indices.get_or_insert_with(|| Vec::new()); + + curr_indices.clear(); + + curr_indices.extend(indices.into_iter()); + } + /// Finds the vertex positions that are furthest in every 3D direction. Keep in mind /// that this can be quite time-expensive if the mesh has many vertices. pub fn find_furthest_vertex_positions(&self) -> DirectionPositions |
