Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a function to enable texel offset for tilemap #18209

Open
wants to merge 2 commits into
base: v3.8.6
Choose a base branch
from

Conversation

minggo
Copy link
Contributor

@minggo minggo commented Jan 17, 2025

@minggo minggo requested a review from qiuguohua January 17, 2025 05:50
Copy link

⚠️ Package size ⤴ 162 bytes, old: 5235727, new: 5235889

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -54535,8 +54535,21 @@
          * let properties = titledMap.getPropertiesForGID(GID);
          * cc.log("Properties: " + properties);
          */
         getPropertiesForGID(gid: __private._cocos_tiledmap_tiled_types__GID): __private._cocos_tiledmap_tiled_types__PropertiesInfo | undefined;
+        /**
+         * @en Enables or disables texel offset correction to fix rendering issues like grid edge artifacts.
+         * This function adjusts the texture coordinates of each grid in the tilemap by applying
+         * a 0.5-pixel offset, ensuring that grid edges do not show black lines or artifacts caused by
+         * texture sampling inaccuracies. This is especially useful for tile-based rendering systems.
+         * @zh 启用或禁用像素偏移修正,用于修复网格边缘的渲染问题(如黑线)。此函数通过对每个 tilemap 网格的纹理坐标应用 0.5 像素
+         * 的偏移来调整,确保网格边缘不会出现因纹理采样不准确导致的黑线或其他伪影问题。对基于图块的渲染系统特别有用。
+         *
+         * @param enable
+         * @en Whether to enable (true) or disable (false) the texel offset correction.
+         * @zh 是否启用 (true) 或禁用 (false) 像素偏移修正。
+         */
+        enableTexelOffset(enable: boolean): void;
         __preload(): void;
         onEnable(): void;
         onDisable(): void;
         _applyFile(): void;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants