-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Compute vertex_count
for indexed meshes on GpuMesh
#8460
Compute vertex_count
for indexed meshes on GpuMesh
#8460
Conversation
@@ -834,9 +835,7 @@ pub enum GpuBufferInfo { | |||
count: u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vertex count would be stored twice (once in GpuMesh.vertex_count
field, once in GpuMesh.buffer_info.Indexed.count
) With this solution.
Why not define vertex_count()
as a method on GpuMesh
? This way you inspect the content of buffer_info
and return the value of either NonIndex.vertex_count
or Indexed.count
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The count stored there is the size of the index buffer, not the amount of vertices in the mesh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same thing confused me at first. Imo, we should rename Indexed.count to Indexed.index_count or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size
would be appropriate then
Oh hey, I also needed this for my path tracing stuff. I have basically the same change in my fork lol. Thanks for the PR! |
Objective
Compute the
vertex_count
for indexed meshes as well as non-indexed meshes.I will need this in a future PR based on #8427 that adds a gizmo component that draws the normals of a mesh when attached to an entity (branch).
Example image
Solution
Move
vertex_count
field fromGpuBufferInfo::NonIndexed
toGpuMesh
Migration Guide
vertex_count
is now stored directly onGpuMesh
instead ofGpuBufferInfo::NonIndexed
.