Skip to content

Commit 66f4060

Browse files
authored
Fix scaling issue of tiles in TMXLayer (#3150)
* Fix scaling issue of tiles in TMXLayer * Removed unused code * Fix clang-format
1 parent 8ba9b34 commit 66f4060

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

axmol/2d/FastTMXLayer.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,6 @@ void FastTMXLayer::updateTotalQuads()
630630
Vec2 tileSize;
631631
Vec2 tileOffset;
632632
Vec2 texSize;
633-
float ptx;
634-
float pty;
635633
Color32 color;
636634
};
637635
std::vector<BatchCache> batchCache(_batches.size());
@@ -649,11 +647,7 @@ void FastTMXLayer::updateTotalQuads()
649647
c.b = static_cast<uint8_t>(c.b * a);
650648
}
651649
batchCache[i] = {AX_SIZE_PIXELS_TO_POINTS(ts->_tileSize),
652-
Vec2(ts->_tileOffset.x / csf, -ts->_tileOffset.y / csf),
653-
ts->_imageSize,
654-
1.0f / ts->_imageSize.width,
655-
1.0f / ts->_imageSize.height,
656-
c};
650+
Vec2(ts->_tileOffset.x / csf, -ts->_tileOffset.y / csf), ts->_imageSize, c};
657651
}
658652

659653
// Cache the last resolved batch index and its GID range to skip re-scanning for
@@ -754,10 +748,10 @@ void FastTMXLayer::updateTotalQuads()
754748
const float ubottom = tileTexture.origin.y / bc.texSize.height;
755749
const float utop = ubottom + tileTexture.size.height / bc.texSize.height;
756750

757-
quad.bl.texCoord = {uleft + bc.ptx, ubottom + bc.pty};
758-
quad.br.texCoord = {uright - bc.ptx, ubottom + bc.pty};
759-
quad.tl.texCoord = {uleft + bc.ptx, utop - bc.pty};
760-
quad.tr.texCoord = {uright - bc.ptx, utop - bc.pty};
751+
quad.bl.texCoord = {uleft, ubottom};
752+
quad.br.texCoord = {uright, ubottom};
753+
quad.tl.texCoord = {uleft, utop};
754+
quad.tr.texCoord = {uright, utop};
761755

762756
quad.bl.color = quad.br.color = quad.tl.color = quad.tr.color = bc.color;
763757

0 commit comments

Comments
 (0)