UNPKG

1.5 kBTypeScriptView Raw
1/// <reference types="webgl2" />
2export declare class Shader {
3 vertex: WebGLShader;
4 fragment: WebGLShader;
5 vertexSource: string;
6 fragmentSource: string;
7 attributes: {};
8 uniforms: {};
9 macros: {};
10 ctx: WebGL2RenderingContext;
11 program: WebGLProgram;
12 isDirty: boolean;
13 constructor(vertCode?: any, fragCode?: any, macros?: {});
14 static clone(shader: Shader): Shader;
15 static macros: string;
16 static buildProgram(shader: Shader, ctx: any): void;
17 static updateUniform(shader: Shader): void;
18 static pickupActiveAttributes(ctx: WebGL2RenderingContext, shader: WebGLProgram): {};
19 static pickupActiveUniforms(gl: WebGL2RenderingContext, shader: WebGLProgram): {};
20 static compileShader(gl: WebGL2RenderingContext, type: any, code: any): WebGLShader;
21 static createShaderProgram(gl: WebGL2RenderingContext, vertexShader: WebGLShader, fragmentShader: WebGLShader): WebGLProgram;
22}
23export declare class Uniform {
24 location: WebGLUniformLocation;
25 type: GLenum;
26 setter: string;
27 argLength: number;
28 constructor(location: WebGLUniformLocation, type: GLenum, setter: string, argLength: number);
29 value: any;
30 isDirty: boolean;
31 static getUnifSetter(type: GLenum): "uniform1f" | "uniform2f" | "uniform3fv" | "uniform4f" | "uniform1i" | "uniform2i" | "uniform3i" | "uniform4i" | "uniformMatrix2fv" | "uniformMatrix3fv" | "uniformMatrix4fv";
32 static getUnifArgLenght(type: GLenum): 3 | 2;
33}