import type { TextureProps, SamplerProps, TextureView, Device, TextureReadOptions } from '@luma.gl/core'; import { Buffer, Texture, Sampler } from '@luma.gl/core'; import { type TextureCubeFace, type TextureDataAsyncProps, type Texture1DData, type Texture2DData, type Texture3DData, type TextureArrayData, type TextureCubeArrayData, type TextureCubeData } from "./texture-data.js"; /** * Properties for a dynamic texture */ export type DynamicTextureProps = Omit & TextureDataAsyncProps & { /** Generate mipmaps after creating textures and setting data */ mipmaps?: boolean; /** nipLevels can be set to 'auto' to generate max number of mipLevels */ mipLevels?: number | 'auto'; /** Width - can be auto-calculated when initializing from ExternalImage */ width?: number; /** Height - can be auto-calculated when initializing from ExternalImage */ height?: number; }; /** * Dynamic Textures * * - Mipmaps - DynamicTexture can generate mipmaps for textures (WebGPU does not provide built-in mipmap generation). * * - Texture initialization and updates - complex textures (2d array textures, cube textures, 3d textures) need multiple images * `DynamicTexture` provides an API that makes it easy to provide the required data. * * - Texture resizing - Textures are immutable in WebGPU, meaning that they cannot be resized after creation. * DynamicTexture provides a `resize()` method that internally creates a new texture with the same parameters * but a different size. * * - Async image data initialization - It is often very convenient to be able to initialize textures with promises * returned by image or data loading functions, as it allows a callback-free linear style of programming. * * @note GPU Textures are quite complex objects, with many subresources and modes of usage. * The `DynamicTexture` class allows luma.gl to provide some support for working with textures * without accumulating excessive complexity in the core Texture class which is designed as an immutable nature of GPU resource. */ export declare class DynamicTexture { readonly device: Device; readonly id: string; /** Props with defaults resolved (except `data` which is processed separately) */ props: Readonly>; /** Created resources */ private _texture; private _sampler; private _view; /** Ready when GPU texture has been created and data (if any) uploaded */ readonly ready: Promise; isReady: boolean; destroyed: boolean; private resolveReady; private rejectReady; get texture(): Texture; get sampler(): Sampler; get view(): TextureView; get [Symbol.toStringTag](): string; toString(): string; constructor(device: Device, props: DynamicTextureProps); /** @note Fire and forget; caller can await `ready` */ initAsync(originalPropsWithAsyncData: DynamicTextureProps): Promise; destroy(): void; generateMipmaps(): void; /** Set sampler or create one from props */ setSampler(sampler?: Sampler | SamplerProps): void; /** * Copies texture contents into a GPU buffer and waits until the copy is complete. * The caller owns the returned buffer and must destroy it when finished. */ readBuffer(options?: TextureReadOptions): Promise; /** Reads texture contents back to CPU memory. */ readAsync(options?: TextureReadOptions): Promise; /** * Resize by cloning the underlying immutable texture. * Does not copy contents; caller may need to re-upload and/or regenerate mips. */ resize(size: { width: number; height: number; }): boolean; /** Convert cube face label to texture slice index. Index can be used with `setTexture2DData()`. */ getCubeFaceIndex(face: TextureCubeFace): number; /** Convert cube face label to texture slice index. Index can be used with `setTexture2DData()`. */ getCubeArrayFaceIndex(cubeIndex: number, face: TextureCubeFace): number; /** @note experimental: Set multiple mip levels (1D) */ setTexture1DData(data: Texture1DData): void; /** @note experimental: Set multiple mip levels (2D), optionally at `z`, slice (depth/array level) index */ setTexture2DData(lodData: Texture2DData, z?: number): void; /** 3D: multiple depth slices, each may carry multiple mip levels */ setTexture3DData(data: Texture3DData): void; /** 2D array: multiple layers, each may carry multiple mip levels */ setTextureArrayData(data: TextureArrayData): void; /** Cube: 6 faces, each may carry multiple mip levels */ setTextureCubeData(data: TextureCubeData): void; /** Cube array: multiple cubes (faces×layers), each face may carry multiple mips */ setTextureCubeArrayData(data: TextureCubeArrayData): void; /** Sets multiple mip levels on different `z` slices (depth/array index) */ private _setTextureSubresources; /** Recursively resolve all promises in data structures */ private _loadAllData; private _checkNotDestroyed; private _checkReady; static defaultProps: Required; } //# sourceMappingURL=dynamic-texture.d.ts.map