tobj
tobj copied to clipboard
Invalid groups when loading object
Using CornellBox-Original.obj from https://casual-effects.com/data/ the following snippet:
let meshes = models
.iter()
.map(|m| {
let mesh = &m.mesh;
println!("{}: {}", m.name, mesh.indices.len());
...
})
.collect();
shows:
floor: 6
ceiling: 6
backWall: 6
rightWall: 6
leftWall: 6
leftWall: 36
shortBox: 36
light: 6
Hi @agorgl , I think you're seeing this because tobj
triangulates obj files by default. So the quads in the OBJ file are turned into 2 triangles. This is why the floor ends up with 6 indices (two triangles) instead of 4 (a quad).
You can now pass the LoadOptions
struct to tobj to tell it to not triangulate the mesh. Then I think the indices should match what you expect, since you'll get the quads back.