import { Sprite2DMaterial, Sprite2DMaterialOptions } from "../materials/Sprite2DMaterial.js"; import { RegistryData } from "../ecs/batchUtils.js"; import { BatchQueryView } from "../pipeline/batchQuery.js"; import { Sprite2D } from "../sprites/Sprite2D.js"; import { SpriteGroup } from "../pipeline/SpriteGroup.js"; import { Scene, Texture } from "three"; import { World } from "koota"; //#region src/orchestration/registry.d.ts /** * Renderers are opaque WeakMap-ish hosts here — the registry never * calls renderer methods; it only needs identity for isolation. Keeps * the orchestration layer renderer-agnostic (WebGPURenderer today, * anything object-shaped tomorrow). */ type RendererLike = object; /** * Per-(renderer, scene) orchestration state. * * The registry is the auto-orchestrate counterpart of an explicit * `SpriteGroup`: it owns a hidden SpriteGroup (ECS world + system * schedule + batch-mesh container) that materializes into the scene on * first use. Nothing constructs one of these until a primitive actually * shows up in a rendered scene — see `getOrCreateRegistry`. * * GC chain: the host lives on the renderer; scenes key a WeakMap. * Drop the scene → registry unreachable. Drop the renderer → all of its * registries unreachable. No module-level strong refs. */ declare class Registry { readonly renderer: RendererLike; readonly scene: Scene; /** * Hidden orchestrator container — a SpriteGroup that carries the ECS * world, the system schedule, and parents the auto-created batch * meshes. Added to the scene lazily when orchestration activates. */ readonly group: SpriteGroup; /** * Registered auto-orchestrated sprites. Lookup collection (material * dispose, wholesale cleanup) — never iterated per frame. */ readonly sprites: Set; /** * Per-texture default materials, replacing the module-static shared * cache. Populated by the material-lifecycle slice; declared here so * the storage shape is complete from day one. */ readonly defaultMaterials: WeakMap, Sprite2DMaterial>; /** * Auto-registered sprites not yet enrolled in the batching world — * each waits standalone until its run reaches the promotion threshold * (2) or an active batch for its run already exists. */ readonly standalone: Set; /** Set when standalone membership changed; drained by the scene sweep. */ _autoEvalDirty: boolean; /** Idempotency marker for the chained `Scene.onBeforeRender` install. */ _sceneHookInstalled: boolean; /** The user's original `Scene.onBeforeRender`, preserved in the chain. */ _originalSceneOnBeforeRender: Scene['onBeforeRender'] | null; constructor(renderer: RendererLike, scene: Scene); /** The Koota world backing this registry (owned by the hidden group). */ get world(): World; /** * Get (or create) this registry's default material for a texture. * Backed by the world-scoped store, so effect registration and * dispose stay isolated between registries/Flatlands sharing textures. */ getDefaultMaterial(texture: Texture): Sprite2DMaterial; /** * Get (or create) this registry's effect-variant material for a * texture + configuration — the constants-effect counterpart of * `getDefaultMaterial`. */ getEffectVariant(texture: Texture, options: Sprite2DMaterialOptions): Sprite2DMaterial; /** * Live view of this registry's batches keyed by run key. Reads * through to the ECS BatchRegistry singleton — no parallel * bookkeeping to drift. */ get batches(): BatchQueryView; /** @internal */ _registryData(): RegistryData | null; } /** * Get (or lazily create) the registry for a (renderer, scene) tuple. * * Same tuple → same registry. Two renderers × one scene → two * registries (different GPU resource graphs). One renderer × two * scenes → two registries (different ECS worlds). */ declare function getOrCreateRegistry(renderer: RendererLike, scene: Scene): Registry; /** Get the registry for a tuple if one exists; never creates. */ declare function peekRegistry(renderer: RendererLike, scene: Scene): Registry | null; //#endregion export { Registry, RendererLike, getOrCreateRegistry, peekRegistry }; //# sourceMappingURL=registry.d.ts.map