Skip to content

Commit

Permalink
Fix tint cache clearing code for Mesh on canvas (#8933)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtimebuddy committed Dec 12, 2022
1 parent 82e8f9a commit 66c6847
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/canvas-mesh/src/CanvasMeshRenderer.ts
Expand Up @@ -115,6 +115,16 @@ export class CanvasMeshRenderer
const textureWidth = base.width;
const textureHeight = base.height;

// Invalidate texture if base texture was updated
// either because mesh.texture or mesh.shader.texture was changed
if (mesh._cachedTexture && mesh._cachedTexture.baseTexture !== base)
{
mesh._cachedTint = 0xffffff;
mesh._cachedTexture?.destroy();
mesh._cachedTexture = null;
mesh._tintedCanvas = null;
}

if (isTinted)
{
if (mesh._cachedTint !== mesh.tint)
Expand Down

0 comments on commit 66c6847

Please sign in to comment.