mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-22 04:37:46 +00:00
Add support for single3/4 normals and UVs
Seems to be common in TexTools imported MDLs
This commit is contained in:
parent
bd104fbae0
commit
b3f8523677
1 changed files with 10 additions and 0 deletions
10
src/model.rs
10
src/model.rs
|
@ -466,6 +466,9 @@ impl MDL {
|
|||
VertexType::Half4 => {
|
||||
vertices[k as usize].normal.clone_from_slice(&MDL::read_half4(&mut cursor).unwrap()[0..3]);
|
||||
}
|
||||
VertexType::Single3 => {
|
||||
vertices[k as usize].normal = MDL::read_single3(&mut cursor).unwrap();
|
||||
}
|
||||
_ => {
|
||||
panic!("Unexpected vertex type for normal: {:#?}", element.vertex_type);
|
||||
}
|
||||
|
@ -476,6 +479,9 @@ impl MDL {
|
|||
VertexType::Half4 => {
|
||||
vertices[k as usize].uv.clone_from_slice(&MDL::read_half4(&mut cursor).unwrap()[0..2]);
|
||||
}
|
||||
VertexType::Single4 => {
|
||||
vertices[k as usize].uv.clone_from_slice(&MDL::read_single4(&mut cursor).unwrap()[0..2]);
|
||||
}
|
||||
_ => {
|
||||
panic!("Unexpected vertex type for uv: {:#?}", element.vertex_type);
|
||||
}
|
||||
|
@ -542,4 +548,8 @@ impl MDL {
|
|||
fn read_single3(cursor: &mut Cursor<&MemoryBuffer>) -> BinResult<[f32; 3]> {
|
||||
cursor.read_le::<[f32; 3]>()
|
||||
}
|
||||
|
||||
fn read_single4(cursor: &mut Cursor<&MemoryBuffer>) -> BinResult<[f32; 4]> {
|
||||
cursor.read_le::<[f32; 4]>()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue