import { type DepthAnnotationRenderer } from "supervision-js-core"; import type { BufferImageSource as PixiBufferImageSource, Container as PixiContainer, Mesh as PixiMesh, MeshGeometry as PixiMeshGeometry, Shader as PixiShader } from "pixi.js"; import type { DepthFrameProvider } from "#render-preparation/depth/source"; import type { InjectedMeshConstructor, InjectedMeshGeometryConstructor, InjectedShaderFactory } from "#renderers/injected-pixi"; import type { ActiveDepthMap } from "#types/media-depth"; import type { ResolvedRenderPreparationGateThresholds } from "#types/render-preparation"; import { type DepthBufferImageSourceConstructor } from "./depth-textures"; import { createPixiDepthShaderRenderer } from "./pixi-depth-shader"; type PixiDepthMesh = PixiMesh; type DepthShaderOptions = Parameters[0]; /** * All depth renderers share one upload of each map; a renderer change rewrites * the shader's uniforms and uploads nothing. A media time with no map hides * every mesh, so a stale map never sits over new pixels. */ export declare function createPixiDepthLayer(options: { readonly BufferImageSource: DepthBufferImageSourceConstructor; readonly Container: new () => PixiContainer; readonly ImageSource: DepthShaderOptions["ImageSource"]; readonly Mesh: InjectedMeshConstructor; readonly MeshGeometry: InjectedMeshGeometryConstructor; readonly Shader: InjectedShaderFactory; readonly UniformGroup: DepthShaderOptions["UniformGroup"]; readonly acceptsUnalignedTextureRows: () => boolean; readonly maxTextureSize?: () => number; readonly getMediaSize: () => { width: number; height: number; }; /** * Gives a texture its GPU copy now. Pixi otherwise creates one lazily, at * the first render that draws it, which is inside a present. */ readonly prepareTexture?: (source: PixiBufferImageSource) => void; readonly renderers: readonly DepthAnnotationRenderer[]; readonly source?: DepthFrameProvider | null; readonly hidden?: boolean; }): { createContainer: () => PixiContainer; setRenderers(next: readonly DepthAnnotationRenderer[]): void; /** * Nothing draws, the playback gate stops waiting for depth and nothing * decodes ahead. The source and what it decoded are kept. */ setHidden(next: boolean): void; setDepthSource(next: DepthFrameProvider | null): void; drawFrame(mediaTime: number): void; getActiveDepth(): ActiveDepthMap | null; prefetch(mediaTime: number): void; /** * Uploads the maps of the next frames into spare textures, so the * presents that draw them only bind. Call it after a present, never in * one: the frame on screen keeps its own texture. * * At a pace that is not a whole number of frames a present, a present * moves the whole part or one more; those two frames are what go up. */ uploadAhead(mediaTime: number): void; needsRenderPreparationWait(mediaTime: number, thresholds: ResolvedRenderPreparationGateThresholds): boolean; waitForRenderPreparation(mediaTime: number, thresholds: ResolvedRenderPreparationGateThresholds, signal?: AbortSignal): Promise; getPreparationProgress(): number; /** * Whether the depth a draw of `mediaTime` would show is decoded, asking * nothing to load. True where there is nothing to wait for. */ isArtifactPrepared(mediaTime: number): boolean; getUploadCounts(): { ahead: number; inPresent: number; }; getContentKey(): string; destroy(): void; }; export type PixiDepthLayer = ReturnType; export {}; //# sourceMappingURL=pixi-depth-layer.d.ts.map