Function appendSpriteAtlasFrames
-
appendSpriteAtlasFrames(
engine: EngineContext,
atlas: SpriteAtlas,
sources: readonly SpriteAtlasFrameSource[],
): number[]Parameters
- engine: EngineContext
- atlas: SpriteAtlas
- sources: readonly SpriteAtlasFrameSource[]
Returns number[]
Append
sourcesinto the remaining free space of an atlas previously built bycreateSpriteAtlasFromFrames. The existingGPUTexture(and any bind group already referencing it) stays valid — each new frame is uploaded with a singlequeue.writeTextureand the UV slots of the existing frames are not touched, so sprite instances already drawing from this atlas remain correct.Returns the integer indices of the newly-appended frames in
atlas.frames, in input order. Sources are validated and placed before any texel is written, so a thrown "atlas full" error leaves the atlas state untouched (all-or-nothing semantics).Throws when:
createGridSpriteAtlas/loadSpriteAtlas(no packer state).maxWidthPxis supplied (cannot fit any shelf).createSpriteAtlasFromFrames(engine, [...], { capacityPx: [w, h] })to reserve room.