From 287d807f0182c84e24fdd55fe9a615d6d1117d17 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 5 Aug 2022 18:23:52 -0400 Subject: [PATCH] Normals are typically three half-width floats, not three full floats --- src/model.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/model.rs b/src/model.rs index 6ed57e2..78e5625 100755 --- a/src/model.rs +++ b/src/model.rs @@ -380,7 +380,10 @@ impl MDL { vertices[k as usize].bone_id = <[u8; 4]>::read(&mut cursor).unwrap(); } VertexUsage::Normal => { - vertices[k as usize].normal = <[f32; 3]>::read(&mut cursor).unwrap(); + // TODO: normals are assumed to be half4 + vertices[k as usize].normal[0] = f16::from_bits(::read(&mut cursor).unwrap()).to_f32(); + vertices[k as usize].normal[1] = f16::from_bits(::read(&mut cursor).unwrap()).to_f32(); + vertices[k as usize].normal[2] = f16::from_bits(::read(&mut cursor).unwrap()).to_f32(); } VertexUsage::UV => { vertices[k as usize].uv[0] = f16::from_bits(::read(&mut cursor).unwrap()).to_f32();