From af7328ed05aba5c2038521a4b3af0e1d52487555 Mon Sep 17 00:00:00 2001 From: _ <_@_> Date: Wed, 23 Feb 2022 00:03:51 +0000 Subject: [PATCH] :construction: wip: write a bogus joint --- src/main.rs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1fc52fa..9749695 100644 --- a/src/main.rs +++ b/src/main.rs @@ -238,7 +238,7 @@ fn main () { let ofs_text = offset; offset += num_text; let ofs_joints = offset; - // offset += num_joints * 48; + offset += num_joints * 48; let filesize = offset; let _ = offset; @@ -274,8 +274,8 @@ fn main () { f.write_all (&(0u32.to_le_bytes ())).unwrap (); // num_joints, ofs_joints - f.write_all (&(0u32.to_le_bytes ())).unwrap (); - f.write_all (&(0u32.to_le_bytes ())).unwrap (); + f.write_all (&(num_joints.to_le_bytes ())).unwrap (); + f.write_all (&(ofs_joints.to_le_bytes ())).unwrap (); // num_poses, ofs_poses f.write_all (&(0u32.to_le_bytes ())).unwrap (); @@ -351,7 +351,25 @@ fn main () { } // Text + f.write_all (texts.as_bytes ()).unwrap (); + + // Joints + + for j in joints { + f.write_all (&(u32::to_le_bytes (j.name))).unwrap (); + f.write_all (&(i32::to_le_bytes (j.parent))).unwrap (); + + for x in j.translate { + f.write_all (&(f32::to_le_bytes (x))).unwrap (); + } + for x in j.rotate { + f.write_all (&(f32::to_le_bytes (x))).unwrap (); + } + for x in j.scale { + f.write_all (&(f32::to_le_bytes (x))).unwrap (); + } + } } fn gltf_node_get_mat4 (node: &gltf::Node) -> Mat4 {