UNPKG

@awayjs/stage

Version:
55 lines 1.93 kB
import { ByteArray } from '@awayjs/core'; import { IProgram } from '../base/IProgram'; import { ContextWebGL } from './ContextWebGL'; import { Part } from '../aglsl/assembler/Part'; export interface IUniformMeta { location: WebGLUniformLocation; type: number; size: number; } export interface IAttrMeta { location: number; type: number; size: number; } export interface INativePropgram { program: WebGLProgram; uniforms: Record<string, IUniformMeta>; attributes: Record<string, IAttrMeta>; usage: number; } export declare class ProgramWebGL implements IProgram { private _context; static programCache: Record<string, INativePropgram>; private static ProgramID; private static _tokenizer; private static _aglslParser; private static _uniformLocationNameDictionary; name: string; private _id; private _gl; private _program; private _uniformCache; private _focusId; /** * @description Changed only after rebound a shader. Can be used for partial upload */ get focusId(): number; constructor(_context: ContextWebGL); upload(vertexProgram: ByteArray | Part, fragmentProgram: ByteArray | Part): void; uploadRaw(vertexGLSL: string, fragmentGLSL: string): void; private grabLocationData; protected insertName(shader: string): string; protected reset(): void; getUniformLocation(programType: number, indexOrName?: number | string): WebGLUniformLocation | null; getAttribLocation(index: number): number; private static _getAGALUniformName; private _needCache; uploadUniform(name: string, data: number | number[] | Float32Array): boolean; uniform1i(type: number, index: number, value: number): void; uniform4fv(type: number, value: Float32Array): void; dispose(): void; focusProgram(): void; get glProgram(): WebGLProgram; } //# sourceMappingURL=ProgramWebGL.d.ts.map