We can just pass off to the existing render function. Yay!

This commit is contained in:
Richard Davey 2020-10-16 14:11:56 +01:00
parent 7add222a87
commit dc7bdf1e99

View file

@ -4,11 +4,6 @@
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var CounterClockwise = require('../../../../src/math/angle/CounterClockwise');
var Clamp = require('../../../../src/math/Clamp');
var RadToDeg = require('../../../../src/math/RadToDeg');
var Wrap = require('../../../../src/math/Wrap');
/**
* Renders this Game Object with the WebGL Renderer to the given Camera.
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
@ -56,12 +51,6 @@ var SpineContainerWebGLRenderer = function (renderer, container, camera, parentM
transformMatrix.applyITRS(container.x, container.y, container.rotation, container.scaleX, container.scaleY);
}
var alpha = container.alpha;
var scrollFactorX = container.scrollFactorX;
var scrollFactorY = container.scrollFactorY;
var GameObjectRenderMask = 15;
if (renderer.newType)
{
// flush + clear if this is a new type
@ -72,7 +61,7 @@ var SpineContainerWebGLRenderer = function (renderer, container, camera, parentM
var rendererNextType = renderer.nextTypeMatch;
// Force these to avoid batch flushing
// Force these to avoid batch flushing during SpineGameObject.renderWebGL
renderer.nextTypeMatch = true;
renderer.newType = false;
@ -82,92 +71,10 @@ var SpineContainerWebGLRenderer = function (renderer, container, camera, parentM
if (src.willRender(camera))
{
src.renderWebGL(renderer, src, camera, transformMatrix);
src.renderWebGL(renderer, src, camera, transformMatrix, container);
}
}
/*
var skeleton = src.skeleton;
var childAlpha = skeleton.color.a;
var willRender = !(GameObjectRenderMask !== src.renderFlags || (src.cameraFilter !== 0 && (src.cameraFilter & camera.id)) || childAlpha === 0);
if (!skeleton || !willRender)
{
continue;
}
var camMatrix = renderer._tempMatrix1;
var spriteMatrix = renderer._tempMatrix2;
var calcMatrix = renderer._tempMatrix3;
spriteMatrix.applyITRS(src.x, src.y, src.rotation, Math.abs(src.scaleX), Math.abs(src.scaleY));
camMatrix.copyFrom(camera.matrix);
// Multiply the camera by the parent matrix
camMatrix.multiplyWithOffset(transformMatrix, -camera.scrollX * scrollFactorX, -camera.scrollY * scrollFactorY);
// Undo the camera scroll
spriteMatrix.e = src.x;
spriteMatrix.f = src.y;
// Multiply by the Sprite matrix, store result in calcMatrix
camMatrix.multiply(spriteMatrix, calcMatrix);
var viewportHeight = renderer.height;
skeleton.x = calcMatrix.tx;
skeleton.y = viewportHeight - calcMatrix.ty;
skeleton.scaleX = calcMatrix.scaleX;
skeleton.scaleY = calcMatrix.scaleY;
if (src.scaleX < 0)
{
skeleton.scaleX *= -1;
src.root.rotation = RadToDeg(calcMatrix.rotationNormalized);
}
else
{
// +90 degrees to account for the difference in Spine vs. Phaser rotation
src.root.rotation = Wrap(RadToDeg(CounterClockwise(calcMatrix.rotationNormalized)) + 90, 0, 360);
}
if (src.scaleY < 0)
{
skeleton.scaleY *= -1;
if (src.scaleX < 0)
{
src.root.rotation -= (RadToDeg(calcMatrix.rotationNormalized) * 2);
}
else
{
src.root.rotation += (RadToDeg(calcMatrix.rotationNormalized) * 2);
}
}
if (camera.renderToTexture || renderer.currentFramebuffer !== null)
{
skeleton.y = calcMatrix.ty;
skeleton.scaleY *= -1;
}
// Add autoUpdate option
skeleton.updateWorldTransform();
skeleton.color.a = Clamp(childAlpha * alpha, 0, 1);
// Draw the current skeleton
sceneRenderer.drawSkeleton(skeleton, src.preMultipliedAlpha);
// Restore alpha
skeleton.color.a = childAlpha;
}
*/
renderer.nextTypeMatch = rendererNextType;
if (!rendererNextType)