Interface InstanceAssetSource<AssetID>

The domain half the tile pool delegates to: what assets an instance is made of, and how to materialise / discard one asset's payload. This is the seam the production conway-geom surface implements (extract → tessellate into the asset's chunks; discard on last release); tests implement it with recording mocks.

interface InstanceAssetSource<AssetID> {
    assetsOf(instanceID: number): GeometryAsset<AssetID>[];
    discard(assetID: AssetID): void;
    materialize(assetID: AssetID): void;
}

Type Parameters

  • AssetID

Methods

  • The assets an instance requires resident, with their byte sizes. For a simple product this is one asset; mapped/instanced representations return the same assetID from many instances — that sharing is the point.

    Parameters

    • instanceID: number

      The instance (product local ID in the geometry case).

    Returns GeometryAsset<AssetID>[]

    The instance's assets.

  • Discard an asset's payload (called exactly once per residency, on the 1→0 reference, after its chunks are already back in the pool).

    Parameters

    • assetID: AssetID

      The asset to discard.

    Returns void

  • Materialise an asset's payload (called exactly once per residency, on the 0→1 reference). In production: run the wasm extract/tessellate and write the result into the asset's pool chunks.

    Parameters

    • assetID: AssetID

      The asset to materialise.

    Returns void