Repository navigation
fix multiple objects generation in OBJ reader if too many 'usemtl' are used - #709
Merged
Merged
Conversation
…re prepended with 'usemtl' line
Member
|
Thanks! To clarify, all new regression test failures are due to multiple materials being merged into one? |
Contributor
Author
|
Here are the files the regression fails on and some ideas:
|
Contributor
Author
|
OK, so the last update fixed The other three files are absolutely OK, just update the database. |
Member
|
Shall work now! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See the test file
cube_usemtl.obj, it has 'usemtl' before each face line and assimp makes a new object for each face. Not even mesh, but object. The reason is that the old code doesn't care what material is being set and simply make a new object.A proper way would be to analyze the material name and ignore the line if the material is the same. If it is not, we need to make a mesh, not object instead.
The proposed patch does exactly that by comparing the new material name with the
m_pCurrentMaterialvariable and skipping all the code if the materials are the same.It also refactors the case when the requested material is undefined, to make sure that the mesh gets a proper default material index.
Finally it fixes the typo (?) in the
needsNewMeshmethod, as theifclause there withordoesn't really make sense.As the assimp build and testing system is quite complex, all the changes are made in our local project and carefully merged into the current master code. The issues are unlikely, but possible. A good testing (especially regression testing) is required. However, I tested all the OBJ files in your test folder and they seems work fine.
Let me know if something is wrong, I will be happy to update the code.
Cheers!