import { EnvPayload } from "../debug-protocol.js"; import { Vector2 } from "three"; //#region src/debug/EnvCollector.d.ts /** * Subset of `WebGPURenderer` we inspect. Fields are all optional / * unknown so three's concrete `Backend` type is still assignable — we * narrow defensively at runtime. `getSize(target)` mutates `target` * via `target.set(w, h)` so it must be a real `Vector2`, not a plain * `{x, y}` object literal. */ interface RendererLike { backend?: unknown; getSize?(target: Vector2): Vector2; getPixelRatio?(): number; } /** * Runtime environment collector for the `env` feature. * * Two modes: * * - **`snapshot(renderer)`** — full env snapshot, used on `subscribe:ack` * so a fresh consumer gets bootstrap capability info without having * to subscribe to env just to find out whether (e.g.) GPU timing is * available. * * - **`fillEnv(out, renderer)`** — delta-encoded payload written into * a caller-owned scratch. Returns `true` if anything differed from * the last emit. Fields absent = no change; `null` = clear (rare for * env — values don't usually *disappear*, just change). * * Almost every env field is static (versions fixed at build time, * renderer backend fixed at construction); only canvas `width`, * `height`, `pixelRatio` change at runtime. So `fillEnv` is cheap — it * usually returns `false` once the first snapshot has been emitted. * * `resetDelta()` clears `_prev` so the next `fillEnv` emits a full * snapshot (re-subscribe path). */ declare class EnvCollector { private _prev; /** Real Vector2 — three's `getSize(target)` calls `target.set(w, h)`. */ private _sizeScratch; /** * Build a full env snapshot. Used for bootstrap info in the * `subscribe:ack` message so consumers see capabilities immediately. * Does NOT update the delta tracker — callers that want to count * this as the baseline should call `resetDelta()` first and then * `fillEnv(out)` on the next tick to synchronise. */ snapshot(renderer: RendererLike | undefined, gpuVerified?: boolean): EnvPayload; /** * Write delta-encoded env updates into `out`. Returns `true` if any * field changed since the last emit. * * `out` must be an EnvPayload the caller owns (typically a scratch). * All fields should be `undefined` on entry; `fillEnv` leaves * unchanged fields as `undefined` (meaning "no change" on the wire) * and sets changed fields to their new value or `null`. */ fillEnv(out: EnvPayload, renderer: RendererLike | undefined, gpuVerified?: boolean): boolean; /** * Reset the delta tracker so the next `fillEnv` emits a full snapshot. * Called when subscriptions change. Also useful after `snapshot()` is * consumed as bootstrap: reset then the next tick's delta is relative * to that bootstrap rather than to an empty prev. */ resetDelta(): void; /** * Record a full snapshot as the current prev. Call this after * `snapshot()` is used for bootstrap so subsequent `fillEnv` calls * compute deltas relative to what the consumer already has. */ recordSnapshotAsPrev(renderer: RendererLike | undefined, gpuVerified?: boolean): void; } //#endregion export { EnvCollector }; //# sourceMappingURL=EnvCollector.d.ts.map