UNPKG

@tolokoban/tgd

Version:

ToloGameDev library for WebGL2

43 lines 1.4 kB
import { TgdCodeBloc } from "../shader/code"; import { TgdPainterStateOptions, WebglAttributeType, WebglUniformType } from ".."; import { TgdProgram } from "../program"; export declare abstract class TgdMaterial { attPosition: string; attNormal: string; attUV: string; /** * Example: * ``` * { * varNormal: "vec3", * varUV: "vec2" * } * ``` */ readonly varyings: { [name: string]: WebglAttributeType; }; readonly uniforms: { [name: string]: WebglUniformType; }; /** * The code of a `vec4 applyMaterial()` function. */ abstract readonly fragmentShaderCode: TgdCodeBloc; /** * The code of a `void applyMaterial(position, normal, uv)` function. */ abstract readonly vertexShaderCode: TgdCodeBloc; /** * Body of the function `vec4 getPosition(vec4 pos)` of the vertex shader. * * By default, this body is `return pos;`. * Yo can use this code to apply any transformation on the vertex position * before convertion to screen space. */ vertexShaderCodeForGetPosition?: TgdCodeBloc; abstract setUniforms(program: TgdProgram, time: number, delay: number): void; protected readonly state: Partial<TgdPainterStateOptions>; applyState(gl: WebGL2RenderingContext, action: () => void): void; } //# sourceMappingURL=material.d.ts.map