Background
Introduction
vtkWebGPUBackground draws the background of a renderer with a full screen quad, picking the solid, gradient, texture or environment shader from the renderer's own background settings.
Methods
ensureQuad
Create the full screen quad and its uniform buffer, once.
| Argument | Type | Required | Description |
|---|---|---|---|
device | Yes | The device to create them on. |
extend
Method used to decorate a given object (publicAPI+model) with vtkWebGPUBackground characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IWebGPUBackgroundInitialValues | No | (default: {}) |
getFragmentTemplate
Get the fragment shader template of a background mode.
| Argument | Type | Required | Description |
|---|---|---|---|
mode | Yes | The background mode. |
getMode
Work out how a renderer's background must be drawn. A background or environment texture is only used once its image has loaded, and a gradient is only used when the two background colors differ.
| Argument | Type | Required | Description |
|---|---|---|---|
renderer | vtkRenderer | Yes | The renderer to inspect. |
newInstance
Method used to create a new instance of vtkWebGPUBackground.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IWebGPUBackgroundInitialValues | No | for pre-setting some of its content |
pipelineHash
The pipeline hash of the mode.
render
Draw the background of a renderer into the given encoder.
| Argument | Type | Required | Description |
|---|---|---|---|
renderEncoder | vtkWebGPURenderEncoder | Yes | The encoder to draw into. |
rendererNode | vtkWebGPURenderer | Yes | The renderer view node. |
texture
The texture sampled by the texture and environment modes, null for the solid and gradient modes.
textureName
The WGSL name the texture is bound under, null when there is none.
updateTexture
Bind the texture of the current background mode to the quad, or clear the bound views when there is no texture or it is not uploaded yet.
| Argument | Type | Required | Description |
|---|---|---|---|
device | Yes | The device the texture is created on. | |
texture | Yes | The vtkTexture to bind, if any. | |
textureName | Yes | The WGSL name to bind it under, if any. |
updateUBO
Write the background colors and the full screen quad matrix into the uniform buffer, and send it when it changed.
| Argument | Type | Required | Description |
|---|---|---|---|
device | Yes | The device to send the buffer to. | |
rendererNode | vtkWebGPURenderer | Yes | The renderer view node. |
renderer | vtkRenderer | Yes | The renderer holding the colors. |