The TileSprite Game Objects now support rendering with normal maps.

This commit is contained in:
Richard Davey 2020-07-16 16:59:53 +01:00
parent fea1ade5b7
commit 848377b8d8

View file

@ -25,20 +25,32 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage,
{
src.updateCanvas();
var width = src.width;
var height = src.height;
var getTint = Utils.getTintAppendFloatAlpha;
var pipeline = this.pipeline;
this.pipeline.batchTexture(
if (width === 0 || height === 0)
{
return;
}
renderer.setPipeline(pipeline, src);
var textureUnit = pipeline.setTexture2D(src.fillPattern, src);
pipeline.batchTexture(
src,
src.fillPattern,
src.displayFrame.width * src.tileScaleX, src.displayFrame.height * src.tileScaleY,
src.x, src.y,
src.width, src.height,
width, height,
src.scaleX, src.scaleY,
src.rotation,
src.flipX, src.flipY,
src.scrollFactorX, src.scrollFactorY,
src.originX * src.width, src.originY * src.height,
0, 0, src.width, src.height,
src.originX * width, src.originY * height,
0, 0, width, height,
getTint(src._tintTL, camera.alpha * src._alphaTL),
getTint(src._tintTR, camera.alpha * src._alphaTR),
getTint(src._tintBL, camera.alpha * src._alphaBL),
@ -47,7 +59,9 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage,
(src.tilePositionX % src.displayFrame.width) / src.displayFrame.width,
(src.tilePositionY % src.displayFrame.height) / src.displayFrame.height,
camera,
parentMatrix
parentMatrix,
false,
textureUnit
);
};