Loads and prepares a mesh component for rendering. Sets up vertex buffer objects (VBO) and vertex array objects (VAO) if not already done.
The mesh component to load
True if the mesh was successfully loaded, false if the mesh is null
Performs common loading operations required for the WebGPU strategy. Initializes morph target arrays and updates blend shape storage buffers when needed.
Main rendering method that draws all primitives in the specified render pass. Handles different primitive types (opaque, translucent, blend) with appropriate depth writing settings.
Array of primitive UIDs to render, sorted by rendering order
The render pass configuration containing rendering settings
The index of the display to render to
True if any primitives were successfully rendered
Destroys all GPU resources held by this strategy. Should be called when the engine is being destroyed.
Performs pre-rendering operations required before drawing. Updates storage buffers when components have been modified and handles morph target updates. This method should be called once per frame before any rendering operations.
Renders a single primitive with the specified material and render settings. Handles shader setup, uniform buffer updates, and the actual draw call.
Unique identifier of the primitive to render
Render pass containing rendering configuration
Whether to enable depth buffer writing
The index of the display to render to
True if the primitive was successfully rendered
Sets up shader programs for materials using the WebGPU rendering strategy. This method orchestrates the shader compilation process by providing the necessary method definitions and property setters.
The material to create shader programs for
The primitive geometry that will use this material
WGSL code containing vertex shader helper methods
WGSL code containing pixel shader helper methods
StaticgetGenerates vertex shader method definitions for storage buffer access. These methods provide standardized access to transform matrices, visibility flags, and morphing functionality in vertex shaders.
WGSL shader code containing helper functions for storage buffer access
StaticinitGets the singleton instance of WebGpuStrategyBasic. Creates a new instance if none exists.
The singleton instance of WebGpuStrategyBasic
Basic WebGPU rendering strategy implementation that handles mesh rendering, storage buffer management, and shader program setup for WebGPU-based rendering pipeline.
This class provides a complete rendering solution using WebGPU API, including:
Example