🚧 wip: write bogus anim
							parent
							
								
									940a2291a3
								
							
						
					
					
						commit
						003cbe4547
					
				
							
								
								
									
										34
									
								
								src/main.rs
								
								
								
								
							
							
						
						
									
										34
									
								
								src/main.rs
								
								
								
								
							| 
						 | 
				
			
			@ -198,6 +198,17 @@ fn main () {
 | 
			
		|||
		},
 | 
			
		||||
	];
 | 
			
		||||
	
 | 
			
		||||
	let anims = [
 | 
			
		||||
		iqm::Anim {
 | 
			
		||||
			name: u32::try_from (texts.len ()).unwrap (),
 | 
			
		||||
			first_frame: 0,
 | 
			
		||||
			num_frames: 2,
 | 
			
		||||
			framerate: 5.0,
 | 
			
		||||
			flags: 0,
 | 
			
		||||
		},
 | 
			
		||||
	];
 | 
			
		||||
	texts.push_str ("bogus_anim\0");
 | 
			
		||||
	
 | 
			
		||||
	let vertexes = vertexes;
 | 
			
		||||
	let triangles = triangles;
 | 
			
		||||
	let meshes = meshes;
 | 
			
		||||
| 
						 | 
				
			
			@ -208,6 +219,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_text = texts.len ();
 | 
			
		||||
	let num_text = u32::try_from (num_text).unwrap ();
 | 
			
		||||
| 
						 | 
				
			
			@ -251,6 +263,8 @@ fn main () {
 | 
			
		|||
	offset += num_joints * 48;
 | 
			
		||||
	let ofs_poses = offset;
 | 
			
		||||
	offset += num_poses * 88;
 | 
			
		||||
	let ofs_anims = offset;
 | 
			
		||||
	offset += num_anims * 5 * 4;
 | 
			
		||||
	
 | 
			
		||||
	let filesize = offset;
 | 
			
		||||
	let _ = offset;
 | 
			
		||||
| 
						 | 
				
			
			@ -294,8 +308,8 @@ fn main () {
 | 
			
		|||
	f.write_all (&(ofs_poses.to_le_bytes ())).unwrap ();
 | 
			
		||||
	
 | 
			
		||||
	// num_anims, ofs_anims
 | 
			
		||||
	f.write_all (&(0u32.to_le_bytes ())).unwrap ();
 | 
			
		||||
	f.write_all (&(0u32.to_le_bytes ())).unwrap ();
 | 
			
		||||
	f.write_all (&(num_anims.to_le_bytes ())).unwrap ();
 | 
			
		||||
	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 ();
 | 
			
		||||
| 
						 | 
				
			
			@ -394,6 +408,14 @@ fn main () {
 | 
			
		|||
			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 ();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn gltf_node_get_mat4 (node: &gltf::Node) -> Mat4 {
 | 
			
		||||
| 
						 | 
				
			
			@ -466,6 +488,14 @@ mod iqm {
 | 
			
		|||
		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 position: [f32; 3],
 | 
			
		||||
		pub normal: [f32; 3],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue