Used to draw to RenderPass view textures (and eventually depth texture) instead of directly to screen.

The meshes assigned to a RenderTarget will be drawn before the other objects in the Scene rendering loop.

Can also be assigned as ShaderPass input or output targets.

If the RenderPass created handle color attachments, then a Texture will be created to update and/or resolve the content of the current view. This Texture could therefore usually be used to access the current content of this RenderTarget.

Example

// set our main GPUCurtains instance
const gpuCurtains = new GPUCurtains({
container: '#canvas' // selector of our WebGPU canvas container
})

// set the GPU device
// note this is asynchronous
await gpuCurtains.setDevice()

const outputTarget = new RenderTarget(gpuCurtains, {
label: 'My render target',
})

Constructors

Properties

renderer: Renderer

Renderer used by this RenderTarget

type: string

The type of the RenderTarget

uuid: string

The universal unique id of this RenderTarget

Options used to create this RenderTarget

renderPass: RenderPass

RenderPass used by this RenderTarget

renderTexture?: Texture

Texture that will be resolved by the renderPass when setting the current texture

#autoRender: boolean = true

Whether we should add this RenderTarget to our Scene to let it handle the rendering process automatically

Accessors

Methods