Properties

objectPickConfiguration

objectPickConfiguration: ObjectPickConfiguration
Holds the ObjectPickConfiguration for pick filtering.
By default the viewer filters the objects from ObjectClicked and ObjectDoubleClicked events the following way:
  • Null materials are ignored
  • Materials with visible=false are ignored
  • Transparent materials with opacity=0 are ignored
  • SpeckleGhostMaterial material instances are ignored

Accessors

allObjects

get allObjects(): Object3D
Gets the parent three.js object for all loaded scene content. Returns: Object3D

clippingPlanes

get clippingPlanes(): Plane[]
set clippingPlanes(value: Plane[])
Gets or set the clipping Planes for the scene. Anything outside the volume determined by the clipping planes will get visually clipped.

clippingVolume

get clippingVolume(): Box3
set clippingVolume(box: Box3)
Gets or set the clipping volume for the renderer as a Box3. Anything outside the clipping volume is not interactible by default.

indirectIBL

set indirectIBL(texture: Texture)
Sets the texture for indirect image based lighting. Works as per existing three.js Scene documentation.

indirectIBLIntensity

set indirectIBLIntensity(value: number)
Sets the envMapIntensity for all SpeckleStandardMaterials in the scene.

intersections

get intersections(): Intersections
Gets the Intersections instance associated with the renderer. Returns: Intersections

needsRender

set needsRender(value: boolean)
Signals the renderer that it needs to render at least one frame. Assigning a false value has no effect.

pipeline

get pipeline(): Pipeline
set pipeline(value: Pipeline)
Gets or sets the renderer’s Pipeline.

renderer

get renderer(): SpeckleWebGLRenderer
Gets the underlying SpeckleWebGLRenderer which is small extension of WebGLRenderer. Returns: SpeckleWebGLRenderer

renderingCamera

get renderingCamera(): Camera
Gets the currently rendering Camera. Returns: Camera

renderingStats

get renderingStats(): RenderingStats
Gets the up to date RenderingStats. Returns: RenderingStats

scene

get scene(): Scene
Gets the underlying three.js Scene. Returns: Scene

sceneBox

get sceneBox(): Box3
Gets the total bounds of the scene. Returns: Box3

sceneCenter

get sceneCenter(): Vector3
Gets the center of the total bounds of the scene. Returns: Vector3

sceneSphere

get sceneSphere(): Sphere
Gets the sphere encompasing the entire scene. Returns: Sphere

shadowcatcher

get shadowcatcher(): Shadowcatcher
Gets The Shadowcatcher🛸 instance associated with the renderer. Returns: Shadowcatcher

shadowMapNeedsUpdate

set shadowMapNeedsUpdate(value: boolean)
Signals the renderer to render the shadowmap.

sunLight

get sunLight(): DirectionalLight
Gets the DirectionalLight sun instance. Returns: DirectionalLight

Methods

addRenderTree

async *addRenderTree(subtreeId: string): AsyncGenerator<any, void, unknown>
Generator function which takes the id of a render tree, builds the batches, then adds the batches to the scene. The function will yield after each batch has been created, allowing for user defined code to be run in the following fashion.
for await (const step of speckleRenderer.addRenderTree(id)) {
  // User defined code
}
Parameters
  • subtreeId: The id of the render tree to add to the scene
Returns: AsyncGenerator

boxFromObjects

boxFromObjects(objectIds: string[]): Box3
Builds the bounds of the provided object ids as a Box3. Parameters
  • objectIds: An array of ids that participate in the bounds calculation
Returns: Box3

cancelRenderTree

cancelRenderTree(subtreeId: string): void
Cancels any ongoing render tree adding operations. Effective cancelling happens as soon as the current running generator step yields. Parameters
  • objectIds: An array of ids that participate in the bounds calculation
Returns: void

enableLayers

enableLayers(layers: ObjectLayers[], value: boolean): void
Enables/Disables ObjectLayers from rendering. By default all layers are enabled. Parameters
  • objectIds: An array of ids that participate in the bounds calculation
Returns: void

getBatch

getBatch(id: string): Batch
Gets a Batch by id. Parameters
  • id: The id of the batch
Returns: Batch

getBatchMaterial

getBatchMaterial(rv: NodeRenderView): Material
Gets the default material of the provided NodeRenderView. It’s originally defined material. Parameters Returns: Material

getMaterial

getMaterial(rv: NodeRenderView): Material
Gets the current material of the provided [NodeRenderView](/dev Parameters Returns: Material

getObject

getObject(rv: NodeRenderView): BatchObject
Gets the associated BatchObject with the provided NodeRenderView. Parameters Returns: BatchObject

getObjects

getObjects(): BatchObject[]
Gets all BatchObject instances from the renderer. Returns: BatchObject[]

removeRenderTree

removeRenderTree(subtreeId: string)
Removes the specified render tree along with all it’s generated objects from the scene. Parameters
  • subtreeId: The id of the render tree to remove from the scene
Returns: void

renderViewFromIntersection

renderViewFromIntersection(intersection: ExtendedIntersection): NodeRenderView
Takes an intersection result produced by intersections and outputs the intersected NodeRenderView. Parameters Returns: NodeRenderView

resetMaterials

resetMaterials(): void
Resets all object materials to their original default. Returns: void

resetPipeline

resetPipeline(): void
Resets the current rendering pipeline. Returns: void

resize

resize(width: number, height: number): void
Manually resizes the renderer. Returns: void

setMaterial

There are several overloads of this method.
setMaterial(rvs: NodeRenderView[], material: Material): void
Sets the material instance to the specified rvs. Parameters
setMaterial(
    rvs: NodeRenderView[],
    material: RenderMaterial & DisplayStyle & MaterialOptions
): void
Creates a material based on the intersection between RenderMaterial, DisplayStyle and MaterialOptions. Because this method does not discriminate based on the render view’s geometry type (mesh, lines, points) it needs to be able to build materials suitable for all gometry types. Parameters Returns: void
setMaterial(rvs: NodeRenderView[], material: FilterMaterial): void
Sets the filter material to the specified rvs. FilterMaterials are a set of predefined material types which are commonly used. Parameters Returns: void

setSunLightConfiguration

setSunLightConfiguration(config: SunLightConfiguration): void
Sets the provided SunLightConfiguration. Parameters Returns: void

updateShadowCatcher

updateShadowCatcher(force?: boolean): void
Updates The Shadowcatcher🛸. Parameters
  • optional force: boolean
Returns: void

Typedefs

ObjectPickConfiguration

interface ObjectPickConfiguration {
  pickedObjectsFilter: ((arg: [NodeRenderView, Material]) => boolean) | null
}
  • pickedObjectsFilter: The filtering predicate
You can accept or reject each picked object from ObjectClicked and ObjectDoubleClicked events, based on thier NodeRenderView and Material

RenderingStats

{
  objects: number
  batchCount: number
  drawCalls: number
  trisCount: number
  vertCount: number
  batchDetails: Array<{
    drawCalls: number
    minDrawCalls: number
    tris: number
    verts: number
  }
}
Details regarding rendering state.

SunLightConfiguration

interface SunLightConfiguration extends LightConfiguration {
  elevation?: number;
  azimuth?: number;
  radius?: number;
}
  • elevation: Elevation in polar coordinates
  • azimuth: Azimuth in polar coordinates
  • radius: Distance from the camera target