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

Fix index remapping #93

Merged
merged 3 commits into from
Jun 28, 2024
Merged

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Jun 27, 2024

While trying to fix MakieOrg/Makie.jl#3993 I noticed that you get an uninitialized normal (and probably position) when loading the cat mesh (test.obj here). This is due to the index remapping not working correctly. (As a reminder - object files can specify independent indices for positions, normals and texture coordinates within a vertex of a face. OpenGL only allows one index buffer, i.e. one index per vertex, so we need to combine vertex indices into a single unique index and reorder the position, normal and texture coordinate arrays accordingly.)

To fix this I just rewrote the remapping code with a Dict instead of whatever it was doing. That should make it faster and easier to understand/reason with. In the end this removes one position and normal from the cat mesh which should be that undefined first normal/position. I also added a short test for the remapping function.

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 96.96970% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.08%. Comparing base (d9a3602) to head (a92967a).

Files Patch % Lines
src/util.jl 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #93      +/-   ##
==========================================
- Coverage   77.56%   77.08%   -0.49%     
==========================================
  Files          10       11       +1     
  Lines         575      576       +1     
==========================================
- Hits          446      444       -2     
- Misses        129      132       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SimonDanisch SimonDanisch merged commit a59cf3a into JuliaIO:master Jun 28, 2024
3 of 4 checks passed
@ffreyer ffreyer deleted the ff/index_remapping branch June 28, 2024 15:00
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