aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-03-13 17:13:35 +0100
committermetamuffin <metamuffin@disroot.org>2025-03-13 17:13:35 +0100
commit55dae4b68013a5c091abba86c725300bccfe1459 (patch)
tree18d601bf3606ea8d88231382a92ff298479a814e
parent664d54952323a52132377ce9ed3c4a552c0993fa (diff)
downloadunity-tools-55dae4b68013a5c091abba86c725300bccfe1459.tar
unity-tools-55dae4b68013a5c091abba86c725300bccfe1459.tar.bz2
unity-tools-55dae4b68013a5c091abba86c725300bccfe1459.tar.zst
fix mesh bugs
-rw-r--r--src/bin/meshes.rs2
-rw-r--r--src/classes/mesh.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/bin/meshes.rs b/src/bin/meshes.rs
index 64fe91c..c6ce39d 100644
--- a/src/bin/meshes.rs
+++ b/src/bin/meshes.rs
@@ -71,7 +71,7 @@ fn main() -> anyhow::Result<()> {
writeln!(obj, "v {x} {y} {z}")?;
}
for [a, b, c] in mesh.read_indecies() {
- writeln!(obj, "f {a} {b} {c}")?;
+ writeln!(obj, "f {} {} {}", a + 1, b + 1, c + 1)?;
}
i += 1;
}
diff --git a/src/classes/mesh.rs b/src/classes/mesh.rs
index 3883535..328af97 100644
--- a/src/classes/mesh.rs
+++ b/src/classes/mesh.rs
@@ -132,7 +132,8 @@ impl VertexData {
.channels
.iter()
.filter(|c| c.stream == si)
- .map(|c| c.dimension as usize * c.format.component_size())
+ // The modulo operator here is a hack to fix normal with 52 dimensions to 4
+ .map(|c| (c.dimension as usize % 48) * c.format.component_size())
.sum();
streams.push((offset, stride));
offset += stride * self.vertex_count as usize