feat: Make it easier work with the Mesh class [flame_3d] #3212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently it is quite hard to operate with the
Mesh
class, because the list of surfaces is kept private.I understand the concern with immutability, and the fact that the
aabb
must be recalculated when anything change.Sadly I don't think Dart provides us with patterns to fully automate updating the
aabb
.We need a way to update the meshes, so this is a compromise:
updateBounds
updateBounds
This also adds an
add
method that takes aSurface
object witch is extremely handy (even though it allows for post-modifications).If we prefer to go a truly fully immutable route, we instead need helper methods to copy and recreate meshes with given set of changes. I am happy to take a stab at that option too.
Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?