From 7c3d5a31428add7aa6004ee594816ecd1508f691 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 14 Apr 2024 13:22:47 -0400 Subject: [PATCH] Add new unknown vertex type found in Dawntrail benchmark Not sure what it's used for yet, but needed to be added so parsing doesn't completely fail. --- src/model.rs | 11 ++++++++++- src/model_vertex_declarations.rs | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/model.rs b/src/model.rs index ff636e6..557380e 100755 --- a/src/model.rs +++ b/src/model.rs @@ -505,6 +505,12 @@ impl MDL { VertexType::ByteFloat4 => { vertices[k as usize].bone_weight = MDL::read_byte_float4(&mut cursor).unwrap(); } + VertexType::Byte4 => { + // TODO: Unimplemented, needed for Dawntrail? + } + VertexType::Unknown1 => { + // TODO: Unimplemented, needed for Dawntrail? + } _ => { panic!("Unexpected vertex type for blendweight: {:#?}", element.vertex_type); } @@ -515,6 +521,9 @@ impl MDL { VertexType::Byte4 => { vertices[k as usize].bone_id = MDL::read_byte4(&mut cursor).unwrap(); } + VertexType::Unknown1 => { + // TODO: Unimplemented, needed for Dawntrail? + } _ => { panic!("Unexpected vertex type for blendindice: {:#?}", element.vertex_type); } @@ -1014,7 +1023,7 @@ impl ModelData { + self.header.shape_mesh_count as u32 * 12 + self.header.shape_value_count as u32 * 4 + 4 // SubmeshBoneMapSize - + self.submesh_bone_map.len() as u32 * 2 + //+ self.submesh_bone_map.len() as u32 * 2 + self.padding_amount as u32 + 1 // PaddingAmount and Padding + (4 * 32) // 4 BoundingBoxes + (self.header.bone_count as u32 * 32) diff --git a/src/model_vertex_declarations.rs b/src/model_vertex_declarations.rs index 6bb0e20..db29afa 100644 --- a/src/model_vertex_declarations.rs +++ b/src/model_vertex_declarations.rs @@ -20,6 +20,9 @@ pub enum VertexType { ByteFloat4 = 8, Half2 = 13, Half4 = 14, + + // Unknown vertex type, I seen them used in BlendIndices in Dawntrail + Unknown1 = 17 } #[binrw]