Added post pipeline support to all Game Objects

This commit is contained in:
Richard Davey 2020-11-23 16:17:13 +00:00
parent 995c8130a2
commit ec5da6930c
24 changed files with 325 additions and 60 deletions

View file

@ -34,7 +34,7 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatr
return;
}
var pipeline = renderer.pipelines.set(this.pipeline, src);
var pipeline = renderer.pipelines.set(src.pipeline, src);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -115,6 +115,13 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatr
var displayCallback = src.displayCallback;
var callbackData = src.callbackData;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
for (var i = 0; i < textLength; i++)
{
charCode = text.charCodeAt(i);
@ -271,6 +278,11 @@ var DynamicBitmapTextWebGLRenderer = function (renderer, src, camera, parentMatr
renderer.popScissor();
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = DynamicBitmapTextWebGLRenderer;

View file

@ -32,7 +32,7 @@ var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix)
return;
}
var pipeline = renderer.pipelines.set(this.pipeline, src);
var pipeline = renderer.pipelines.set(src.pipeline, src);
var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc;
@ -66,6 +66,13 @@ var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix)
var dropShadow = (dropShadowX !== 0 || dropShadowY !== 0);
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (dropShadow)
{
var srcShadowColor = src._dropShadowColorGL;
@ -120,6 +127,11 @@ var BitmapTextWebGLRenderer = function (renderer, src, camera, parentMatrix)
// Debug test if the characters are in the correct place when rendered:
// pipeline.drawFillRect(tx0, ty0, tx2 - tx0, ty2 - ty0, 0x00ff00, 0.5);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = BitmapTextWebGLRenderer;

View file

@ -54,6 +54,13 @@ var BlitterWebGLRenderer = function (renderer, src, camera, parentMatrix)
var alpha = camera.alpha * src.alpha;
var roundPixels = camera.roundPixels;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
for (var index = 0; index < list.length; index++)
{
var bob = list[index];
@ -117,6 +124,11 @@ var BlitterWebGLRenderer = function (renderer, src, camera, parentMatrix)
prevTextureSourceIndex = -1;
}
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = BlitterWebGLRenderer;

View file

@ -47,7 +47,14 @@ var GraphicsWebGLRenderer = function (renderer, src, camera, parentMatrix)
return;
}
var pipeline = renderer.pipelines.set(this.pipeline, src);
var pipeline = renderer.pipelines.set(src.pipeline, src);
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
var calcMatrix = GetCalcMatrix(src, camera, parentMatrix).calc;
@ -338,6 +345,11 @@ var GraphicsWebGLRenderer = function (renderer, src, camera, parentMatrix)
}
}
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = GraphicsWebGLRenderer;

View file

@ -61,6 +61,13 @@ var MeshWebGLRenderer = function (renderer, src, camera, parentMatrix)
var totalFacesRendered = 0;
var postPipeline = (src && src.hasPostPipeline && !src.manualPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
for (var i = 0; i < totalFaces; i++)
{
var face = faces[i];
@ -95,6 +102,11 @@ var MeshWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
debugCallback.call(src, src, debugFaces);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = MeshWebGLRenderer;

View file

@ -62,6 +62,13 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, camera, p
var textureUnit = pipeline.setGameObject(emitterManager, emitterManager.defaultFrame);
var postPipeline = (emitterManager && emitterManager.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(emitterManager);
}
for (var e = 0; e < emittersLength; e++)
{
var emitter = emitters[e];
@ -145,6 +152,11 @@ var ParticleManagerWebGLRenderer = function (renderer, emitterManager, camera, p
// pipeline.setTexture2D(texture, 0);
}
}
if (postPipeline)
{
postPipeline.manager.postBatch(emitterManager);
}
};
module.exports = ParticleManagerWebGLRenderer;

View file

@ -34,6 +34,13 @@ var RenderTextureWebGLRenderer = function (renderer, src, camera, parentMatrix)
var textureUnit = pipeline.setTexture2D(renderTarget.texture);
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
src.pipeline.batchTexture(
src,
renderTarget.texture,
@ -59,6 +66,11 @@ var RenderTextureWebGLRenderer = function (renderer, src, camera, parentMatrix)
);
renderer.resetTextures();
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = RenderTextureWebGLRenderer;

View file

@ -41,9 +41,14 @@ var RopeWebGLRenderer = function (renderer, src, camera, parentMatrix)
// Because it's a triangle strip and we don't want lots of degenerate triangles joining things up
pipeline.flush();
var textureUnit = pipeline.setGameObject(src);
var postPipeline = (src && src.hasPostPipeline);
pipeline.manager.preBatch(src);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
var textureUnit = pipeline.setGameObject(src);
var vertexViewF32 = pipeline.vertexViewF32;
var vertexViewU32 = pipeline.vertexViewU32;
@ -100,7 +105,10 @@ var RopeWebGLRenderer = function (renderer, src, camera, parentMatrix)
pipeline.vertexCount += vertexCount;
pipeline.manager.postBatch(src);
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = RopeWebGLRenderer;

View file

@ -24,7 +24,7 @@ var StrokePathWebGL = require('../StrokePathWebGL');
*/
var ArcWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -35,6 +35,13 @@ var ArcWebGLRenderer = function (renderer, src, camera, parentMatrix)
var alpha = camera.alpha * src.alpha;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (src.isFilled)
{
FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy);
@ -44,6 +51,11 @@ var ArcWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
StrokePathWebGL(pipeline, src, alpha, dx, dy);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = ArcWebGLRenderer;

View file

@ -24,7 +24,7 @@ var StrokePathWebGL = require('../StrokePathWebGL');
*/
var CurveWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -35,6 +35,13 @@ var CurveWebGLRenderer = function (renderer, src, camera, parentMatrix)
var alpha = camera.alpha * src.alpha;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (src.isFilled)
{
FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy);
@ -44,6 +51,11 @@ var CurveWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
StrokePathWebGL(pipeline, src, alpha, dx, dy);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = CurveWebGLRenderer;

View file

@ -24,7 +24,7 @@ var StrokePathWebGL = require('../StrokePathWebGL');
*/
var EllipseWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -35,6 +35,13 @@ var EllipseWebGLRenderer = function (renderer, src, camera, parentMatrix)
var alpha = camera.alpha * src.alpha;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (src.isFilled)
{
FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy);
@ -44,6 +51,11 @@ var EllipseWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
StrokePathWebGL(pipeline, src, alpha, dx, dy);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = EllipseWebGLRenderer;

View file

@ -23,7 +23,7 @@ var Utils = require('../../../renderer/webgl/Utils');
*/
var GridWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -80,6 +80,13 @@ var GridWebGLRenderer = function (renderer, src, camera, parentMatrix)
}
}
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (showCells && src.fillAlpha > 0)
{
fillTint = pipeline.fillTint;
@ -184,6 +191,11 @@ var GridWebGLRenderer = function (renderer, src, camera, parentMatrix)
pipeline.batchLine(0, y1, width, y1, 1, 1, 1, 0, false);
}
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = GridWebGLRenderer;

View file

@ -23,7 +23,7 @@ var Utils = require('../../../renderer/webgl/Utils');
*/
var IsoBoxWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -56,6 +56,14 @@ var IsoBoxWebGLRenderer = function (renderer, src, camera, parentMatrix)
var x3;
var y3;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
// Top Face
if (src.showTop)
@ -118,6 +126,11 @@ var IsoBoxWebGLRenderer = function (renderer, src, camera, parentMatrix)
pipeline.batchQuad(x0, y0, x1, y1, x2, y2, x3, y3, tint, tint, tint, tint);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = IsoBoxWebGLRenderer;

View file

@ -23,7 +23,7 @@ var Utils = require('../../../renderer/webgl/Utils');
*/
var IsoTriangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -44,6 +44,13 @@ var IsoTriangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
return;
}
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
var tint;
var x0;
@ -139,6 +146,11 @@ var IsoTriangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
pipeline.batchTri(x0, y0, x1, y1, x2, y2, tint, tint, tint);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = IsoTriangleWebGLRenderer;

View file

@ -23,7 +23,7 @@ var Utils = require('../../../renderer/webgl/Utils');
*/
var LineWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -33,6 +33,13 @@ var LineWebGLRenderer = function (renderer, src, camera, parentMatrix)
var dy = src._displayOriginY;
var alpha = camera.alpha * src.alpha;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (src.isStroked)
{
var strokeTint = pipeline.strokeTint;
@ -60,6 +67,11 @@ var LineWebGLRenderer = function (renderer, src, camera, parentMatrix)
result.camera
);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = LineWebGLRenderer;

View file

@ -24,7 +24,7 @@ var StrokePathWebGL = require('../StrokePathWebGL');
*/
var PolygonWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -35,6 +35,13 @@ var PolygonWebGLRenderer = function (renderer, src, camera, parentMatrix)
var alpha = camera.alpha * src.alpha;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (src.isFilled)
{
FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy);
@ -44,6 +51,11 @@ var PolygonWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
StrokePathWebGL(pipeline, src, alpha, dx, dy);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = PolygonWebGLRenderer;

View file

@ -24,7 +24,7 @@ var Utils = require('../../../renderer/webgl/Utils');
*/
var RectangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -34,6 +34,13 @@ var RectangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
var dy = src._displayOriginY;
var alpha = camera.alpha * src.alpha;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (src.isFilled)
{
var fillTint = pipeline.fillTint;
@ -56,6 +63,11 @@ var RectangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
StrokePathWebGL(pipeline, src, alpha, dx, dy);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = RectangleWebGLRenderer;

View file

@ -24,7 +24,7 @@ var StrokePathWebGL = require('../StrokePathWebGL');
*/
var StarWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -35,6 +35,13 @@ var StarWebGLRenderer = function (renderer, src, camera, parentMatrix)
var alpha = camera.alpha * src.alpha;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (src.isFilled)
{
FillPathWebGL(pipeline, calcMatrix, src, alpha, dx, dy);
@ -44,6 +51,11 @@ var StarWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
StrokePathWebGL(pipeline, src, alpha, dx, dy);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = StarWebGLRenderer;

View file

@ -24,7 +24,7 @@ var Utils = require('../../../renderer/webgl/Utils');
*/
var TriangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
var pipeline = renderer.pipelines.set(this.pipeline);
var pipeline = renderer.pipelines.set(src.pipeline);
var result = GetCalcMatrix(src, camera, parentMatrix);
@ -34,6 +34,13 @@ var TriangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
var dy = src._displayOriginY;
var alpha = camera.alpha * src.alpha;
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
if (src.isFilled)
{
var fillTint = pipeline.fillTint;
@ -67,6 +74,11 @@ var TriangleWebGLRenderer = function (renderer, src, camera, parentMatrix)
{
StrokePathWebGL(pipeline, src, alpha, dx, dy);
}
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = TriangleWebGLRenderer;

View file

@ -27,11 +27,18 @@ var TextWebGLRenderer = function (renderer, src, camera, parentMatrix)
return;
}
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
var frame = src.frame;
var width = frame.width;
var height = frame.height;
var getTint = Utils.getTintAppendFloatAlpha;
var pipeline = renderer.pipelines.set(this.pipeline, src);
var pipeline = renderer.pipelines.set(src.pipeline, src);
var textureUnit = pipeline.setTexture2D(frame.glTexture, src);
@ -58,6 +65,11 @@ var TextWebGLRenderer = function (renderer, src, camera, parentMatrix)
false,
textureUnit
);
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = TextWebGLRenderer;

View file

@ -31,9 +31,16 @@ var TileSpriteWebGLRenderer = function (renderer, src, camera, parentMatrix)
return;
}
var postPipeline = (src && src.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
var getTint = Utils.getTintAppendFloatAlpha;
var pipeline = renderer.pipelines.set(this.pipeline, src);
var pipeline = renderer.pipelines.set(src.pipeline, src);
var textureUnit = pipeline.setTexture2D(src.fillPattern, src);
@ -61,6 +68,11 @@ var TileSpriteWebGLRenderer = function (renderer, src, camera, parentMatrix)
false,
textureUnit
);
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = TileSpriteWebGLRenderer;

View file

@ -1145,13 +1145,6 @@ var WebGLPipeline = new Class({
{
if (unit === undefined) { unit = this.currentUnit; }
var postPipeline = (gameObject && gameObject.hasPostPipeline && !gameObject.manualPostPipeline);
if (postPipeline)
{
this.manager.preBatch(gameObject);
}
var hasFlushed = false;
if (this.shouldFlush(6))
@ -1172,11 +1165,6 @@ var WebGLPipeline = new Class({
this.onBatch(gameObject);
if (postPipeline)
{
this.manager.postBatch(gameObject);
}
return hasFlushed;
},

View file

@ -167,19 +167,19 @@ var MultiPipeline = new Class({
* @method Phaser.Renderer.WebGL.Pipelines.MultiPipeline#batchSprite
* @since 3.0.0
*
* @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} sprite - The texture based Game Object to add to the batch.
* @param {(Phaser.GameObjects.Image|Phaser.GameObjects.Sprite)} gameObject - The texture based Game Object to add to the batch.
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera to use for the rendering transform.
* @param {Phaser.GameObjects.Components.TransformMatrix} [parentTransformMatrix] - The transform matrix of the parent container, if set.
*/
batchSprite: function (sprite, camera, parentTransformMatrix)
batchSprite: function (gameObject, camera, parentTransformMatrix)
{
this.manager.set(this, sprite);
this.manager.set(this, gameObject);
var camMatrix = this._tempMatrix1;
var spriteMatrix = this._tempMatrix2;
var calcMatrix = this._tempMatrix3;
var frame = sprite.frame;
var frame = gameObject.frame;
var texture = frame.glTexture;
var u0 = frame.u0;
@ -192,19 +192,19 @@ var MultiPipeline = new Class({
var frameHeight = frame.cutHeight;
var customPivot = frame.customPivot;
var displayOriginX = sprite.displayOriginX;
var displayOriginY = sprite.displayOriginY;
var displayOriginX = gameObject.displayOriginX;
var displayOriginY = gameObject.displayOriginY;
var x = -displayOriginX + frameX;
var y = -displayOriginY + frameY;
if (sprite.isCropped)
if (gameObject.isCropped)
{
var crop = sprite._crop;
var crop = gameObject._crop;
if (crop.flipX !== sprite.flipX || crop.flipY !== sprite.flipY)
if (crop.flipX !== gameObject.flipX || crop.flipY !== gameObject.flipY)
{
frame.updateCropUVs(crop, sprite.flipX, sprite.flipY);
frame.updateCropUVs(crop, gameObject.flipX, gameObject.flipY);
}
u0 = crop.u0;
@ -225,7 +225,7 @@ var MultiPipeline = new Class({
var flipX = 1;
var flipY = 1;
if (sprite.flipX)
if (gameObject.flipX)
{
if (!customPivot)
{
@ -237,7 +237,7 @@ var MultiPipeline = new Class({
// Auto-invert the flipY if this is coming from a GLTexture
if (sprite.flipY || (frame.source.isGLTexture && !texture.flipY))
if (gameObject.flipY || (frame.source.isGLTexture && !texture.flipY))
{
if (!customPivot)
{
@ -247,23 +247,23 @@ var MultiPipeline = new Class({
flipY = -1;
}
spriteMatrix.applyITRS(sprite.x, sprite.y, sprite.rotation, sprite.scaleX * flipX, sprite.scaleY * flipY);
spriteMatrix.applyITRS(gameObject.x, gameObject.y, gameObject.rotation, gameObject.scaleX * flipX, gameObject.scaleY * flipY);
camMatrix.copyFrom(camera.matrix);
if (parentTransformMatrix)
{
// Multiply the camera by the parent matrix
camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * sprite.scrollFactorX, -camera.scrollY * sprite.scrollFactorY);
camMatrix.multiplyWithOffset(parentTransformMatrix, -camera.scrollX * gameObject.scrollFactorX, -camera.scrollY * gameObject.scrollFactorY);
// Undo the camera scroll
spriteMatrix.e = sprite.x;
spriteMatrix.f = sprite.y;
spriteMatrix.e = gameObject.x;
spriteMatrix.f = gameObject.y;
}
else
{
spriteMatrix.e -= camera.scrollX * sprite.scrollFactorX;
spriteMatrix.f -= camera.scrollY * sprite.scrollFactorY;
spriteMatrix.e -= camera.scrollX * gameObject.scrollFactorX;
spriteMatrix.f -= camera.scrollY * gameObject.scrollFactorY;
}
// Multiply by the Sprite matrix, store result in calcMatrix
@ -287,10 +287,10 @@ var MultiPipeline = new Class({
var getTint = Utils.getTintAppendFloatAlpha;
var cameraAlpha = camera.alpha;
var tintTL = getTint(sprite.tintTopLeft, cameraAlpha * sprite._alphaTL);
var tintTR = getTint(sprite.tintTopRight, cameraAlpha * sprite._alphaTR);
var tintBL = getTint(sprite.tintBottomLeft, cameraAlpha * sprite._alphaBL);
var tintBR = getTint(sprite.tintBottomRight, cameraAlpha * sprite._alphaBR);
var tintTL = getTint(gameObject.tintTopLeft, cameraAlpha * gameObject._alphaTL);
var tintTR = getTint(gameObject.tintTopRight, cameraAlpha * gameObject._alphaTR);
var tintBL = getTint(gameObject.tintBottomLeft, cameraAlpha * gameObject._alphaBL);
var tintBR = getTint(gameObject.tintBottomRight, cameraAlpha * gameObject._alphaBR);
if (camera.roundPixels)
{
@ -312,9 +312,21 @@ var MultiPipeline = new Class({
this.flush();
}
var unit = this.setGameObject(sprite, frame);
var unit = this.setGameObject(gameObject, frame);
this.batchQuad(sprite, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, sprite.tintEffect, texture, unit);
var postPipeline = (gameObject && gameObject.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(gameObject);
}
this.batchQuad(gameObject, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, gameObject.tintEffect, texture, unit);
if (postPipeline)
{
postPipeline.manager.postBatch(gameObject);
}
},
/**
@ -502,7 +514,19 @@ var MultiPipeline = new Class({
textureUnit = this.renderer.setTexture2D(texture);
}
var postPipeline = (gameObject && gameObject.hasPostPipeline);
if (postPipeline)
{
postPipeline.manager.preBatch(gameObject);
}
this.batchQuad(gameObject, tx0, ty0, tx1, ty1, tx2, ty2, tx3, ty3, u0, v0, u1, v1, tintTL, tintTR, tintBL, tintBR, tintEffect, texture, textureUnit);
if (postPipeline)
{
postPipeline.manager.postBatch(gameObject);
}
},
/**

View file

@ -45,11 +45,12 @@ var TilemapLayerWebGLRenderer = function (renderer, src, camera)
var sx = src.scaleX;
var sy = src.scaleY;
var pipelines = renderer.pipelines;
var postPipeline = (src && src.hasPostPipeline);
pipelines.preBatch(src);
src.manualPostPipeline = true;
if (postPipeline)
{
postPipeline.manager.preBatch(src);
}
for (var i = 0; i < tileCount; i++)
{
@ -100,7 +101,10 @@ var TilemapLayerWebGLRenderer = function (renderer, src, camera)
);
}
pipelines.postBatch(src);
if (postPipeline)
{
postPipeline.manager.postBatch(src);
}
};
module.exports = TilemapLayerWebGLRenderer;