RenderTree
The render tree is the core data structure that the viewer uses to render geometry.
Constructors
constructor
The recommended way of spawing render trees is via getRenderTree method in WorldTree.
Parameters
Returns: RenderTree
Accessors
id
Gets the id of the render tree’s root node.
Returns: string
Methods
buildRenderTree
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
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
Computes the final world space transformation for the given TreeNode.
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
getAtomicParent
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
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
Gets all renderable nodes of the specified SpeckleTypes.
Parameters
- types: Variable number of SpeckleType values
Returns: TreeNode[]
getRenderableRenderViews
Same as getRenderableNodes, but returns the mapped NodeRenderViews of the renderable nodes.
Parameters
- node: Variable number of SpeckleType values
Returns: NodeRenderView[]
getRenderViewNodesForNode
Returns all TreeNodes that have a displayable NodeRenderView descending from node.
Parameters
- node: TreeNode
Returns: TreeNode[]
getRenderViewsForNode
Gets all displayable NodeRenderViews descending from node.
Parameters
- node: TreeNode
Returns: NodeRenderView[]
getRenderViewsForNodeId
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
Purges the render tree.
Purges render trees are no longer usable.
Returns: void