Skip to main content

Geometry3d

Represents a geometry that consists of one or more IFC objects

Hierarchy

Index

Properties

readonlyaabb

aabb: { max: Vector3; min: Vector3 }

The axis-aligned bounding box of the geometry.


Type declaration

  • max: Vector3
  • min: Vector3

readonlycenter

center: Vector3

The center of the geometry's axis-aligned bounding box in IFC space.

cullOnCameraMove

cullOnCameraMove: boolean

Specifies whether to cull the geometry when the camera moves.

readonlycullingDistance

cullingDistance: number

The distance at which the geometry should be culled.

readonlyid

id: string

The unique identifier for the geometry.

readonlyisTransparent

isTransparent: boolean

Indicates whether the geometry is transparent.

readonlyproductsAndMeshes

productsAndMeshes: BimIfcProductsAndMeshes

The products and meshes associated with the geometry.

readonlyreservedIndices

reservedIndices: GeometryIndiceArray

Indices. Describes triangles by referencing items in reservedPositions.

readonlyreservedPositions

reservedPositions: Float32Array<ArrayBufferLike>

Positions written so far, sized to the merge's reserved capacity — not the actual written count, which stays at reserved size until compact() (on the concrete VertexDataMerge) trims it. Empty when the merge wrote quantized positions instead. See writtenPositionCount for the real count.

readonlyreservedUvs

reservedUvs: Float32Array<ArrayBufferLike>

Uvs (u, v), reserved-size like reservedPositions — see writtenPositionCount.

readonlywrittenPositionCount

writtenPositionCount: number

The number of vertices actually written by the merge. Unlike reservedPositions.length / 3, this is correct regardless of layout: reservedPositions is empty on the quantized path, and both arrays stay sized to the merge's reserved capacity — not the actual written count — until compact() trims them.

Methods

applyToGeometry

  • applyToGeometry(babylonGeometry: Geometry, engine: Engine, quantization?: PositionQuantization): void
  • Applies geometry to a babylon Geometry. Pass quantization to upload int16 positions.


    Parameters

    • babylonGeometry: Geometry
    • engine: Engine
    • optionalquantization: PositionQuantization

    Returns void

applyToMesh

  • applyToMesh(mesh: Mesh, engine: Engine): void
  • Applies geometry to a babylon Mesh. Whether positions are uploaded as int16 or float32 is fixed when the merge is created — see VertexDataMergeOptions.quantizePositions — because the merge has to produce them in the matching layout.

    When quantization is enabled, the int16 positions are written through a scratch buffer shared across every applyToMesh call. The upload is synchronous, so the scratch is safe to reuse only if the caller clears the mesh's cached CPU vertex data (e.g. mesh.twinfinity.clearCachedVertexData(), as TwinfinityViewer.addOrReplaceMesh does immediately after calling this) before the next applyToMesh call on any geometry. Skipping that cleanup does not throw — it silently corrupts the previously-uploaded mesh's positions on the next merge.


    Parameters

    • mesh: Mesh
    • engine: Engine

    Returns void

copyNormalsTo

  • copyNormalsTo<T>(dst: T): T
  • Copies normals to existing array.


    Type parameters

    • T: Writeable<ArrayLike<number>>

    Parameters

    • dst: T

    Returns T

toHandle

  • Handle for this geometry. Can be used to unload the geometry from the GPU.


    Returns Geometry3dHandle