🚧 wip: write bogus frames, fix alignment

main
_ 2022-02-23 01:08:54 +00:00
parent 003cbe4547
commit 5515362d7b
1 changed files with 28 additions and 9 deletions

View File

@ -209,6 +209,13 @@ fn main () {
];
texts.push_str ("bogus_anim\0");
let num_framechannels = 1;
let frames = [
0,
32768,
];
let vertexes = vertexes;
let triangles = triangles;
let meshes = meshes;
@ -220,6 +227,7 @@ fn main () {
let num_joints = u32::try_from (joints.len ()).unwrap ();
let num_poses = u32::try_from (poses.len ()).unwrap ();
let num_anims = u32::try_from (anims.len ()).unwrap ();
let num_frames = u32::try_from (frames.len ()).unwrap () / num_framechannels;
let num_text = texts.len ();
let num_text = u32::try_from (num_text).unwrap ();
@ -257,15 +265,22 @@ fn main () {
let ofs_triangles = offset;
offset += num_triangles * 3 * 4;
let ofs_text = offset;
offset += num_text;
let ofs_joints = offset;
offset += num_joints * 48;
let ofs_poses = offset;
offset += num_poses * 88;
let ofs_anims = offset;
offset += num_anims * 5 * 4;
let ofs_frames = offset;
offset += num_frames * num_framechannels * 2;
let ofs_text = offset;
offset += num_text;
let filesize = offset;
let _ = offset;
@ -312,9 +327,9 @@ fn main () {
f.write_all (&(ofs_anims.to_le_bytes ())).unwrap ();
// num_frames, num_framechannels, ofs_frames, ofs_bounds
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
f.write_all (&(num_frames.to_le_bytes ())).unwrap ();
f.write_all (&(num_framechannels.to_le_bytes ())).unwrap ();
f.write_all (&(ofs_frames.to_le_bytes ())).unwrap ();
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
// num_comment, ofs_comment
@ -376,10 +391,6 @@ fn main () {
}
}
// Text
f.write_all (texts.as_bytes ()).unwrap ();
// Joints
for j in joints {
@ -416,6 +427,14 @@ fn main () {
f.write_all (&(f32::to_le_bytes (a.framerate))).unwrap ();
f.write_all (&(u32::to_le_bytes (a.flags))).unwrap ();
}
for x in frames {
f.write_all (&(u16::to_le_bytes (x))).unwrap ();
}
// Text
f.write_all (texts.as_bytes ()).unwrap ();
}
fn gltf_node_get_mat4 (node: &gltf::Node) -> Mat4 {