mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-26 14:17: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 => {
|
||||
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);
|
||||
|
|
|
@ -75,11 +75,11 @@ impl MDL {
|
|||
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]>()
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -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]
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue