Vastly reduced the complexity of the rendering. Now only gets called if it will actually render.

This commit is contained in:
Richard Davey 2020-10-16 11:38:04 +01:00
parent 67f24ea363
commit 3fa295f541
2 changed files with 2 additions and 40 deletions

View file

@ -30,15 +30,6 @@ var SpineGameObjectCanvasRenderer = function (renderer, src, camera, parentMatri
var skeleton = src.skeleton;
var skeletonRenderer = plugin.skeletonRenderer;
var GameObjectRenderMask = 15;
var willRender = !(GameObjectRenderMask !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)));
if (!skeleton || !willRender)
{
return;
}
var camMatrix = renderer._tempMatrix1;
var spriteMatrix = renderer._tempMatrix2;
var calcMatrix = renderer._tempMatrix3;

View file

@ -27,38 +27,14 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, camera, parentMatrix
{
var plugin = src.plugin;
var skeleton = src.skeleton;
var childAlpha = skeleton.color.a;
var sceneRenderer = plugin.sceneRenderer;
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, 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();
renderer.pipelines.rebind();
}
if (!renderer.finalType)
{
// Reset the current type
renderer.currentType = '';
}
return;
}
if (renderer.newType)
{
// flush + clear previous pipeline if this is a new type
renderer.pipelines.clear();
sceneRenderer.begin();
}
var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc;
@ -107,11 +83,6 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, camera, parentMatrix
// Add autoUpdate option
skeleton.updateWorldTransform();
if (renderer.newType)
{
sceneRenderer.begin();
}
// Draw the current skeleton
sceneRenderer.drawSkeleton(skeleton, src.preMultipliedAlpha);