Base renderer class, that could technically be used to render compute passes and draw fullscreen quads, even tho it is strongly advised to use at least the GPUCameraRenderer class instead. A renderer is responsible for:

  • Setting a context
  • Handling the canvas onto everything is drawn
  • Creating a RenderPass that will handle our render and depth textures and the render pass descriptor
  • Keeping track of every specific class objects created relative to computing and rendering
  • Creating a Scene class that will take care of the rendering process of all previously mentioned objects

Hierarchy (View Summary)

Constructors

Properties

type: string

The type of the GPURenderer

uuid: string

The universal unique id of this GPURenderer

deviceManager: GPUDeviceManager

The GPUDeviceManager used to create this GPURenderer

HTMLCanvasElement onto everything is drawn

The WebGPU context used

Options used to create this GPURenderer

renderPass: RenderPass

The render pass used to render our result to screen

postProcessingPass: RenderPass

Additional render pass used by ShaderPass for compositing / post processing. Does not handle depth

scene: Scene

The Scene used

shouldRender: boolean

Whether we should render our GPURenderer or not. If set to false, the render hooks onBeforeCommandEncoderCreation, onBeforeRenderScene, onAfterRenderScene and onAfterCommandEncoderSubmission won't be called, the scene graph will not be updated and the scene will not be rendered, completely pausing the renderer. Default to true.

shouldRenderScene: boolean

Whether we should explicitly update our Scene or not. If set to false, the scene graph will not be updated and the scene will not be rendered. Default to true.

computePasses: ComputePass[]

An array containing all our created ComputePass

pingPongPlanes: PingPongPlane[]

An array containing all our created PingPongPlane

shaderPasses: ShaderPass[]

An array containing all our created ShaderPass

renderTargets: RenderTarget[]

An array containing all our created RenderTarget

An array containing all our created meshes

textures: (MediaTexture | Texture)[]

An array containing all our created Texture

environmentMaps: Map<string, EnvironmentMap>

A Map containing all the EnvironmentMap handled by this renderer.

renderBundles: Map<string, RenderBundle>

A Map containing all the RenderBundle handled by this renderer.

animations: Map<string, TargetsAnimationsManager>

A Map containing all the TargetsAnimationsManager handled by this renderer.

pixelRatio: number

Pixel ratio to use for rendering

rectBBox: RectBBox

An object defining the width, height, top and left position of the canvas. Mainly used internally. If you need to get the renderer dimensions, use boundingRect instead.

domElement: DOMElement

DOMElement that will track our canvas container size

onBeforeCommandEncoderCreation: TasksQueueManager

Allow to add callbacks to be executed at each render before the GPUCommandEncoder is created

onBeforeRenderScene: TasksQueueManager

Allow to add callbacks to be executed at each render after the GPUCommandEncoder has been created but before the Scene is rendered

onAfterRenderScene: TasksQueueManager

Allow to add callbacks to be executed at each render after the GPUCommandEncoder has been created and after the Scene has been rendered

onAfterCommandEncoderSubmission: TasksQueueManager

Allow to add callbacks to be executed at each render after the Scene has been rendered and the GPUCommandEncoder has been submitted

_onResizeCallback: () => void = ...

function assigned to the onResize callback

_onAfterResizeCallback: () => void = ...

function assigned to the onAfterResize callback

Accessors

Methods