sebcrozet / kiss3d

Keep it simple, stupid 3d graphics engine for Rust.
http://kiss3d.org
BSD 3-Clause "New" or "Revised" License
1.49k stars 173 forks source link

Obj importer does not work with multiobject files #275

Open korken89 opened 3 years ago

korken89 commented 3 years ago

Hi!

When importing OBJ files the importer does not under stand lines that start with o SOME_NAME, which is a new object within the file. This causes the generated mesh to not make sense at all. Sometimes this also causes the imported to panic:

Warning: unknown line 1 ignored: `o SOLID.128'
At line 823: could not find the material Planed
Warning: unknown line 824 ignored: `s off'
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 14359', /home/emifre/.cargo/registry/src/github.com-1ecc6299db9ec823/kiss3d-0.30.0/src/loader/obj.rs:436:41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I am not sure how to help with this issue unfortunately. Is there a way to get around it? For example I had a look for an STL importer, but this did not exist unfortunately.

virtualritz commented 3 years ago

Use the tobj crate until this is fixed? It supports triangulation on import so getting meshes in a format ready for kiss3d is painless.