Class BlockEndShader

A shader component that generates the ending block of a shader function. This class creates GLSL function definitions that pass input values directly to output values, effectively acting as a pass-through block in shader node graphs.

Hierarchy (view full)

Constructors

Properties

__webglResourceRepository?: WebGLResourceRepository = ...
__instance: CommonShaderPart

Accessors

  • get attributeCompositions(): CompositionTypeEnum[]
  • Gets the composition types for vertex attributes required by this shader component. This block end shader doesn't require any specific attribute compositions.

    Returns CompositionTypeEnum[]

    An empty array as no attribute compositions are needed

  • get pixelShaderDefinitions(): string
  • Generates the pixel shader function definition. Returns the same definition as the vertex shader since the logic is identical.

    Returns string

    The GLSL function definition string for pixel shaders

  • get vertexShaderDefinitions(): string
  • Generates the vertex shader function definition. Creates a GLSL function that takes input parameters and assigns them directly to output parameters.

    Returns string

    The GLSL function definition string for vertex shaders

Methods

  • 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

    • 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 vertex shaders. Creates code to write varying variables that will be passed to fragment shader.

    Parameters

    • 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

    • 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

    • 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

    • shaderNodes: AbstractShaderNode[]

      Array of shader nodes used to generate varying variables for WebGPU

    Returns string

    The complete fragment shader prerequisites code string

  • 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

    • shaderNodes: AbstractShaderNode[]

      Array of shader nodes used to generate varying variables for WebGPU

    Returns string

    The complete vertex shader prerequisites code string