真机运行有缝隙

Tiled瓦片地图在真机运行时有缝隙的解决方法

我与影子孤独终老i 提交于 2019-12-01 05:53:34
最近遇到个问题,在用tilemap制作像素风地图后,xcode模拟器运行正常,打包真机运行发现部分地图出现瓦片间有缝隙的问题,如下图: 游戏引擎Cocos-2dx-Lua 3.10版本,地图用Tiled 0.10.2制作,试着在DesignResolutionSize下面下手,发现问题无法解决,后来查阅资料,发现在frameworks/cocos2d-x/cocos/base下,有一个名为ccConfig.h的文件,找到如下代码: /** @def CC_FIX_ARTIFACTS_BY_STRECHING_TEXE L * If enabled, the texture coordinates will be calculated by using this formula: * - texCoord.left = (rect.origin.x*2+1) / (texture.wide*2); * - texCoord.right = texCoord.left + (rect.size.width*2-2)/(texture.wide*2); * The same for bottom and top. * This formula prevents artifacts by using 99% of the texture. * The "correct" way to