From 3fa295f5418fbd608e86f1f273aba43770322b48 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 16 Oct 2020 11:38:04 +0100 Subject: [PATCH] Vastly reduced the complexity of the rendering. Now only gets called if it will actually render. --- .../SpineGameObjectCanvasRenderer.js | 9 ----- .../SpineGameObjectWebGLRenderer.js | 33 ++----------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/plugins/spine/src/gameobject/SpineGameObjectCanvasRenderer.js b/plugins/spine/src/gameobject/SpineGameObjectCanvasRenderer.js index 99902aeb6..a575261ad 100644 --- a/plugins/spine/src/gameobject/SpineGameObjectCanvasRenderer.js +++ b/plugins/spine/src/gameobject/SpineGameObjectCanvasRenderer.js @@ -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; diff --git a/plugins/spine/src/gameobject/SpineGameObjectWebGLRenderer.js b/plugins/spine/src/gameobject/SpineGameObjectWebGLRenderer.js index f40348ffa..791f0718e 100644 --- a/plugins/spine/src/gameobject/SpineGameObjectWebGLRenderer.js +++ b/plugins/spine/src/gameobject/SpineGameObjectWebGLRenderer.js @@ -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);