🚧 wip: write a bogus joint

main
_ 2022-02-23 00:03:51 +00:00
parent 4bd6d7d25d
commit af7328ed05
1 changed files with 21 additions and 3 deletions

View File

@ -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 {