➕ write out bogus blend weights and indexes
parent
3fe2d17bce
commit
1e9c671c68
26
src/main.rs
26
src/main.rs
|
@ -164,6 +164,18 @@ fn main () {
|
|||
format: iqm::FLOAT,
|
||||
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;
|
||||
|
@ -277,7 +289,7 @@ fn main () {
|
|||
f.write_all (&(mesh.num_triangles.to_le_bytes ())).unwrap ();
|
||||
}
|
||||
|
||||
// Vertex arrays
|
||||
// Vertex array meta-data
|
||||
|
||||
for va in &vertexarrays {
|
||||
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 ();
|
||||
}
|
||||
|
||||
// Vertex position
|
||||
// Vertex data
|
||||
|
||||
for v in &vertexes {
|
||||
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
|
||||
|
||||
for t in triangles {
|
||||
|
@ -334,6 +354,7 @@ mod iqm {
|
|||
pub const BLENDINDEXES: u32 = 4;
|
||||
pub const BLENDWEIGHTS: u32 = 5;
|
||||
|
||||
pub const UBYTE: u32 = 1;
|
||||
pub const FLOAT: u32 = 7;
|
||||
|
||||
pub struct VertexArrayUnplaced {
|
||||
|
@ -346,6 +367,7 @@ mod iqm {
|
|||
impl VertexArrayUnplaced {
|
||||
pub fn stride (&self) -> u32 {
|
||||
self.size * match self.format {
|
||||
UBYTE => 1,
|
||||
FLOAT => 4,
|
||||
_ => panic! ("Can't handle this vertexarray format yet"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue