mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 04:33:31 +00:00
Vastly reduced the complexity of the rendering. Now only gets called if it will actually render.
This commit is contained in:
parent
67f24ea363
commit
3fa295f541
2 changed files with 2 additions and 40 deletions
|
@ -30,15 +30,6 @@ var SpineGameObjectCanvasRenderer = function (renderer, src, camera, parentMatri
|
||||||
var skeleton = src.skeleton;
|
var skeleton = src.skeleton;
|
||||||
var skeletonRenderer = plugin.skeletonRenderer;
|
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 camMatrix = renderer._tempMatrix1;
|
||||||
var spriteMatrix = renderer._tempMatrix2;
|
var spriteMatrix = renderer._tempMatrix2;
|
||||||
var calcMatrix = renderer._tempMatrix3;
|
var calcMatrix = renderer._tempMatrix3;
|
||||||
|
|
|
@ -27,38 +27,14 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, camera, parentMatrix
|
||||||
{
|
{
|
||||||
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 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)
|
if (renderer.newType)
|
||||||
{
|
{
|
||||||
// flush + clear previous pipeline if this is a new type
|
// flush + clear previous pipeline if this is a new type
|
||||||
renderer.pipelines.clear();
|
renderer.pipelines.clear();
|
||||||
|
|
||||||
|
sceneRenderer.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc;
|
var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc;
|
||||||
|
@ -107,11 +83,6 @@ var SpineGameObjectWebGLRenderer = function (renderer, src, camera, parentMatrix
|
||||||
// Add autoUpdate option
|
// Add autoUpdate option
|
||||||
skeleton.updateWorldTransform();
|
skeleton.updateWorldTransform();
|
||||||
|
|
||||||
if (renderer.newType)
|
|
||||||
{
|
|
||||||
sceneRenderer.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw the current skeleton
|
// Draw the current skeleton
|
||||||
sceneRenderer.drawSkeleton(skeleton, src.preMultipliedAlpha);
|
sceneRenderer.drawSkeleton(skeleton, src.preMultipliedAlpha);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue