Open
Description
Scratch projects change the positions of their sprites very regularly. Since Scratch keeps Sprites within the visible bounds of the rendered stage, getFencedPositionOfDrawable is called for every position change.
There are a few things that could be changed to possibly speed up getFencedPositionOfDrawable.
- getFencedPositionOfDrawable in the convex hull points path creates approximately 8 objects (assuming the hull has 3 points). Most or all of these could use preexisting or cached objects reduce object creation and garbage collection.
- getFencedPositionOfDrawable in the aabb path creates 10 objects.
- getFastBounds could just ensure u_modelMatrix is up to date instead of both it and _inverseMatrix. (In fact both getBounds and getAABB already make sure that u_modelMatrix is up to date.)
- getFastBounds could be assigned to getBounds or getAabb by setConvexHullDirty and setConvexHullPoints