Closed jbphet closed 3 years ago
@jbphet and I noticed that Vector2's poolable mixInto() call has default values, but Bounds2 did not. We added those and now Bounds2.dirtyFromPool
works.
@jonathanolson please review.
The above commit uses these default values for Bounds2:
[ Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY ]
It is unclear why these are desirable/correct defaults. Can you please document/clarify?
We were using Bounds2.dirtyFromPool
as a replacement for allocating new Bounds as Bounds2.NOTHING
, which contains those values.
Do you think [ 0, 0, 0, 0 ]
would be more appropriate?
We were using
Bounds2.dirtyFromPool
as a replacement for allocating new Bounds asBounds2.NOTHING
, which contains those values.
Bounds2.NOTHING seems reasonable, perhaps document it and use its values like:
defaultArguments: [ Bounds2.NOTHING.minX, etc...]
Fixed, thanks @samreid.
This looks great to me, thanks!
@chrisklus and I were working to reduce allocations in Energy Forms and Changes, and we tried to use
Bounds2.dirtyFromPool
, and it threw an assertion. I suspect that all that is needed is a no-argument constructor, but there may be a reason that this doesn't exist, so I'm logging an issue and assigning to @jonathanolson, since he created bothBounds2
andPoolable
.