Skip to content

Make the compute mesh example easier to understand and modify.#25033

Open
ivanceras wants to merge 3 commits into
bevyengine:mainfrom
ivanceras:main
Open

Make the compute mesh example easier to understand and modify.#25033
ivanceras wants to merge 3 commits into
bevyengine:mainfrom
ivanceras:main

Conversation

@ivanceras

Copy link
Copy Markdown

Objective

  • Make the compute mesh more hack-able and easier to modify.

Solution

  • Remove the use of non-intuitive numbers such as 192 which is the total number of f32 in the vertices data. Instead we use the VERTEX_COUNT (24 in this case) to assemble the vertex data elements inside the loop. The array of 8 element of f32 becomes an inner loop inside of the main loop, which makes a total of 192 iteration matching the original algorithm.
  • Decouple the normals and uvs from the combined vertex data in vertices to make it more flexible to add or remove attributes in the vertex data of a mesh.

Testing

  • The output compute_mesh example stays the same as the previous code.
  • Are there any parts that need more testing?
  • Perhaps experimenting with custom mesh attributes and use it in the compute_mesh shader.
  • How can other people (reviewers) test your changes? Is there anything specific they need to know?
  • Pull this PR and run the compute_mesh example. It should be running the same as before.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@mnmaita mnmaita added C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Code-Quality A section of code that is hard to understand or change C-Docs An addition or correction to our documentation C-Examples An addition or correction to our examples D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants