Better conditional flow

This commit is contained in:
Richard Davey 2020-09-01 13:30:22 +01:00
parent 1406f23bd6
commit 8d02da00f2
4 changed files with 47 additions and 39 deletions

View file

@ -35220,6 +35220,8 @@ var SpineContainerWebGLRenderer = function (renderer, container, interpolationPe
if (sceneRenderer.batcher.isDrawing && renderer.finalType)
{
sceneRenderer.end();
renderer.rebindPipeline();
}
return;
@ -35248,6 +35250,9 @@ var SpineContainerWebGLRenderer = function (renderer, container, interpolationPe
if (renderer.newType)
{
// flush + clear if this is a new type
renderer.clearPipeline();
sceneRenderer.begin();
}
@ -35337,13 +35342,11 @@ var SpineContainerWebGLRenderer = function (renderer, container, interpolationPe
if (!renderer.nextTypeMatch)
{
// The next object in the display list is not a Spine Game Object or Spine Container, 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();
if (!renderer.finalType)
{
renderer.rebindPipeline(renderer.pipelines.MultiPipeline);
}
// And rebind the previous pipeline
renderer.rebindPipeline();
}
};
@ -37335,36 +37338,37 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
var childAlpha = skeleton.color.a;
var sceneRenderer = plugin.sceneRenderer;
if (renderer.newType)
{
// flush + clear if this is a new type, even if it doesn't render
renderer.clearPipeline();
}
var GameObjectRenderMask = 15;
var willRender = !(GameObjectRenderMask !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)) || childAlpha === 0);
if (!skeleton || !willRender)
{
// If there is already a batch running, we need to close it
if (!renderer.nextTypeMatch)
// If there is already a batch running, and the next type isn't a Spine object, or this is the end, we need to close it
if (sceneRenderer.batcher.isDrawing && (!renderer.nextTypeMatch || renderer.finalType))
{
// The next object in the display list is not a Spine object, so we end the batch
sceneRenderer.end();
if (!renderer.finalType)
{
// Reset the current type
renderer.currentType = '';
renderer.rebindPipeline();
}
renderer.rebindPipeline();
}
if (!renderer.finalType)
{
// Reset the current type
renderer.currentType = '';
}
return;
}
if (renderer.newType)
{
// flush + clear previous pipeline if this is a new type
renderer.clearPipeline();
}
var camMatrix = renderer._tempMatrix1;
var spriteMatrix = renderer._tempMatrix2;
var calcMatrix = renderer._tempMatrix3;

File diff suppressed because one or more lines are too long

View file

@ -35,6 +35,8 @@ var SpineContainerWebGLRenderer = function (renderer, container, interpolationPe
if (sceneRenderer.batcher.isDrawing && renderer.finalType)
{
sceneRenderer.end();
renderer.rebindPipeline();
}
return;
@ -63,6 +65,9 @@ var SpineContainerWebGLRenderer = function (renderer, container, interpolationPe
if (renderer.newType)
{
// flush + clear if this is a new type
renderer.clearPipeline();
sceneRenderer.begin();
}
@ -152,13 +157,11 @@ var SpineContainerWebGLRenderer = function (renderer, container, interpolationPe
if (!renderer.nextTypeMatch)
{
// The next object in the display list is not a Spine Game Object or Spine Container, 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();
if (!renderer.finalType)
{
renderer.rebindPipeline(renderer.pipelines.MultiPipeline);
}
// And rebind the previous pipeline
renderer.rebindPipeline();
}
};

View file

@ -30,36 +30,37 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, interpolationPercent
var childAlpha = skeleton.color.a;
var sceneRenderer = plugin.sceneRenderer;
if (renderer.newType)
{
// flush + clear if this is a new type, even if it doesn't render
renderer.clearPipeline();
}
var GameObjectRenderMask = 15;
var willRender = !(GameObjectRenderMask !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)) || childAlpha === 0);
if (!skeleton || !willRender)
{
// If there is already a batch running, we need to close it
if (!renderer.nextTypeMatch)
// If there is already a batch running, and the next type isn't a Spine object, or this is the end, we need to close it
if (sceneRenderer.batcher.isDrawing && (!renderer.nextTypeMatch || renderer.finalType))
{
// The next object in the display list is not a Spine object, so we end the batch
sceneRenderer.end();
if (!renderer.finalType)
{
// Reset the current type
renderer.currentType = '';
renderer.rebindPipeline();
}
renderer.rebindPipeline();
}
if (!renderer.finalType)
{
// Reset the current type
renderer.currentType = '';
}
return;
}
if (renderer.newType)
{
// flush + clear previous pipeline if this is a new type
renderer.clearPipeline();
}
var camMatrix = renderer._tempMatrix1;
var spriteMatrix = renderer._tempMatrix2;
var calcMatrix = renderer._tempMatrix3;