UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

56 lines (55 loc) 2.06 kB
/** * A collection of shader chunks, used by {@link ShaderChunks}. This is a map of shader chunk names * to their code. As this class extends `Map`, it can be used as a `Map` as well in addition to * custom functionality it provides. * * @category Graphics */ export class ShaderChunkMap extends Map<any, any> { constructor(); constructor(entries?: readonly (readonly [any, any])[]); constructor(); constructor(iterable?: Iterable<readonly [any, any]>); _keyDirty: boolean; _key: string; /** * Adds a new shader chunk with a specified name and shader source code to the Map. If an * element with the same name already exists, the element will be updated. * * @param {string} name - The name of the shader chunk. * @param {string} code - The shader source code. * @returns {this} The ShaderChunkMap instance. */ set(name: string, code: string): this; /** * Adds multiple shader chunks to the Map. This method accepts an object where the keys are the * names of the shader chunks and the values are the shader source code. If an element with the * same name already exists, the element will be updated. * * @param {Object} object - Object containing shader chunks. * @returns {this} The ShaderChunkMap instance. */ add(object: any): this; /** * Removes a shader chunk by name from the Map. If the element does not exist, no action is * taken. * * @param {string} name - The name of the shader chunk to remove. * @returns {boolean} True if an element in the Map existed and has been removed, or false if the * element does not exist. */ delete(name: string): boolean; markDirty(): void; _dirty: boolean; isDirty(): boolean; resetDirty(): void; get key(): string; /** * Copy the shader chunk map. * * @param {ShaderChunkMap} source - The instance to copy. * @returns {this} The destination instance. * @ignore */ copy(source: ShaderChunkMap): this; }