UNPKG

@tolokoban/tgd

Version:

ToloGameDev library for WebGL2

44 lines 1.81 kB
import { type WebglAttributeType, type WebglUniformType } from ".."; import { type TgdCodeBloc, type TgdCodeFunctions, type TgdCodeVariables } from "./code"; /** * Helper to write the code of a fragment Shader. * @see https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf */ export declare class TgdShaderFragment { protected static counter: number; readonly name: string; precision: "lowp" | "mediump" | "highp"; uniforms: TgdCodeVariables<WebglUniformType>; varying: TgdCodeVariables<WebglAttributeType>; outputs: TgdCodeVariables<WebglAttributeType>; /** * The key should be the signatureof a function * (like `vec2 scale(vec2 v, float s)`) * and the value to code of this function (like `return v * s;`). * * But if the key starts with a `_`, then the content of the value is uses verbatim. */ functions: TgdCodeFunctions | TgdCodeBloc; mainCode: TgdCodeBloc; /** * Thinkg that you put at the beginnig of your shader. * * Example: `layout(origin_upper_left) in vec4 gl_FragCoord;` */ header: TgdCodeBloc; constructor(options?: Partial<{ name: string; precision: "lowp" | "mediump" | "highp"; uniforms: TgdCodeVariables<WebglUniformType>; outputs: TgdCodeVariables<WebglAttributeType>; varying: TgdCodeVariables<WebglAttributeType>; functions: TgdCodeFunctions | TgdCodeBloc; mainCode: TgdCodeBloc; header: TgdCodeBloc; }>); clone(): TgdShaderFragment; get code(): string; debug(caption?: string): void; } export declare function expandOutputs<Type extends WebglAttributeType | WebglUniformType>(definition: TgdCodeVariables<Type>, comment?: string): TgdCodeBloc[]; //# sourceMappingURL=fragment.d.ts.map