-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add the ability to pass Vec<VecX> directly to mesh.set_attribute + simple example #2719
Conversation
Could you retarget this to I suspect the basic idea should still hold, but you may have to do some reorganization and cleanup to match the new APIs. |
Done, looks like there were no issues. |
Allow passing `Vec`s of glam vector types as vertex attributes. Alternative to #4548 and #2719 Also used some macros to cut down on all the repetition. # Migration Guide Implementations of `From<Vec<[u16; 4]>>` and `From<Vec<[u8; 4]>>` for `VertexAttributeValues` have been removed. I you're passing either `Vec<[u16; 4]>` or `Vec<[u8; 4]>` into `Mesh::insert_attribute` it will now require wrapping it with right the `VertexAttributeValues` enum variant. Co-authored-by: devil-ira <justthecooldude@gmail.com>
This was superseded by #6442. |
Allow passing `Vec`s of glam vector types as vertex attributes. Alternative to bevyengine#4548 and bevyengine#2719 Also used some macros to cut down on all the repetition. # Migration Guide Implementations of `From<Vec<[u16; 4]>>` and `From<Vec<[u8; 4]>>` for `VertexAttributeValues` have been removed. I you're passing either `Vec<[u16; 4]>` or `Vec<[u8; 4]>` into `Mesh::insert_attribute` it will now require wrapping it with right the `VertexAttributeValues` enum variant. Co-authored-by: devil-ira <justthecooldude@gmail.com>
Objective
With this pr we can pass
Vec<VecX>
directly tomesh.set_attribute
. When working with custom meshes, particularly with procedural generation, I find it extremely helpful to work directly withVec<VecX>
to represent my mesh points/uvs/colors/etc.Solution
Using bytemuck we can perform a conversion from
Vec<VecX>
toVec<[f32;X]>
when it gets passed to the mesh. Then we can useVec<Vec3>
directly to represent mesh points for example: