summaryrefslogtreecommitdiff
path: root/engine/src/mesh.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/mesh.rs')
-rw-r--r--engine/src/mesh.rs14
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