/** * A texture parameter a placeholder stands in for, with the channels of the texture it samples. */ export type PlaceholderMap = { /** * - The name of the texture parameter, such as 'aoMap'. */ name: string; /** * - The channels the parameter samples, such as 'g', or all of them * when not specified. */ channel?: string; }; /** * The 1x1 textures the {@link MaterialHandler} assigns to a texture parameter of a material while * its texture asset loads, which the loaded texture then replaces. * * A placeholder decodes like the texture it stands in for, as it is sRGB and of the type that * texture is, so the shader generated for the placeholder is the one the texture needs as well. * A placeholder is named after the first of the texture parameters it stands in for, and * placeholders named after different parameters are different textures, as a material samples * maps holding the same texture from one sampler. * * The textures are created the first time they are needed, which is when an asset is bound to a * material or unloads - never while rendering, where creating a texture is not supported. * * @ignore */ export class PlaceholderTextures { /** * @param {GraphicsDevice} device - The graphics device the textures are created on, and * destroyed with. */ constructor(device: GraphicsDevice); /** * The graphics device the textures are created on. * * @type {GraphicsDevice} */ device: GraphicsDevice; /** * The placeholder textures, by their name. * * @type {Map} * @private */ private _textures; /** * The placeholder textures, to recognize one. * * @type {Set} * @private */ private _set; destroy(): void; /** * Returns whether a texture is one of the placeholders. * * @param {Texture|null|undefined} texture - The texture. * @returns {boolean} True if the texture is a placeholder. */ has(texture: Texture | null | undefined): boolean; /** * Returns the placeholder standing in for one texture referenced by the given texture * parameters of a material, created on the first request. * * @param {PlaceholderMap[]} maps - The texture parameters referencing the texture, the first * of which names the placeholder. * @param {boolean} srgb - Whether the texture it stands in for is sRGB. * @param {string} type - The type of the texture it stands in for. * @returns {Texture} The placeholder texture. */ get(maps: PlaceholderMap[], srgb: boolean, type: string): Texture; } import type { GraphicsDevice } from '../../platform/graphics/graphics-device.js'; import { Texture } from '../../platform/graphics/texture.js';