-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Objects and Groups behave differently #15
Comments
Thanks @johannesvollmer , this is interesting! I didn't know about this difference between the two, I haven't seen a file that uses this duplicate group merging functionality. I'll leave this issue open in case someone else finds that this causes a loading bug for them, but it seems like a relatively rare use case so for now I'll leave the code as is. |
To be honest, I too have never seen such a file in my life 😁 |
Just ran into this while loading OBJ files. An interesting consequence of this is that it can become impossible to get the name of the object if there are no faces before the first group. Example file: https://github.com/ProtoArt/spritec/blob/28bf3b8b84a0c86e646d3b2d598be983a2e7c167/samples/bigboi/obj/bigboi_000001.obj In this example file, we have something like this:
All the vertices are defined at the object level, but none of the faces show up until the first group. The code below means that name will be overwritten with the name of the group and it won't be possible to get the object name. Lines 655 to 673 in e3d93b4
This isn't a huge deal for what I'm working on right now, but it definitely would have been nice to be able to get a |
Hi!
As assumed in line 655,
tobj/src/lib.rs
Line 655 in 023076f
Objects and groups are not the same and should, in theory, be handled differently.
Probably, only few people will need it. Nevertheless, I'll describe the difference here. You will have to decide on your own if that distinction is important enough to be implemented.
Objects
The code currently treats objects as expected. For objects, each name starts a new object and closes the old one. Two objects with the same name will result in two different objects that happen to have the same name.
Groups
In the code, groups are handled the same way as objects. Instead, groups should be treated as collections, accumulating data from anywhere in the OBJ file, as many times as desired. As a result, a group name appearing twice in a file should not result in two distinct groups, but instead the result should be a single group containing the geometry of both parts.
Summarizing: Duplicate objects stay separated, duplicate groups should be merged.
Cheers!
The text was updated successfully, but these errors were encountered: