mirror of
https://github.com/photonstorm/phaser
synced 2024-11-28 23:51:31 +00:00
A Spine Game Object with setVisible(false)
will no longer still cause internal gl commands and is now properly skipped, retaining any current batch in the process. Fix #5174
This commit is contained in:
parent
0bbe67dafd
commit
482f016898
1 changed files with 14 additions and 7 deletions
|
@ -27,25 +27,29 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
|
||||||
{
|
{
|
||||||
var plugin = src.plugin;
|
var plugin = src.plugin;
|
||||||
var skeleton = src.skeleton;
|
var skeleton = src.skeleton;
|
||||||
|
var childAlpha = skeleton.color.a;
|
||||||
var sceneRenderer = plugin.sceneRenderer;
|
var sceneRenderer = plugin.sceneRenderer;
|
||||||
|
|
||||||
var GameObjectRenderMask = 15;
|
var GameObjectRenderMask = 15;
|
||||||
|
|
||||||
var willRender = !(GameObjectRenderMask !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)));
|
var willRender = !(GameObjectRenderMask !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)) || childAlpha === 0);
|
||||||
|
|
||||||
if (!skeleton || !willRender)
|
if (!skeleton || !willRender)
|
||||||
{
|
{
|
||||||
// Reset the current type
|
|
||||||
renderer.currentType = '';
|
|
||||||
|
|
||||||
// If there is already a batch running, we need to close it
|
// If there is already a batch running, we need to close it
|
||||||
if (!renderer.nextTypeMatch)
|
if (!renderer.nextTypeMatch)
|
||||||
{
|
{
|
||||||
// The next object in the display list is not a Spine object, so we end the batch
|
// The next object in the display list is not a Spine object, so we end the batch
|
||||||
sceneRenderer.end();
|
sceneRenderer.end();
|
||||||
|
|
||||||
|
if (!renderer.finalType)
|
||||||
|
{
|
||||||
|
// Reset the current type
|
||||||
|
renderer.currentType = '';
|
||||||
|
|
||||||
renderer.rebindPipeline(renderer.pipelines.MultiPipeline);
|
renderer.rebindPipeline(renderer.pipelines.MultiPipeline);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -152,11 +156,14 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
|
||||||
|
|
||||||
if (!renderer.nextTypeMatch)
|
if (!renderer.nextTypeMatch)
|
||||||
{
|
{
|
||||||
// The next object in the display list is not a Spine object, so we end the batch
|
// The next object in the display list is not a Spine Game Object or Spine Container, so we end the batch.
|
||||||
sceneRenderer.end();
|
sceneRenderer.end();
|
||||||
|
|
||||||
|
if (!renderer.finalType)
|
||||||
|
{
|
||||||
renderer.rebindPipeline(renderer.pipelines.MultiPipeline);
|
renderer.rebindPipeline(renderer.pipelines.MultiPipeline);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = SpineGameObjectWebGLRenderer;
|
module.exports = SpineGameObjectWebGLRenderer;
|
||||||
|
|
Loading…
Reference in a new issue