-
-
Notifications
You must be signed in to change notification settings - Fork 657
Open
Description
Description
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.assigninSprite.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 ingetUVs() - Require proper pre-defined atlas regions via
addRegion()
Locations
src/video/texture/atlas.js—addRegion(),getUVs(),addUVs()src/renderable/sprite.js—addAnimation()affected by atlas pollution- Batcher/compositor code that consumes texture regions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels