Loads and prepares a mesh component for rendering with the data texture strategy. This method validates the mesh, updates current component SIDs, and ensures the mesh's VBO and VAO are properly set up.
The mesh component to load and prepare for rendering
true if the mesh was successfully loaded, false if there was an error
Re-establishes a shader program for a material using updated shader sources. This method is typically called by debugging tools like Spector.js when shader sources are modified at runtime for inspection or debugging.
The material whose shader needs to be re-setup
The primitive geometry associated with the shader
The modified shader source code
Callback function to handle compilation or linking errors
The resource handle of the updated shader program, or InvalidCGAPIResourceUid on failure
Attaches GPU data for a primitive (placeholder implementation). This method is part of the CGAPIStrategy interface but is not used in the data texture strategy since data is handled through textures.
The primitive to attach GPU data for
Internal GPU data attachment (placeholder implementation). This method is part of the interface but not actively used in data texture strategy.
The WebGL rendering context
The shader program to attach data to
Attaches vertex data for a primitive (placeholder implementation). This method is part of the interface but delegates to attachVertexDataInner.
Index parameter (unused in this implementation)
The primitive to attach vertex data for
The WebGL context wrapper
The instance ID buffer resource handle
Internal implementation for attaching vertex data to the rendering pipeline. This method binds the appropriate Vertex Array Object (VAO) or sets up vertex attribute pointers and element buffer bindings.
The mesh containing the vertex data
The specific primitive within the mesh
Index of the primitive within the mesh
The WebGL context wrapper for WebGL operations
Resource handle for instance ID buffer
Main rendering method that processes all primitives in a render pass. This method handles different primitive types (opaque, translucent, blend) and manages VR/non-VR rendering modes.
Array of primitive UIDs to render
The render pass configuration
Current tick count for the render pass
true if any primitives were successfully rendered, false otherwise
This method processes primitives in the following order:
The method also handles buffer-less rendering mode for special cases and manages depth mask settings for different primitive types.
Prepares the rendering pipeline before actual rendering begins. This method updates GPU storage (data texture and UBO) based on component update states and manages light components for the current frame.
This method performs conditional updates based on what has changed:
The method tracks update counts to avoid unnecessary GPU uploads and provides optimal performance by updating only what has changed.
Sets up a shader program for the specified material and primitive. This method creates and configures the complete shader program including uniform locations and data texture-specific shader definitions.
The resource handle of the created or retrieved shader program
This method handles:
Static
dumpStatic
getGets the singleton instance of WebGLStrategyDataTexture. Creates the instance if it doesn't exist and initializes the WebXR system reference.
The singleton instance of WebGLStrategyDataTexture
Static
getGenerates vertex shader method definitions for data texture access. These methods provide standardized ways to fetch transformation matrices, visibility flags, and other per-instance data from the data texture.
A string containing GLSL shader method definitions for data texture access
WebGL rendering strategy implementation that uses data textures for storing shader data. This strategy stores uniform data in textures rather than traditional uniform variables, enabling support for larger amounts of instance data and more efficient batch rendering.
Remarks
This class implements both CGAPIStrategy and WebGLStrategy interfaces, providing a complete rendering pipeline for WebGL with data texture optimization. The strategy is particularly useful for rendering many instances with unique properties.