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

Accessors for all valid component types of TEXCOORD_n and COLOR_n attributes aren't supported #15

Open
mrehayden1 opened this issue Feb 29, 2024 · 1 comment

Comments

@mrehayden1
Copy link
Contributor

There should probably be some code handling, or at least calling error when encountering unhandled component types in the accessors for these vertex attributes.

Relevant function definitions below.

-- | Decode texture coordinates. Note that we only use the first one.
vertexTexCoords :: GlTF -> Vector GltfBuffer -> AccessorIx -> Vector (V2 Float)
vertexTexCoords = readBufferWithGet getTexCoords

-- | Decode vertex colors
vertexColors :: GlTF -> Vector GltfBuffer -> AccessorIx -> Vector (V4 Word16)
vertexColors = readBufferWithGet getColors

-- | Texture coordinates binary decoder
getTexCoords :: Get (Vector (V2 Float))
getTexCoords = getVec2 getFloat

-- | Vertex colors binary decoder
getColors :: Get (Vector (V4 Word16))
getColors = getVec4 getUnsignedShort
@sgillespie
Copy link
Owner

That's a good idea. error would work, another idea would be to add some proper error handling (say, adding something like EitherT to the adapter monad). Either way I'd be happy with

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

No branches or pull requests

2 participants