# BatchObject

#

Constructors

constructor

#

Accessors

aabb accelerationStructure batchIndex localOrigin renderView

#

Methods

buildAccelerationStructure transformTRS

#

Typedefs

VectorLike InstancedBatchObject

#

Constructors

# constructor

constructor(renderView: NodeRenderView, batchIndex: number)
1

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
1

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
1

Gets the object's bottom level BVH.

Returns: AccelerationStructure

# batchIndex

get batchIndex(): number
1

Gets the object's index inside its batch.

Returns: number

# localOrigin

get localOrigin(): Vector3
1

Gets local origin of the object. i.e the render view's aabb center.

Returns: Vector3 (opens new window)

# renderView

get renderView(): NodeRenderView
1

Gets the start index inside the batch's index buffer.

Returns: NodeRenderView

#

Methods

# buildAccelerationStructure

buildAccelerationStructure(bvh?: MeshBVH)
1

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

Returns: void

# transformTRS()

public transformTRS(
    translation: VectorLike,
    euler?: VectorLike,
    scale?: VectorLike,
    pivot?: VectorLike
  )
1
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 };
1

Archtype for Vector2, Vector3 and Vector4.

# InstancedBatchObject

class InstancedBatchObject extends BatchObject
1

Child class used for instanced objects. No additional functionality, just some additional required logic wrapped.