This renderer just extends the GPUCameraRenderer by keeping track of all the created DOM Meshes

Example

// first, we need a WebGPU device, that's what GPUDeviceManager is for
const gpuDeviceManager = new GPUDeviceManager({
label: 'Custom device manager',
})

// we need to wait for the WebGPU device to be created
await gpuDeviceManager.init()

// then we can create a curtains renderer
const gpuCurtainsRenderer = new GPUCurtainsRenderer({
deviceManager: gpuDeviceManager, // we need the WebGPU device to create the renderer context
container: document.querySelector('#canvas'),
})

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

Properties

camera: Camera

Camera used by this GPUCameraRenderer.

cameraLightsBindGroup: BindGroup

bind group handling the camera, lights and shadows BufferBinding.

lights: Light[]

Array of all the created Light.

lightsBindingParams: LightsBindingParams

An object defining the current lights binding parameters, including the maximum number of lights for each type and the structure used to create the associated BufferBinding.

shadowsBindingsStruct: Record<string, Record<string, Input>>

An object defining the structure used to create the shadows BufferBinding.

The bindings used by the camera, lights and shadows bind group.

Options used to create this GPUCameraRenderer.

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

canvas: HTMLCanvasElement

HTMLCanvasElement onto everything is drawn

context: GPUCanvasContext

The WebGPU GPUCanvasContext | context used

alphaMode?: GPUCanvasAlphaMode

Set the GPUCanvasContext | context alpha mode

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: Texture[]

An array containing all our created Texture

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 resizeObjects callback

Type declaration

    • (): void
    • function assigned to the resizeObjects callback

      Returns void

_onAfterResizeCallback: (() => void) = ...

function assigned to the onAfterResize callback

Type declaration

    • (): void
    • function assigned to the onAfterResize callback

      Returns void

domMeshes: DOMProjectedMesh[]

All created DOM Meshes and planes

domObjects: DOMObject3D[]

All created DOMObject3D which position should be updated on scroll.

Accessors

Methods

  • Create a GPUBindGroupLayout

    Parameters

    • bindGroupLayoutDescriptor: GPUBindGroupLayoutDescriptor

      GPUBindGroupLayoutDescriptor | GPU bind group layout descriptor

    Returns GPUBindGroupLayout

    • newly created GPUBindGroupLayout
  • Create a GPUPipelineLayout

    Parameters

    • pipelineLayoutDescriptor: GPUPipelineLayoutDescriptor

      GPUPipelineLayoutDescriptor | GPU pipeline layout descriptor

    Returns GPUPipelineLayout

    • newly created GPUPipelineLayout
  • Asynchronously create a GPURenderPipeline

    Parameters

    • pipelineDescriptor: GPURenderPipelineDescriptor

      GPURenderPipelineDescriptor | GPU render pipeline descriptor

    Returns Promise<GPURenderPipeline>

    • newly created GPURenderPipeline

    Async

  • Asynchronously create a GPUComputePipeline

    Parameters

    • pipelineDescriptor: GPUComputePipelineDescriptor

      GPUComputePipelineDescriptor | GPU compute pipeline descriptor

    Returns Promise<GPUComputePipeline>

    • newly created GPUComputePipeline

    Async