You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor Batcher to use pre-computed UVs from region objects instead of coordinate-string lookups #1281
The texture atlas currently maintains a workaround where regions are cached under coordinate-string keys ("x,y,w,h") in addUVs() so the Batcher can look them up by source coordinates. Additionally, getUVs() has a fallback that parses unknown region names as "x,y,w,h" strings and creates ad-hoc regions on the fly.
This is fragile and adds unnecessary complexity. The Batcher should work directly with region/frame objects that already carry their pre-computed UV float arrays, rather than performing string-based lookups.
Current behavior
addUVs() creates a duplicate atlas entry keyed by "x,y,w,h" coordinates (atlas.js:401-402)
getUVs() falls back to parsing the region name as "x,y,w,h" when no named region is found (atlas.js:370-372)
addRegion() allows creating arbitrary regions on the fly (atlas.js:285)
The coordinate-string cache pollutes the atlas dictionary, causing Object.assign in Sprite.addAnimation() to produce undefined entries in WebGL mode (sprite.js:409)
Proposed solution
Refactor the Batcher to accept region objects with pre-computed UVs directly, instead of looking up regions by coordinate strings
Remove the coordinate-string cache in addUVs()
Remove the "x,y,w,h" parsing fallback in getUVs()
Require proper pre-defined atlas regions via addRegion()
Activity
Clean up TODO/FIXME/XXX comments across codebase
TextureAtlas: compute quad UVs instead of adding a region for every d…