Skip to main content

Class: Components

components.Components

The entry point of Open BIM Components. It contains the basic items to create a BIM 3D scene based on Three.js, as well as all the tools provided by this library. It also manages the update loop of everything. Each instance has to be initialized with init.

Properties

meshes

meshes: Mesh<BufferGeometry<NormalBufferAttributes>, Material | Material[]>[] = []

All the loaded meshes. This includes IFC models, fragments, 3D scans, etc.

Defined in

temp/components/core/Components/index.ts:34


tools

Readonly tools: ToolComponent

ToolComponent

Defined in

temp/components/core/Components/index.ts:23


ui

Readonly ui: UIManager

UIManager

Defined in

temp/components/core/Components/index.ts:28

Accessors

camera

get camera(): Component<Camera>

The Three.js camera that determines the point of view of the renderer.

Returns

Component<Camera>

Defined in

temp/components/core/Components/index.ts:84

set camera(camera): void

This needs to be initialized before calling init().

Parameters

NameType
cameraComponent<Camera>

Returns

void

Defined in

temp/components/core/Components/index.ts:94


raycaster

get raycaster(): Raycaster

A component using the Three.js raycaster used primarily to pick 3D items with the mouse or a touch screen.

Returns

Raycaster

Defined in

temp/components/core/Components/index.ts:102

set raycaster(raycaster): void

Although this is not necessary to make the library work, it's necessary to initialize this if any component that needs a raycaster is used.

Parameters

NameType
raycasterRaycaster

Returns

void

Defined in

temp/components/core/Components/index.ts:113


renderer

get renderer(): BaseRenderer

The Three.js renderer used to render the scene. This library provides multiple renderer components with pre-made functionality (e.g. rendering of 2D CSS elements.

Returns

BaseRenderer

Defined in

temp/components/core/Components/index.ts:48

set renderer(renderer): void

This needs to be initialized before calling init().

Parameters

NameType
rendererBaseRenderer

Returns

void

Defined in

temp/components/core/Components/index.ts:58


scene

get scene(): Component<Scene>

The Three.js scene where all the rendered items are placed.

Returns

Component<Scene>

Defined in

temp/components/core/Components/index.ts:66

set scene(scene): void

This needs to be initialized before calling init().

Parameters

NameType
sceneComponent<Scene>

Returns

void

Defined in

temp/components/core/Components/index.ts:76

Methods

dispose

dispose(): void

Disposes the memory of all the components and tools of this instance of the library. A memory leak will be created if:

  • An instance of the library ends up out of scope and this function isn't called. This is especially relevant in Single Page Applications (React, Angular, Vue, etc).

  • Any of the objects of this instance (meshes, geometries, etc) is referenced by a reference type (object or array).

You can learn more about how Three.js handles memory leaks here.

Returns

void

Defined in

temp/components/core/Components/index.ts:151


init

init(): void

Initializes the library. It should be called at the start of the app after initializing the scene, the renderer and the camera. Additionally, if any component that need a raycaster is used, the raycaster will need to be initialized.

Returns

void

Defined in

temp/components/core/Components/index.ts:130