rhodonite
    Preparing search index...

    Class BlockBeginShader

    A shader part that generates the beginning block of a shader function. This class creates GLSL function definitions with input and output parameters based on the provided shader sockets.

    Hierarchy (View Summary)

    Index
    • Creates a new BlockBeginShader instance.

      Parameters

      • __functionName: string

        The name of the GLSL function to generate

      • __valueInputs: ShaderSocket[]

        Array of input shader sockets that define function parameters

      • __valueOutputs: ShaderSocket[]

        Array of output shader sockets that define function output parameters

      Returns BlockBeginShader

    • get attributeCompositions(): CompositionTypeEnum[]

      Gets the composition types for vertex attributes required by this shader part. This shader part doesn't require any specific attribute compositions.

      Returns CompositionTypeEnum[]

      An empty array as no attribute compositions are needed

    • get attributeNames(): AttributeNames

      Gets the attribute names required by this shader part. This shader part doesn't require any specific vertex attributes.

      Returns AttributeNames

      An empty array as no attributes are needed

    • get attributeSemantics(): VertexAttributeEnum[]

      Gets the vertex attribute semantics required by this shader part. This shader part doesn't require any specific vertex attribute semantics.

      Returns VertexAttributeEnum[]

      An empty array as no attribute semantics are needed

    • Generates variable assignment statement with proper type declaration. Creates appropriate syntax for both WebGL (GLSL) and WebGPU (WGSL) based on the current process approach.

      Parameters

      • engine: Engine

        The engine instance

      • varName: string

        The name of the variable to declare

      • inputSocket: Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>

        The socket containing type and default value information

      Returns string

      The variable assignment statement string

    • Generates varying variable assignment statement for fragment/pixel shaders. Creates code to read varying variables passed from vertex shader with proper type declaration.

      Parameters

      • engine: Engine

        The engine instance

      • varName: string

        The name of the variable to declare

      • inputSocket: Socket<string, CompositionTypeEnum, ComponentTypeEnum, SocketDefaultValue>

        The socket containing type information

      • inputNode: AbstractShaderNode

        The shader node that provides the varying variable

      • outputNameOfPrev: string

      Returns string

      The varying variable assignment statement string for fragment shader

    • Generates varying variable assignment statement for vertex shaders. Creates code to write varying variables that will be passed to fragment shader.

      Parameters

      • engine: Engine

        The engine instance

      • inputNode: AbstractShaderNode

        The shader node that provides the varying variable

      • varNames: string[]

        Array of variable names to assign

      • j: number

        Index of the current variable in the varNames array

      Returns string

      The varying variable assignment statement string for vertex shader

    • Generates the main function beginning code for vertex or fragment shaders. Handles differences between WebGL (GLSL) and WebGPU (WGSL) shader languages.

      Parameters

      • engine: Engine
      • isVertexStage: boolean

        True if generating code for vertex shader, false for fragment shader

      Returns string

      The shader code string for the main function beginning

    • Generates the main function ending code for vertex or fragment shaders. Handles differences between WebGL (GLSL) and WebGPU (WGSL) shader languages.

      Parameters

      • engine: Engine

        The engine instance

      • isVertexStage: boolean

        True if generating code for vertex shader, false for fragment shader

      Returns "\n return output;\n}\n" | "\n return rt0;\n}\n" | "\n}\n"

      The shader code string for the main function ending

    • Generates fragment/pixel shader prerequisites including definitions and varying variable declarations. Creates appropriate code for both WebGL (GLSL) and WebGPU (WGSL) based on the current process approach.

      Parameters

      • engine: Engine

        The engine instance

      • shaderNodes: AbstractShaderNode[]

        Array of shader nodes used to generate varying variables for WebGPU

      Returns string

      The complete fragment shader prerequisites code string

    • Generates the pixel shader function definition. Returns the same definition as vertex shader since the function structure is identical.

      Parameters

      Returns string

      The GLSL function definition string for pixel shader

    • Generates vertex shader prerequisites including definitions, vertex inputs, and uniform declarations. Creates appropriate code for both WebGL (GLSL) and WebGPU (WGSL) based on the current process approach.

      Parameters

      • engine: Engine

        The engine instance

      • shaderNodes: AbstractShaderNode[]

        Array of shader nodes used to generate varying variables for WebGPU

      Returns string

      The complete vertex shader prerequisites code string

    • Generates the vertex shader function definition. Creates a GLSL function with the specified name, input parameters, and output parameters. The function body assigns input values to corresponding output values.

      Parameters

      Returns string

      The GLSL function definition string for vertex shader