# 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
1

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
1

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
1

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
1

Gets the display name of the pass

Returns: string

# enabled

get enabled(): boolean
set enabled(value: boolean)
1
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
1

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)
1

Sets the pass options. PassOptions

Returns: void

# outputTarget

set outputTarget(value: WebGLRenderTarget)
get outputTarget(): WebGLRenderTarget | null
1
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
1

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
1

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
1

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
1

Callback for after rendering the pass

Returns: void

# onBeforeRender

onBeforeRender: () => void
1

Callback for before rendering the pass

Returns: void

# render

render(
    renderer: WebGLRenderer,
    camera?: PerspectiveCamera | OrthographicCamera | null,
    scene?: Scene
  ): boolean
1
2
3
4
5

The pass's render function

Parameters

Returns: boolean If true, it signals that the pass needs more rendering, false otherwise

# setClearColor

setClearColor(color: number, alpha: number): void
1

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
1

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
1

Sets the current clipping planes, if any exist

Parameters

Returns: void

# setJitter

setJitter(value: boolean): void
1

Enables/disables jittering for the pass

Returns: void

# setLayers

setLayers?(layers: ObjectLayers[]): void
1

The the exclusive layers this pass will render. If no layers are set, all layers get rendered

Parameters

Returns: void

# setSize

setSize(width: number, height: number): void
1

Sets the rendering size for this pass.

Parameters

  • width: number
  • height: number

Returns: void

# setVisibility

setVisibility(objectVisibility: ObjectVisibility): void
1

Sets the exclusive visibility of the pass. Currently just a single visibility option can be set.

Parameters

Returns: void

# update

update(camera: PerspectiveCamera | OrthographicCamera | null): void
1

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
}
1
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'
}
1
2
3
4
5
6

An object visibility categorization. Used to restrict pass rendering to only specific object lists

# PassOptions

interface PassOptions {}
1

This can be virtuall anything, and it's up for the concrete pass implementations to define their own options