Skip to content

Commit

Permalink
[#355] workaround for the Tile texture rendering seam issue
Browse files Browse the repository at this point in the history
  • Loading branch information
obiot committed Jul 11, 2016
1 parent e24d90e commit 6f800a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/level/TMXTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
offset.x, offset.y,
this.tilewidth, this.tileheight,
dx, dy,
this.tilewidth, this.tileheight
this.tilewidth + renderer.uvOffset, this.tileheight + renderer.uvOffset
);

if (tmxTile.flipped) {
Expand Down
6 changes: 6 additions & 0 deletions src/video/canvas/canvas_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @param {Boolean} [options.doubleBuffering=false] Whether to enable double buffering
* @param {Boolean} [options.antiAlias=false] Whether to enable anti-aliasing
* @param {Boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
* @param {Boolean} [options.textureSeamFix=true] enable the texture seam fix when rendering Tile when antiAlias is off for the canvasRenderer
* @param {Number} [options.zoomX=width] The actual width of the canvas with scaling applied
* @param {Number} [options.zoomY=height] The actual height of the canvas with scaling applied
*/
Expand Down Expand Up @@ -59,6 +60,11 @@
// create a texture cache
this.cache = new me.Renderer.TextureCache();

if (options.textureSeamFix !== false && !this.antiAlias) {
// enable the tile texture seam fix with the canvas renderer
this.uvOffset = 1;
}

return this;
},

Expand Down
3 changes: 3 additions & 0 deletions src/video/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
// global color
this.currentColor = new me.Color(255, 255, 255, 1.0);

// default uvOffset
this.uvOffset = 0;

return this;
},

Expand Down

1 comment on commit 6f800a4

@obiot
Copy link
Member Author

@obiot obiot commented on 6f800a4 Jul 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.