Class GlobalDataRepository

The repository class that manages global data used throughout the rendering pipeline. This singleton class handles global properties such as camera matrices, lighting data, bone transformations for skeletal animation, and other shared rendering state.

Methods

  • Internal

    Adds global property declarations to vertex and pixel shader code strings. This method is used during shader compilation to inject the necessary uniform declarations for all registered global properties.

    Parameters

    • vertexPropertiesStr: string

      The string to append vertex shader property declarations to

    • pixelPropertiesStr: string

      The string to append pixel shader property declarations to

    • propertySetter: getShaderPropertyFunc

      The function used to generate property declaration code

    • isWebGL2: boolean

      Whether the target is WebGL 2.0 (affects syntax generation)

    Returns string[]

    A tuple containing the updated vertex and pixel shader property strings

  • Internal

    Sets up uniform locations for properties that need uniform access in data texture mode. Only sets up uniforms for properties marked with needUniformInDataTextureMode flag.

    Parameters

    • shaderProgramUid: number

      The unique identifier of the shader program

    Returns void

  • Internal

    Sets up uniform locations for all global properties when using uniform mode. This is used internally by the WebGL resource repository for shader program setup.

    Parameters

    • shaderProgramUid: number

      The unique identifier of the shader program

    Returns void

  • Returns the current number of allocated instances for a specific property. This represents how many instances of the property have been created with takeOne().

    Parameters

    • propertyName: string

      The name of the property to get the count for

    Returns number

    The number of currently allocated instances, or 0 if the property doesn't exist

  • Returns an array of all registered global property structures. Useful for iterating over all available global properties.

    Returns GlobalPropertyStruct[]

    An array containing all GlobalPropertyStruct instances

  • Retrieves the complete global property structure for a given property name. This includes semantic information, values array, max count, and accessor.

    Parameters

    • propertyName: string

      The name of the property to retrieve

    Returns undefined | GlobalPropertyStruct

    The GlobalPropertyStruct for the specified property, or undefined if not found

  • Gets the memory location offset of a global property in 16-byte aligned units. This is used for data texture mode to determine where properties are stored in memory.

    Parameters

    • propertyName: string

      The name of the property to get the offset for

    Returns number

    The offset in 16-byte units, or -1 if the property is not found

  • Retrieves the value of a specific instance of a global property.

    Parameters

    • shaderSemantic: string

      The name of the shader semantic property to retrieve

    • countIndex: number

      The index of the specific instance to retrieve

    Returns any

    The value object for the specified property instance, or undefined if not found

  • Initializes the GlobalDataRepository with all required global properties. Sets up data structures for camera matrices, lighting, skeletal animation, and other rendering parameters based on the specified process approach.

    Parameters

    • approach: ProcessApproachClass

      The processing approach that determines how data is organized and accessed in shaders

    Returns void

  • Sets uniform values for all global properties in the specified shader program. Iterates through all registered properties and uploads their current values to the GPU.

    Parameters

    • shaderProgram: WebGLProgram

      The WebGL shader program to set uniform values for

    Returns void

  • Sets the value of a specific instance of a global property. Updates the underlying memory buffer with the new value.

    Parameters

    • shaderSemantic: string

      The name of the shader semantic property to update

    • countIndex: number

      The index of the specific instance to update

    • value: any

      The new value to set for this property instance

    Returns void

  • Allocates and returns a new instance of the specified global property. Initializes the property with its default value and adds it to the internal tracking.

    Parameters

    • shaderSemantic: string

      The name of the shader semantic property to allocate

    Returns any

    The newly allocated property value object, or undefined if the property doesn't exist