rhodonite
    Preparing search index...

    Class VarianceShadowMapDecodeClassicMaterialContent

    Abstract base class for material content that provides common functionality for material rendering. This class handles shader semantics, rendering setup, and GPU parameter management for materials.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new instance of VarianceShadowMapDecodeClassicMaterialContent for variance shadow mapping. This material content handles the decoding and rendering of variance shadow maps, which provide soft shadows with reduced aliasing compared to traditional shadow mapping techniques.

      Parameters

      • engine: Engine

        The engine instance

      • materialName: string

        The name identifier for this material

      • options: {
            colorAttachmentsNumberDepth: number;
            colorAttachmentsNumberSquareDepth: number;
            depthCameraComponent?: CameraComponent;
            isDebugging: boolean;
            isLighting: boolean;
            isMorphing: boolean;
            isSkinning: boolean;
        }

        Configuration options for the material

        • colorAttachmentsNumberDepth: number

          Index of the color attachment containing depth information from DepthEncodeMaterialContent

        • colorAttachmentsNumberSquareDepth: number

          Index of the color attachment containing squared depth information

        • OptionaldepthCameraComponent?: CameraComponent

          Optional camera component used for depth rendering. If not provided, uses the current render pass camera

        • isDebugging: boolean

          Whether to enable debug visualization showing areas outside depth map in debug color

        • isLighting: boolean

          Whether to apply lighting calculations. When false, renders original material color except in shadow areas

        • isMorphing: boolean

          Whether to enable morphing/blend shape support

        • isSkinning: boolean

          Whether to enable skeletal animation support

      • encodedDepthRenderPasses: RenderPass[]

        Array of exactly 2 render passes containing the encoded depth information (depth and squared depth)

      Returns VarianceShadowMapDecodeClassicMaterialContent

      Will log an error if encodedDepthRenderPasses length is not exactly 2

      Will log a warning if depthCameraComponent is not provided

    Properties

    __definitions: string = ''
    __materialName: string
    __semantics: ShaderSemanticsInfo[] = []
    _engine?: Engine

    The engine instance this material content is associated with

    _tags: RnTags = {}

    Collection of tags associated with this object

    shaderType: EnumIO = ShaderType.VertexAndPixelShader
    __tmp_vector2: MutableVector2 = ...
    __tmp_vector4: MutableVector4 = ...
    AllowableDepthError: ShaderSemanticsClass = ...
    currentMaxObjectCount: number = 0

    Current maximum object count for UID generation

    DebugColorFactor: ShaderSemanticsEnum = ...
    DepthAdjustment: ShaderSemanticsClass = ...
    DepthTexture: ShaderSemanticsClass = ...
    InvalidObjectUID: -1

    Invalid object UID constant

    IsPointLight: ShaderSemanticsClass = ...
    LightBleedingParameter: ShaderSemanticsClass = ...
    materialNodes: AbstractMaterialContent[] = []
    MinimumVariance: ShaderSemanticsClass = ...
    ShadowColor: ShaderSemanticsClass = ...
    SquareDepthTexture: ShaderSemanticsClass = ...
    TextureDepthAdjustment: ShaderSemanticsClass = ...
    zFarInner: ShaderSemanticsClass = ...
    zNearInner: ShaderSemanticsClass = ...

    Accessors

    • set depthCameraComponent(depthCameraComponent: CameraComponent): void

      Sets the depth camera component used for shadow map generation. This camera defines the light's perspective for shadow mapping calculations.

      Parameters

      • depthCameraComponent: CameraComponent

        The camera component representing the light's view for shadow mapping

      Returns void

      The depth camera component should be positioned and oriented to match the light source that will cast shadows. Its view-projection matrix will be used to transform vertices into light space for shadow map lookup operations.

    • get objectUID(): number

      Gets the unique object identifier

      Returns number

      The object's UID

    • get pixelShaderityObject(): ShaderityObject | undefined

      Gets the pixel shader object associated with this material.

      Returns ShaderityObject | undefined

      The pixel shader object or undefined if not set

    • get uniqueName(): string

      Gets the unique name of this object

      Returns string

      The unique name string

    • get vertexShaderityObject(): ShaderityObject | undefined

      Gets the vertex shader object associated with this material.

      Returns ShaderityObject | undefined

      The vertex shader object or undefined if not set

    Methods

    • Sets internal rendering parameters for the material on a per-material basis. This method configures shader uniforms and parameters specific to variance shadow mapping, including camera matrices, depth information, and various rendering features like skinning and morphing.

      Parameters

      • params: {
            args: RenderingArgWebGL;
            engine: Engine;
            material: Material;
            shaderProgram: WebGLProgram;
        }

        The rendering parameters object

        • args: RenderingArgWebGL

          WebGL-specific rendering arguments containing entity, camera, and rendering context

        • engine: Engine
        • material: Material

          The material instance being rendered

        • shaderProgram: WebGLProgram

          The WebGL shader program to configure

      Returns void

      This method handles:

      • Setting world, view, and projection matrices
      • Configuring depth camera parameters (zNear, zFar, view-projection matrix)
      • Setting up skeletal animation if present
      • Configuring lighting information
      • Setting up morph target data if morphing is enabled

      The method optimizes performance by caching zNear and zFar values to avoid unnecessary uniform updates.

    • Performs shader reflection to extract semantics information from vertex and pixel shaders.

      Parameters

      • engine: Engine
      • vertexShader: ShaderityObject

        The vertex shader object for WebGL

      • pixelShader: ShaderityObject

        The pixel shader object for WebGL

      • vertexShaderWebGpu: ShaderityObject

        The vertex shader object for WebGPU

      • pixelShaderWebGpu: ShaderityObject

        The pixel shader object for WebGPU

      • definitions: string[]

        Array of shader definitions

      Returns ShaderSemanticsInfo[]

      Array of shader semantics information

    • Checks whether this object has a tag with the specified name

      Parameters

      • tagName: string

        The name of the tag to check for

      Returns boolean

      True if the tag exists (value is not null/undefined), false otherwise

    • Checks if this object has a tag with the specified name and value

      Parameters

      • tagName: string

        The tag name to match

      • tagValue: string

        The tag value to match

      Returns boolean

      True if the object has a matching tag, false otherwise

    • Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.

      Parameters

      • stringArray: string[]

        Array of strings that must all be present in the combined tag string

      Returns boolean

      True if all strings are found in the combined tag string, false otherwise

    • Attempts to set a tag on this object. If the tag already exists, it will be replaced.

      Parameters

      • tag: Tag

        The tag object containing the name and value to set

      Returns boolean

      True if the tag was successfully set, false if the tag name contains invalid characters

    • Attempts to set a unique name for this object

      Parameters

      • name: string

        The desired unique name

      • toAddNameIfConflict: boolean

        If true, appends UID to make name unique when conflicts occur; if false, fails on conflict

      Returns boolean

      True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false

    • Validates that a tag string contains only allowed characters (alphanumeric and underscore)

      Parameters

      • val: string

        The string to validate

      Returns boolean

      True if the string contains only valid characters, false if it contains invalid characters

    • Searches for the first object that has a specific tag with the given value

      Parameters

      • tag: string

        The tag name to search for

      • value: string

        The tag value to match

      Returns WeakRef<RnObject> | undefined

      WeakRef to the first matching object, or undefined if not found