1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-21 20:27:46 +00:00

Add MDL::replace_vertices function

Will be used for model writing in the future
This commit is contained in:
Joshua Goins 2023-12-09 14:45:00 -05:00
parent 8efbe484a5
commit c2426193ca

View file

@ -305,7 +305,7 @@ struct VertexElement {
usage_index: u8, usage_index: u8,
} }
#[derive(Clone)] #[derive(Clone, Copy)]
#[repr(C)] #[repr(C)]
pub struct Vertex { pub struct Vertex {
pub position: [f32; 3], 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<ByteBuffer> { pub fn write_to_buffer(&self) -> Option<ByteBuffer> {
let mut buffer = ByteBuffer::new(); let mut buffer = ByteBuffer::new();