Move CPU render updates only where they're needed
This commit is contained in:
@@ -769,6 +769,8 @@ class RenderWebGL extends EventEmitter {
|
||||
const color = __touchingColor;
|
||||
const hasMask = Boolean(mask3b);
|
||||
|
||||
drawable.updateCPURenderAttributes();
|
||||
|
||||
// Masked drawable ignores ghost effect
|
||||
const effectMask = ~ShaderManager.EFFECT_INFO.ghost.mask;
|
||||
|
||||
@@ -915,6 +917,8 @@ class RenderWebGL extends EventEmitter {
|
||||
const drawable = this._allDrawables[drawableID];
|
||||
const point = __isTouchingDrawablesPoint;
|
||||
|
||||
drawable.updateCPURenderAttributes();
|
||||
|
||||
// This is an EXTREMELY brute force collision detector, but it is
|
||||
// still faster than asking the GPU to give us the pixels.
|
||||
for (let x = bounds.left; x <= bounds.right; x++) {
|
||||
@@ -1369,8 +1373,6 @@ class RenderWebGL extends EventEmitter {
|
||||
/** @todo remove this once URL-based skin setting is removed. */
|
||||
if (!drawable.skin || !drawable.skin.getTexture([100, 100])) return null;
|
||||
|
||||
|
||||
drawable.updateCPURenderAttributes();
|
||||
const bounds = drawable.getFastBounds();
|
||||
|
||||
// Limit queries to the stage size.
|
||||
@@ -1856,14 +1858,14 @@ class RenderWebGL extends EventEmitter {
|
||||
_getConvexHullPointsForDrawable (drawableID) {
|
||||
const drawable = this._allDrawables[drawableID];
|
||||
|
||||
drawable.updateCPURenderAttributes();
|
||||
|
||||
const [width, height] = drawable.skin.size;
|
||||
// No points in the hull if invisible or size is 0.
|
||||
if (!drawable.getVisible() || width === 0 || height === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
drawable.updateCPURenderAttributes();
|
||||
|
||||
/**
|
||||
* Return the determinant of two vectors, the vector from A to B and the vector from A to C.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user