rhodonite
    Preparing search index...

    Class WebGLStrategyUniform

    WebGL rendering strategy implementation using uniform-based approach. This strategy uses uniforms to pass per-object data to shaders instead of vertex attributes, which is more suitable for rendering multiple objects with different properties.

    Implements

    Index

    Methods

    • Re-sets up shader program for the material using updated shader sources from Spector.js. This method is specifically designed for shader debugging and live editing scenarios.

      Parameters

      • material: Material

        The material to re-setup shader program for

      • primitive: Primitive

        The primitive geometry associated with the shader

      • updatedShaderSources: ShaderSources

        The updated shader source code

      • onError: (message: string) => void

        Callback function to handle compilation errors

      Returns number

      The CGAPIResourceHandle of the updated shader program, or InvalidCGAPIResourceUid on failure

    • Loads and prepares mesh data for rendering. Sets up VBO (Vertex Buffer Object) and VAO (Vertex Array Object) if not already done.

      Parameters

      • meshComponent: MeshComponent

        The mesh component containing the mesh to load

      Returns boolean

      True if the mesh was loaded successfully, false otherwise

    • Internal method to attach vertex data for a specific mesh and primitive. Binds the appropriate VAO or sets up vertex data pipeline for rendering.

      Parameters

      • engine: Engine
      • mesh: Mesh

        The mesh containing vertex data

      • primitive: Primitive

        The primitive geometry to render

      • primitiveUid: number

        Unique identifier for the primitive

      • glw: WebGLContextWrapper

        WebGL context wrapper

      • instanceIDBufferUid: number

        Instance ID buffer handle (unused in uniform strategy)

      Returns void

    • Common rendering method that handles the main rendering pipeline. Processes primitives in different rendering phases: opaque, translucent, blend with/without Z-write. Supports buffer-less rendering mode for special cases like post-processing effects.

      Parameters

      • primitiveUids: number[]

        Array of primitive UIDs to render, sorted by rendering order

      • renderPass: RenderPass

        The render pass configuration containing rendering settings

      • renderPassTickCount: number

        Current tick count for the render pass

      • _displayIdx: number

      Returns boolean

      True if any primitives were rendered, false otherwise

    • Deletes the current data texture and frees associated GPU resources. This method should be called when the data texture needs to be recreated or when cleaning up resources.

      Parameters

      Returns void

      After calling this method, the data texture UID is reset to an invalid state, and a new data texture will be created on the next rendering cycle.

    • Internal rendering method for processing individual primitives. Handles shader setup, material parameters, lighting, VR rendering, and draw calls for each mesh entity associated with the primitive.

      Parameters

      • primitiveUid: number

        Unique identifier of the primitive to render

      • glw: WebGLContextWrapper

        WebGL context wrapper

      • renderPass: RenderPass

        The render pass configuration

      • _renderPassTickCount: number

      Returns boolean

      True if the primitive was rendered successfully, false otherwise

    • Sets up shader program for the given material and primitive in this WebGL strategy. Creates a new shader program if needed and configures uniform locations for rendering.

      Parameters

      • material: Material

        The material to setup shader program for

      • primitive: Primitive

        The primitive geometry to associate with the shader

      Returns number

      The CGAPIResourceHandle of the created or existing shader program