Compare commits
No commits in common. "514f0d4ac9c62d116c958fba695d1262d8bfbbda" and "940a2291a33343367328bf05fd6ea6fd53af2d43" have entirely different histories.
514f0d4ac9
...
940a2291a3
|
@ -1,5 +1,4 @@
|
||||||
/target
|
/target
|
||||||
/videos
|
|
||||||
|
|
||||||
*.blend
|
*.blend
|
||||||
*.glb
|
*.glb
|
||||||
|
|
96
src/main.rs
96
src/main.rs
|
@ -164,12 +164,6 @@ fn main () {
|
||||||
format: iqm::FLOAT,
|
format: iqm::FLOAT,
|
||||||
size: 3,
|
size: 3,
|
||||||
},
|
},
|
||||||
iqm::VertexArrayUnplaced {
|
|
||||||
r#type: iqm::TANGENT,
|
|
||||||
flags: 0,
|
|
||||||
format: iqm::FLOAT,
|
|
||||||
size: 4,
|
|
||||||
},
|
|
||||||
iqm::VertexArrayUnplaced {
|
iqm::VertexArrayUnplaced {
|
||||||
r#type: iqm::BLENDINDEXES,
|
r#type: iqm::BLENDINDEXES,
|
||||||
flags: 0,
|
flags: 0,
|
||||||
|
@ -189,7 +183,7 @@ fn main () {
|
||||||
name: u32::try_from (texts.len ()).unwrap (),
|
name: u32::try_from (texts.len ()).unwrap (),
|
||||||
parent: -1,
|
parent: -1,
|
||||||
translate: [0.0, 0.0, 0.0],
|
translate: [0.0, 0.0, 0.0],
|
||||||
rotate: [0.0, 0.0, 0.0, 1.0],
|
rotate: [1.0, 0.0, 0.0, 0.0],
|
||||||
scale: [1.0, 1.0, 1.0],
|
scale: [1.0, 1.0, 1.0],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -199,33 +193,11 @@ fn main () {
|
||||||
iqm::Pose {
|
iqm::Pose {
|
||||||
parent: -1,
|
parent: -1,
|
||||||
channelmask: 1, // Should be X translation
|
channelmask: 1, // Should be X translation
|
||||||
channeloffset: [
|
channeloffset: [0.0; 10],
|
||||||
0.0, 0.0, 0.0,
|
|
||||||
0.0, 0.0, 0.0, 1.0,
|
|
||||||
1.0, 1.0, 1.0,
|
|
||||||
],
|
|
||||||
channelscale: [16.0 / 32768.0; 10],
|
channelscale: [16.0 / 32768.0; 10],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let anims = [
|
|
||||||
iqm::Anim {
|
|
||||||
name: u32::try_from (texts.len ()).unwrap (),
|
|
||||||
first_frame: 0,
|
|
||||||
num_frames: 2,
|
|
||||||
framerate: 0.5,
|
|
||||||
flags: 0,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
texts.push_str ("bogus_anim\0");
|
|
||||||
|
|
||||||
let num_framechannels = 1;
|
|
||||||
|
|
||||||
let frames = [
|
|
||||||
0,
|
|
||||||
32768,
|
|
||||||
];
|
|
||||||
|
|
||||||
let vertexes = vertexes;
|
let vertexes = vertexes;
|
||||||
let triangles = triangles;
|
let triangles = triangles;
|
||||||
let meshes = meshes;
|
let meshes = meshes;
|
||||||
|
@ -236,8 +208,6 @@ fn main () {
|
||||||
|
|
||||||
let num_joints = u32::try_from (joints.len ()).unwrap ();
|
let num_joints = u32::try_from (joints.len ()).unwrap ();
|
||||||
let num_poses = u32::try_from (poses.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 = texts.len ();
|
||||||
let num_text = u32::try_from (num_text).unwrap ();
|
let num_text = u32::try_from (num_text).unwrap ();
|
||||||
|
@ -275,21 +245,12 @@ fn main () {
|
||||||
|
|
||||||
let ofs_triangles = offset;
|
let ofs_triangles = offset;
|
||||||
offset += num_triangles * 3 * 4;
|
offset += num_triangles * 3 * 4;
|
||||||
|
|
||||||
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;
|
let ofs_text = offset;
|
||||||
offset += num_text;
|
offset += num_text;
|
||||||
|
let ofs_joints = offset;
|
||||||
|
offset += num_joints * 48;
|
||||||
|
let ofs_poses = offset;
|
||||||
|
offset += num_poses * 88;
|
||||||
|
|
||||||
let filesize = offset;
|
let filesize = offset;
|
||||||
let _ = offset;
|
let _ = offset;
|
||||||
|
@ -333,13 +294,13 @@ fn main () {
|
||||||
f.write_all (&(ofs_poses.to_le_bytes ())).unwrap ();
|
f.write_all (&(ofs_poses.to_le_bytes ())).unwrap ();
|
||||||
|
|
||||||
// num_anims, ofs_anims
|
// num_anims, ofs_anims
|
||||||
f.write_all (&(num_anims.to_le_bytes ())).unwrap ();
|
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
|
||||||
f.write_all (&(ofs_anims.to_le_bytes ())).unwrap ();
|
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
|
||||||
|
|
||||||
// num_frames, num_framechannels, ofs_frames, ofs_bounds
|
// num_frames, num_framechannels, ofs_frames, ofs_bounds
|
||||||
f.write_all (&(num_frames.to_le_bytes ())).unwrap ();
|
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
|
||||||
f.write_all (&(num_framechannels.to_le_bytes ())).unwrap ();
|
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
|
||||||
f.write_all (&(ofs_frames.to_le_bytes ())).unwrap ();
|
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
|
||||||
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
|
f.write_all (&(0u32.to_le_bytes ())).unwrap ();
|
||||||
|
|
||||||
// num_comment, ofs_comment
|
// num_comment, ofs_comment
|
||||||
|
@ -385,12 +346,6 @@ fn main () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for v in &vertexes {
|
|
||||||
for x in [0.0, 0.0, 0.0, 1.0] {
|
|
||||||
f.write_all (&(f32::to_le_bytes (x))).unwrap ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for v in &vertexes {
|
for v in &vertexes {
|
||||||
f.write_all (&[0, 0, 0, 0]).unwrap ();
|
f.write_all (&[0, 0, 0, 0]).unwrap ();
|
||||||
}
|
}
|
||||||
|
@ -407,6 +362,10 @@ fn main () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Text
|
||||||
|
|
||||||
|
f.write_all (texts.as_bytes ()).unwrap ();
|
||||||
|
|
||||||
// Joints
|
// Joints
|
||||||
|
|
||||||
for j in joints {
|
for j in joints {
|
||||||
|
@ -435,22 +394,6 @@ fn main () {
|
||||||
f.write_all (&(f32::to_le_bytes (x))).unwrap ();
|
f.write_all (&(f32::to_le_bytes (x))).unwrap ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for a in anims {
|
|
||||||
f.write_all (&(u32::to_le_bytes (a.name))).unwrap ();
|
|
||||||
f.write_all (&(u32::to_le_bytes (a.first_frame))).unwrap ();
|
|
||||||
f.write_all (&(u32::to_le_bytes (a.num_frames))).unwrap ();
|
|
||||||
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 {
|
fn gltf_node_get_mat4 (node: &gltf::Node) -> Mat4 {
|
||||||
|
@ -471,7 +414,6 @@ mod iqm {
|
||||||
|
|
||||||
pub const POSITION: u32 = 0;
|
pub const POSITION: u32 = 0;
|
||||||
pub const NORMAL: u32 = 2;
|
pub const NORMAL: u32 = 2;
|
||||||
pub const TANGENT: u32 = 3;
|
|
||||||
pub const BLENDINDEXES: u32 = 4;
|
pub const BLENDINDEXES: u32 = 4;
|
||||||
pub const BLENDWEIGHTS: u32 = 5;
|
pub const BLENDWEIGHTS: u32 = 5;
|
||||||
|
|
||||||
|
@ -524,14 +466,6 @@ mod iqm {
|
||||||
pub channelscale: [f32; 10],
|
pub channelscale: [f32; 10],
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Anim {
|
|
||||||
pub name: u32,
|
|
||||||
pub first_frame: u32,
|
|
||||||
pub num_frames: u32,
|
|
||||||
pub framerate: f32,
|
|
||||||
pub flags: u32,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
pub position: [f32; 3],
|
pub position: [f32; 3],
|
||||||
pub normal: [f32; 3],
|
pub normal: [f32; 3],
|
||||||
|
|
Loading…
Reference in New Issue