Particle Emitters and Containers can now have geometry masked children

This commit is contained in:
Richard Davey 2019-04-15 16:46:47 +01:00
parent 1fc9b15ff1
commit 78e1ef9df0
2 changed files with 12 additions and 1 deletions

View file

@ -75,6 +75,11 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
renderer.setBlendMode(child.blendMode); renderer.setBlendMode(child.blendMode);
} }
if (child.mask)
{
child.mask.preRenderWebGL(renderer, child, camera);
}
// Set parent values // Set parent values
child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY); child.setScrollFactor(childScrollFactorX * scrollFactorX, childScrollFactorY * scrollFactorY);
child.setAlpha(childAlpha * alpha); child.setAlpha(childAlpha * alpha);
@ -85,6 +90,11 @@ var ContainerWebGLRenderer = function (renderer, container, interpolationPercent
// Restore original values // Restore original values
child.setAlpha(childAlpha); child.setAlpha(childAlpha);
child.setScrollFactor(childScrollFactorX, childScrollFactorY); child.setScrollFactor(childScrollFactorX, childScrollFactorY);
if (child.mask)
{
child.mask.postRenderWebGL(renderer, camera);
}
} }
}; };

View file

@ -144,7 +144,8 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, interpola
if (emitter.mask) if (emitter.mask)
{ {
emitter.mask.postRenderWebGL(renderer); emitter.mask.postRenderWebGL(renderer, camera);
pipeline.setTexture2D(texture, 0);
} }
} }
}; };