fix: glTF parser - respect byteStride for all vertex attributes - #80
Open
transmutrix wants to merge 1 commit into
Open
fix: glTF parser - respect byteStride for all vertex attributes#80transmutrix wants to merge 1 commit into
transmutrix wants to merge 1 commit into
Conversation
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.
Hi! Hopefully submitting a PR is ok. ^_^
What?
Makes the glTF parser compatible with .glb files that use interleaved vertex attributes by respecting
bufferView.byteStridein all vertex attribute reads. The Blender exports I examined all show abyteStrideof zero for all their bufferViews, so they parse exactly the same with these changes.Why?
I am just getting started with N64 development and have been working through the Tiny3D examples and writing small tests of my own based on them. I haven't been able to get Fast64 working in Blender yet, but I wanted to try loading an original model.
So, I made a small model with some vertex colors and no textures using Wings 3D and exported it as a .glb file. I was able to get it to load, but the triangles were really messed up.
I first tried importing my .glb file in another program to make sure it wasn't just malformed, and it seemed fine. I then compared with existing .glb files in the examples and noticed the example .glb files don't specify
byteStridefor any of their bufferViews but my file does.I changed the parser to respect the
byteStridewhen one is set, and my model geometry now loads correctly.Minimal Repro
This zip contains a minimal repro. Drop it in
tiny3d/and run the makefile to build it. With the unfixed parser, the model appears as a mess of triangles because the vertex attributes are read incorrectly (the "before" screenshot). With the fixed version, it should look like the "after" screenshot.repro.zip
Before
After
Feedback
Please let me know if there are any changes I should make to be in keeping with the "house style" or something.