# NodeRenderView
# Constructors
constructor |
---|
# Accessors
aabb | batchCount | batchEnd | batchId |
---|---|---|---|
batchStart | geometryType | guid | hasGeometry |
hasMetadata | renderData | renderMaterialHash | speckleType |
transparent | validGeometry | vertEnd | vertStart |
# Methods
setBatchData | computeAABB | disposeGeometry |
---|
# Typedefs
NodeRenderData | GeometryData | GeometryAttributes | GeometryType |
---|
# Constructors
# constructor
constructor(data: NodeRenderData)
Populates/constructs this node render view.
Parameters
- data: NodeRenderData
# Accessors
# aabb
get aabb(): Box3
Gets the axis aligned box of this render view's geometry.
WARNING
The bounds returned do not take any user transformations into account, nor the instance transformations.
Returns: Box3 (opens new window)
# batchCount
get batchCount(): number
Gets the total number of indices inside it's batch.
Returns: number
# batchEnd
get batchEnd(): number
Gets the end index inside the batch's index buffer. Equals to batchStart + batchCount
.
Returns: number
# batchId
get batchId(): string
Gets the id of the batch this render view belongs to.
Returns: string
# batchStart
get batchStart(): number
Gets the start index inside the batch's index buffer.
Returns: string
# geometryType
get geometryType(): GeometryType
Gets this render view's GeometryType.
Returns: GeometryType
# guid
get guid(): string
Gets a unique id by concatenating the node's id and the subtree id it's part of.
Returns: string
# hasGeometry
get hasGeometry(): boolean
Returns true if this render view has geometry, false otherwise.
Returns: boolean
# hasMetadata
get hasMetadata(): boolean
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
get renderData(): NodeRenderData
Gets the render view's associated NodeRenderData.
Returns: NodeRenderData
# renderMaterialHash
get renderMaterialHash(): number
Gets the render view's computed material hash.
Returns: number
# speckleType
get speckleType(): SpeckleType
Gets the render view's render data SpeckleType.
Returns: SpeckleType
# transparent
get transparent(): boolean
Gets whether the render view has a transparent default material.
Returns: boolean
# validGeometry
get validGeometry(): boolean
Returns true if the existing geometry is valid. Input data can be invalid, so this checks for that.
Returns: boolean
# vertEnd
get vertEnd(): number
Gets the ending index of this render view's vertex position attribute array inside it's batch.
Returns: number
# vertStart
get vertStart(): number
Gets the starting index of this render view's vertex position attribute array inside it's batch.
Returns: number
# Methods
# setBatchData
setBatchData(
id: string,
start: number,
count: number,
vertStart?: number,
vertEnd?: number
)
2
3
4
5
6
7
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.
WARNING
By default, batchStart
and batchCount
are dynamic, so they can change at runtime. vertStart
and vertEnd
are not dynamic by default.
WARNING
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()
computeAABB(): void
Computes this render view's axis aligned bounding box.
WARNING
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
disposeGeometry(): void
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
interface NodeRenderData {
id: string;
subtreeId: number;
speckleType: SpeckleType;
geometry: GeometryData;
renderMaterial: RenderMaterial;
displayStyle: DisplayStyle;
}
2
3
4
5
6
7
8
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 some extra functionality.
- 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
interface GeometryData {
attributes: Partial<Record<GeometryAttributes, number[]>>;
bakeTransform: Matrix4;
transform: Matrix4;
metaData?: Record<string, any>;
instanced?: boolean;
}
2
3
4
5
6
7
Raw geometry information, explicit and/or implicit.
- attributes: GeometryAttributes Vertex attribute arrays
- bakeTransform: Matrix4 (opens new window) transformation that will get baked into the geometry
- transform: Matrix4 (opens new window) 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
enum GeometryAttributes {
POSITION = "POSITION",
COLOR = "COLOR",
NORMAL = "NORMAL",
UV = "UV",
TANGENT = "TANGENT",
INDEX = "INDEX",
}
2
3
4
5
6
7
8
Defined attributes that the viewer supports.
# GeometryType enum
enum GeometryType {
MESH,
LINE,
POINT,
POINT_CLOUD,
TEXT,
}
2
3
4
5
6
7
The formalized geometry types the viewer supports and recognizes.
← Loader RenderTree →