NodeRenderView
The render view is the core data structure that the viewer uses to render geometry.
Constructors
constructor
Populates/constructs this node render view.
Parameters
- data: NodeRenderData
Accessors
aabb
Gets the axis aligned box of this render view’s geometry.
The bounds returned do not take any user transformations into account, nor the instance transformations.
Returns: Box3
batchCount
Gets the total number of indices inside it’s batch.
Returns: number
batchEnd
Gets the end index inside the batch’s index buffer. Equals to batchStart + batchCount
.
Returns: number
batchId
Gets the id of the batch this render view belongs to.
Returns: string
batchStart
Gets the start index inside the batch’s index buffer.
Returns: string
geometryType
Gets this render view’s GeometryType.
Returns: GeometryType
guid
Gets a unique id by concatenating the node’s id and the subtree id it’s part of.
Returns: string
hasGeometry
Returns true if this render view has geometry, false otherwise.
Returns: boolean
hasMetadata
Returns true if this render view has metadata, false otherwise. Metadata is any data that is used to create geometry in a deffered way.
Returns: boolean
renderData
Gets the render view’s associated NodeRenderData.
Returns: NodeRenderData
renderMaterialHash
Gets the render view’s computed material hash.
Returns: number
speckleType
Gets the render view’s render data SpeckleType.
Returns: SpeckleType
transparent
Gets whether the render view has a transparent default material.
Returns: boolean
validGeometry
Returns true if the existing geometry is valid. Input data can be invalid, so this checks for that.
Returns: boolean
vertEnd
Gets the ending index of this render view’s vertex position attribute array inside it’s batch.
Returns: number
vertStart
Gets the starting index of this render view’s vertex position attribute array inside it’s batch.
Returns: number
Methods
setBatchData
Sets the batch related data to the render view. All render view geometry is contained inside a batch, and the offset + length is being stored at render view level for both indices and position attribute.
By default, batchStart
and batchCount
are dynamic, so they can change at runtime. vertStart
and vertEnd
are not dynamic by default.
Normally, you have no need overwritting the render view’s batch data. It’s handled internally by the viewer-core.
Parameters
- id: The id of the batch
- start: Start index of the render view’s index array inside the batch’s index array
- count: Start length of the render view’s index array
- optional vertStart: Start index of the render view’s position array inside the batch’s position array
- optional vertEnd: End index of the render view’s index array inside the batch’s index array
Returns: void
computeAABB
Computes this render view’s axis aligned bounding box.
The render view’s aabb can be read by using aabb, but do note that it does not take user transformations nor instance transformations into account.
Returns: void
disposeGeometry
Disposes of the individual geometry of this render view. After batching, the individual geometry of render views becomes redundant, so we can dispose of it to reduce memory footprint.
Returns: void
Typedefs
NodeRenderData
This is the bare bones data representation of anything renderable in the viewer. The NodeRenderView is more or less a wrapper around this data that adds some shorthands and
- id: The id of the object. For speckle data, this would be the speckle id
- subtreeId: The id of the subtree of the host node
- speckleType: SpeckleType
- geometry: Raw geometry information stored as GeometryData
- renderMaterial: Raw material information stored as RenderMaterial
- DisplayStyle: Raw line material information stored as DisplayStyle
GeometryData
Raw geometry information, explicit and/or implicit.
- attributes: GeometryAttributes Vertex attribute arrays
- bakeTransform: Matrix4 transformation that will get baked into the geometry
- transform: Matrix4 the object’s transformation. As per the default implementation, instances use this as the per instance transform attribute. Non-instances have it baked in their geometries
- metaData: Implicit geometry data which the viewer uses at runtime to create geometry. Text is a good example of implicit geometry
- instanced: Whether this geometry data is instanced or not
GeometryAttributes
Defined attributes that the viewer supports.
GeometryType enum
The formalized geometry types the viewer supports and recognizes.