Skip to content

Decode an atlas once for all its sprites #154

Closed

Description

@fatal10110

Package: packages/texture (npm unity-asset-reader-texture), sprite.ts

Description

Follow-up of #34, recorded there as a ponytail. decodeSprite(obj, env) decodes the sprite's texture on every call, so an atlas holding N sprites is decoded N times when a caller exports all of them. That is fine for the fixtures (a 128x128 RGBA32 atlas) but not for a 2048x2048 compressed atlas.

Tasks

  • When a real caller hits it: let callers decode an atlas once and cut many sprites from it, e.g. an option carrying already-decoded textures, or exporting the lookup and the cut (findSpriteSource, cutSprite, internal today) as a two-step API. No cache hidden in the package: a decoded 2048x2048 atlas is 16 MB, and its lifetime is the caller's decision.

Acceptance

  • Decoding every sprite of one atlas decodes its texture once, and gives the same images as decodeSprite.

Plan: docs/unity-asset-reader-plan.md. Behavior source of truth: Razviar/assetstudio (MIT). Golden oracle: UnityPy (MIT). MIT-derivative port: keep upstream copyright notices. Do not copy or import @arkntools/unity-js (AGPL-3.0), tests included. No C# compiled to WASM - C# is reference only, hand-ported to TS; WASM is built from C/C++ only (plan D2). Layout: npm-workspaces monorepo under packages/; dependencies point feature package -> core only (plan D7/D8, rules R13/R14).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:textureTexture and sprite decodingbacklogOn-demand, no named consumer yet

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions