Skip to content

Commit 96f36ff

Browse files
authored
Merge pull request #624 from adroitwhiz/update-silhouette-differently
Move `updateCPURenderAttributes` calls to where they're actually needed
2 parents 98caee6 + ade45c0 commit 96f36ff

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/RenderWebGL.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,8 @@ class RenderWebGL extends EventEmitter {
800800
const color = __touchingColor;
801801
const hasMask = Boolean(mask3b);
802802

803+
drawable.updateCPURenderAttributes();
804+
803805
// Masked drawable ignores ghost effect
804806
const effectMask = ~ShaderManager.EFFECT_INFO.ghost.mask;
805807

@@ -969,6 +971,8 @@ class RenderWebGL extends EventEmitter {
969971
const drawable = this._allDrawables[drawableID];
970972
const point = __isTouchingDrawablesPoint;
971973

974+
drawable.updateCPURenderAttributes();
975+
972976
// This is an EXTREMELY brute force collision detector, but it is
973977
// still faster than asking the GPU to give us the pixels.
974978
for (let x = bounds.left; x <= bounds.right; x++) {
@@ -1423,8 +1427,6 @@ class RenderWebGL extends EventEmitter {
14231427
/** @todo remove this once URL-based skin setting is removed. */
14241428
if (!drawable.skin || !drawable.skin.getTexture([100, 100])) return null;
14251429

1426-
1427-
drawable.updateCPURenderAttributes();
14281430
const bounds = drawable.getFastBounds();
14291431

14301432
// Limit queries to the stage size.
@@ -1919,14 +1921,14 @@ class RenderWebGL extends EventEmitter {
19191921
_getConvexHullPointsForDrawable (drawableID) {
19201922
const drawable = this._allDrawables[drawableID];
19211923

1922-
drawable.updateCPURenderAttributes();
1923-
19241924
const [width, height] = drawable.skin.size;
19251925
// No points in the hull if invisible or size is 0.
19261926
if (!drawable.getVisible() || width === 0 || height === 0) {
19271927
return [];
19281928
}
19291929

1930+
drawable.updateCPURenderAttributes();
1931+
19301932
/**
19311933
* Return the determinant of two vectors, the vector from A to B and the vector from A to C.
19321934
*

0 commit comments

Comments
 (0)