# RenderTree
# Constructors
constructor |
---|
# Accessors
id |
---|
# Methods
buildRenderTree | cancelBuild | computeTransform |
---|---|---|
getAtomicParent | getInstances | getRenderableNodes |
getRenderableRenderViews | getRenderViewNodesForNode | getRenderViewsForNode |
getRenderViewsForNodeId | purge |
# Constructors
# constructor
constructor(tree: WorldTree, subtreeRoot: TreeNode)
The recommended way of spawing render trees is via getRenderTree method in WorldTree.
Parameters
Returns: RenderTree
# Accessors
# id
get id(): string
Gets the id of the render tree's root node.
Returns: string
# Methods
# buildRenderTree
buildRenderTree(geometryConverter: GeometryConverter): Promise<boolean>
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
- geometryConverter: The GeometryConverter to use in building the tree
Returns: A promise which resolves to a boolean indicating if the building process completed successfully (true) or was interrupted (false)
# cancelBuild
cancelBuild(): void
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
Computes the final world space transformation for the given TreeNode.
WARNING
For non instanced nodes, this function will return the identity transformation since speckle does not define a local space (yet) and all geometry is in world space. This function will not take any runtime user defined transformations into account.
Parameters
- node: TreeNode
Returns: Matrix4 (opens new window)
# getAtomicParent
getAtomicParent(node: TreeNode): TreeNode
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
- node: TreeNode
Returns: TreeNode[]
# getInstances
getInstances(): { [id: string]: Record<string, TreeNode> }
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[]
Gets all renderable nodes of the specified SpeckleTypes.
Parameters
- types: Variable number of SpeckleType values
Returns: TreeNode[]
# getRenderableRenderViews
getRenderableRenderViews(...types: SpeckleType[]): NodeRenderView[]
Same as getRenderableNodes, but returns the mapped NodeRenderViews of the renderable nodes.
Parameters
- node: Variable number of SpeckleType values
Returns: NodeRenderView[]
# getRenderViewNodesForNode
getRenderViewNodesForNode(node: TreeNode): TreeNode[]
Returns all TreeNodes that have a displayable NodeRenderView descending from node.
Parameters
- node: TreeNode
Returns: TreeNode[]
# getRenderViewsForNode
getRenderViewsForNode(node: TreeNode): NodeRenderView[]
Gets all displayable NodeRenderViews descending from node.
Parameters
- node: TreeNode
Returns: NodeRenderView[]
# getRenderViewsForNodeId
getRenderViewsForNodeId(id: string): NodeRenderView[]
Gets all displayable NodeRenderViews descending from the node with the provided id.
Parameters
- id: Id of the node to gather NodeRenderViews for
Returns: NodeRenderView[]
# purge
purge(): void
Purges the render tree.
WARNING
Purges render trees are no longer usable.
Returns: void