# RenderTree

#

Constructors

constructor

#

Accessors

id

#

Methods

buildRenderTree cancelBuild computeTransform
getAtomicParent getInstances getRenderableNodes
getRenderableRenderViews getRenderViewNodesForNode getRenderViewsForNode
getRenderViewsForNodeId purge

#

Constructors

# constructor

constructor(tree: WorldTree, subtreeRoot: TreeNode)
1

The recommended way of spawing render trees is via getRenderTree method in WorldTree.

Parameters

Returns: RenderTree

#

Accessors

# id

get id(): string
1

Gets the id of the render tree's root node.

Returns: string

#

Methods

# buildRenderTree

buildRenderTree(geometryConverter: GeometryConverter): Promise<boolean>
1

Builds the render tree using the provided GeometryConverter. Building can be interrupted by calling cancelBuild. 'Building' the render tree, means constructing each node's NodeRenderView, preparing all geometry and materials, and executing any required transformations. This operation should only be carrired out once, as re-building an already built tree is not possible.

Parameters

Returns: A promise which resolves to a boolean indicating if the building process completed successfully (true) or was interrupted (false)

# cancelBuild

cancelBuild(): void
1

Cancel any tree building operations that might be taking place. If no building is taking place, nothing happens.

Parameters

  • subtreeId: The TreeNode to add as a subtree

Returns: void

# computeTransform

computeTransform(node: TreeNode): Matrix4
1

Computes the final world space transformation for the given TreeNode.

Parameters

Returns: Matrix4 (opens new window)

# getAtomicParent

getAtomicParent(node: TreeNode): TreeNode
1

Gets the closest atomic parent of the provided node. An atomic node represents a standalone object. E.g a door, a window, rather than pieces of a standalone object E.g the door's handle, the window's frame.

Parameters

Returns: TreeNode[]

# getInstances

getInstances(): { [id: string]: Record<string, TreeNode> }
1

Calls the underlying WorldTree getInstances with the render tree's id as the argument.

Returns: A dictionary where each instance id holds a record of TreeNode grouped by their instance unique id.

# getRenderableNodes

getRenderableNodes(...types: SpeckleType[]): TreeNode[]
1

Gets all renderable nodes of the specified SpeckleTypes.

Parameters

Returns: TreeNode[]

# getRenderableRenderViews

getRenderableRenderViews(...types: SpeckleType[]): NodeRenderView[]
1

Same as getRenderableNodes, but returns the mapped NodeRenderViews of the renderable nodes.

Parameters

Returns: NodeRenderView[]

# getRenderViewNodesForNode

getRenderViewNodesForNode(node: TreeNode): TreeNode[]
1

Returns all TreeNodes that have a displayable NodeRenderView descending from node.

Parameters

Returns: TreeNode[]

# getRenderViewsForNode

getRenderViewsForNode(node: TreeNode): NodeRenderView[]
1

Gets all displayable NodeRenderViews descending from node.

Parameters

Returns: NodeRenderView[]

# getRenderViewsForNodeId

getRenderViewsForNodeId(id: string): NodeRenderView[]
1

Gets all displayable NodeRenderViews descending from the node with the provided id.

Parameters

Returns: NodeRenderView[]

# purge

purge(): void
1

Purges the render tree.

WARNING

Purges render trees are no longer usable.

Returns: void