Skip to content

Commit 848377b

Browse files
committed
The TileSprite Game Objects now support rendering with normal maps.
1 parent fea1ade commit 848377b

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

src/gameobjects/tilesprite/TileSpriteWebGLRenderer.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,32 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage,
2525
{
2626
src.updateCanvas();
2727

28+
var width = src.width;
29+
var height = src.height;
2830
var getTint = Utils.getTintAppendFloatAlpha;
31+
var pipeline = this.pipeline;
2932

30-
this.pipeline.batchTexture(
33+
if (width === 0 || height === 0)
34+
{
35+
return;
36+
}
37+
38+
renderer.setPipeline(pipeline, src);
39+
40+
var textureUnit = pipeline.setTexture2D(src.fillPattern, src);
41+
42+
pipeline.batchTexture(
3143
src,
3244
src.fillPattern,
3345
src.displayFrame.width * src.tileScaleX, src.displayFrame.height * src.tileScaleY,
3446
src.x, src.y,
35-
src.width, src.height,
47+
width, height,
3648
src.scaleX, src.scaleY,
3749
src.rotation,
3850
src.flipX, src.flipY,
3951
src.scrollFactorX, src.scrollFactorY,
40-
src.originX * src.width, src.originY * src.height,
41-
0, 0, src.width, src.height,
52+
src.originX * width, src.originY * height,
53+
0, 0, width, height,
4254
getTint(src._tintTL, camera.alpha * src._alphaTL),
4355
getTint(src._tintTR, camera.alpha * src._alphaTR),
4456
getTint(src._tintBL, camera.alpha * src._alphaBL),
@@ -47,7 +59,9 @@ var TileSpriteWebGLRenderer = function (renderer, src, interpolationPercentage,
4759
(src.tilePositionX % src.displayFrame.width) / src.displayFrame.width,
4860
(src.tilePositionY % src.displayFrame.height) / src.displayFrame.height,
4961
camera,
50-
parentMatrix
62+
parentMatrix,
63+
false,
64+
textureUnit
5165
);
5266
};
5367

0 commit comments

Comments
 (0)