import { Device } from '../Device'; import { ShaderType } from '../enums'; import { Shader, ShaderOptions } from './Shader'; import { ShaderUniform, ShaderUniformBinding, ShaderUniformValue } from './ShaderUniform'; /** * Constructor options for {@link ShaderProgram} * * @public */ export interface ShaderProgramOptions { /** * The vertex shader to be used within the program * * @remarks * If it is a string it is assumed to be the source code for the vertex shader. * If it is an object it is assumed to be the shader options to be passed into the `Shader` constructor. */ vertexShader?: string | ShaderOptions | Shader; /** * The fragment shader to be used within the program * * @remarks * If it is a string it is assumed to be the source code for the fragment shader. * If it is an object it is assumed to be the shader options to be passed into the `Shader` constructor. */ fragmentShader?: string | ShaderOptions | Shader; } /** * A wrapper class around {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGLProgram | WebGLProgram} * * @public * @remarks * Combines a vertex shader and a fragment shader into a shader program. * * On creation the shader source code is inspected for */ export declare abstract class ShaderProgram { /** * A symbol identifying the `ShaderProgramOptions` type. */ static readonly OptionsSymbol: unique symbol; /** * A unique id */ readonly uid: string; /** * The graphics device */ abstract readonly device: Device; /** * The vertex shader */ abstract readonly vertexShader: Shader; /** * The fragment shader */ abstract readonly fragmentShader: Shader; /** * A map of all shader uniforms */ readonly uniforms: ReadonlyMap; private errLogs; abstract create(): this; /** * Releases the program handle */ abstract destroy(): this; /** * Sets this program as the current program on the graphics device */ bind(): this; /** * Creates a new copy of this resource */ clone(): ShaderProgram; /** * Sets multiple uniform values. * * @remarks * Takes only known uniform names into account and ignores `null` values */ setUniforms(uniforms?: { [key: string]: ShaderUniformValue; }): this; /** * Sets a value on the named uniform * * @remarks * `null` values are ignored */ setUniform(name: string, value: ShaderUniformValue): this; applyBindings(bindings: ShaderUniformBinding[]): void; private reportMissingUniform; protected getShader(type: ShaderType, from: string | ShaderOptions | Shader): Shader; } //# sourceMappingURL=ShaderProgram.d.ts.map