Skip to content

Move updateCPURenderAttributes calls to where they're actually needed #624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/RenderWebGL.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*
Expand Down