Engine API Reference - v2.7.1
    Preparing search index...

    Interface ShaderDesc

    Defines the vertex and fragment shader source for ShaderMaterial, supporting both GLSL and WGSL formats. WebGL always uses the GLSL code. WebGPU prefers the WGSL code if available, otherwise it automatically transpiles the provided GLSL code at runtime.

    interface ShaderDesc {
        attributes?: {};
        fragmentGLSL?: string;
        fragmentOutputTypes?: string | string[];
        fragmentWGSL?: string;
        uniqueName: string;
        vertexGLSL?: string;
        vertexWGSL?: string;
    }
    Index

    Properties

    attributes?: {}

    Object detailing the mapping of vertex shader attribute names to semantics SEMANTIC_*. This enables the engine to match vertex buffer data as inputs to the shader. Defaults to undefined, which generates the default attributes.

    fragmentGLSL?: string

    The fragment shader code in GLSL.

    fragmentOutputTypes?: string | string[]

    Fragment shader output types, which default to vec4. Passing a string will set the output type for all color attachments. Passing an array will set the output type for each color attachment.

    fragmentWGSL?: string

    The fragment shader code in WGSL.

    uniqueName: string

    Unique name for the shader. If a shader with this name already exists, it will be returned instead of a new shader instance.

    vertexGLSL?: string

    The vertex shader code in GLSL.

    vertexWGSL?: string

    The vertex shader code in WGSL.