GPass
Contract for all rendering pass implementations in the speckle viewer.
The “G” stands for “Graphics” and it’s only there to make it clear that it’s a different type that three’s Pass
.
Accessors
clearAlpha
Gets the current alpha clear value for the pass. If the value is undefined
the pass will not clear alpha
Returns: number | undefined
clearColor
Gets the current clear color value for the pass. If the value is undefined
the pass will not clear color.
The color is represented as a number
where:
R = value & 0xFF0000
G = value & 0x00FF00
B = value & 0x0000FF
Returns: number | undefined
clearFlags
Gets the current flags that determine what gets cleared by the pass. The value returned is a mask with the possibly OR-ed WebGL constant values for COLOR_BUFFER_BIT
DEPTH_BUFFER_BIT
and STENCIL_BUFFER_BIT
Returns: number | undefined
displayName
Gets the display name of the pass.
Returns: string
enabled
Gets the enabled state of the pass. A disabled pass will not be rendered by the hosting pipeline
Returns: boolean
jitter
Gets the jitter state of the pass. If jitter is enabled, the pipeline will apply Hatlon jitter to the projection matrix
Returns: boolean
options
Gets the pass options. PassOptions
Returns: PassOptions
outputTarget
Gets or sets the render target the pass writes to. If null
it will write to the backbuffer
Returns: WebGLRenderTarget
| null
overrideBatchMaterial
Gets the material that will override the default material of batches in the scene. This allows the pass to combine it’s defined override material with filters or other externally applied materials. If null
, nothing gets overriden
Returns: Material | null
overrideMaterial
Gets the material that will override all materials. If the overriden material is defined, it will completely replace any existing materials on the batches and no other effects that apply materials on objects will be made visible in this pass’s render result. If null
, nothing gets overriden
Returns: Material | null
visibility
Gets the current visibility state for the pass. If null
, no visibility restrictions will be applied to the pass’s rendering, i.e everything gets rendered
Returns: ObjectVisibility | null
Methods
onAferRender
Callback for after rendering the pass
Returns: void
onBeforeRender
Callback for before rendering the pass
Returns: void
render
The pass’s render function.
Parameters:
- renderer: The hosting
WebGLRenderer
- optional camera: The rendering camera.
- optional scene: The scene to render
Returns: boolean
- If true
, it signals that the pass needs more rendering, false
otherwise.
setClearColor
Sets the pass’s clear color and alpha.
Clearing will be executed on whatever the current outputTarget
value is. If outputTarget
is null
, the backbuffer will be cleared!
Parameters:
- color: The color to clear with represented as a
number
where:R = value & 0xFF0000
G = value & 0x00FF00
B = value & 0x0000FF
- alpha: The alpha value to clear with in the range
[0, 1]
Returns: void
setClearFlags
Sets the clear flags. The ClearFlags values can be used for ease of use.
Parameters:
- flags: The value for the flags as previously detailed
Returns: void
setClippingPlanes
Sets the current clipping planes, if any exist
Parameters:
- planes: The array of Planes
Returns: void
setJitter
Enables/disables jittering for the pass
Returns: void
setLayers
The the exclusive layers this pass will render. If no layers are set, all layers get rendered
Parameters:
- layers: The array of ObjectLayers
Returns: void
setSize
Sets the rendering size for this pass.
Parameters:
- width: number - The width of the rendering size.
- height: number - The height of the rendering size.
Returns: void
setVisibility
Sets the exclusive visibility of the pass. Currently just a single visibility option can be set.
Parameters:
- objectVisibility: The ObjectVisibility to set.
Returns: void
update
The pass’s update function. Generally used for updating pass related data before the render call
Parameters:
- camera: The rendering camera.
Returns: void
Typedefs
ClearFlags
The WebGL constant values for the clear flags for convenience
ObjectVisibility
An object visibility categorization. Used to restrict pass rendering to only specific object lists
PassOptions
This can be virtually anything, and it’s up for the concrete pass implementations to define their own options.