diff --git a/src/model.rs b/src/model.rs index 9900b7a..f73df3b 100755 --- a/src/model.rs +++ b/src/model.rs @@ -305,7 +305,7 @@ struct VertexElement { usage_index: u8, } -#[derive(Clone)] +#[derive(Clone, Copy)] #[repr(C)] pub struct Vertex { pub position: [f32; 3], @@ -579,6 +579,13 @@ impl MDL { }) } + pub fn replace_vertices(&mut self, lod_index: usize, part_index: usize, vertices: &[Vertex], indices: &[u16]) { + let part = &mut self.lods[lod_index].parts[part_index]; + + part.vertices.copy_from_slice(vertices); + part.indices.copy_from_slice(indices); + } + pub fn write_to_buffer(&self) -> Option { let mut buffer = ByteBuffer::new();