diff --git a/src/model.rs b/src/model.rs index e47fd18..58ed625 100755 --- a/src/model.rs +++ b/src/model.rs @@ -453,8 +453,8 @@ impl MDL { } VertexUsage::BlendIndices => { match element.vertex_type { - VertexType::UInt => { - vertices[k as usize].bone_id = MDL::read_uint(&mut cursor).unwrap(); + VertexType::Byte4 => { + vertices[k as usize].bone_id = MDL::read_byte4(&mut cursor).unwrap(); } _ => { panic!("Unexpected vertex type for blendindice: {:#?}", element.vertex_type); @@ -737,8 +737,8 @@ impl MDL { } VertexUsage::BlendIndices => { match element.vertex_type { - VertexType::UInt => { - MDL::write_uint(&mut cursor, &vert.bone_id).ok()?; + VertexType::Byte4 => { + MDL::write_byte4(&mut cursor, &vert.bone_id).ok()?; } _ => { panic!("Unexpected vertex type for blendindice: {:#?}", element.vertex_type); diff --git a/src/model_file_operations.rs b/src/model_file_operations.rs index e2b57e0..a3ce043 100644 --- a/src/model_file_operations.rs +++ b/src/model_file_operations.rs @@ -75,11 +75,11 @@ impl MDL { f16::from_f32(vec[1]).to_bits()]) } - pub(crate) fn read_uint(cursor: &mut Cursor) -> BinResult<[u8; 4]> { + pub(crate) fn read_byte4(cursor: &mut Cursor) -> BinResult<[u8; 4]> { cursor.read_le::<[u8; 4]>() } - pub(crate) fn write_uint(cursor: &mut T, vec: &[u8; 4]) -> BinResult<()> { + pub(crate) fn write_byte4(cursor: &mut T, vec: &[u8; 4]) -> BinResult<()> { cursor.write_le::<[u8; 4]>(vec) } @@ -167,10 +167,10 @@ mod tests { let mut v = vec![]; let mut cursor = Cursor::new(&mut v); - MDL::write_uint(&mut cursor, &a).unwrap(); + MDL::write_byte4(&mut cursor, &a).unwrap(); let mut read_cursor = Cursor::new(v.as_slice()); - assert_eq!(MDL::read_uint(&mut read_cursor).unwrap(), a); + assert_eq!(MDL::read_byte4(&mut read_cursor).unwrap(), a); } #[test] diff --git a/src/model_vertex_declarations.rs b/src/model_vertex_declarations.rs index 190a9b2..72010cf 100644 --- a/src/model_vertex_declarations.rs +++ b/src/model_vertex_declarations.rs @@ -11,10 +11,11 @@ const END_OF_STREAM: u8 = 0xFF; #[brw(repr = u8)] #[derive(Copy, Clone, Debug, PartialEq)] pub enum VertexType { - Invalid = 0, + Single1 = 0, + Single2 = 1, Single3 = 2, Single4 = 3, - UInt = 5, + Byte4 = 5, ByteFloat4 = 8, Half2 = 13, Half4 = 14,