# 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 | clearColor | clearFlags | displayName |
---|---|---|---|
enabled | jitter | options | outputTarget |
overrideBatchMaterial | overrideMaterial | visibility |
# Methods
onAferRender | onBeforeRender | render | setClearColor |
---|---|---|---|
setClearFlags | setClippingPlanes | setJitter | setLayers |
setSize | setVisibility | update |
# Typedefs
ClearFlags | ObjectVisibility | PassOptions |
---|
# Accessors
# clearAlpha
get clearAlpha(): number | undefined
Gets the current alpha clear value for the pass. If the value is undefined
the pass will not clear alpha
Returns: number | undefined
# clearColor
get clearColor(): number | undefined
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
get clearFlags(): number | undefined
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
get displayName(): string
Gets the display name of the pass
Returns: string
# enabled
get enabled(): boolean
set enabled(value: boolean)
2
Gets or sets the enabled state of the pass. A disabled pass will not be rendered by the hosting pipeline
Returns: boolean
# jitter
get jitter(): boolean
Gets the jitter state of the pass. If jitter is enabled, the pipeline will apply Hatlon jitter to the projection matrix
Returns: boolean
# options
set options(value: PassOptions)
Sets the pass options. PassOptions
Returns: void
# outputTarget
set outputTarget(value: WebGLRenderTarget)
get outputTarget(): WebGLRenderTarget | null
2
Gets or sets the render target the pass writes to. If null
it will write to the backbuffer
Returns: WebGLRenderTarget (opens new window)
# overrideBatchMaterial
get overrideBatchMaterial(): Material | null
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
get overrideMaterial(): Material | null
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
get visibility(): ObjectVisibility | null
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
onAferRender: () => void
Callback for after rendering the pass
Returns: void
# onBeforeRender
onBeforeRender: () => void
Callback for before rendering the pass
Returns: void
# render
render(
renderer: WebGLRenderer,
camera?: PerspectiveCamera | OrthographicCamera | null,
scene?: Scene
): boolean
2
3
4
5
The pass's render function
Parameters
- renderer: The hosting WebGLRenderer (opens new window)
- optional camera: The rendering camera
- optional scene The scene to be rendered
Returns: boolean If true
, it signals that the pass needs more rendering, false
otherwise
# setClearColor
setClearColor(color: number, alpha: number): void
Sets the pass's clear color and alpha.
WARNING
Clearing will be executed on whatever the current outputTarget
value is. If outputTarget
is null
, the backbuffer will be cleared!
Parameters
- color: The color represented as a number as previously detailed
- alpha: The alpha value in the range of [0,1]
Returns: void
# setClearFlags
setClearFlags(flags: number): void
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
setClippingPlanes(planes: Plane[]): void
Sets the current clipping planes, if any exist
Parameters
- flags: The array of Planes (opens new window)
Returns: void
# setJitter
setJitter(value: boolean): void
Enables/disables jittering for the pass
Returns: void
# setLayers
setLayers?(layers: ObjectLayers[]): void
The the exclusive layers this pass will render. If no layers are set, all layers get rendered
Parameters
- layers: ObjectLayers
Returns: void
# setSize
setSize(width: number, height: number): void
Sets the rendering size for this pass.
Parameters
- width: number
- height: number
Returns: void
# setVisibility
setVisibility(objectVisibility: ObjectVisibility): void
Sets the exclusive visibility of the pass. Currently just a single visibility option can be set.
Parameters
- objectVisibility: ObjectVisibility
Returns: void
# update
update(camera: PerspectiveCamera | OrthographicCamera | null): void
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
enum ClearFlags {
COLOR = 0x00000100,
DEPTH = 0x00000400,
STENCIL = 0x00004000
}
2
3
4
5
The WebGL constant values for the clear flags for convenience
# ObjectVisibility
enum ObjectVisibility {
OPAQUE = 'opaque',
TRANSPARENT = 'transparent',
DEPTH = 'depth',
STENCIL = 'stencil'
}
2
3
4
5
6
An object visibility categorization. Used to restrict pass rendering to only specific object lists
# PassOptions
interface PassOptions {}
This can be virtuall anything, and it's up for the concrete pass implementations to define their own options