Skip to content

Commit

Permalink
Fix nvert for scalar data file
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Nov 7, 2023
1 parent b0d98ea commit 14e04e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mni2mz3"
version = "0.1.0-rc.4"
version = "0.1.1"
edition = "2021"

authors = ["Jennings Zhang <[email protected]>"]
Expand Down
5 changes: 4 additions & 1 deletion src/mz3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ impl From<MniMeshRaw> for Mz3 {
}

fn data_to_mz3<W: Write>(data: Vec<f32>, sink: &mut W) -> io::Result<()> {
let n_vert = data.len() as u32;
sink.write_all(MZ3_MAGIC_SIGNATURE)?;
sink.write_all(MZ3_IS_SCALAR)?;
sink.write_all(&[0, 0, 0, 0, 0, 0, 0, 0])?; // NFACE=0 NVERT=0
sink.write_all(&0u32.to_le_bytes())?; // NFACE=0
sink.write_all(&n_vert.to_le_bytes())?;
sink.write_all(&[0, 0, 0, 0, 0, 0, 0, 0])?;
sink.write_all(NSKIP_EMPTY)?;
for element in data {
sink.write_all(&element.to_le_bytes())?;
Expand Down

0 comments on commit 14e04e2

Please sign in to comment.