Skip to content
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

[rModels] Correctly split obj meshes by material #4285

Merged
merged 2 commits into from
Aug 25, 2024

Conversation

JeffM2501
Copy link
Contributor

This PR rewrites the code that converts tinyOBJ data into raylib meshes and correctly splits the meshes by material so they can be represented by raylib's meshes. This should fix issue #3576

The previous code would just blindly set all meshes to material ID 0.
This is incorrect.
The code in 4.5 would assume there was a material for each mesh, this was also incorrect and would cause a crash.

This version should handle it properly.

src/rmodels.c Fixed Show resolved Hide resolved
src/rmodels.c Fixed Show fixed Hide fixed
src/rmodels.c Fixed Show fixed Hide fixed
src/rmodels.c Fixed Show fixed Hide fixed
src/rmodels.c Fixed Show resolved Hide resolved
src/rmodels.c Outdated Show resolved Hide resolved
src/rmodels.c Fixed Show resolved Hide resolved
src/rmodels.c Outdated Show resolved Hide resolved
@raysan5
Copy link
Owner

raysan5 commented Aug 25, 2024

@JeffM2501 Added some minor comments, also CodeQL detects some unused variables, maybe those lines could be commented, jsut in case they can be useful in the future.

@JeffM2501
Copy link
Contributor Author

PR Updated with feedback

@raysan5 raysan5 merged commit 91a9888 into raysan5:master Aug 25, 2024
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Aug 25, 2024

@JeffM2501 The redesign looks great to me, thank you very much for working on this improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants