1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-26 06:07:45 +00:00

Export material indices for MDL parts

This commit is contained in:
Joshua Goins 2023-03-31 21:31:15 -04:00
parent 8af6bfeb8b
commit ba80ca326b

View file

@ -313,6 +313,7 @@ pub struct Vertex {
pub struct Part { pub struct Part {
pub vertices: Vec<Vertex>, pub vertices: Vec<Vertex>,
pub indices: Vec<u16>, pub indices: Vec<u16>,
pub material_index: u16
} }
pub struct Lod { pub struct Lod {
@ -399,6 +400,7 @@ impl MDL {
{ {
let declaration = &vertex_declarations[j as usize]; let declaration = &vertex_declarations[j as usize];
let vertex_count = model.meshes[j as usize].vertex_count; let vertex_count = model.meshes[j as usize].vertex_count;
let material_index = model.meshes[j as usize].material_index;
let default_vertex = Vertex { let default_vertex = Vertex {
position: [0.0; 3], position: [0.0; 3],
@ -472,7 +474,7 @@ impl MDL {
indices.push(cursor.read_le::<u16>().ok()?); indices.push(cursor.read_le::<u16>().ok()?);
} }
parts.push(Part { vertices, indices }); parts.push(Part { vertices, indices, material_index });
} }
lods.push(Lod { parts }); lods.push(Lod { parts });