mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-27 06:27:45 +00:00
Rename Uint4 to Byte4 so it's clearer
This commit is contained in:
parent
ecc872ead1
commit
4194ec4432
3 changed files with 11 additions and 10 deletions
|
@ -453,8 +453,8 @@ impl MDL {
|
||||||
}
|
}
|
||||||
VertexUsage::BlendIndices => {
|
VertexUsage::BlendIndices => {
|
||||||
match element.vertex_type {
|
match element.vertex_type {
|
||||||
VertexType::UInt => {
|
VertexType::Byte4 => {
|
||||||
vertices[k as usize].bone_id = MDL::read_uint(&mut cursor).unwrap();
|
vertices[k as usize].bone_id = MDL::read_byte4(&mut cursor).unwrap();
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
panic!("Unexpected vertex type for blendindice: {:#?}", element.vertex_type);
|
panic!("Unexpected vertex type for blendindice: {:#?}", element.vertex_type);
|
||||||
|
@ -737,8 +737,8 @@ impl MDL {
|
||||||
}
|
}
|
||||||
VertexUsage::BlendIndices => {
|
VertexUsage::BlendIndices => {
|
||||||
match element.vertex_type {
|
match element.vertex_type {
|
||||||
VertexType::UInt => {
|
VertexType::Byte4 => {
|
||||||
MDL::write_uint(&mut cursor, &vert.bone_id).ok()?;
|
MDL::write_byte4(&mut cursor, &vert.bone_id).ok()?;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
panic!("Unexpected vertex type for blendindice: {:#?}", element.vertex_type);
|
panic!("Unexpected vertex type for blendindice: {:#?}", element.vertex_type);
|
||||||
|
|
|
@ -75,11 +75,11 @@ impl MDL {
|
||||||
f16::from_f32(vec[1]).to_bits()])
|
f16::from_f32(vec[1]).to_bits()])
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn read_uint(cursor: &mut Cursor<ByteSpan>) -> BinResult<[u8; 4]> {
|
pub(crate) fn read_byte4(cursor: &mut Cursor<ByteSpan>) -> BinResult<[u8; 4]> {
|
||||||
cursor.read_le::<[u8; 4]>()
|
cursor.read_le::<[u8; 4]>()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn write_uint<T: BinWriterExt>(cursor: &mut T, vec: &[u8; 4]) -> BinResult<()> {
|
pub(crate) fn write_byte4<T: BinWriterExt>(cursor: &mut T, vec: &[u8; 4]) -> BinResult<()> {
|
||||||
cursor.write_le::<[u8; 4]>(vec)
|
cursor.write_le::<[u8; 4]>(vec)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,10 +167,10 @@ mod tests {
|
||||||
let mut v = vec![];
|
let mut v = vec![];
|
||||||
let mut cursor = Cursor::new(&mut v);
|
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());
|
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]
|
#[test]
|
||||||
|
|
|
@ -11,10 +11,11 @@ const END_OF_STREAM: u8 = 0xFF;
|
||||||
#[brw(repr = u8)]
|
#[brw(repr = u8)]
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
pub enum VertexType {
|
pub enum VertexType {
|
||||||
Invalid = 0,
|
Single1 = 0,
|
||||||
|
Single2 = 1,
|
||||||
Single3 = 2,
|
Single3 = 2,
|
||||||
Single4 = 3,
|
Single4 = 3,
|
||||||
UInt = 5,
|
Byte4 = 5,
|
||||||
ByteFloat4 = 8,
|
ByteFloat4 = 8,
|
||||||
Half2 = 13,
|
Half2 = 13,
|
||||||
Half4 = 14,
|
Half4 = 14,
|
||||||
|
|
Loading…
Add table
Reference in a new issue