textmode.js
Version:
Apply real-time ASCII conversion to any HTML canvas.
44 lines (43 loc) • 1.15 kB
TypeScript
/**
* Shader program wrapper with simplified uniform management
*/
export declare class Shader {
private gl;
private program;
private uniformLocations;
private attributeLocations;
private textureUnitCounter;
constructor(gl: WebGLRenderingContext, vertexSource: string, fragmentSource: string);
private createProgram;
private createShader;
private cacheLocations;
/**
* Use this shader program
*/
use(): void;
/**
* Set a single uniform value with automatic texture unit management
*/
setUniform(name: string, value: any): void;
/**
* Get uniform info to determine the correct WebGL type
*/
private getUniformInfo;
private getNextTextureUnit;
/**
* Check if this shader has a specific uniform
*/
hasUniform(name: string): boolean;
/**
* Check if this shader has a specific attribute
*/
hasAttribute(name: string): boolean;
/**
* Get the WebGL program
*/
get glProgram(): WebGLProgram;
/**
* Reset texture unit counter (useful when starting a new frame)
*/
resetTextureUnits(): void;
}