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
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
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.
Internal GPU data attachment (placeholder implementation). This method is part of the interface but not actively used in data texture strategy.
Attaches vertex data for a primitive (placeholder implementation). This method is part of the interface but delegates to attachVertexDataInner.
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
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.
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.
Destroys all GPU resources held by this strategy. Should be called when the engine is being destroyed.
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__method definitions for component data access for data texture-based rendering. Provides GLSL functions for accessing component data through data textures.
GLSL shader code string for the component data access method definitions
StaticdumpInitiates the dumping of the data texture buffer for debugging purposes. This method flags the system to export the data texture buffer contents on the next rendering cycle.
StaticinitGets the singleton instance of WebGLStrategyDataTexture. Creates the instance if it doesn't exist and initializes the WebXR system reference.
The singleton instance of WebGLStrategyDataTexture
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.