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

Make BufferGeometry only contain normal buffer attributes by default #432

Merged
merged 6 commits into from
Apr 28, 2023

Conversation

Methuselah96
Copy link
Contributor

@Methuselah96 Methuselah96 commented Apr 28, 2023

Why

Fixes #389.

#314 added support GLBufferAttribute which made it harder to work with attributes since a lot of three.js code doesn't consider whether an attribute could be a GLBufferAttribute. This PR reduces that friction making it so that geometries don't support GLBufferAttribute by default, and you have to opt-in to them using a generic.

What

Add an Attributes generic to BufferGeometry that specifies what attributes are allowed. This is set to NormalBufferAttributes by default, which does not allow GLBufferAttribute. The consumer can opt-in to allowing GLBufferAttributes by using the NormalOrGLBufferAttributes type or use their own type. This should also pave the way for something like #241 in the future.

I only made it so that Points can handle a geometry with GLBufferAttributes for now. Presumably other objects with geometries will need to allow GLBufferAttributes, but I'm not sure how far to spread it right now. Hopefully we can get can feedback about this from people who actually use GLBufferAttributes once this is released.

Checklist

  • Checked the target branch (current goes master, next goes dev)
  • Added myself to contributors table
  • Ready to be merged

@Methuselah96 Methuselah96 changed the title Default BufferGeometry to use normal attributes Make BufferGeometry only handle non-GLBufferAttributes by default Apr 28, 2023
@Methuselah96 Methuselah96 changed the base branch from dev to master April 28, 2023 02:28
@Methuselah96 Methuselah96 changed the base branch from master to dev April 28, 2023 02:28
@Methuselah96 Methuselah96 changed the base branch from dev to master April 28, 2023 02:29
@Methuselah96 Methuselah96 marked this pull request as ready for review April 28, 2023 02:32
@Methuselah96 Methuselah96 changed the title Make BufferGeometry only handle non-GLBufferAttributes by default Make BufferGeometry only contain normal buffer attributes by default Apr 28, 2023
@Methuselah96 Methuselah96 merged commit fb11acb into master Apr 28, 2023
@Methuselah96 Methuselah96 deleted the buffer-attribute branch April 28, 2023 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant