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
duplicate_vertices silently consumes indices #13228
Comments
The way I see this function is: This can obviously be better documented, but this side effect can be implied with some knowledge about the rasterization process. But - yes - as you have suggested, its only implicit. |
How can Bevy's documentation be improved?
Mesh::duplicate_vertices
silently takesindices
from theMesh
but doesn't mention it in the method documentation.This lead to my code breaking because it relied upon indices being present. I added a call to
duplicate_vertices
and didn't realise my later code that did something for each index was now not running.I assume not rebuilding the index data is an optimisation. Either way this behaviour should be documented or the code should rebuild the index data if it was previously present.
An alternative could be to have a function
duplicate_vertices_without_indices
(naming aside) that would have the current behaviour, and changeduplicate_vertices
to rebuild the index data before finishing. I'm thinking along the same lines asVec::sort
andVec::sort_unstable
, orVec::remove
andVec::swap_remove
having longer/different names for behaviours that have side effects the programmer should take note of.The text was updated successfully, but these errors were encountered: