feat:(flame_texturepacker) add CompositeAtlas #3893
feat:(flame_texturepacker) add CompositeAtlas #3893s1r1m1r1 wants to merge 1 commit intoflame-engine:mainfrom
Conversation
0aec96c to
e5a6aa9
Compare
composite_atlasA runtime-composed texture atlas library for Flutter/Flame games. Merges multiple texture sources into a single atlas to minimize draw calls, reduce memory, and enable runtime texture manipulation. PurposeRuntime Use Cases
Development / Pre-build Use Cases
FeaturesMultiple Source Types
GDX TexturePacker CompatibilityReads atlases created by libGDX TexturePacker and preserves all metadata:
Sprites baked from GDX atlases maintain identical offsets and dimensions as the source, ensuring pixel-perfect visual equivalence. Alpha TrimmingScans the alpha channel of each sprite to find the tight non-transparent bounding box. Eliminates wasted transparent space, producing a more compact atlas. Automatically disabled for GDX sources (already optimally trimmed). Frame DeduplicationDetects sprites with identical pixel content and reuses a single packed slot for all duplicates — exactly like GDX TexturePacker. Uses pixel-level hashing to catch duplicates even when source positions differ: Packing Algorithms
Power-of-Two OutputAtlas dimensions are always rounded up to the nearest power of two (64, 128, 256, 512, 1024, 2048), compatible with GPU texture requirements. Sprite Animation SupportIndexed sprites (GDX Decorators & Filters
Supported Formats
Quick Start// Bake multiple atlases into one
final atlas = await CompositeAtlas.bake([
AtlasBakeRequest(gdxAtlas),
AtlasBakeRequest(gdxAtlas2, whiteList: ['ui_']),
SpriteBakeRequest(mySprite, name: 'hero'),
ImageBakeRequest(icon, name: 'icon'),
], maxAtlasWidth: 1024.0, allowRotation: true);
// Use with Flame like a regular TexturePackerAtlas
final sprite = atlas.findSpriteByName('hero');
final anim = atlas.getAnimation('boy', stepTime: 0.1);
|
e5a6aa9 to
d5d7099
Compare
… texture packer code
d5d7099 to
e966ac3
Compare
Description
Replace this text.
Checklist
docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues