write out bogus blend weights and indexes

main
_ 2022-02-22 23:47:48 +00:00
parent 3fe2d17bce
commit 1e9c671c68
1 changed files with 24 additions and 2 deletions

View File

@ -164,6 +164,18 @@ fn main () {
format: iqm::FLOAT, format: iqm::FLOAT,
size: 3, size: 3,
}, },
iqm::VertexArrayUnplaced {
r#type: iqm::BLENDINDEXES,
flags: 0,
format: iqm::UBYTE,
size: 4,
},
iqm::VertexArrayUnplaced {
r#type: iqm::BLENDWEIGHTS,
flags: 0,
format: iqm::UBYTE,
size: 4,
},
]; ];
let vertexes = vertexes; let vertexes = vertexes;
@ -277,7 +289,7 @@ fn main () {
f.write_all (&(mesh.num_triangles.to_le_bytes ())).unwrap (); f.write_all (&(mesh.num_triangles.to_le_bytes ())).unwrap ();
} }
// Vertex arrays // Vertex array meta-data
for va in &vertexarrays { for va in &vertexarrays {
f.write_all (&(va.r#type.to_le_bytes ())).unwrap (); f.write_all (&(va.r#type.to_le_bytes ())).unwrap ();
@ -287,7 +299,7 @@ fn main () {
f.write_all (&(va.offset.to_le_bytes ())).unwrap (); f.write_all (&(va.offset.to_le_bytes ())).unwrap ();
} }
// Vertex position // Vertex data
for v in &vertexes { for v in &vertexes {
for x in v.position { for x in v.position {
@ -301,6 +313,14 @@ fn main () {
} }
} }
for v in &vertexes {
f.write_all (&[0, 0, 0, 0]).unwrap ();
}
for v in &vertexes {
f.write_all (&[255, 0, 0, 0]).unwrap ();
}
// Triangles // Triangles
for t in triangles { for t in triangles {
@ -334,6 +354,7 @@ mod iqm {
pub const BLENDINDEXES: u32 = 4; pub const BLENDINDEXES: u32 = 4;
pub const BLENDWEIGHTS: u32 = 5; pub const BLENDWEIGHTS: u32 = 5;
pub const UBYTE: u32 = 1;
pub const FLOAT: u32 = 7; pub const FLOAT: u32 = 7;
pub struct VertexArrayUnplaced { pub struct VertexArrayUnplaced {
@ -346,6 +367,7 @@ mod iqm {
impl VertexArrayUnplaced { impl VertexArrayUnplaced {
pub fn stride (&self) -> u32 { pub fn stride (&self) -> u32 {
self.size * match self.format { self.size * match self.format {
UBYTE => 1,
FLOAT => 4, FLOAT => 4,
_ => panic! ("Can't handle this vertexarray format yet"), _ => panic! ("Can't handle this vertexarray format yet"),
} }