diff --git a/src/model.rs b/src/model.rs index 9d88de8..8d44355 100755 --- a/src/model.rs +++ b/src/model.rs @@ -520,11 +520,13 @@ impl MDL { vertices[k as usize].bone_weight = MDL::read_byte_float4(&mut cursor).unwrap(); } VertexType::Byte4 => { - // TODO: This was used in Dawntrail models. Look into if this is really correct, but seems so? - vertices[k as usize].bone_weight = MDL::read_byte_float4(&mut cursor).unwrap(); - } - VertexType::Unknown1 => { - // TODO: Unimplemented, needed for Dawntrail? + let bytes = MDL::read_byte4(&mut cursor).unwrap(); + vertices[k as usize].bone_weight = [ + f32::from(bytes[0]), + f32::from(bytes[1]), + f32::from(bytes[2]), + f32::from(bytes[3]) + ]; } _ => { panic!("Unexpected vertex type for blendweight: {:#?}", element.vertex_type); @@ -536,9 +538,6 @@ 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); } diff --git a/src/model_vertex_declarations.rs b/src/model_vertex_declarations.rs index 56104e1..f334929 100644 --- a/src/model_vertex_declarations.rs +++ b/src/model_vertex_declarations.rs @@ -12,17 +12,40 @@ const END_OF_STREAM: u8 = 0xFF; #[brw(repr = u8)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum VertexType { + /// 1 32-bit float Single1 = 0, + /// 2 32-bit floats Single2 = 1, + /// 3 32-bit floats Single3 = 2, + /// 4 32-bit floats Single4 = 3, + + /// 4 bytes Byte4 = 5, + + /// 2 16-bit signed integers + Short2 = 6, + /// 4 16-bit signed integers + Short4 = 7, + + /// 4 8-bit floats ByteFloat4 = 8, + + /// Duplicate of Short2? + Short2n = 9, + /// Duplicate of Short4? + Short4n = 10, + + /// 2 16-bit floats Half2 = 13, + /// 4 16-bit floats Half4 = 14, - // Unknown vertex type, I seen them used in BlendIndices in Dawntrail - Unknown1 = 17 + /// 2 16-bit unsigned integers + UnsignedShort2 = 16, + /// 4 16-bit unsigned integers + UnsignedShort4 = 17 } #[binrw]