Skip to content

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.

ArgumentTypeRequiredDescription
deviceYesThe device to create them on.

extend ​

Method used to decorate a given object (publicAPI+model) with vtkWebGPUBackground characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIWebGPUBackgroundInitialValuesNo(default: {})

getFragmentTemplate ​

Get the fragment shader template of a background mode.

ArgumentTypeRequiredDescription
modeYesThe 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.

ArgumentTypeRequiredDescription
renderervtkRendererYesThe renderer to inspect.

newInstance ​

Method used to create a new instance of vtkWebGPUBackground.

ArgumentTypeRequiredDescription
initialValuesIWebGPUBackgroundInitialValuesNofor pre-setting some of its content

pipelineHash ​

The pipeline hash of the mode.

render ​

Draw the background of a renderer into the given encoder.

ArgumentTypeRequiredDescription
renderEncodervtkWebGPURenderEncoderYesThe encoder to draw into.
rendererNodevtkWebGPURendererYesThe 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.

ArgumentTypeRequiredDescription
deviceYesThe device the texture is created on.
textureYesThe vtkTexture to bind, if any.
textureNameYesThe 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.

ArgumentTypeRequiredDescription
deviceYesThe device to send the buffer to.
rendererNodevtkWebGPURendererYesThe renderer view node.
renderervtkRendererYesThe renderer holding the colors.