# BatchObject
# Constructors
constructor |
---|
# Accessors
aabb | accelerationStructure | batchIndex | localOrigin | renderView |
---|
# Methods
buildAccelerationStructure | transformTRS |
---|
# Typedefs
VectorLike | InstancedBatchObject |
---|
# Constructors
# constructor
constructor(renderView: NodeRenderView, batchIndex: number)
Populates/constructs this batch object.
Parameters
- renderView: NodeRenderView
- batchIndex: The object's index within its batch. Objects are placed in order inside the batch as they get processed
# Accessors
# aabb
get aabb(): Box3
Gets the axis aligned bounding box of this object.
TIP
If you want to work with object dimensions and positioning, this is the bounds to use. This is the transformed aabb, unlike NodeRenderView's aabb which does not take any transformation into account.
Returns: Box3 (opens new window)
# accelerationStructure
get accelerationStructure(): AccelerationStructure
Gets the object's bottom level BVH.
Returns: AccelerationStructure
# batchIndex
get batchIndex(): number
Gets the object's index inside its batch.
Returns: number
# localOrigin
get localOrigin(): Vector3
Gets local origin of the object. i.e the render view's aabb center.
Returns: Vector3 (opens new window)
# renderView
get renderView(): NodeRenderView
Gets the start index inside the batch's index buffer.
Returns: NodeRenderView
# Methods
# buildAccelerationStructure
buildAccelerationStructure(bvh?: MeshBVH)
Build this object's AccelerationStructure either from scratch, using the render view's geometry, either by using the optional bvh argument. BVH's can be shared between objects as long as it makes sense like for example for instances.
TIP
The speckle viewer uses the three-mesh-bvh (opens new window) library as the backbone for any BVH related operations.
Parameters
- optional bvh: MeshBVH (opens new window)
Returns: void
# transformTRS()
public transformTRS(
translation: VectorLike,
euler?: VectorLike,
scale?: VectorLike,
pivot?: VectorLike
)
2
3
4
5
6
Used for transforming the object by using translation, rotation, scale and rotation pivot values.
Parameters
- translation: The translation component of the transformation
- optional euler: Rotation component as euler angles in XYZ order
- optional scale: Scale component of the transformation
- optional pivot: The rotation pivot
Returns: void
# Typedefs
# VectorLike
type VectorLike = { x: number; y: number; z?: number; w?: number };
Archtype for Vector2, Vector3 and Vector4.
# InstancedBatchObject
class InstancedBatchObject extends BatchObject
Child class used for instanced objects. No additional functionality, just some additional required logic wrapped.