vim-web 0.6.0-dev.0 → 0.6.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -75
- package/dist/style.css +3 -0
- package/dist/vim-bim.d.ts +1920 -0
- package/dist/vim-web.d.ts +3364 -0
- package/dist/vim-web.iife.js +13597 -14585
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +13626 -14614
- package/dist/vim-web.js.map +1 -1
- package/package.json +12 -9
- package/dist/types/core-viewers/index.d.ts +0 -3
- package/dist/types/core-viewers/shared/baseInputHandler.d.ts +0 -28
- package/dist/types/core-viewers/shared/index.d.ts +0 -11
- package/dist/types/core-viewers/shared/inputAdapter.d.ts +0 -22
- package/dist/types/core-viewers/shared/inputHandler.d.ts +0 -99
- package/dist/types/core-viewers/shared/keyboardHandler.d.ts +0 -96
- package/dist/types/core-viewers/shared/loadResult.d.ts +0 -55
- package/dist/types/core-viewers/shared/mouseHandler.d.ts +0 -30
- package/dist/types/core-viewers/shared/raycaster.d.ts +0 -27
- package/dist/types/core-viewers/shared/selection.d.ts +0 -105
- package/dist/types/core-viewers/shared/touchHandler.d.ts +0 -42
- package/dist/types/core-viewers/shared/vim.d.ts +0 -48
- package/dist/types/core-viewers/shared/vimCollection.d.ts +0 -25
- package/dist/types/core-viewers/ultra/camera.d.ts +0 -116
- package/dist/types/core-viewers/ultra/colorManager.d.ts +0 -73
- package/dist/types/core-viewers/ultra/decoder.d.ts +0 -108
- package/dist/types/core-viewers/ultra/decoderWithWorker.d.ts +0 -80
- package/dist/types/core-viewers/ultra/element3d.d.ts +0 -44
- package/dist/types/core-viewers/ultra/index.d.ts +0 -29
- package/dist/types/core-viewers/ultra/inputAdapter.d.ts +0 -8
- package/dist/types/core-viewers/ultra/loadRequest.d.ts +0 -14
- package/dist/types/core-viewers/ultra/logger.d.ts +0 -9
- package/dist/types/core-viewers/ultra/protocol.d.ts +0 -13
- package/dist/types/core-viewers/ultra/raycaster.d.ts +0 -52
- package/dist/types/core-viewers/ultra/remoteColor.d.ts +0 -37
- package/dist/types/core-viewers/ultra/renderer.d.ts +0 -147
- package/dist/types/core-viewers/ultra/rpcClient.d.ts +0 -86
- package/dist/types/core-viewers/ultra/rpcMarshal.d.ts +0 -64
- package/dist/types/core-viewers/ultra/rpcSafeClient.d.ts +0 -470
- package/dist/types/core-viewers/ultra/rpcTypes.d.ts +0 -71
- package/dist/types/core-viewers/ultra/rpcUtils.d.ts +0 -8
- package/dist/types/core-viewers/ultra/sectionBox.d.ts +0 -33
- package/dist/types/core-viewers/ultra/selection.d.ts +0 -4
- package/dist/types/core-viewers/ultra/socketClient.d.ts +0 -153
- package/dist/types/core-viewers/ultra/streamLogger.d.ts +0 -19
- package/dist/types/core-viewers/ultra/streamRenderer.d.ts +0 -7
- package/dist/types/core-viewers/ultra/viewer.d.ts +0 -139
- package/dist/types/core-viewers/ultra/viewport.d.ts +0 -47
- package/dist/types/core-viewers/ultra/vim.d.ts +0 -50
- package/dist/types/core-viewers/ultra/vimCollection.d.ts +0 -51
- package/dist/types/core-viewers/ultra/visibility.d.ts +0 -100
- package/dist/types/core-viewers/webgl/index.d.ts +0 -5
- package/dist/types/core-viewers/webgl/loader/averageBoundingBox.d.ts +0 -6
- package/dist/types/core-viewers/webgl/loader/colorAttribute.d.ts +0 -34
- package/dist/types/core-viewers/webgl/loader/element3d.d.ts +0 -108
- package/dist/types/core-viewers/webgl/loader/elementMapping.d.ts +0 -113
- package/dist/types/core-viewers/webgl/loader/geometry.d.ts +0 -103
- package/dist/types/core-viewers/webgl/loader/index.d.ts +0 -24
- package/dist/types/core-viewers/webgl/loader/materials/ghostMaterial.d.ts +0 -16
- package/dist/types/core-viewers/webgl/loader/materials/index.d.ts +0 -10
- package/dist/types/core-viewers/webgl/loader/materials/maskMaterial.d.ts +0 -8
- package/dist/types/core-viewers/webgl/loader/materials/materials.d.ts +0 -161
- package/dist/types/core-viewers/webgl/loader/materials/mergeMaterial.d.ts +0 -18
- package/dist/types/core-viewers/webgl/loader/materials/outlineMaterial.d.ts +0 -78
- package/dist/types/core-viewers/webgl/loader/materials/pickingMaterial.d.ts +0 -42
- package/dist/types/core-viewers/webgl/loader/materials/simpleMaterial.d.ts +0 -17
- package/dist/types/core-viewers/webgl/loader/materials/skyboxMaterial.d.ts +0 -16
- package/dist/types/core-viewers/webgl/loader/materials/standardMaterial.d.ts +0 -57
- package/dist/types/core-viewers/webgl/loader/materials/transferMaterial.d.ts +0 -8
- package/dist/types/core-viewers/webgl/loader/mesh.d.ts +0 -118
- package/dist/types/core-viewers/webgl/loader/progressive/g3dOffsets.d.ts +0 -53
- package/dist/types/core-viewers/webgl/loader/progressive/g3dSubset.d.ts +0 -117
- package/dist/types/core-viewers/webgl/loader/progressive/insertableGeometry.d.ts +0 -45
- package/dist/types/core-viewers/webgl/loader/progressive/insertableMesh.d.ts +0 -63
- package/dist/types/core-viewers/webgl/loader/progressive/insertableSubmesh.d.ts +0 -43
- package/dist/types/core-viewers/webgl/loader/progressive/instancedMesh.d.ts +0 -39
- package/dist/types/core-viewers/webgl/loader/progressive/instancedMeshFactory.d.ts +0 -27
- package/dist/types/core-viewers/webgl/loader/progressive/instancedSubmesh.d.ts +0 -31
- package/dist/types/core-viewers/webgl/loader/progressive/legacyMeshFactory.d.ts +0 -26
- package/dist/types/core-viewers/webgl/loader/progressive/loadRequest.d.ts +0 -21
- package/dist/types/core-viewers/webgl/loader/progressive/loadingSynchronizer.d.ts +0 -27
- package/dist/types/core-viewers/webgl/loader/progressive/subsetBuilder.d.ts +0 -74
- package/dist/types/core-viewers/webgl/loader/progressive/subsetRequest.d.ts +0 -38
- package/dist/types/core-viewers/webgl/loader/progressive/vimx.d.ts +0 -17
- package/dist/types/core-viewers/webgl/loader/scene.d.ts +0 -90
- package/dist/types/core-viewers/webgl/loader/vim.d.ts +0 -163
- package/dist/types/core-viewers/webgl/loader/vimCollection.d.ts +0 -78
- package/dist/types/core-viewers/webgl/loader/vimSettings.d.ts +0 -69
- package/dist/types/core-viewers/webgl/loader/webglAttribute.d.ts +0 -19
- package/dist/types/core-viewers/webgl/utils/boxes.d.ts +0 -5
- package/dist/types/core-viewers/webgl/viewer/camera/camera.d.ts +0 -149
- package/dist/types/core-viewers/webgl/viewer/camera/cameraInterface.d.ts +0 -107
- package/dist/types/core-viewers/webgl/viewer/camera/cameraMovement.d.ts +0 -88
- package/dist/types/core-viewers/webgl/viewer/camera/cameraMovementLerp.d.ts +0 -28
- package/dist/types/core-viewers/webgl/viewer/camera/cameraMovementSnap.d.ts +0 -23
- package/dist/types/core-viewers/webgl/viewer/camera/cameraOrthographic.d.ts +0 -11
- package/dist/types/core-viewers/webgl/viewer/camera/cameraPerspective.d.ts +0 -11
- package/dist/types/core-viewers/webgl/viewer/camera/index.d.ts +0 -7
- package/dist/types/core-viewers/webgl/viewer/environment/environment.d.ts +0 -38
- package/dist/types/core-viewers/webgl/viewer/environment/index.d.ts +0 -3
- package/dist/types/core-viewers/webgl/viewer/environment/light.d.ts +0 -43
- package/dist/types/core-viewers/webgl/viewer/environment/skybox.d.ts +0 -39
- package/dist/types/core-viewers/webgl/viewer/gizmos/axes/axes.d.ts +0 -14
- package/dist/types/core-viewers/webgl/viewer/gizmos/axes/axesSettings.d.ts +0 -20
- package/dist/types/core-viewers/webgl/viewer/gizmos/axes/gizmoAxes.d.ts +0 -62
- package/dist/types/core-viewers/webgl/viewer/gizmos/axes/index.d.ts +0 -3
- package/dist/types/core-viewers/webgl/viewer/gizmos/gizmoLoading.d.ts +0 -23
- package/dist/types/core-viewers/webgl/viewer/gizmos/gizmoOrbit.d.ts +0 -76
- package/dist/types/core-viewers/webgl/viewer/gizmos/gizmos.d.ts +0 -45
- package/dist/types/core-viewers/webgl/viewer/gizmos/index.d.ts +0 -7
- package/dist/types/core-viewers/webgl/viewer/gizmos/markers/gizmoMarker.d.ts +0 -113
- package/dist/types/core-viewers/webgl/viewer/gizmos/markers/gizmoMarkers.d.ts +0 -52
- package/dist/types/core-viewers/webgl/viewer/gizmos/markers/index.d.ts +0 -2
- package/dist/types/core-viewers/webgl/viewer/gizmos/measure/index.d.ts +0 -3
- package/dist/types/core-viewers/webgl/viewer/gizmos/measure/measure.d.ts +0 -97
- package/dist/types/core-viewers/webgl/viewer/gizmos/measure/measureGizmo.d.ts +0 -44
- package/dist/types/core-viewers/webgl/viewer/gizmos/measure/measureHtml.d.ts +0 -26
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/SectionBoxMesh.d.ts +0 -15
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/index.d.ts +0 -7
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBox.d.ts +0 -103
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxGizmo.d.ts +0 -18
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandle.d.ts +0 -20
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandles.d.ts +0 -20
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxInputs.d.ts +0 -118
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxOutline.d.ts +0 -15
- package/dist/types/core-viewers/webgl/viewer/index.d.ts +0 -10
- package/dist/types/core-viewers/webgl/viewer/inputAdapter.d.ts +0 -3
- package/dist/types/core-viewers/webgl/viewer/raycaster.d.ts +0 -71
- package/dist/types/core-viewers/webgl/viewer/rendering/gpuPicker.d.ts +0 -127
- package/dist/types/core-viewers/webgl/viewer/rendering/index.d.ts +0 -4
- package/dist/types/core-viewers/webgl/viewer/rendering/mergePass.d.ts +0 -18
- package/dist/types/core-viewers/webgl/viewer/rendering/outlinePass.d.ts +0 -19
- package/dist/types/core-viewers/webgl/viewer/rendering/renderScene.d.ts +0 -57
- package/dist/types/core-viewers/webgl/viewer/rendering/renderer.d.ts +0 -135
- package/dist/types/core-viewers/webgl/viewer/rendering/renderingComposer.d.ts +0 -95
- package/dist/types/core-viewers/webgl/viewer/rendering/renderingSection.d.ts +0 -40
- package/dist/types/core-viewers/webgl/viewer/rendering/transferPass.d.ts +0 -17
- package/dist/types/core-viewers/webgl/viewer/selection.d.ts +0 -9
- package/dist/types/core-viewers/webgl/viewer/settings/index.d.ts +0 -3
- package/dist/types/core-viewers/webgl/viewer/settings/viewerDefaultSettings.d.ts +0 -5
- package/dist/types/core-viewers/webgl/viewer/settings/viewerSettings.d.ts +0 -310
- package/dist/types/core-viewers/webgl/viewer/settings/viewerSettingsParsing.d.ts +0 -9
- package/dist/types/core-viewers/webgl/viewer/viewer.d.ts +0 -115
- package/dist/types/core-viewers/webgl/viewer/viewport.d.ts +0 -73
- package/dist/types/index.d.ts +0 -3
- package/dist/types/react-viewers/bim/bimInfoBody.d.ts +0 -9
- package/dist/types/react-viewers/bim/bimInfoData.d.ts +0 -144
- package/dist/types/react-viewers/bim/bimInfoHeader.d.ts +0 -6
- package/dist/types/react-viewers/bim/bimInfoObject.d.ts +0 -12
- package/dist/types/react-viewers/bim/bimInfoPanel.d.ts +0 -10
- package/dist/types/react-viewers/bim/bimInfoVim.d.ts +0 -5
- package/dist/types/react-viewers/bim/bimPanel.d.ts +0 -40
- package/dist/types/react-viewers/bim/bimSearch.d.ts +0 -17
- package/dist/types/react-viewers/bim/bimTree.d.ts +0 -33
- package/dist/types/react-viewers/bim/bimTreeData.d.ts +0 -44
- package/dist/types/react-viewers/bim/bimUtils.d.ts +0 -13
- package/dist/types/react-viewers/bim/index.d.ts +0 -8
- package/dist/types/react-viewers/bim/openState.d.ts +0 -5
- package/dist/types/react-viewers/container.d.ts +0 -27
- package/dist/types/react-viewers/controlbar/controlBar.d.ts +0 -25
- package/dist/types/react-viewers/controlbar/controlBarButton.d.ts +0 -15
- package/dist/types/react-viewers/controlbar/controlBarIds.d.ts +0 -32
- package/dist/types/react-viewers/controlbar/controlBarSection.d.ts +0 -8
- package/dist/types/react-viewers/controlbar/index.d.ts +0 -5
- package/dist/types/react-viewers/controlbar/style.d.ts +0 -10
- package/dist/types/react-viewers/errors/errorStyle.d.ts +0 -15
- package/dist/types/react-viewers/errors/errors.d.ts +0 -6
- package/dist/types/react-viewers/errors/index.d.ts +0 -2
- package/dist/types/react-viewers/generic/genericField.d.ts +0 -31
- package/dist/types/react-viewers/generic/genericPanel.d.ts +0 -12
- package/dist/types/react-viewers/generic/index.d.ts +0 -2
- package/dist/types/react-viewers/generic/inputNumber.d.ts +0 -4
- package/dist/types/react-viewers/helpers/cameraObserver.d.ts +0 -8
- package/dist/types/react-viewers/helpers/cursor.d.ts +0 -37
- package/dist/types/react-viewers/helpers/customizer.d.ts +0 -4
- package/dist/types/react-viewers/helpers/data.d.ts +0 -27
- package/dist/types/react-viewers/helpers/element.d.ts +0 -14
- package/dist/types/react-viewers/helpers/fullScreenObserver.d.ts +0 -9
- package/dist/types/react-viewers/helpers/index.d.ts +0 -6
- package/dist/types/react-viewers/helpers/layout.d.ts +0 -24
- package/dist/types/react-viewers/helpers/loadRequest.d.ts +0 -27
- package/dist/types/react-viewers/helpers/reactUtils.d.ts +0 -286
- package/dist/types/react-viewers/helpers/requestResult.d.ts +0 -13
- package/dist/types/react-viewers/helpers/utils.d.ts +0 -15
- package/dist/types/react-viewers/icons.d.ts +0 -61
- package/dist/types/react-viewers/index.d.ts +0 -14
- package/dist/types/react-viewers/panels/axesPanel.d.ts +0 -21
- package/dist/types/react-viewers/panels/contextMenu.d.ts +0 -83
- package/dist/types/react-viewers/panels/help.d.ts +0 -10
- package/dist/types/react-viewers/panels/index.d.ts +0 -26
- package/dist/types/react-viewers/panels/isolationPanel.d.ts +0 -11
- package/dist/types/react-viewers/panels/loadingBox.d.ts +0 -29
- package/dist/types/react-viewers/panels/logo.d.ts +0 -5
- package/dist/types/react-viewers/panels/messageBox.d.ts +0 -15
- package/dist/types/react-viewers/panels/modal.d.ts +0 -17
- package/dist/types/react-viewers/panels/overlay.d.ts +0 -10
- package/dist/types/react-viewers/panels/performance.d.ts +0 -7
- package/dist/types/react-viewers/panels/restOfScreen.d.ts +0 -5
- package/dist/types/react-viewers/panels/sectionBoxPanel.d.ts +0 -10
- package/dist/types/react-viewers/panels/sidePanel.d.ts +0 -20
- package/dist/types/react-viewers/panels/toast.d.ts +0 -22
- package/dist/types/react-viewers/settings/anySettings.d.ts +0 -7
- package/dist/types/react-viewers/settings/index.d.ts +0 -5
- package/dist/types/react-viewers/settings/settingsInputBox.d.ts +0 -4
- package/dist/types/react-viewers/settings/settingsItem.d.ts +0 -30
- package/dist/types/react-viewers/settings/settingsKeys.d.ts +0 -46
- package/dist/types/react-viewers/settings/settingsPanel.d.ts +0 -18
- package/dist/types/react-viewers/settings/settingsPanelContent.d.ts +0 -6
- package/dist/types/react-viewers/settings/settingsState.d.ts +0 -18
- package/dist/types/react-viewers/settings/settingsStorage.d.ts +0 -15
- package/dist/types/react-viewers/settings/settingsSubtitle.d.ts +0 -2
- package/dist/types/react-viewers/settings/settingsToggle.d.ts +0 -11
- package/dist/types/react-viewers/settings/userBoolean.d.ts +0 -17
- package/dist/types/react-viewers/state/cameraState.d.ts +0 -24
- package/dist/types/react-viewers/state/controlBarState.d.ts +0 -88
- package/dist/types/react-viewers/state/fullScreenState.d.ts +0 -4
- package/dist/types/react-viewers/state/index.d.ts +0 -9
- package/dist/types/react-viewers/state/measureState.d.ts +0 -7
- package/dist/types/react-viewers/state/pointerState.d.ts +0 -6
- package/dist/types/react-viewers/state/sectionBoxState.d.ts +0 -34
- package/dist/types/react-viewers/state/sharedIsolation.d.ts +0 -40
- package/dist/types/react-viewers/state/sideState.d.ts +0 -22
- package/dist/types/react-viewers/state/viewerInputs.d.ts +0 -3
- package/dist/types/react-viewers/ultra/camera.d.ts +0 -3
- package/dist/types/react-viewers/ultra/controlBar.d.ts +0 -9
- package/dist/types/react-viewers/ultra/errors/fileLoadingError.d.ts +0 -2
- package/dist/types/react-viewers/ultra/errors/fileOpeningError.d.ts +0 -2
- package/dist/types/react-viewers/ultra/errors/serverCompatibilityError.d.ts +0 -2
- package/dist/types/react-viewers/ultra/errors/serverConnectionError.d.ts +0 -2
- package/dist/types/react-viewers/ultra/errors/serverFileDownloadingError.d.ts +0 -2
- package/dist/types/react-viewers/ultra/errors/serverStreamError.d.ts +0 -2
- package/dist/types/react-viewers/ultra/errors/ultraErrors.d.ts +0 -3
- package/dist/types/react-viewers/ultra/index.d.ts +0 -3
- package/dist/types/react-viewers/ultra/isolation.d.ts +0 -3
- package/dist/types/react-viewers/ultra/modal.d.ts +0 -5
- package/dist/types/react-viewers/ultra/sectionBox.d.ts +0 -3
- package/dist/types/react-viewers/ultra/settings.d.ts +0 -13
- package/dist/types/react-viewers/ultra/settingsPanel.d.ts +0 -5
- package/dist/types/react-viewers/ultra/viewer.d.ts +0 -23
- package/dist/types/react-viewers/ultra/viewerRef.d.ts +0 -50
- package/dist/types/react-viewers/urls.d.ts +0 -2
- package/dist/types/react-viewers/webgl/camera.d.ts +0 -3
- package/dist/types/react-viewers/webgl/index.d.ts +0 -4
- package/dist/types/react-viewers/webgl/inputsBindings.d.ts +0 -8
- package/dist/types/react-viewers/webgl/isolation.d.ts +0 -2
- package/dist/types/react-viewers/webgl/loading.d.ts +0 -64
- package/dist/types/react-viewers/webgl/sectionBox.d.ts +0 -3
- package/dist/types/react-viewers/webgl/settings.d.ts +0 -36
- package/dist/types/react-viewers/webgl/settingsPanel.d.ts +0 -12
- package/dist/types/react-viewers/webgl/viewer.d.ts +0 -28
- package/dist/types/react-viewers/webgl/viewerRef.d.ts +0 -131
- package/dist/types/react-viewers/webgl/viewerState.d.ts +0 -13
- package/dist/types/utils/array.d.ts +0 -18
- package/dist/types/utils/asyncQueue.d.ts +0 -15
- package/dist/types/utils/debounce.d.ts +0 -30
- package/dist/types/utils/index.d.ts +0 -10
- package/dist/types/utils/interfaces.d.ts +0 -3
- package/dist/types/utils/math3d.d.ts +0 -19
- package/dist/types/utils/partial.d.ts +0 -7
- package/dist/types/utils/promise.d.ts +0 -21
- package/dist/types/utils/threeUtils.d.ts +0 -4
- package/dist/types/utils/url.d.ts +0 -10
- package/dist/types/utils/validation.d.ts +0 -29
|
@@ -0,0 +1,3364 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export { THREE };
|
|
3
|
+
import * as BIM from 'vim-format';
|
|
4
|
+
import { IElement, VimHelpers, VimHeader, VimDocument } from 'vim-format';
|
|
5
|
+
export { BIM };
|
|
6
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
|
+
import React, { ReactNode } from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @module vim-loader
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Determines how to draw (or not) transparent and opaque objects
|
|
14
|
+
*/
|
|
15
|
+
type TransparencyMode = 'opaqueOnly' | 'transparentOnly' | 'allAsOpaque' | 'all';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @module vim-loader
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Per-model transform and rendering settings, passed to `viewer.load(source, settings)`.
|
|
23
|
+
* Controls how an individual VIM file is positioned, rotated, and scaled in the scene.
|
|
24
|
+
* Not to be confused with {@link ViewerSettings} (renderer config) or WebglSettings (UI toggles).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* viewer.load({ url }, { position: new THREE.Vector3(100, 0, 0), scale: 2 })
|
|
28
|
+
*/
|
|
29
|
+
type VimSettings = {
|
|
30
|
+
/**
|
|
31
|
+
* The positional offset for the vim object, in Z-up space (X = right, Y = forward, Z = up).
|
|
32
|
+
*/
|
|
33
|
+
position: THREE.Vector3;
|
|
34
|
+
/**
|
|
35
|
+
* The XYZ rotation applied to the vim object, in degrees.
|
|
36
|
+
*/
|
|
37
|
+
rotation: THREE.Vector3;
|
|
38
|
+
/**
|
|
39
|
+
* The scaling factor applied to the vim object.
|
|
40
|
+
*/
|
|
41
|
+
scale: number;
|
|
42
|
+
/**
|
|
43
|
+
* The matrix representation of the vim object's position, rotation, and scale.
|
|
44
|
+
* Setting this will override individual position, rotation, and scale properties.
|
|
45
|
+
*/
|
|
46
|
+
matrix: THREE.Matrix4;
|
|
47
|
+
/**
|
|
48
|
+
* Determines whether objects are drawn based on their transparency.
|
|
49
|
+
*/
|
|
50
|
+
transparency: TransparencyMode;
|
|
51
|
+
/**
|
|
52
|
+
* Set to true to enable verbose HTTP logging.
|
|
53
|
+
*/
|
|
54
|
+
verboseHttp: boolean;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Represents a partial configuration of settings for a vim object.
|
|
58
|
+
*/
|
|
59
|
+
type VimPartialSettings = Partial<VimSettings>;
|
|
60
|
+
|
|
61
|
+
interface AxesSettings {
|
|
62
|
+
size: number;
|
|
63
|
+
padding: number;
|
|
64
|
+
bubbleSizePrimary: number;
|
|
65
|
+
bubbleSizeSecondary: number;
|
|
66
|
+
lineWidth: number;
|
|
67
|
+
fontPxSize: number;
|
|
68
|
+
fontFamily: string;
|
|
69
|
+
fontWeight: string;
|
|
70
|
+
fontColor: string;
|
|
71
|
+
className: string;
|
|
72
|
+
colorX: string;
|
|
73
|
+
colorY: string;
|
|
74
|
+
colorZ: string;
|
|
75
|
+
colorXSub: string;
|
|
76
|
+
colorYSub: string;
|
|
77
|
+
colorZSub: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Makes all field optional recursively
|
|
82
|
+
* https://stackoverflow.com/questions/41980195/recursive-partialt-in-typescript
|
|
83
|
+
*/
|
|
84
|
+
type RecursivePartial<T> = {
|
|
85
|
+
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
@module viw-webgl-viewer
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
type MaterialSettings = {
|
|
93
|
+
/**
|
|
94
|
+
* Use fast simple materials instead of standard Lambert materials
|
|
95
|
+
* - Enables: Significantly faster rendering (no Lambert lighting calculations)
|
|
96
|
+
* - Trade-off: Simpler pseudo-lighting using screen-space derivatives
|
|
97
|
+
* - Useful for: Performance-critical scenarios, large models, lower-end hardware
|
|
98
|
+
* Default: false
|
|
99
|
+
*/
|
|
100
|
+
useFastMaterials: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Default color of standard material
|
|
103
|
+
*/
|
|
104
|
+
standard: {
|
|
105
|
+
color: THREE.Color;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Ghost material options
|
|
109
|
+
*/
|
|
110
|
+
ghost: {
|
|
111
|
+
/**
|
|
112
|
+
* Ghost material color
|
|
113
|
+
* Default: rgb(78, 82, 92)
|
|
114
|
+
*/
|
|
115
|
+
color: THREE.Color;
|
|
116
|
+
/**
|
|
117
|
+
* Ghost material opacity
|
|
118
|
+
* Default: 0.08
|
|
119
|
+
*/
|
|
120
|
+
opacity: number;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Section box intersection highlight options
|
|
124
|
+
*/
|
|
125
|
+
section: {
|
|
126
|
+
/**
|
|
127
|
+
* Intersection highlight stroke width.
|
|
128
|
+
* Default: 0.01
|
|
129
|
+
*/
|
|
130
|
+
strokeWidth: number;
|
|
131
|
+
/**
|
|
132
|
+
* Intersection highlight stroke falloff.
|
|
133
|
+
* Default: 0.75
|
|
134
|
+
*/
|
|
135
|
+
strokeFalloff: number;
|
|
136
|
+
/**
|
|
137
|
+
* Intersection highlight stroke color.
|
|
138
|
+
* Default: rgb(246, 246, 246)
|
|
139
|
+
*/
|
|
140
|
+
strokeColor: THREE.Color;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Selection outline options
|
|
144
|
+
*/
|
|
145
|
+
outline: {
|
|
146
|
+
/**
|
|
147
|
+
* Selection outline opacity (0 = invisible, 1 = fully opaque).
|
|
148
|
+
* Default: 1
|
|
149
|
+
*/
|
|
150
|
+
opacity: number;
|
|
151
|
+
/**
|
|
152
|
+
* Selection outline color.
|
|
153
|
+
* Default: rgb(0, 255, 255)
|
|
154
|
+
*/
|
|
155
|
+
color: THREE.Color;
|
|
156
|
+
/**
|
|
157
|
+
* Scale factor for outline render target resolution (0-1).
|
|
158
|
+
* Lower = faster, higher = sharper outlines.
|
|
159
|
+
* Default: 0.75
|
|
160
|
+
*/
|
|
161
|
+
scale: number;
|
|
162
|
+
/**
|
|
163
|
+
* Outline thickness in pixels (of the outline render target).
|
|
164
|
+
* Higher values sample more pixels per fragment (4 fetches per level).
|
|
165
|
+
* Range: 1-5. Default: 2
|
|
166
|
+
*/
|
|
167
|
+
thickness: number;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Core renderer configuration, passed to `Core.Webgl.createViewer(settings)` at initialization.
|
|
172
|
+
* Controls camera defaults, lighting, materials, canvas, and rendering pipeline.
|
|
173
|
+
* Not to be confused with {@link VimSettings} (per-model transform) or WebglSettings (React UI toggles).
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* const viewer = Core.Webgl.createViewer({
|
|
177
|
+
* camera: { orthographic: true, fov: 50 },
|
|
178
|
+
* materials: { useFastMaterials: true }
|
|
179
|
+
* })
|
|
180
|
+
*/
|
|
181
|
+
type ViewerSettings = {
|
|
182
|
+
/**
|
|
183
|
+
* Webgl canvas related options
|
|
184
|
+
*/
|
|
185
|
+
canvas: {
|
|
186
|
+
/**
|
|
187
|
+
* Canvas dom model id. If none provided a new canvas will be created
|
|
188
|
+
* Default: undefined.
|
|
189
|
+
*/
|
|
190
|
+
id: string | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Limits how often canvas will be resized if window is resized in ms.
|
|
193
|
+
* Default: 200
|
|
194
|
+
*/
|
|
195
|
+
resizeDelay: number;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Three.js camera related options
|
|
199
|
+
*/
|
|
200
|
+
camera: {
|
|
201
|
+
/**
|
|
202
|
+
* Start with orthographic camera
|
|
203
|
+
* Default: false
|
|
204
|
+
*/
|
|
205
|
+
orthographic: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Movement lock per axis in Z-up space (X = right, Y = forward, Z = up).
|
|
208
|
+
* Each component should be 0 (locked) or 1 (free).
|
|
209
|
+
* Default: THREE.Vector3(1, 1, 1)
|
|
210
|
+
*/
|
|
211
|
+
lockMovement: THREE.Vector3;
|
|
212
|
+
/**
|
|
213
|
+
* Rotation lock per axis. x = yaw (around Z), y = pitch (up/down).
|
|
214
|
+
* Each component should be 0 (locked) or 1 (free).
|
|
215
|
+
* Default: THREE.Vector2(1, 1)
|
|
216
|
+
*/
|
|
217
|
+
lockRotation: THREE.Vector2;
|
|
218
|
+
/**
|
|
219
|
+
* Near clipping plane distance
|
|
220
|
+
* Default: 0.01
|
|
221
|
+
*/
|
|
222
|
+
near: number;
|
|
223
|
+
/**
|
|
224
|
+
* Far clipping plane distance
|
|
225
|
+
* Default: 15000
|
|
226
|
+
*/
|
|
227
|
+
far: number;
|
|
228
|
+
/**
|
|
229
|
+
* Fov angle in degrees
|
|
230
|
+
* Default: 50
|
|
231
|
+
*/
|
|
232
|
+
fov: number;
|
|
233
|
+
/**
|
|
234
|
+
* Camera zoom level
|
|
235
|
+
* Default: 1
|
|
236
|
+
*/
|
|
237
|
+
zoom: number;
|
|
238
|
+
/**
|
|
239
|
+
* Initial forward vector of the camera in Z-up space (X = right, Y = forward, Z = up).
|
|
240
|
+
* Default: THREE.Vector3(1, -1, 1)
|
|
241
|
+
*/
|
|
242
|
+
forward: THREE.Vector3;
|
|
243
|
+
/** Camera controls related options */
|
|
244
|
+
controls: {
|
|
245
|
+
/**
|
|
246
|
+
* <p>Set true to start in orbit mode.</p>
|
|
247
|
+
* <p>Camera has two modes: First person and orbit</p>
|
|
248
|
+
* <p>First person allows to moves the camera around freely</p>
|
|
249
|
+
* <p>Orbit rotates the camera around a focus point</p>
|
|
250
|
+
* Default: true
|
|
251
|
+
*/
|
|
252
|
+
orbit: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Camera rotation speed factor
|
|
255
|
+
* Default: 1
|
|
256
|
+
*/
|
|
257
|
+
rotateSpeed: number;
|
|
258
|
+
/**
|
|
259
|
+
* Camera orbit rotation speed factor.
|
|
260
|
+
* Default: 1
|
|
261
|
+
*/
|
|
262
|
+
orbitSpeed: number;
|
|
263
|
+
/**
|
|
264
|
+
* Camera movement speed factor
|
|
265
|
+
* Default: 1
|
|
266
|
+
*/
|
|
267
|
+
moveSpeed: number;
|
|
268
|
+
/**
|
|
269
|
+
* Camera movement speed factor on mouse scroll
|
|
270
|
+
* Default: 1
|
|
271
|
+
* Range: [0.1, 10]
|
|
272
|
+
*/
|
|
273
|
+
scrollSpeed: number;
|
|
274
|
+
};
|
|
275
|
+
/** Camera gizmo related options */
|
|
276
|
+
gizmo: {
|
|
277
|
+
/**
|
|
278
|
+
* Enables/Disables camera gizmo.
|
|
279
|
+
* Default: true
|
|
280
|
+
*/
|
|
281
|
+
enable: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Size of camera gizmo as fraction of screen (0-1).
|
|
284
|
+
* Default: 0.1
|
|
285
|
+
*/
|
|
286
|
+
size: number;
|
|
287
|
+
/**
|
|
288
|
+
* Color of vertical rings (great circles).
|
|
289
|
+
* Default: THREE.Color(0x0590cc) - VIM blue
|
|
290
|
+
*/
|
|
291
|
+
color: THREE.Color;
|
|
292
|
+
/**
|
|
293
|
+
* Color of horizontal rings (latitude circles).
|
|
294
|
+
* Default: THREE.Color(0x58b5dd) - Primary_300
|
|
295
|
+
*/
|
|
296
|
+
colorHorizontal: THREE.Color;
|
|
297
|
+
/**
|
|
298
|
+
* Opacity of the camera gizmo when in front of objects.
|
|
299
|
+
* Default: 0.5
|
|
300
|
+
*/
|
|
301
|
+
opacity: number;
|
|
302
|
+
/**
|
|
303
|
+
* Opacity of the camera gizmo when behind objects.
|
|
304
|
+
* Default: 0.1
|
|
305
|
+
*/
|
|
306
|
+
opacityAlways: number;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Rendering background options
|
|
311
|
+
*/
|
|
312
|
+
background: {
|
|
313
|
+
/**
|
|
314
|
+
* Color of the cavas background
|
|
315
|
+
* Default: THREE.Color('#96999f')
|
|
316
|
+
*/
|
|
317
|
+
color: THREE.Color;
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Skybox options
|
|
321
|
+
*/
|
|
322
|
+
skybox: {
|
|
323
|
+
/**
|
|
324
|
+
* Enables/Disables skybox.
|
|
325
|
+
*/
|
|
326
|
+
enable: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Color for the lower part of the skybox.
|
|
329
|
+
*/
|
|
330
|
+
groundColor: THREE.Color;
|
|
331
|
+
/**
|
|
332
|
+
* Color for the upper part of the skybox.
|
|
333
|
+
*/
|
|
334
|
+
skyColor: THREE.Color;
|
|
335
|
+
/**
|
|
336
|
+
* Controls the gradient transition between the sky and the ground.
|
|
337
|
+
*/
|
|
338
|
+
sharpness: number;
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Material options
|
|
342
|
+
*/
|
|
343
|
+
materials: MaterialSettings;
|
|
344
|
+
/**
|
|
345
|
+
* Axes gizmo options
|
|
346
|
+
*/
|
|
347
|
+
axes: Partial<AxesSettings>;
|
|
348
|
+
/**
|
|
349
|
+
* Skylight (hemisphere light) options
|
|
350
|
+
*/
|
|
351
|
+
skylight: {
|
|
352
|
+
/**
|
|
353
|
+
* Skylight sky Color.
|
|
354
|
+
* Default: THREE.Color(153, 204, 255)
|
|
355
|
+
*/
|
|
356
|
+
skyColor: THREE.Color;
|
|
357
|
+
/**
|
|
358
|
+
* Skylight ground color.
|
|
359
|
+
* Default: THREE.Color(242, 213, 181)
|
|
360
|
+
*/
|
|
361
|
+
groundColor: THREE.Color;
|
|
362
|
+
/**
|
|
363
|
+
* Skylight intensity.
|
|
364
|
+
* Default: 0.8
|
|
365
|
+
*/
|
|
366
|
+
intensity: number;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Sunlight (directional light) options
|
|
370
|
+
* Two Blue-Green lights at odd angles. See defaultViewerSettings.
|
|
371
|
+
*/
|
|
372
|
+
sunlights: {
|
|
373
|
+
followCamera: boolean;
|
|
374
|
+
/** Light position. */
|
|
375
|
+
position: THREE.Vector3;
|
|
376
|
+
/** Light color. */
|
|
377
|
+
color: THREE.Color;
|
|
378
|
+
/** Light intensity. */
|
|
379
|
+
intensity: number;
|
|
380
|
+
}[];
|
|
381
|
+
rendering: {
|
|
382
|
+
/**
|
|
383
|
+
* When true, only renders when changes are detected. When false, renders every frame.
|
|
384
|
+
* Default: true
|
|
385
|
+
*/
|
|
386
|
+
autoRender: boolean;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Same as the Setting type but any field can be undefined.
|
|
391
|
+
*/
|
|
392
|
+
type PartialViewerSettings = RecursivePartial<ViewerSettings>;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* @module vim-loader/materials
|
|
396
|
+
*
|
|
397
|
+
* MaterialSet provides a cleaner API for managing material overrides.
|
|
398
|
+
* Instead of confusing arrays [visible, hidden], we explicitly name each material type.
|
|
399
|
+
*/
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* A set of materials for different geometry types and visibility states.
|
|
403
|
+
*
|
|
404
|
+
* This replaces the confusing array-based system where [material0, material1]
|
|
405
|
+
* was ambiguous (opaque/transparent? visible/hidden?).
|
|
406
|
+
*
|
|
407
|
+
* Now we explicitly name each material:
|
|
408
|
+
* - opaque: For solid geometry (undefined = don't render opaque meshes)
|
|
409
|
+
* - transparent: For see-through geometry (undefined = don't render transparent meshes)
|
|
410
|
+
* - hidden: For ghosted/hidden objects (undefined = don't render ghost)
|
|
411
|
+
*/
|
|
412
|
+
declare class MaterialSet {
|
|
413
|
+
readonly opaque?: THREE.Material;
|
|
414
|
+
readonly transparent?: THREE.Material;
|
|
415
|
+
readonly hidden?: THREE.Material;
|
|
416
|
+
constructor(opaque?: THREE.Material, transparent?: THREE.Material, hidden?: THREE.Material);
|
|
417
|
+
/**
|
|
418
|
+
* Get material for opaque meshes.
|
|
419
|
+
* Returns a single material, or a `[visible, hidden]` array when a ghost material is set.
|
|
420
|
+
* Returns `undefined` if no opaque material exists (mesh should be hidden).
|
|
421
|
+
*/
|
|
422
|
+
getOpaque(): THREE.Material | THREE.Material[] | undefined;
|
|
423
|
+
/**
|
|
424
|
+
* Get material for transparent meshes.
|
|
425
|
+
* Returns a single material, or a `[visible, hidden]` array when a ghost material is set.
|
|
426
|
+
* Returns `undefined` if no transparent material exists (mesh should be hidden).
|
|
427
|
+
*/
|
|
428
|
+
getTransparent(): THREE.Material | THREE.Material[] | undefined;
|
|
429
|
+
private _resolve;
|
|
430
|
+
/**
|
|
431
|
+
* Check if this MaterialSet is equivalent to another.
|
|
432
|
+
* Used to avoid unnecessary material updates.
|
|
433
|
+
*/
|
|
434
|
+
equals(other: MaterialSet | undefined): boolean;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* @module vim-loader/materials
|
|
439
|
+
*/
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Public API for material configuration.
|
|
443
|
+
* Users interact with this interface via `viewer.materials`.
|
|
444
|
+
*
|
|
445
|
+
* Raw THREE materials are exposed for building MaterialSet.
|
|
446
|
+
* All property mutation goes through flat proxy getters/setters.
|
|
447
|
+
*/
|
|
448
|
+
interface IMaterials {
|
|
449
|
+
/** The opaque model material. Used as the opaque slot when building a MaterialSet. */
|
|
450
|
+
readonly modelOpaqueMaterial: THREE.Material;
|
|
451
|
+
/** The transparent model material. Used as the transparent slot when building a MaterialSet. */
|
|
452
|
+
readonly modelTransparentMaterial: THREE.Material;
|
|
453
|
+
/** The ghost material used to render hidden/ghosted elements. */
|
|
454
|
+
readonly ghostMaterial: THREE.Material;
|
|
455
|
+
/** Base color tint applied to opaque and transparent model materials. */
|
|
456
|
+
modelColor: THREE.Color;
|
|
457
|
+
/** Opacity of the ghost material (0 = invisible, 1 = fully opaque). */
|
|
458
|
+
ghostOpacity: number;
|
|
459
|
+
/** Color of the ghost material. */
|
|
460
|
+
ghostColor: THREE.Color;
|
|
461
|
+
/** Opacity of the selection outline (0 = invisible, 1 = fully opaque). */
|
|
462
|
+
outlineOpacity: number;
|
|
463
|
+
/** Thickness of the selection outline in pixels (of the outline render target). Range: 1-5. */
|
|
464
|
+
outlineThickness: number;
|
|
465
|
+
/** Color of the selection outline post-process effect. */
|
|
466
|
+
outlineColor: THREE.Color;
|
|
467
|
+
/** Width of the stroke rendered where the section box intersects the model. */
|
|
468
|
+
sectionStrokeWidth: number;
|
|
469
|
+
/** Gradient falloff of the section box intersection stroke. */
|
|
470
|
+
sectionStrokeFalloff: number;
|
|
471
|
+
/** Color of the section box intersection stroke. */
|
|
472
|
+
sectionStrokeColor: THREE.Color;
|
|
473
|
+
/** Clipping planes applied to all materials. Set to undefined to disable clipping. */
|
|
474
|
+
clippingPlanes: THREE.Plane[] | undefined;
|
|
475
|
+
/** Applies a full set of material settings from the viewer configuration. */
|
|
476
|
+
applySettings(settings: MaterialSettings): void;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* @module vim-loader
|
|
481
|
+
*/
|
|
482
|
+
|
|
483
|
+
/** Public-facing interface for vim.scene. Represents loaded geometry in the renderer. */
|
|
484
|
+
interface IScene {
|
|
485
|
+
/** The world transform matrix applied to all meshes in this scene. */
|
|
486
|
+
readonly matrix: THREE.Matrix4;
|
|
487
|
+
/** Bounding box of currently loaded geometry in Z-up world space (X = right, Y = forward, Z = up). Undefined if nothing loaded yet. */
|
|
488
|
+
getBoundingBox(target?: THREE.Box3): THREE.Box3 | undefined;
|
|
489
|
+
/** Bounding box using average mesh centers, in Z-up world space. More stable against outliers. */
|
|
490
|
+
getAverageBoundingBox(): THREE.Box3;
|
|
491
|
+
/** Material override for all meshes in this scene. */
|
|
492
|
+
material: MaterialSet;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* A signal with no payload.
|
|
497
|
+
* Subscribe to be notified when the signal fires.
|
|
498
|
+
*/
|
|
499
|
+
interface ISignal {
|
|
500
|
+
/** Number of active subscriptions. */
|
|
501
|
+
readonly count: number;
|
|
502
|
+
/** Subscribe to the signal. Returns a function that unsubscribes. */
|
|
503
|
+
subscribe(fn: () => void): () => void;
|
|
504
|
+
/** Alias for {@link subscribe}. */
|
|
505
|
+
sub(fn: () => void): () => void;
|
|
506
|
+
/** Subscribe once — automatically removed after first fire. */
|
|
507
|
+
one(fn: () => void): () => void;
|
|
508
|
+
/** Remove a subscription by handler reference. */
|
|
509
|
+
unsubscribe(fn: () => void): void;
|
|
510
|
+
/** Check whether a handler is currently subscribed. */
|
|
511
|
+
has(fn: () => void): boolean;
|
|
512
|
+
/** Remove all subscriptions. */
|
|
513
|
+
clear(): void;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* A signal that carries a payload of type `T`.
|
|
517
|
+
* Subscribers receive the payload as their first argument.
|
|
518
|
+
*/
|
|
519
|
+
interface ISimpleEvent<T> {
|
|
520
|
+
/** Number of active subscriptions. */
|
|
521
|
+
readonly count: number;
|
|
522
|
+
/** Subscribe to the event. Returns a function that unsubscribes. */
|
|
523
|
+
subscribe(fn: (args: T) => void): () => void;
|
|
524
|
+
/** Alias for {@link subscribe}. */
|
|
525
|
+
sub(fn: (args: T) => void): () => void;
|
|
526
|
+
/** Subscribe once — automatically removed after first fire. */
|
|
527
|
+
one(fn: (args: T) => void): () => void;
|
|
528
|
+
/** Remove a subscription by handler reference. */
|
|
529
|
+
unsubscribe(fn: (args: T) => void): void;
|
|
530
|
+
/** Check whether a handler is currently subscribed. */
|
|
531
|
+
has(fn: (args: T) => void): boolean;
|
|
532
|
+
/** Remove all subscriptions. */
|
|
533
|
+
clear(): void;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Interface for a Vim element.
|
|
538
|
+
*/
|
|
539
|
+
interface IVimElement {
|
|
540
|
+
/**
|
|
541
|
+
* The vim from which this object came.
|
|
542
|
+
*/
|
|
543
|
+
vim: IVim<IVimElement> | undefined;
|
|
544
|
+
/**
|
|
545
|
+
* The bounding box of the object.
|
|
546
|
+
*/
|
|
547
|
+
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Interface for a Vim object.
|
|
551
|
+
* @template T - The type of element contained in the Vim.
|
|
552
|
+
*/
|
|
553
|
+
interface IVim<T extends IVimElement> {
|
|
554
|
+
/**
|
|
555
|
+
* Stable index assigned by the viewer (0-254).
|
|
556
|
+
* Used by VimCollection for O(1) lookup.
|
|
557
|
+
*/
|
|
558
|
+
readonly vimIndex: number;
|
|
559
|
+
/**
|
|
560
|
+
* Retrieves the element associated with the specified instance index.
|
|
561
|
+
* @param instance - The instance index of the of one of the instance included in the element.
|
|
562
|
+
* @returns The object corresponding to the instance, or undefined if not found.
|
|
563
|
+
*/
|
|
564
|
+
getElement(instance: number): T | undefined;
|
|
565
|
+
/**
|
|
566
|
+
* Retrieves the element associated with the specified id.
|
|
567
|
+
* @param id - The element ID to retrieve objects for (number or bigint).
|
|
568
|
+
* @returns An array of element corresponding to the given id.
|
|
569
|
+
*/
|
|
570
|
+
getElementsFromId(id: number | bigint): T[];
|
|
571
|
+
/**
|
|
572
|
+
* Retrieves the element associated with the given index.
|
|
573
|
+
* @param element - The index of the element.
|
|
574
|
+
* @returns The element corresponding to the element index, or undefined if not found.
|
|
575
|
+
*/
|
|
576
|
+
getElementFromIndex(element: number): T | undefined;
|
|
577
|
+
/**
|
|
578
|
+
* Retrieves all elements within the Vim.
|
|
579
|
+
* @returns An array of all Vim objects.
|
|
580
|
+
*/
|
|
581
|
+
getAllElements(): T[];
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Public interface for the selection manager.
|
|
586
|
+
*
|
|
587
|
+
* In the WebGL viewer, `T` is {@link ISelectable} — a union of `IElement3D` and `IMarker`.
|
|
588
|
+
* Use the `type` discriminant (`'Element3D'` or `'Marker'`) to narrow:
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```ts
|
|
592
|
+
* const selected = viewer.core.selection.getAll()
|
|
593
|
+
* for (const item of selected) {
|
|
594
|
+
* if (item.type === 'Element3D') {
|
|
595
|
+
* // item is IElement3D — has .hasMesh, .getBimElement(), etc.
|
|
596
|
+
* }
|
|
597
|
+
* }
|
|
598
|
+
*
|
|
599
|
+
* // Common operations
|
|
600
|
+
* viewer.core.selection.select(element) // Replace selection
|
|
601
|
+
* viewer.core.selection.add(element) // Add to selection
|
|
602
|
+
* viewer.core.selection.clear() // Clear all
|
|
603
|
+
* viewer.core.selection.onSelectionChanged.sub(() => { ... }) // React to changes
|
|
604
|
+
* ```
|
|
605
|
+
*/
|
|
606
|
+
interface ISelection<T extends IVimElement> {
|
|
607
|
+
/** If true, selecting an already-selected single object toggles it off. */
|
|
608
|
+
toggleOnRepeatSelect: boolean;
|
|
609
|
+
/** If false, all selection operations are no-ops. */
|
|
610
|
+
enabled: boolean;
|
|
611
|
+
/** Returns true if the target is currently selected. */
|
|
612
|
+
has(target: T): boolean;
|
|
613
|
+
/** Returns the number of currently selected objects. */
|
|
614
|
+
count(): number;
|
|
615
|
+
/** Returns true if at least one object is selected. */
|
|
616
|
+
any(): boolean;
|
|
617
|
+
/** Signal that fires whenever the selection changes. */
|
|
618
|
+
readonly onSelectionChanged: ISignal;
|
|
619
|
+
/** Replaces the entire selection with the given object. */
|
|
620
|
+
select(object: T): void;
|
|
621
|
+
/** Replaces the entire selection with the given objects. */
|
|
622
|
+
select(objects: T[]): void;
|
|
623
|
+
/** Toggles the selection state of the given object. */
|
|
624
|
+
toggle(object: T): void;
|
|
625
|
+
/** Toggles the selection state of the given objects. */
|
|
626
|
+
toggle(objects: T[]): void;
|
|
627
|
+
/** Adds the given object to the selection. */
|
|
628
|
+
add(object: T): void;
|
|
629
|
+
/** Adds the given objects to the selection. */
|
|
630
|
+
add(objects: T[]): void;
|
|
631
|
+
/** Removes the given object from the selection. */
|
|
632
|
+
remove(object: T): void;
|
|
633
|
+
/** Removes the given objects from the selection. */
|
|
634
|
+
remove(objects: T[]): void;
|
|
635
|
+
/** Clears the entire selection. */
|
|
636
|
+
clear(): void;
|
|
637
|
+
/** Returns an array of all currently selected objects. */
|
|
638
|
+
getAll(): T[];
|
|
639
|
+
/** Returns all selected objects belonging to a specific VIM model. */
|
|
640
|
+
getFromVim(vim: IVim<T>): T[];
|
|
641
|
+
/** Removes all selected objects that belong to a specific VIM model. */
|
|
642
|
+
removeFromVim(vim: IVim<T>): void;
|
|
643
|
+
/** Computes the bounding box encompassing all selected objects, in Z-up world space (X = right, Y = forward, Z = up). */
|
|
644
|
+
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* @module viw-webgl-viewer
|
|
649
|
+
*/
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Selectable object in the WebGL viewer. Both {@link IElement3D} and {@link IMarker} implement this.
|
|
653
|
+
*
|
|
654
|
+
* Use the `type` discriminant to narrow:
|
|
655
|
+
* - `'Element3D'` → {@link IElement3D} (BIM element with geometry, color, BIM data)
|
|
656
|
+
* - `'Marker'` → {@link IMarker} (sprite gizmo in the scene)
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```ts
|
|
660
|
+
* const items = viewer.core.selection.getAll() // ISelectable[]
|
|
661
|
+
* for (const item of items) {
|
|
662
|
+
* if (item.type === 'Element3D') {
|
|
663
|
+
* const el = item as IElement3D
|
|
664
|
+
* console.log(el.hasMesh, el.elementId)
|
|
665
|
+
* }
|
|
666
|
+
* }
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
interface ISelectable extends IVimElement {
|
|
670
|
+
/** Discriminant: `'Element3D'` for BIM elements, `'Marker'` for gizmo markers. */
|
|
671
|
+
readonly type: string;
|
|
672
|
+
/** The BIM element index, or undefined for markers without an associated element. */
|
|
673
|
+
readonly element: number | undefined;
|
|
674
|
+
/** Whether to render selection outline for this object. */
|
|
675
|
+
outline: boolean;
|
|
676
|
+
/** Whether to render this object. */
|
|
677
|
+
visible: boolean;
|
|
678
|
+
/** True if this object is a room element. Always false for markers. */
|
|
679
|
+
readonly isRoom: boolean;
|
|
680
|
+
/** The geometry instances associated with this object, if any. */
|
|
681
|
+
readonly instances: number[] | undefined;
|
|
682
|
+
}
|
|
683
|
+
type IWebglSelection = ISelection<ISelectable>;
|
|
684
|
+
/**
|
|
685
|
+
* Type guard to narrow an {@link ISelectable} to an `IElement3D`.
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* ```ts
|
|
689
|
+
* const items = viewer.core.selection.getAll()
|
|
690
|
+
* const elements = items.filter(isElement3D) // IElement3D[]
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
declare function isElement3D(item: ISelectable): item is ISelectable & {
|
|
694
|
+
type: 'Element3D';
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* @module vim-loader
|
|
699
|
+
*/
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Public interface for a loaded BIM element with geometry and visual state.
|
|
703
|
+
*
|
|
704
|
+
* Obtained via `vim.getElementFromIndex(index)` or `vim.getAllElements()`.
|
|
705
|
+
*
|
|
706
|
+
* @example
|
|
707
|
+
* ```ts
|
|
708
|
+
* const element = vim.getElementFromIndex(301)
|
|
709
|
+
* element.color = new THREE.Color(0xff0000)
|
|
710
|
+
* element.visible = false
|
|
711
|
+
* const params = await element.getBimParameters()
|
|
712
|
+
* ```
|
|
713
|
+
*/
|
|
714
|
+
interface IElement3D extends ISelectable {
|
|
715
|
+
readonly type: 'Element3D';
|
|
716
|
+
/** The vim from which this element came. */
|
|
717
|
+
readonly vim: IWebglVim;
|
|
718
|
+
/** The BIM element index. */
|
|
719
|
+
readonly element: number;
|
|
720
|
+
/** The unique element ID. */
|
|
721
|
+
readonly elementId: bigint;
|
|
722
|
+
/** The geometry instances associated with this element. */
|
|
723
|
+
readonly instances: number[] | undefined;
|
|
724
|
+
/** True if this element has associated geometry. */
|
|
725
|
+
readonly hasMesh: boolean;
|
|
726
|
+
/** True if this element is a room. */
|
|
727
|
+
readonly isRoom: boolean;
|
|
728
|
+
/** Whether to render selection outline for this element. */
|
|
729
|
+
outline: boolean;
|
|
730
|
+
/** Whether to render focus highlight for this element. */
|
|
731
|
+
focused: boolean;
|
|
732
|
+
/** Whether to render this element. */
|
|
733
|
+
visible: boolean;
|
|
734
|
+
/** The display color override. Set to undefined to revert to default. */
|
|
735
|
+
color: THREE.Color | undefined;
|
|
736
|
+
/** Retrieves BIM data for this element. */
|
|
737
|
+
getBimElement(): Promise<IElement>;
|
|
738
|
+
/**
|
|
739
|
+
* Retrieves all BIM parameters for this element.
|
|
740
|
+
* @returns Array of `{ name: string, value: string, group: string }` objects.
|
|
741
|
+
* Type is `VimHelpers.ElementParameter` from vim-format (accessible via `VIM.BIM.VimHelpers`).
|
|
742
|
+
*/
|
|
743
|
+
getBimParameters(): Promise<VimHelpers.ElementParameter[]>;
|
|
744
|
+
/** Retrieves the bounding box in Z-up world space (X = right, Y = forward, Z = up), or undefined if the element has no geometry. */
|
|
745
|
+
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
746
|
+
/** Retrieves the center position in Z-up world space, or undefined if the element has no geometry. */
|
|
747
|
+
getCenter(target?: THREE.Vector3): Promise<THREE.Vector3 | undefined>;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* @module vim-loader
|
|
752
|
+
*/
|
|
753
|
+
/** Filter mode for subset operations. Only exports modes that are actually implemented. */
|
|
754
|
+
type SubsetFilter = 'instance' | 'mesh';
|
|
755
|
+
/**
|
|
756
|
+
* A filtered view of geometry instances for progressive loading.
|
|
757
|
+
* Obtained via `vim.subset()`, then refined with `filter()`, `except()`, and `chunks()`.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```ts
|
|
761
|
+
* // Load all geometry
|
|
762
|
+
* await vim.load()
|
|
763
|
+
*
|
|
764
|
+
* // Or load progressively in chunks
|
|
765
|
+
* const all = vim.subset()
|
|
766
|
+
* const chunks = all.chunks(500_000) // Split into ~500K index chunks
|
|
767
|
+
* for (const chunk of chunks) {
|
|
768
|
+
* await vim.load(chunk)
|
|
769
|
+
* }
|
|
770
|
+
*
|
|
771
|
+
* // Or load a filtered subset
|
|
772
|
+
* const sub = vim.subset().filter('instance', [0, 1, 2, 3])
|
|
773
|
+
* await vim.load(sub)
|
|
774
|
+
* ```
|
|
775
|
+
*/
|
|
776
|
+
interface ISubset {
|
|
777
|
+
/** Total instance count in this subset. */
|
|
778
|
+
getInstanceCount(): number;
|
|
779
|
+
/** Split into smaller subsets by index count threshold (for chunked loading). */
|
|
780
|
+
chunks(count: number): ISubset[];
|
|
781
|
+
/** Return a new subset excluding instances matching the filter. */
|
|
782
|
+
except(mode: SubsetFilter, filter: number[] | Set<number>): ISubset;
|
|
783
|
+
/** Return a new subset including only instances matching the filter. */
|
|
784
|
+
filter(mode: SubsetFilter, filter: number[] | Set<number>): ISubset;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* @module vim-loader
|
|
789
|
+
*/
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Public API for a loaded VIM model, accessed via `viewer.vims`.
|
|
793
|
+
*
|
|
794
|
+
* Provides element queries, BIM data access, scene/material control,
|
|
795
|
+
* and progressive geometry loading.
|
|
796
|
+
*
|
|
797
|
+
* **Cleanup:** Do not call dispose directly — use `viewer.unload(vim)` to remove
|
|
798
|
+
* a vim from the viewer. Use `vim.clear()` only to remove loaded geometry
|
|
799
|
+
* while keeping the vim (e.g., before reloading a different subset).
|
|
800
|
+
*
|
|
801
|
+
* @example
|
|
802
|
+
* ```ts
|
|
803
|
+
* const vim = await viewer.load({ url }).getVim()
|
|
804
|
+
*
|
|
805
|
+
* // Query elements
|
|
806
|
+
* const element = vim.getElementFromIndex(301)
|
|
807
|
+
* const all = vim.getAllElements()
|
|
808
|
+
*
|
|
809
|
+
* // Modify visibility
|
|
810
|
+
* element.visible = false
|
|
811
|
+
* element.color = new THREE.Color(0xff0000)
|
|
812
|
+
*
|
|
813
|
+
* // BIM data (types from vim-format, accessible via VIM.BIM)
|
|
814
|
+
* const bimElement = await element.getBimElement() // VIM.BIM.IElement
|
|
815
|
+
* const params = await element.getBimParameters() // VIM.BIM.VimHelpers.ElementParameter[]
|
|
816
|
+
*
|
|
817
|
+
* // Progressive loading
|
|
818
|
+
* const sub = vim.subset().filter('instance', [0, 1, 2])
|
|
819
|
+
* await vim.load(sub)
|
|
820
|
+
*
|
|
821
|
+
* // Cleanup
|
|
822
|
+
* viewer.unload(vim) // Remove from viewer (do NOT call vim.dispose())
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
interface IWebglVim extends IVim<IElement3D> {
|
|
826
|
+
readonly type: 'webgl';
|
|
827
|
+
/** The URL this vim was loaded from, if applicable. */
|
|
828
|
+
readonly source: string | undefined;
|
|
829
|
+
/** The VIM file header (from vim-format, accessible via `VIM.BIM.VimHeader`). */
|
|
830
|
+
readonly header: VimHeader | undefined;
|
|
831
|
+
/** BIM document for querying element properties, categories, levels, etc. (from vim-format, accessible via `VIM.BIM.VimDocument`). */
|
|
832
|
+
readonly bim: VimDocument | undefined;
|
|
833
|
+
/** The scene containing this vim's geometry. */
|
|
834
|
+
readonly scene: IScene;
|
|
835
|
+
/** The bounding box of all loaded geometry in Z-up world space (X = right, Y = forward, Z = up), or undefined if nothing loaded. */
|
|
836
|
+
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
837
|
+
/** Returns a subset representing all instances, for use with {@link load} and filtering. */
|
|
838
|
+
subset(): ISubset;
|
|
839
|
+
/**
|
|
840
|
+
* Loads geometry for the given subset, or all geometry if no subset is provided.
|
|
841
|
+
* Caller is responsible for not loading the same subset twice.
|
|
842
|
+
* @param subset - The subset to load. Omit to load everything.
|
|
843
|
+
*/
|
|
844
|
+
load(subset?: ISubset): Promise<void>;
|
|
845
|
+
/** Removes all loaded geometry from the renderer (does NOT unload the vim from the viewer). */
|
|
846
|
+
clear(): void;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
interface ILoadSuccess<T> {
|
|
850
|
+
readonly isSuccess: true;
|
|
851
|
+
readonly isError: false;
|
|
852
|
+
readonly vim: T;
|
|
853
|
+
}
|
|
854
|
+
interface ILoadError {
|
|
855
|
+
readonly isSuccess: false;
|
|
856
|
+
readonly isError: true;
|
|
857
|
+
readonly error: string;
|
|
858
|
+
readonly details?: string;
|
|
859
|
+
}
|
|
860
|
+
type ProgressType = 'bytes' | 'percent';
|
|
861
|
+
interface IProgress {
|
|
862
|
+
type: ProgressType;
|
|
863
|
+
current: number;
|
|
864
|
+
total?: number;
|
|
865
|
+
}
|
|
866
|
+
type LoadResult<TValue, TError extends ILoadError = ILoadError> = ILoadSuccess<TValue> | TError;
|
|
867
|
+
/**
|
|
868
|
+
* Interface for load requests that can be used as a type constraint.
|
|
869
|
+
*/
|
|
870
|
+
interface ILoadRequest<TVim, TError extends ILoadError = ILoadError> {
|
|
871
|
+
/** Whether the load has finished (successfully or with error). */
|
|
872
|
+
readonly isCompleted: boolean;
|
|
873
|
+
/** Yields progress updates as they arrive. Use with `for await`. */
|
|
874
|
+
getProgress(): AsyncGenerator<IProgress>;
|
|
875
|
+
/**
|
|
876
|
+
* Returns the final load result (success or error).
|
|
877
|
+
* Awaits completion if still loading. Use `result.isSuccess` to discriminate.
|
|
878
|
+
*/
|
|
879
|
+
getResult(): Promise<LoadResult<TVim, TError>>;
|
|
880
|
+
/**
|
|
881
|
+
* Convenience method that awaits the result and returns the vim directly.
|
|
882
|
+
* @throws Error if the load failed.
|
|
883
|
+
*/
|
|
884
|
+
getVim(): Promise<TVim>;
|
|
885
|
+
/** Cancels the load request. Pending getVim()/getResult() promises will reject/resolve with error. */
|
|
886
|
+
abort(): void;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Core VIM parsing entry point. Loads a VIM file (BFast container) and produces
|
|
891
|
+
* a Vim object with G3d geometry, BIM document, element mapping, and mesh factory.
|
|
892
|
+
* The Vim is created WITHOUT geometry — call vim.load() or vim.load(subset)
|
|
893
|
+
* separately to build Three.js meshes.
|
|
894
|
+
*/
|
|
895
|
+
|
|
896
|
+
type RequestSource = {
|
|
897
|
+
url?: string;
|
|
898
|
+
buffer?: ArrayBuffer;
|
|
899
|
+
headers?: Record<string, string>;
|
|
900
|
+
};
|
|
901
|
+
type IWebglLoadRequest = ILoadRequest<IWebglVim>;
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* ## Coordinate System
|
|
905
|
+
* All camera operations use **Z-up**: X = right, Y = forward, Z = up.
|
|
906
|
+
* This differs from Three.js's default Y-up convention.
|
|
907
|
+
*
|
|
908
|
+
* @module camera
|
|
909
|
+
*/
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* Public interface for camera movement operations.
|
|
913
|
+
*
|
|
914
|
+
* Obtained via `camera.snap()` (instant) or `camera.lerp(duration)` (animated).
|
|
915
|
+
*
|
|
916
|
+
* @example
|
|
917
|
+
* ```ts
|
|
918
|
+
* camera.lerp(1).frame(element) // Animate to frame element
|
|
919
|
+
* camera.snap().set(position, target) // Instant position/target
|
|
920
|
+
* camera.lerp(0.5).orbit(new THREE.Vector2(45, 0)) // Animated orbit
|
|
921
|
+
* ```
|
|
922
|
+
*/
|
|
923
|
+
interface ICameraMovement {
|
|
924
|
+
/**
|
|
925
|
+
* Moves the camera along a single axis.
|
|
926
|
+
* @param axis The Z-up axis to move along ('X' = right, 'Y' = forward, 'Z' = up).
|
|
927
|
+
* @param amount The distance to move.
|
|
928
|
+
* @param space 'local' to move relative to camera orientation, 'world' for absolute axes.
|
|
929
|
+
*/
|
|
930
|
+
move(axis: 'X' | 'Y' | 'Z', amount: number, space: 'local' | 'world'): void;
|
|
931
|
+
/**
|
|
932
|
+
* Moves the camera along two axes.
|
|
933
|
+
* @param axes The Z-up plane to move in (e.g. 'XY' = ground, 'XZ' = vertical).
|
|
934
|
+
* @param vector The 2D displacement, components mapped to the specified axes.
|
|
935
|
+
* @param space 'local' to move relative to camera orientation, 'world' for absolute axes.
|
|
936
|
+
*/
|
|
937
|
+
move(axes: 'XY' | 'XZ' | 'YZ', vector: THREE.Vector2, space: 'local' | 'world'): void;
|
|
938
|
+
/**
|
|
939
|
+
* Moves the camera along all three axes.
|
|
940
|
+
* @param axes Must be 'XYZ'.
|
|
941
|
+
* @param vector The 3D displacement in Z-up convention (X = right, Y = forward, Z = up).
|
|
942
|
+
* @param space 'local' to move relative to camera orientation, 'world' for absolute axes.
|
|
943
|
+
*/
|
|
944
|
+
move(axes: 'XYZ', vector: THREE.Vector3, space: 'local' | 'world'): void;
|
|
945
|
+
/**
|
|
946
|
+
* Rotates the camera in place by the given angles.
|
|
947
|
+
* @param angle - x: yaw (around Z), y: pitch (up/down), in degrees.
|
|
948
|
+
*/
|
|
949
|
+
rotate(angle: THREE.Vector2): void;
|
|
950
|
+
/**
|
|
951
|
+
* Changes the distance between the camera and its target by a specified factor.
|
|
952
|
+
* @param amount - The zoom factor (e.g., 2 to zoom in / halve the distance, 0.5 to zoom out / double the distance).
|
|
953
|
+
*/
|
|
954
|
+
zoom(amount: number): void;
|
|
955
|
+
/**
|
|
956
|
+
* Zooms the camera toward a specific world point while preserving camera orientation.
|
|
957
|
+
* The orbit target is updated to the world point for future orbit operations.
|
|
958
|
+
* @param amount - The zoom factor (e.g., 2 to zoom in / move closer, 0.5 to zoom out / move farther).
|
|
959
|
+
* @param worldPoint - The world position to zoom toward (Z-up).
|
|
960
|
+
* @param screenPoint - Screen position of the world point, used to keep the target pinned under the cursor.
|
|
961
|
+
*/
|
|
962
|
+
zoomTowards(amount: number, worldPoint: THREE.Vector3, screenPoint?: THREE.Vector2): void;
|
|
963
|
+
/**
|
|
964
|
+
* Orbits the camera around its target while maintaining the distance.
|
|
965
|
+
* @param angle - x: azimuth change, y: elevation change, in degrees.
|
|
966
|
+
*/
|
|
967
|
+
orbit(angle: THREE.Vector2): void;
|
|
968
|
+
/**
|
|
969
|
+
* Orbits the camera around its target to align with the given direction.
|
|
970
|
+
* @param direction - The direction towards which the camera should be oriented (Z-up).
|
|
971
|
+
*/
|
|
972
|
+
orbitTowards(direction: THREE.Vector3): void;
|
|
973
|
+
/**
|
|
974
|
+
* Orients the camera to look at the given point. The orbit target is updated.
|
|
975
|
+
* @param target - The target element or world position (Z-up) to look at.
|
|
976
|
+
*/
|
|
977
|
+
lookAt(target: IElement3D | THREE.Vector3): Promise<void>;
|
|
978
|
+
/**
|
|
979
|
+
* Moves the orbit target without moving the camera or changing orientation.
|
|
980
|
+
* @param target - The new orbit target (element or world position in Z-up).
|
|
981
|
+
*/
|
|
982
|
+
setTarget(target: IElement3D | THREE.Vector3): Promise<void>;
|
|
983
|
+
/**
|
|
984
|
+
* Resets the camera to its last saved position and orientation.
|
|
985
|
+
*/
|
|
986
|
+
reset(): void;
|
|
987
|
+
/**
|
|
988
|
+
* Sets the camera position and target, orienting the camera to look at the target.
|
|
989
|
+
* Elevation is clamped to avoid gimbal lock at poles.
|
|
990
|
+
* @param position - The new camera position (Z-up).
|
|
991
|
+
* @param target - The new orbit target (Z-up). Defaults to the current target.
|
|
992
|
+
*/
|
|
993
|
+
set(position: THREE.Vector3, target?: THREE.Vector3): void;
|
|
994
|
+
/**
|
|
995
|
+
* Sets the camera's orientation and position to focus on the specified target.
|
|
996
|
+
* @param target - The target to frame, or 'all' to frame everything.
|
|
997
|
+
* @param forward - Optional forward direction after framing (Z-up).
|
|
998
|
+
*/
|
|
999
|
+
frame(target: ISelectable | IWebglVim | THREE.Sphere | THREE.Box3 | 'all', forward?: THREE.Vector3): Promise<void>;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Interface representing a camera with various properties and methods for controlling its behavior.
|
|
1003
|
+
*/
|
|
1004
|
+
interface IWebglCamera {
|
|
1005
|
+
/**
|
|
1006
|
+
* A signal that is dispatched when camera settings change.
|
|
1007
|
+
*/
|
|
1008
|
+
onSettingsChanged: ISignal;
|
|
1009
|
+
/**
|
|
1010
|
+
* A signal that is dispatched when camera moves.
|
|
1011
|
+
*/
|
|
1012
|
+
onMoved: ISignal;
|
|
1013
|
+
/**
|
|
1014
|
+
* True if the camera has moved this frame.
|
|
1015
|
+
*/
|
|
1016
|
+
get hasMoved(): boolean;
|
|
1017
|
+
/**
|
|
1018
|
+
* Movement lock per axis in Z-up space (X = right, Y = forward, Z = up).
|
|
1019
|
+
* Each component should be 0 (locked) or 1 (free).
|
|
1020
|
+
*/
|
|
1021
|
+
lockMovement: THREE.Vector3;
|
|
1022
|
+
/**
|
|
1023
|
+
* Rotation lock per axis. x = yaw (around Z), y = pitch (up/down).
|
|
1024
|
+
* Each component should be 0 (locked) or 1 (free).
|
|
1025
|
+
*/
|
|
1026
|
+
lockRotation: THREE.Vector2;
|
|
1027
|
+
/**
|
|
1028
|
+
* The default forward direction in Z-up space (X = right, Y = forward, Z = up).
|
|
1029
|
+
*/
|
|
1030
|
+
defaultForward: THREE.Vector3;
|
|
1031
|
+
/**
|
|
1032
|
+
* Interface for instantaneously moving the camera.
|
|
1033
|
+
* @param {boolean} [force=false] - Set to true to ignore locked axis and rotation.
|
|
1034
|
+
* @returns {ICameraMovement} The camera movement api.
|
|
1035
|
+
*/
|
|
1036
|
+
snap(force?: boolean): ICameraMovement;
|
|
1037
|
+
/**
|
|
1038
|
+
* Interface for smoothly moving the camera over time.
|
|
1039
|
+
* @param {number} [duration=1] - The duration of the camera movement animation.
|
|
1040
|
+
* @param {boolean} [force=false] - Set to true to ignore locked axis and rotation.
|
|
1041
|
+
* @returns {ICameraMovement} The camera movement api.
|
|
1042
|
+
*/
|
|
1043
|
+
lerp(duration: number, force?: boolean): ICameraMovement;
|
|
1044
|
+
/**
|
|
1045
|
+
* Calculates the frustum size at a given point in the scene.
|
|
1046
|
+
* @param {THREE.Vector3} point - The point in the scene to calculate the frustum size at.
|
|
1047
|
+
* @returns {THREE.Vector2} The frustum size (width, height) at the specified point.
|
|
1048
|
+
*/
|
|
1049
|
+
frustumSizeAt(point: THREE.Vector3): THREE.Vector2;
|
|
1050
|
+
/**
|
|
1051
|
+
* Returns the world-space direction from the camera through the given screen position.
|
|
1052
|
+
* @param screenPos Screen position in 0-1 range (0,0 is top-left).
|
|
1053
|
+
*/
|
|
1054
|
+
screenToDirection(screenPos: THREE.Vector2): THREE.Vector3;
|
|
1055
|
+
/**
|
|
1056
|
+
* The current THREE Camera
|
|
1057
|
+
*/
|
|
1058
|
+
get three(): THREE.Camera;
|
|
1059
|
+
/**
|
|
1060
|
+
* The quaternion representing the camera's orientation.
|
|
1061
|
+
*/
|
|
1062
|
+
get quaternion(): THREE.Quaternion;
|
|
1063
|
+
/**
|
|
1064
|
+
* The position of the camera in Z-up world space.
|
|
1065
|
+
*/
|
|
1066
|
+
get position(): THREE.Vector3;
|
|
1067
|
+
/**
|
|
1068
|
+
* The matrix representing the transformation of the camera.
|
|
1069
|
+
*/
|
|
1070
|
+
get matrix(): THREE.Matrix4;
|
|
1071
|
+
/**
|
|
1072
|
+
* The forward direction of the camera in Z-up world space.
|
|
1073
|
+
*/
|
|
1074
|
+
get forward(): THREE.Vector3;
|
|
1075
|
+
get isLerping(): boolean;
|
|
1076
|
+
/**
|
|
1077
|
+
* The current or target velocity of the camera.
|
|
1078
|
+
*/
|
|
1079
|
+
localVelocity: THREE.Vector3;
|
|
1080
|
+
/**
|
|
1081
|
+
* Immediately stops the camera movement.
|
|
1082
|
+
*/
|
|
1083
|
+
stop(): void;
|
|
1084
|
+
/**
|
|
1085
|
+
* The target at which the camera is looking at and around which it rotates, in Z-up world space.
|
|
1086
|
+
*/
|
|
1087
|
+
get target(): THREE.Vector3;
|
|
1088
|
+
/**
|
|
1089
|
+
* The distance from the camera to the target.
|
|
1090
|
+
*/
|
|
1091
|
+
get orbitDistance(): number;
|
|
1092
|
+
/**
|
|
1093
|
+
* Saves current camera orientation to restore on next reset.
|
|
1094
|
+
*/
|
|
1095
|
+
save(): void;
|
|
1096
|
+
/**
|
|
1097
|
+
* Represents whether the camera projection is orthographic.
|
|
1098
|
+
*/
|
|
1099
|
+
orthographic: boolean;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* @module viw-webgl-viewer/gizmos
|
|
1104
|
+
*/
|
|
1105
|
+
/**
|
|
1106
|
+
* Public interface for the axis gizmo.
|
|
1107
|
+
*/
|
|
1108
|
+
interface IGizmoAxes {
|
|
1109
|
+
/** The canvas on which the axes are drawn. */
|
|
1110
|
+
readonly canvas: HTMLCanvasElement;
|
|
1111
|
+
/** Resizes the gizmo to the given pixel size. */
|
|
1112
|
+
resize(size: number): void;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* @module viw-webgl-viewer/gizmos
|
|
1117
|
+
*/
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Public interface for the orbit target gizmo.
|
|
1121
|
+
*/
|
|
1122
|
+
interface IGizmoOrbit {
|
|
1123
|
+
/** Whether the orbit gizmo is enabled. */
|
|
1124
|
+
enabled: boolean;
|
|
1125
|
+
/** Updates the size of the orbit gizmo (fraction of screen 0-1). */
|
|
1126
|
+
setSize(size: number): void;
|
|
1127
|
+
/** Updates the colors of the orbit gizmo. */
|
|
1128
|
+
setColors(color: THREE.Color, colorHorizontal: THREE.Color): void;
|
|
1129
|
+
/** Updates the opacities of the orbit gizmo. */
|
|
1130
|
+
setOpacity(opacity: number, opacityAlways: number): void;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* @module viw-webgl-viewer/gizmos/measure
|
|
1135
|
+
*/
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Interacts with the measure tool.
|
|
1139
|
+
*/
|
|
1140
|
+
interface IMeasure {
|
|
1141
|
+
/**
|
|
1142
|
+
* Start point of the current measure or undefined if no active measure.
|
|
1143
|
+
*/
|
|
1144
|
+
get startPoint(): THREE.Vector3 | undefined;
|
|
1145
|
+
/**
|
|
1146
|
+
* End point of the current measure or undefined if no active measure.
|
|
1147
|
+
*/
|
|
1148
|
+
get endPoint(): THREE.Vector3 | undefined;
|
|
1149
|
+
/**
|
|
1150
|
+
* Vector from start to end of the current measure or undefined if no active measure.
|
|
1151
|
+
*/
|
|
1152
|
+
get measurement(): THREE.Vector3 | undefined;
|
|
1153
|
+
/**
|
|
1154
|
+
* Stage of the current measure or undefined if no active measure.
|
|
1155
|
+
*/
|
|
1156
|
+
get stage(): MeasureStage | undefined;
|
|
1157
|
+
/**
|
|
1158
|
+
* Starts a new measure flow where the two next click are overriden.
|
|
1159
|
+
* Currently running flow if any will be aborted.
|
|
1160
|
+
* Promise is resolved if flow is succesfully completed, rejected otherwise.
|
|
1161
|
+
* Do not override viewer.onMouseClick while this flow is active.
|
|
1162
|
+
*/
|
|
1163
|
+
start(): Promise<void>;
|
|
1164
|
+
/**
|
|
1165
|
+
* Aborts the current measure flow, fails the related promise.
|
|
1166
|
+
*/
|
|
1167
|
+
abort(): void;
|
|
1168
|
+
/**
|
|
1169
|
+
* Clears meshes.
|
|
1170
|
+
*/
|
|
1171
|
+
clear(): void;
|
|
1172
|
+
}
|
|
1173
|
+
type MeasureStage = 'ready' | 'active' | 'done' | 'failed';
|
|
1174
|
+
|
|
1175
|
+
/**
|
|
1176
|
+
* @module viw-webgl-viewer/gizmos/sectionBox
|
|
1177
|
+
*/
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Public interface for the section box gizmo.
|
|
1181
|
+
*
|
|
1182
|
+
* @example
|
|
1183
|
+
* ```ts
|
|
1184
|
+
* const sb = viewer.gizmos.sectionBox
|
|
1185
|
+
* sb.active = true // Enable clipping
|
|
1186
|
+
* sb.visible = true // Show gizmo
|
|
1187
|
+
* sb.setBox(await vim.getBoundingBox()) // Fit to model
|
|
1188
|
+
* sb.onBoxConfirm.sub((box) => console.log('Confirmed:', box))
|
|
1189
|
+
* ```
|
|
1190
|
+
*/
|
|
1191
|
+
interface IWebglSectionBox {
|
|
1192
|
+
/** Dispatches when active, visible, or interactive change. */
|
|
1193
|
+
readonly onStateChanged: ISignal;
|
|
1194
|
+
/** Dispatches when the user finishes manipulating the box. */
|
|
1195
|
+
readonly onBoxConfirm: ISimpleEvent<THREE.Box3>;
|
|
1196
|
+
/** Dispatches boolean indicating pointer hover state on box handles. */
|
|
1197
|
+
readonly onHover: ISimpleEvent<boolean>;
|
|
1198
|
+
/** Returns a copy of the current section box. */
|
|
1199
|
+
getBox(): THREE.Box3;
|
|
1200
|
+
/** Whether clipping planes are applied to the model. */
|
|
1201
|
+
active: boolean;
|
|
1202
|
+
/** Whether the gizmo responds to pointer events. */
|
|
1203
|
+
interactive: boolean;
|
|
1204
|
+
/** Whether the section box gizmo is visible. */
|
|
1205
|
+
visible: boolean;
|
|
1206
|
+
/** Resizes the section gizmo to match the given box. */
|
|
1207
|
+
setBox(box: THREE.Box3): void;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* Public interface for a marker gizmo in the scene.
|
|
1212
|
+
*
|
|
1213
|
+
* Obtained via `viewer.gizmos.markers.add(position)`.
|
|
1214
|
+
*/
|
|
1215
|
+
interface IMarker extends ISelectable {
|
|
1216
|
+
readonly type: 'Marker';
|
|
1217
|
+
/** The Vim object from which this marker came, if any. */
|
|
1218
|
+
vim: IWebglVim | undefined;
|
|
1219
|
+
/** The BIM element index, if associated with a Vim element. */
|
|
1220
|
+
element: number | undefined;
|
|
1221
|
+
/** The geometry instances, if derived from multiple instances. */
|
|
1222
|
+
instances: number[] | undefined;
|
|
1223
|
+
/** The index of the marker in the marker collection. */
|
|
1224
|
+
readonly index: number;
|
|
1225
|
+
/** Always false for markers. */
|
|
1226
|
+
readonly isRoom: boolean;
|
|
1227
|
+
/** Always false; marker is a gizmo, not an actual mesh. */
|
|
1228
|
+
readonly hasMesh: boolean;
|
|
1229
|
+
/** Whether the marker is outlined (highlighted). */
|
|
1230
|
+
outline: boolean;
|
|
1231
|
+
/** Whether the marker is visible in the scene. */
|
|
1232
|
+
visible: boolean;
|
|
1233
|
+
/** Whether the marker is focused (enlarged). */
|
|
1234
|
+
focused: boolean;
|
|
1235
|
+
/** The color override for the marker. */
|
|
1236
|
+
color: THREE.Color | undefined;
|
|
1237
|
+
/** The uniform scale factor applied to the marker. */
|
|
1238
|
+
size: number;
|
|
1239
|
+
/** The world position of the marker in Z-up space (X = right, Y = forward, Z = up). */
|
|
1240
|
+
position: THREE.Vector3;
|
|
1241
|
+
/** Retrieves the bounding box of the marker in Z-up world space. */
|
|
1242
|
+
getBoundingBox(): Promise<THREE.Box3>;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Public interface for adding and managing sprite markers in the scene.
|
|
1247
|
+
*/
|
|
1248
|
+
interface IGizmoMarkers {
|
|
1249
|
+
getMarkerFromIndex(index: number): IMarker | undefined;
|
|
1250
|
+
add(position: THREE.Vector3): IMarker;
|
|
1251
|
+
remove(marker: IMarker): void;
|
|
1252
|
+
clear(): void;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Public interface for the gizmo collection.
|
|
1257
|
+
* Exposes only the members needed by API consumers.
|
|
1258
|
+
*/
|
|
1259
|
+
interface IGizmos {
|
|
1260
|
+
/** The interface to start and manage measure tool interaction. */
|
|
1261
|
+
readonly measure: IMeasure;
|
|
1262
|
+
/** The section box gizmo. */
|
|
1263
|
+
readonly sectionBox: IWebglSectionBox;
|
|
1264
|
+
/** The camera orbit target gizmo. */
|
|
1265
|
+
readonly orbit: IGizmoOrbit;
|
|
1266
|
+
/** The axis gizmos of the viewer. */
|
|
1267
|
+
readonly axes: IGizmoAxes;
|
|
1268
|
+
/** The interface for adding and managing sprite markers in the scene. */
|
|
1269
|
+
readonly markers: IGizmoMarkers;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
interface IRaycastResult<T> {
|
|
1273
|
+
/** The model Object hit */
|
|
1274
|
+
object: T | undefined;
|
|
1275
|
+
/** The 3D world position of the hit point, in Z-up space (X = right, Y = forward, Z = up). */
|
|
1276
|
+
worldPosition: THREE.Vector3;
|
|
1277
|
+
/** The surface normal at the hit point, in Z-up space. */
|
|
1278
|
+
worldNormal: THREE.Vector3;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Interface for raycasting against a 3D scene.
|
|
1282
|
+
* @template T - The type of object to raycast against.
|
|
1283
|
+
*/
|
|
1284
|
+
interface IRaycaster<T> {
|
|
1285
|
+
/**
|
|
1286
|
+
* Raycasts from camera to the screen position to find the first object hit.
|
|
1287
|
+
* @param position - The screen position to raycast from.
|
|
1288
|
+
* @returns A promise that resolves to the raycast result, or undefined if no hit.
|
|
1289
|
+
*/
|
|
1290
|
+
raycastFromScreen(position: THREE.Vector2): Promise<IRaycastResult<T> | undefined>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Raycasts from camera to world position to find the first object hit.
|
|
1293
|
+
* @param position - The world position to raycast through (Z-up).
|
|
1294
|
+
* @returns A promise that resolves to the raycast result, or undefined if no hit.
|
|
1295
|
+
*/
|
|
1296
|
+
raycastFromWorld(position: THREE.Vector3): Promise<IRaycastResult<T> | undefined>;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* @module viw-webgl-viewer
|
|
1301
|
+
*/
|
|
1302
|
+
|
|
1303
|
+
type IWebglRaycastResult = IRaycastResult<ISelectable>;
|
|
1304
|
+
type IWebglRaycaster = IRaycaster<ISelectable>;
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
@module viw-webgl-viewer
|
|
1308
|
+
*/
|
|
1309
|
+
|
|
1310
|
+
/**
|
|
1311
|
+
* Public interface for the viewport.
|
|
1312
|
+
* Exposes only the members needed by API consumers.
|
|
1313
|
+
*/
|
|
1314
|
+
interface IWebglViewport {
|
|
1315
|
+
/** HTML Canvas on which the model is rendered. */
|
|
1316
|
+
readonly canvas: HTMLCanvasElement;
|
|
1317
|
+
/** The parent element of the canvas. */
|
|
1318
|
+
readonly parent: HTMLElement | null;
|
|
1319
|
+
/** Moves the canvas to a new parent element. */
|
|
1320
|
+
reparent(parent: HTMLElement): void;
|
|
1321
|
+
/** Returns the pixel size of the parent element. */
|
|
1322
|
+
getParentSize(): THREE.Vector2;
|
|
1323
|
+
/** Returns the pixel size of the canvas. */
|
|
1324
|
+
getSize(): THREE.Vector2;
|
|
1325
|
+
/** Returns the aspect ratio (width / height) of the parent element. */
|
|
1326
|
+
getAspectRatio(): number;
|
|
1327
|
+
/** Triggers a resize to match parent dimensions. */
|
|
1328
|
+
resizeToParent(): void;
|
|
1329
|
+
/** Signal dispatched when the canvas is reparented. */
|
|
1330
|
+
readonly onReparent: ISignal;
|
|
1331
|
+
/** Signal dispatched when the canvas is resized. */
|
|
1332
|
+
readonly onResize: ISignal;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* @module viw-webgl-viewer/inputs
|
|
1337
|
+
*/
|
|
1338
|
+
/**
|
|
1339
|
+
* Public API for keyboard input, accessed via `viewer.inputs.keyboard`.
|
|
1340
|
+
*
|
|
1341
|
+
* Supports per-key overrides with automatic restore, and an `active` toggle
|
|
1342
|
+
* to temporarily disable all keyboard handling (e.g., when a text input has focus).
|
|
1343
|
+
*
|
|
1344
|
+
* @example
|
|
1345
|
+
* ```ts
|
|
1346
|
+
* // Override the F key (key up)
|
|
1347
|
+
* const restore = viewer.inputs.keyboard.override('KeyF', 'up', () => myAction())
|
|
1348
|
+
* // Later: restore()
|
|
1349
|
+
*
|
|
1350
|
+
* // Chain with the original handler
|
|
1351
|
+
* viewer.inputs.keyboard.override('KeyF', 'up', (original) => {
|
|
1352
|
+
* original?.()
|
|
1353
|
+
* myExtraAction()
|
|
1354
|
+
* })
|
|
1355
|
+
*
|
|
1356
|
+
* // Disable keyboard while typing
|
|
1357
|
+
* viewer.inputs.keyboard.active = false
|
|
1358
|
+
* // Re-enable
|
|
1359
|
+
* viewer.inputs.keyboard.active = true
|
|
1360
|
+
* ```
|
|
1361
|
+
*/
|
|
1362
|
+
interface IKeyboardInput {
|
|
1363
|
+
/** Whether keyboard event listeners are active. Set to `false` to suspend all keyboard handling. */
|
|
1364
|
+
active: boolean;
|
|
1365
|
+
/**
|
|
1366
|
+
* Overrides a key handler. Returns a function that restores the previous handler.
|
|
1367
|
+
*
|
|
1368
|
+
* @param code - The `KeyboardEvent.code` (e.g., `'KeyF'`, `'Escape'`) or an array of codes.
|
|
1369
|
+
* @param on - Whether to intercept key `'down'` or `'up'` events.
|
|
1370
|
+
* @param handler - Callback invoked on the event. Receives the previous handler as `original`.
|
|
1371
|
+
* @returns A function that restores the previous handler when called.
|
|
1372
|
+
*/
|
|
1373
|
+
override(code: string | string[], on: 'down' | 'up', handler: (original?: () => void) => void): () => void;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* Drag tracking helper with zero-allocation delta calculation.
|
|
1378
|
+
*
|
|
1379
|
+
* Tracks pointer drag operations and calculates movement deltas
|
|
1380
|
+
* without creating new objects.
|
|
1381
|
+
*/
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Callback type for drag events.
|
|
1385
|
+
* @param delta - Movement delta since last frame (reusable vector - do not store!)
|
|
1386
|
+
* @param button - Button being dragged (0=left, 1=middle, 2=right)
|
|
1387
|
+
*/
|
|
1388
|
+
type DragCallback = (delta: THREE.Vector2, button: number) => void;
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Mouse and pointer input handler.
|
|
1392
|
+
*
|
|
1393
|
+
* See INPUT.md for architecture, coordinate systems, and performance patterns.
|
|
1394
|
+
*/
|
|
1395
|
+
|
|
1396
|
+
type ClickHandler = (position: THREE.Vector2, ctrl: boolean) => void;
|
|
1397
|
+
type DoubleClickHandler = (position: THREE.Vector2) => void;
|
|
1398
|
+
type PointerButtonHandler = (pos: THREE.Vector2, button: number) => void;
|
|
1399
|
+
type MoveHandler = (pos: THREE.Vector2) => void;
|
|
1400
|
+
type WheelHandler = (value: number, ctrl: boolean, clientX: number, clientY: number) => void;
|
|
1401
|
+
type ContextMenuHandler = (position: THREE.Vector2) => void;
|
|
1402
|
+
/**
|
|
1403
|
+
* Public API for mouse input, accessed via `viewer.inputs.mouse`.
|
|
1404
|
+
*
|
|
1405
|
+
* Supports overriding any mouse callback with automatic restore. Each override
|
|
1406
|
+
* handler receives the original callback as its first parameter for chaining.
|
|
1407
|
+
*
|
|
1408
|
+
* @example
|
|
1409
|
+
* ```ts
|
|
1410
|
+
* // Override click to add custom logic
|
|
1411
|
+
* const restore = viewer.inputs.mouse.override({
|
|
1412
|
+
* onClick: (original, pos, ctrl) => {
|
|
1413
|
+
* if (myCondition) myAction(pos)
|
|
1414
|
+
* else original(pos, ctrl)
|
|
1415
|
+
* }
|
|
1416
|
+
* })
|
|
1417
|
+
* // Later: restore()
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
interface IMouseInput {
|
|
1421
|
+
/** Whether mouse event listeners are active. Set to `false` to suspend all mouse handling. */
|
|
1422
|
+
active: boolean;
|
|
1423
|
+
/**
|
|
1424
|
+
* Temporarily overrides mouse callbacks. Only provided handlers are replaced;
|
|
1425
|
+
* others keep their current behavior. Each handler receives the original as its first param.
|
|
1426
|
+
*
|
|
1427
|
+
* @param handlers - Partial set of callbacks to override.
|
|
1428
|
+
* @returns A function that restores all overridden callbacks when called.
|
|
1429
|
+
*/
|
|
1430
|
+
override(handlers: MouseOverrides): () => void;
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Partial set of mouse callbacks for use with {@link IMouseInput.override}.
|
|
1434
|
+
* Each handler receives the original callback as its first parameter.
|
|
1435
|
+
* All positions are canvas-relative, normalized to [0, 1].
|
|
1436
|
+
*/
|
|
1437
|
+
type MouseOverrides = {
|
|
1438
|
+
onClick?: (original: ClickHandler, pos: THREE.Vector2, ctrl: boolean) => void;
|
|
1439
|
+
onDoubleClick?: (original: DoubleClickHandler, pos: THREE.Vector2) => void;
|
|
1440
|
+
onDrag?: (original: DragCallback, delta: THREE.Vector2, button: number) => void;
|
|
1441
|
+
onPointerDown?: (original: PointerButtonHandler, pos: THREE.Vector2, button: number) => void;
|
|
1442
|
+
onPointerUp?: (original: PointerButtonHandler, pos: THREE.Vector2, button: number) => void;
|
|
1443
|
+
onPointerMove?: (original: MoveHandler, pos: THREE.Vector2) => void;
|
|
1444
|
+
onWheel?: (original: WheelHandler, value: number, ctrl: boolean, clientX: number, clientY: number) => void;
|
|
1445
|
+
onContextMenu?: (original: ContextMenuHandler, pos: THREE.Vector2) => void;
|
|
1446
|
+
};
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1449
|
+
* Touch input handler with support for tap, pinch, and pan gestures.
|
|
1450
|
+
*
|
|
1451
|
+
* See INPUT.md for gesture recognition, state management, and performance patterns.
|
|
1452
|
+
*/
|
|
1453
|
+
|
|
1454
|
+
type TapHandler = (position: THREE.Vector2) => void;
|
|
1455
|
+
type DragHandler = (delta: THREE.Vector2) => void;
|
|
1456
|
+
type PinchStartHandler = (screenCenter: THREE.Vector2) => void;
|
|
1457
|
+
type PinchHandler = (totalRatio: number) => void;
|
|
1458
|
+
/**
|
|
1459
|
+
* Public API for touch input, accessed via `viewer.inputs.touch`.
|
|
1460
|
+
*
|
|
1461
|
+
* Supports overriding any touch callback with automatic restore. Each override
|
|
1462
|
+
* handler receives the original callback as its first parameter for chaining.
|
|
1463
|
+
*
|
|
1464
|
+
* @example
|
|
1465
|
+
* ```ts
|
|
1466
|
+
* const restore = viewer.inputs.touch.override({
|
|
1467
|
+
* onTap: (original, pos) => { myAction(pos) }
|
|
1468
|
+
* })
|
|
1469
|
+
* // Later: restore()
|
|
1470
|
+
* ```
|
|
1471
|
+
*/
|
|
1472
|
+
interface ITouchInput {
|
|
1473
|
+
/** Whether touch event listeners are active. Set to `false` to suspend all touch handling. */
|
|
1474
|
+
active: boolean;
|
|
1475
|
+
/**
|
|
1476
|
+
* Temporarily overrides touch callbacks. Only provided handlers are replaced;
|
|
1477
|
+
* others keep their current behavior. Each handler receives the original as its first param.
|
|
1478
|
+
*
|
|
1479
|
+
* @param handlers - Partial set of callbacks to override.
|
|
1480
|
+
* @returns A function that restores all overridden callbacks when called.
|
|
1481
|
+
*/
|
|
1482
|
+
override(handlers: TouchOverrides): () => void;
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Partial set of touch callbacks for use with {@link ITouchInput.override}.
|
|
1486
|
+
* Each handler receives the original callback as its first parameter.
|
|
1487
|
+
* All positions are canvas-relative, normalized to [0, 1].
|
|
1488
|
+
*/
|
|
1489
|
+
type TouchOverrides = {
|
|
1490
|
+
/** Single-finger tap. */
|
|
1491
|
+
onTap?: (original: TapHandler, pos: THREE.Vector2) => void;
|
|
1492
|
+
/** Double tap. */
|
|
1493
|
+
onDoubleTap?: (original: TapHandler, pos: THREE.Vector2) => void;
|
|
1494
|
+
/** Single-finger drag. Delta is normalized to canvas size. */
|
|
1495
|
+
onDrag?: (original: DragHandler, delta: THREE.Vector2) => void;
|
|
1496
|
+
/** Two-finger drag (pan). Delta is normalized to canvas size. */
|
|
1497
|
+
onDoubleDrag?: (original: DragHandler, delta: THREE.Vector2) => void;
|
|
1498
|
+
/** Two-finger pinch/spread started. Center is canvas-relative position. */
|
|
1499
|
+
onPinchStart?: (original: PinchStartHandler, center: THREE.Vector2) => void;
|
|
1500
|
+
/** Two-finger pinch/spread. Ratio is cumulative distance relative to start (1.0 = no change). */
|
|
1501
|
+
onPinchOrSpread?: (original: PinchHandler, ratio: number) => void;
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* Input coordinator that routes device events to viewer-specific adapters.
|
|
1506
|
+
*
|
|
1507
|
+
* See INPUT.md for architecture, pointer modes, and customization patterns.
|
|
1508
|
+
*/
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* Determines how left-drag (mouse) or single-finger drag (touch) is interpreted.
|
|
1512
|
+
*
|
|
1513
|
+
* - `ORBIT` — Rotate camera around its target point.
|
|
1514
|
+
* - `LOOK` — Rotate camera in place (first-person).
|
|
1515
|
+
* - `PAN` — Slide camera laterally.
|
|
1516
|
+
* - `ZOOM` — Dolly camera forward/backward.
|
|
1517
|
+
* - `RECT` — Rectangle selection (reserved).
|
|
1518
|
+
*/
|
|
1519
|
+
declare enum PointerMode {
|
|
1520
|
+
ORBIT = "orbit",
|
|
1521
|
+
LOOK = "look",
|
|
1522
|
+
PAN = "pan",
|
|
1523
|
+
ZOOM = "zoom",
|
|
1524
|
+
RECT = "rect"
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Public API for the input system, accessed via `viewer.inputs`.
|
|
1528
|
+
*
|
|
1529
|
+
* Provides access to the three device handlers (keyboard, mouse, touch),
|
|
1530
|
+
* pointer mode control, and speed settings.
|
|
1531
|
+
*
|
|
1532
|
+
* @example
|
|
1533
|
+
* ```ts
|
|
1534
|
+
* // Change pointer mode to pan
|
|
1535
|
+
* viewer.inputs.pointerMode = PointerMode.PAN
|
|
1536
|
+
*
|
|
1537
|
+
* // Override a keyboard binding
|
|
1538
|
+
* const restore = viewer.inputs.keyboard.override('KeyF', 'up', () => myFrameLogic())
|
|
1539
|
+
* // Later: restore()
|
|
1540
|
+
*
|
|
1541
|
+
* // Override mouse click behavior
|
|
1542
|
+
* const restore = viewer.inputs.mouse.override({
|
|
1543
|
+
* onClick: (original, pos, ctrl) => { myLogic(pos); original(pos, ctrl) }
|
|
1544
|
+
* })
|
|
1545
|
+
* ```
|
|
1546
|
+
*/
|
|
1547
|
+
interface IInputHandler {
|
|
1548
|
+
/** Keyboard input handler. Override key bindings via {@link IKeyboardInput.override}. */
|
|
1549
|
+
keyboard: IKeyboardInput;
|
|
1550
|
+
/** Mouse input handler. Override callbacks via {@link IMouseInput.override}. */
|
|
1551
|
+
mouse: IMouseInput;
|
|
1552
|
+
/** Touch input handler. Override callbacks via {@link ITouchInput.override}. */
|
|
1553
|
+
touch: ITouchInput;
|
|
1554
|
+
/** The active pointer mode controlling how left-drag is interpreted. */
|
|
1555
|
+
pointerMode: PointerMode;
|
|
1556
|
+
/** Temporary pointer mode during drag (e.g., right-drag = LOOK). Read-only. */
|
|
1557
|
+
readonly pointerOverride: PointerMode | undefined;
|
|
1558
|
+
/** Fires when {@link pointerMode} or {@link pointerOverride} changes. */
|
|
1559
|
+
readonly onPointerModeChanged: ISignal;
|
|
1560
|
+
/** WASD move speed. Exponential scale: actual speed = 1.25^moveSpeed. Range: [-10, +10]. */
|
|
1561
|
+
moveSpeed: number;
|
|
1562
|
+
/** Scroll wheel zoom speed. Higher = faster zoom per scroll tick. */
|
|
1563
|
+
scrollSpeed: number;
|
|
1564
|
+
/** Fires when any speed setting changes (moveSpeed, scrollSpeed). */
|
|
1565
|
+
readonly onSettingsChanged: ISignal;
|
|
1566
|
+
/** Fires when a right-click context menu should be shown. Payload is client-space position. */
|
|
1567
|
+
readonly onContextMenu: ISimpleEvent<THREE.Vector2 | undefined>;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
/** Creates a headers object with a Bearer authorization token. */
|
|
1571
|
+
declare function authHeaders(token: string): Record<string, string>;
|
|
1572
|
+
|
|
1573
|
+
/**
|
|
1574
|
+
* @module viw-webgl-viewer/rendering
|
|
1575
|
+
*/
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* Public interface for section box management.
|
|
1579
|
+
* Exposes only the members needed by API consumers.
|
|
1580
|
+
*/
|
|
1581
|
+
interface IRenderingSection {
|
|
1582
|
+
readonly box: THREE.Box3;
|
|
1583
|
+
fitBox(box: THREE.Box3): void;
|
|
1584
|
+
active: boolean;
|
|
1585
|
+
readonly clippingPlanes: THREE.Plane[];
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/**
|
|
1589
|
+
* @module viw-webgl-viewer/rendering
|
|
1590
|
+
*/
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Public interface for the WebGL renderer.
|
|
1594
|
+
* Exposes only the members needed by API consumers.
|
|
1595
|
+
*/
|
|
1596
|
+
interface IWebglRenderer {
|
|
1597
|
+
/** The THREE WebGL renderer. */
|
|
1598
|
+
readonly three: THREE.WebGLRenderer;
|
|
1599
|
+
/** Interface to interact with section box directly without using the gizmo. */
|
|
1600
|
+
readonly section: IRenderingSection;
|
|
1601
|
+
/** Whether a re-render has been requested for the current frame. */
|
|
1602
|
+
readonly needsUpdate: boolean;
|
|
1603
|
+
/**
|
|
1604
|
+
* Flags the scene as dirty so it will be re-rendered on the next animation frame.
|
|
1605
|
+
* Selection, visibility, camera, and material changes call this automatically.
|
|
1606
|
+
* Only needed when making direct Three.js changes the renderer can't detect.
|
|
1607
|
+
*/
|
|
1608
|
+
requestRender(): void;
|
|
1609
|
+
/**
|
|
1610
|
+
* Immediately renders the current frame.
|
|
1611
|
+
* For screenshots: call `requestRender()`, then `render()`, then read `canvas.toDataURL()`.
|
|
1612
|
+
*/
|
|
1613
|
+
render(): void;
|
|
1614
|
+
/** Gets or sets the background color or texture of the scene. */
|
|
1615
|
+
background: THREE.Color | THREE.Texture;
|
|
1616
|
+
/** Gets or sets the material used to render models. */
|
|
1617
|
+
modelMaterial: MaterialSet;
|
|
1618
|
+
/** The target MSAA sample count. Higher = better quality. */
|
|
1619
|
+
samples: number;
|
|
1620
|
+
/** Scale factor for outline/selection render target resolution (0-1). */
|
|
1621
|
+
outlineScale: number;
|
|
1622
|
+
/** Signal dispatched once per render frame if the scene was updated. */
|
|
1623
|
+
readonly onSceneUpdated: ISignal;
|
|
1624
|
+
/** Signal dispatched when bounding box is updated. */
|
|
1625
|
+
readonly onBoxUpdated: ISignal;
|
|
1626
|
+
/** Whether text rendering is enabled. */
|
|
1627
|
+
textEnabled: boolean;
|
|
1628
|
+
/** Instance count below which ghosted meshes are hidden entirely. */
|
|
1629
|
+
smallGhostThreshold: number;
|
|
1630
|
+
/** Returns the bounding box encompassing all rendered objects. */
|
|
1631
|
+
getBoundingBox(target?: THREE.Box3): THREE.Box3 | undefined;
|
|
1632
|
+
/** When true (default), only renders when dirty (`requestRender()` was called). When false, renders every frame. */
|
|
1633
|
+
autoRender: boolean;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
/**
|
|
1637
|
+
@module viw-webgl-viewer
|
|
1638
|
+
*/
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* Public interface for the WebGL viewer.
|
|
1642
|
+
* Consumers should use this instead of the concrete class.
|
|
1643
|
+
*
|
|
1644
|
+
* **Lifecycle:** Call `load()` to add VIM models (auto-populates `vims`),
|
|
1645
|
+
* `unload(vim)` to remove one, `clear()` to remove all, and `dispose()` to
|
|
1646
|
+
* tear down the viewer entirely. Do not call `dispose()` on individual vims —
|
|
1647
|
+
* always go through `unload()`.
|
|
1648
|
+
*
|
|
1649
|
+
* @example
|
|
1650
|
+
* ```ts
|
|
1651
|
+
* const viewer = Core.Webgl.createViewer()
|
|
1652
|
+
* const vim = await viewer.load({ url: 'model.vim' }).getVim()
|
|
1653
|
+
* console.log(viewer.vims.length) // 1
|
|
1654
|
+
*
|
|
1655
|
+
* viewer.unload(vim) // Remove one vim
|
|
1656
|
+
* viewer.clear() // Remove all vims
|
|
1657
|
+
* viewer.dispose() // Tear down viewer
|
|
1658
|
+
* ```
|
|
1659
|
+
*/
|
|
1660
|
+
interface IWebglViewer {
|
|
1661
|
+
readonly type: 'webgl';
|
|
1662
|
+
readonly settings: ViewerSettings;
|
|
1663
|
+
readonly renderer: IWebglRenderer;
|
|
1664
|
+
readonly viewport: IWebglViewport;
|
|
1665
|
+
readonly selection: IWebglSelection;
|
|
1666
|
+
readonly inputs: IInputHandler;
|
|
1667
|
+
readonly raycaster: IWebglRaycaster;
|
|
1668
|
+
readonly materials: IMaterials;
|
|
1669
|
+
readonly camera: IWebglCamera;
|
|
1670
|
+
readonly gizmos: IGizmos;
|
|
1671
|
+
/** Fires when a vim finishes loading and is added to the scene. */
|
|
1672
|
+
readonly onVimLoaded: ISignal;
|
|
1673
|
+
/** All loaded VIM models. Auto-populated on load, auto-removed on unload. */
|
|
1674
|
+
readonly vims: IWebglVim[];
|
|
1675
|
+
/** Loads a VIM file. The resulting vim is added to `vims` on success. */
|
|
1676
|
+
load(source: RequestSource, settings?: VimPartialSettings): IWebglLoadRequest;
|
|
1677
|
+
/** Removes a vim from the viewer and disposes its resources. */
|
|
1678
|
+
unload(vim: IWebglVim): void;
|
|
1679
|
+
/** Removes and disposes all loaded vims. */
|
|
1680
|
+
clear(): void;
|
|
1681
|
+
/** Tears down the viewer entirely — releases WebGL context, DOM elements, and all resources. */
|
|
1682
|
+
dispose(): void;
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Creates a headless WebGL viewer without React UI.
|
|
1686
|
+
* Use this for programmatic-only usage or custom UI frameworks.
|
|
1687
|
+
* For a full React UI viewer, use `React.Webgl.createViewer()` instead.
|
|
1688
|
+
*
|
|
1689
|
+
* @param settings - Optional renderer config (camera, materials, lighting). See {@link ViewerSettings}.
|
|
1690
|
+
* @returns A new WebGL viewer.
|
|
1691
|
+
*
|
|
1692
|
+
* @example
|
|
1693
|
+
* const viewer = Core.Webgl.createViewer({ camera: { orthographic: true } })
|
|
1694
|
+
* document.body.appendChild(viewer.viewport.canvas)
|
|
1695
|
+
* const vim = await viewer.load({ url: 'model.vim' }).getVim()
|
|
1696
|
+
*/
|
|
1697
|
+
declare function createCoreWebglViewer(settings?: PartialViewerSettings): IWebglViewer;
|
|
1698
|
+
|
|
1699
|
+
declare namespace Core_Webgl {
|
|
1700
|
+
export { MaterialSet, createCoreWebglViewer as createViewer, isElement3D };
|
|
1701
|
+
export type { AxesSettings, ICameraMovement, IElement3D, IGizmoAxes, IGizmoMarkers, IGizmoOrbit, IGizmos, IMarker, IMaterials, IMeasure, IRenderingSection, IScene, ISelectable, ISubset, IWebglCamera, IWebglLoadRequest, IWebglRaycastResult, IWebglRaycaster, IWebglRenderer, IWebglSectionBox, IWebglSelection, IWebglViewport, IWebglVim, MaterialSettings, MeasureStage, PartialViewerSettings, RequestSource, SubsetFilter, TransparencyMode, IWebglViewer as Viewer, ViewerSettings, VimPartialSettings, VimSettings };
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* Public interface for an Ultra Vim's scene.
|
|
1706
|
+
* Provides cached geometry information and spatial queries.
|
|
1707
|
+
*/
|
|
1708
|
+
interface IUltraScene {
|
|
1709
|
+
/** Bounding box of the loaded geometry in Z-up world space (X = right, Y = forward, Z = up). Undefined before load or if empty. */
|
|
1710
|
+
getBoundingBox(): THREE.Box3 | undefined;
|
|
1711
|
+
/** Returns elements whose bounding boxes intersect the given box. Box coordinates are in Z-up world space. */
|
|
1712
|
+
getObjectsInBox(box: THREE.Box3): IUltraElement3D[];
|
|
1713
|
+
/** Returns the combined bounding box for the given elements (or all), in Z-up world space. */
|
|
1714
|
+
getBoundingBoxForElements(elements: number[] | 'all'): Promise<THREE.Box3 | undefined>;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
type VimRequestErrorType = 'loadingError' | 'downloadingError' | 'serverDisconnected' | 'unknown' | 'cancelled';
|
|
1718
|
+
interface IUltraLoadError extends ILoadError {
|
|
1719
|
+
readonly type: VimRequestErrorType;
|
|
1720
|
+
}
|
|
1721
|
+
type IUltraLoadRequest = ILoadRequest<IUltraVim, IUltraLoadError>;
|
|
1722
|
+
|
|
1723
|
+
/**
|
|
1724
|
+
* Describes the source location and optional authentication for loading a VIM file.
|
|
1725
|
+
*/
|
|
1726
|
+
type VimSource = {
|
|
1727
|
+
/**
|
|
1728
|
+
* URL to the VIM file.
|
|
1729
|
+
* Can be a local path (file://) or remote URL (http:// or https://).
|
|
1730
|
+
*/
|
|
1731
|
+
url: string;
|
|
1732
|
+
/**
|
|
1733
|
+
* Optional HTTP headers for authentication and other purposes.
|
|
1734
|
+
* Use {@link authHeaders} to create Bearer token headers.
|
|
1735
|
+
*/
|
|
1736
|
+
headers?: Record<string, string>;
|
|
1737
|
+
};
|
|
1738
|
+
/**
|
|
1739
|
+
* Represents the loading state and progress for a single vim.
|
|
1740
|
+
*/
|
|
1741
|
+
type VimLoadingState = {
|
|
1742
|
+
/**
|
|
1743
|
+
* Current loading status.
|
|
1744
|
+
*/
|
|
1745
|
+
status: VimLoadingStatus;
|
|
1746
|
+
/**
|
|
1747
|
+
* Loading progress as a percentage from 0 to 100.
|
|
1748
|
+
*/
|
|
1749
|
+
progress: number;
|
|
1750
|
+
};
|
|
1751
|
+
/**
|
|
1752
|
+
* Defines supported input modes for camera control in the viewer.
|
|
1753
|
+
*/
|
|
1754
|
+
declare enum InputMode {
|
|
1755
|
+
/**
|
|
1756
|
+
* Orbit mode — rotates around a fixed point.
|
|
1757
|
+
*/
|
|
1758
|
+
Orbit = "orbit",
|
|
1759
|
+
/**
|
|
1760
|
+
* Free mode — allows unrestricted movement.
|
|
1761
|
+
*/
|
|
1762
|
+
Free = "free"
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Scene-wide rendering and lighting configuration options.
|
|
1766
|
+
*/
|
|
1767
|
+
type SceneSettings = {
|
|
1768
|
+
/**
|
|
1769
|
+
* White point for tone mapping (clamped between 0 and 1).
|
|
1770
|
+
*/
|
|
1771
|
+
toneMappingWhitePoint: number;
|
|
1772
|
+
/**
|
|
1773
|
+
* Global HDR intensity multiplier (floored to 0).
|
|
1774
|
+
*/
|
|
1775
|
+
hdrScale: number;
|
|
1776
|
+
/**
|
|
1777
|
+
* HDR scale for the background (clamped between 0 and 1).
|
|
1778
|
+
*/
|
|
1779
|
+
hdrBackgroundScale: number;
|
|
1780
|
+
/**
|
|
1781
|
+
* Background saturation (clamped between 0 and 1).
|
|
1782
|
+
*/
|
|
1783
|
+
hdrBackgroundSaturation: number;
|
|
1784
|
+
/**
|
|
1785
|
+
* Background blur strength (clamped between 0 and 1).
|
|
1786
|
+
*/
|
|
1787
|
+
backgroundBlur: number;
|
|
1788
|
+
/**
|
|
1789
|
+
* Background color in linear RGB format.
|
|
1790
|
+
*/
|
|
1791
|
+
backgroundColor: THREE.Color;
|
|
1792
|
+
};
|
|
1793
|
+
/**
|
|
1794
|
+
* Default scene settings used when none are explicitly provided.
|
|
1795
|
+
*/
|
|
1796
|
+
declare const defaultSceneSettings: SceneSettings;
|
|
1797
|
+
/**
|
|
1798
|
+
* Enumerates the possible states of VIM file loading.
|
|
1799
|
+
*/
|
|
1800
|
+
declare enum VimLoadingStatus {
|
|
1801
|
+
/**
|
|
1802
|
+
* No known loading activity.
|
|
1803
|
+
*/
|
|
1804
|
+
Unknown = 0,
|
|
1805
|
+
/**
|
|
1806
|
+
* Actively loading VIM data.
|
|
1807
|
+
*/
|
|
1808
|
+
Loading = 1,
|
|
1809
|
+
/**
|
|
1810
|
+
* Downloading VIM file from a remote source.
|
|
1811
|
+
*/
|
|
1812
|
+
Downloading = 2,
|
|
1813
|
+
/**
|
|
1814
|
+
* Load completed successfully.
|
|
1815
|
+
*/
|
|
1816
|
+
Done = 3,
|
|
1817
|
+
/**
|
|
1818
|
+
* Download failed (e.g., due to network or permission issues).
|
|
1819
|
+
*/
|
|
1820
|
+
FailedToDownload = 4,
|
|
1821
|
+
/**
|
|
1822
|
+
* VIM file could not be parsed or initialized correctly.
|
|
1823
|
+
*/
|
|
1824
|
+
FailedToLoad = 5
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* Public interface for an Ultra Vim model (server-side rendered).
|
|
1829
|
+
* Provides access to elements, visibility state, and scene queries.
|
|
1830
|
+
*
|
|
1831
|
+
* **Cleanup:** Do not call dispose directly — use `viewer.unload(vim)`.
|
|
1832
|
+
*
|
|
1833
|
+
* @example
|
|
1834
|
+
* ```ts
|
|
1835
|
+
* const vim = await viewer.load({ url: 'model.vim' }).getVim()
|
|
1836
|
+
*
|
|
1837
|
+
* // Query elements
|
|
1838
|
+
* const element = vim.getElementFromIndex(301)
|
|
1839
|
+
* element.visible = false
|
|
1840
|
+
* element.outline = true
|
|
1841
|
+
* element.ghosted = true
|
|
1842
|
+
* element.color = new THREE.Color(0xff0000)
|
|
1843
|
+
*
|
|
1844
|
+
* // Scene queries
|
|
1845
|
+
* const box = vim.scene.getBoundingBox()
|
|
1846
|
+
*
|
|
1847
|
+
* // Cleanup
|
|
1848
|
+
* viewer.unload(vim)
|
|
1849
|
+
* ```
|
|
1850
|
+
*/
|
|
1851
|
+
interface IUltraVim extends IVim<IUltraElement3D> {
|
|
1852
|
+
readonly type: 'ultra';
|
|
1853
|
+
/** The source URL and headers this vim was loaded from. */
|
|
1854
|
+
readonly source: VimSource;
|
|
1855
|
+
/** Scene providing bounding box and spatial queries. */
|
|
1856
|
+
readonly scene: IUltraScene;
|
|
1857
|
+
/** The server-side handle for this vim. */
|
|
1858
|
+
readonly handle: number;
|
|
1859
|
+
/** Whether this vim is currently connected to the server. */
|
|
1860
|
+
readonly connected: boolean;
|
|
1861
|
+
/** Reconnects this vim to the server. */
|
|
1862
|
+
connect(): IUltraLoadRequest;
|
|
1863
|
+
/** Disconnects this vim from the server. */
|
|
1864
|
+
disconnect(): void;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* Public interface for an Ultra 3D element.
|
|
1869
|
+
* Provides visual state control (visibility, outline, color) and bounding box queries.
|
|
1870
|
+
*
|
|
1871
|
+
* **WebGL vs Ultra parity:** Ultra elements do NOT expose BIM data methods
|
|
1872
|
+
* (`getBimElement`, `getBimParameters`), geometry metadata (`hasMesh`, `isRoom`,
|
|
1873
|
+
* `elementId`, `instances`), or `getCenter()`. The Ultra viewer renders server-side,
|
|
1874
|
+
* so BIM data is not available on the client. For BIM queries, use the WebGL viewer.
|
|
1875
|
+
*
|
|
1876
|
+
* @example
|
|
1877
|
+
* ```ts
|
|
1878
|
+
* element.visible = false // Hide
|
|
1879
|
+
* element.outline = true // Highlight
|
|
1880
|
+
* element.ghosted = true // Ghosted appearance
|
|
1881
|
+
* element.color = new THREE.Color(0xff0000) // Override color
|
|
1882
|
+
* const box = await element.getBoundingBox() // Get bounding box
|
|
1883
|
+
* ```
|
|
1884
|
+
*/
|
|
1885
|
+
interface IUltraElement3D extends IVimElement {
|
|
1886
|
+
/** The parent vim this element belongs to. */
|
|
1887
|
+
readonly vim: IUltraVim;
|
|
1888
|
+
/** The BIM element index. */
|
|
1889
|
+
readonly element: number;
|
|
1890
|
+
/** The handle of the parent vim on the server. */
|
|
1891
|
+
readonly vimHandle: number;
|
|
1892
|
+
/** Whether the element is visible (not hidden). Preserves highlight state. */
|
|
1893
|
+
visible: boolean;
|
|
1894
|
+
/** Whether the element has an outline highlight. Preserves visibility state. */
|
|
1895
|
+
outline: boolean;
|
|
1896
|
+
/** Whether the element is rendered as a ghost. Preserves highlight state. */
|
|
1897
|
+
ghosted: boolean;
|
|
1898
|
+
/** The display color override. Set to undefined to revert to default. */
|
|
1899
|
+
color: THREE.Color | undefined;
|
|
1900
|
+
/** Retrieves the bounding box in Z-up world space (X = right, Y = forward, Z = up), or undefined if the element is abstract. */
|
|
1901
|
+
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
declare class Segment {
|
|
1905
|
+
origin: THREE.Vector3;
|
|
1906
|
+
target: THREE.Vector3;
|
|
1907
|
+
constructor(origin?: THREE.Vector3, target?: THREE.Vector3);
|
|
1908
|
+
static fromArray(array: number[]): Segment;
|
|
1909
|
+
toArray(): number[];
|
|
1910
|
+
isValid(): boolean;
|
|
1911
|
+
equals(segment: Segment): boolean;
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* Camera movement operations obtained via `camera.snap()` or `camera.lerp(duration)`.
|
|
1916
|
+
*
|
|
1917
|
+
* All positions use **Z-up**: X = right, Y = forward, Z = up.
|
|
1918
|
+
*
|
|
1919
|
+
* @example
|
|
1920
|
+
* ```ts
|
|
1921
|
+
* camera.lerp(1).frame(element) // Animated frame
|
|
1922
|
+
* camera.snap().set(position, target) // Instant position/target
|
|
1923
|
+
* camera.lerp(0.5).frame('all') // Animated frame all
|
|
1924
|
+
* ```
|
|
1925
|
+
*/
|
|
1926
|
+
interface IUltraCameraMovement {
|
|
1927
|
+
/**
|
|
1928
|
+
* Frames the camera to fit the specified target.
|
|
1929
|
+
* @param target - Element, vim, bounding box, or 'all' to frame everything.
|
|
1930
|
+
*/
|
|
1931
|
+
frame(target: IUltraElement3D | IUltraVim | THREE.Box3 | 'all'): Promise<Segment | undefined>;
|
|
1932
|
+
/**
|
|
1933
|
+
* Sets the camera position and target.
|
|
1934
|
+
* @param position - The new camera position (Z-up).
|
|
1935
|
+
* @param target - The new look-at target (Z-up).
|
|
1936
|
+
*/
|
|
1937
|
+
set(position: THREE.Vector3, target: THREE.Vector3): void;
|
|
1938
|
+
/**
|
|
1939
|
+
* Resets the camera to its last saved position.
|
|
1940
|
+
*/
|
|
1941
|
+
reset(): void;
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Public interface for the Ultra camera.
|
|
1945
|
+
* Uses the same snap/lerp pattern as the WebGL camera.
|
|
1946
|
+
*/
|
|
1947
|
+
interface IUltraCamera {
|
|
1948
|
+
/**
|
|
1949
|
+
* Returns a camera movement interface that executes instantly (blendTime = 0).
|
|
1950
|
+
*/
|
|
1951
|
+
snap(): IUltraCameraMovement;
|
|
1952
|
+
/**
|
|
1953
|
+
* Returns a camera movement interface that animates over the given duration.
|
|
1954
|
+
* @param duration - Animation duration in seconds. Defaults to 0.5.
|
|
1955
|
+
*/
|
|
1956
|
+
lerp(duration?: number): IUltraCameraMovement;
|
|
1957
|
+
/**
|
|
1958
|
+
* Saves the current camera position for later restoration via `reset()`.
|
|
1959
|
+
* @param segment - Optional specific camera position to save.
|
|
1960
|
+
*/
|
|
1961
|
+
save(segment?: Segment): void;
|
|
1962
|
+
/**
|
|
1963
|
+
* Controls the rendering state of the viewer.
|
|
1964
|
+
* @param value - True to pause, false to resume rendering.
|
|
1965
|
+
*/
|
|
1966
|
+
pause(value: boolean): void;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* Interface defining the basic decoder operations
|
|
1971
|
+
*/
|
|
1972
|
+
interface IUltraDecoder {
|
|
1973
|
+
/** Indicates if the decoder is ready to process frames */
|
|
1974
|
+
ready: boolean;
|
|
1975
|
+
/** Indicates if the decoder is currently paused */
|
|
1976
|
+
paused: boolean;
|
|
1977
|
+
/** Stops the decoder operations */
|
|
1978
|
+
stop(): void;
|
|
1979
|
+
/** Starts the decoder operations */
|
|
1980
|
+
start(): void;
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
interface ILogger {
|
|
1984
|
+
log(message: string, obj?: any): void;
|
|
1985
|
+
error(message: string, e: unknown): void;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
type IUltraRaycastResult = IRaycastResult<IUltraElement3D>;
|
|
1989
|
+
type IUltraRaycaster = IRaycaster<IUltraElement3D>;
|
|
1990
|
+
|
|
1991
|
+
/**
|
|
1992
|
+
* Render settings that extend SceneSettings with additional rendering-specific properties
|
|
1993
|
+
*/
|
|
1994
|
+
type RenderSettings = SceneSettings & {
|
|
1995
|
+
/** Color used for ghost/transparent rendering */
|
|
1996
|
+
ghostColor: THREE.Color;
|
|
1997
|
+
ghostOpacity: number;
|
|
1998
|
+
};
|
|
1999
|
+
/**
|
|
2000
|
+
* Default rendering settings
|
|
2001
|
+
*/
|
|
2002
|
+
declare const defaultRenderSettings: RenderSettings;
|
|
2003
|
+
/**
|
|
2004
|
+
* Interface defining the basic renderer capabilities
|
|
2005
|
+
*/
|
|
2006
|
+
interface IUltraRenderer {
|
|
2007
|
+
onSceneUpdated: ISignal;
|
|
2008
|
+
ghostColor: THREE.Color;
|
|
2009
|
+
ghostOpacity: number;
|
|
2010
|
+
hdrScale: number;
|
|
2011
|
+
toneMappingWhitePoint: number;
|
|
2012
|
+
hdrBackgroundScale: number;
|
|
2013
|
+
hdrBackgroundSaturation: number;
|
|
2014
|
+
backgroundBlur: number;
|
|
2015
|
+
backgroundColor: THREE.Color;
|
|
2016
|
+
getBoundingBox(): Promise<THREE.Box3 | undefined>;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
/**
|
|
2020
|
+
* Public interface for the Ultra section box.
|
|
2021
|
+
* Controls clipping, visibility, and interactivity of the section box.
|
|
2022
|
+
*
|
|
2023
|
+
* @example
|
|
2024
|
+
* ```ts
|
|
2025
|
+
* const sb = viewer.sectionBox
|
|
2026
|
+
* sb.active = true // Enable clipping
|
|
2027
|
+
* sb.visible = true // Show gizmo
|
|
2028
|
+
* sb.setBox(await vim.getBoundingBox()) // Fit to model
|
|
2029
|
+
* ```
|
|
2030
|
+
*/
|
|
2031
|
+
interface IUltraSectionBox {
|
|
2032
|
+
readonly onUpdate: ISignal;
|
|
2033
|
+
visible: boolean;
|
|
2034
|
+
interactive: boolean;
|
|
2035
|
+
active: boolean;
|
|
2036
|
+
setBox(box: THREE.Box3): void;
|
|
2037
|
+
getBox(): THREE.Box3 | undefined;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
type IUltraSelection = ISelection<IUltraElement3D>;
|
|
2041
|
+
|
|
2042
|
+
type ConnectionSettings = {
|
|
2043
|
+
url?: string;
|
|
2044
|
+
retries?: number;
|
|
2045
|
+
timeout?: number;
|
|
2046
|
+
retryDelay?: number;
|
|
2047
|
+
};
|
|
2048
|
+
type ClientState = ClientStateConnecting | ClientStateConnected | ClientStateDisconnected | ClientStateValidating | ClientError;
|
|
2049
|
+
type ClientError = ClientStateCompatibilityError | ClientStateConnectionError | ClientStateStreamError;
|
|
2050
|
+
type ClientStateConnecting = {
|
|
2051
|
+
status: 'connecting';
|
|
2052
|
+
};
|
|
2053
|
+
type ClientStateValidating = {
|
|
2054
|
+
status: 'validating';
|
|
2055
|
+
};
|
|
2056
|
+
type ClientStateConnected = {
|
|
2057
|
+
status: 'connected';
|
|
2058
|
+
};
|
|
2059
|
+
type ClientStateDisconnected = {
|
|
2060
|
+
status: 'disconnected';
|
|
2061
|
+
};
|
|
2062
|
+
type ClientStateCompatibilityError = {
|
|
2063
|
+
status: 'error';
|
|
2064
|
+
error: 'compatibility';
|
|
2065
|
+
serverUrl: string;
|
|
2066
|
+
serverVersion: string;
|
|
2067
|
+
clientVersion: string;
|
|
2068
|
+
};
|
|
2069
|
+
type ClientStateConnectionError = {
|
|
2070
|
+
status: 'error';
|
|
2071
|
+
error: 'connection';
|
|
2072
|
+
serverUrl: string;
|
|
2073
|
+
};
|
|
2074
|
+
type ClientStateStreamError = {
|
|
2075
|
+
status: 'error';
|
|
2076
|
+
error: 'stream';
|
|
2077
|
+
serverUrl: string;
|
|
2078
|
+
details: string;
|
|
2079
|
+
};
|
|
2080
|
+
|
|
2081
|
+
/**
|
|
2082
|
+
* Interface defining viewport functionality
|
|
2083
|
+
*/
|
|
2084
|
+
interface IUltraViewport {
|
|
2085
|
+
/** The HTML canvas element used for rendering */
|
|
2086
|
+
canvas: HTMLCanvasElement;
|
|
2087
|
+
/** Updates the aspect ratio of the viewport on the server */
|
|
2088
|
+
update(): void;
|
|
2089
|
+
/** Resizes the viewport to match its parent's dimensions */
|
|
2090
|
+
resizeToParent(): void;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
declare const INVALID_HANDLE = 4294967295;
|
|
2094
|
+
/**
|
|
2095
|
+
* Public interface for the Ultra viewer (server-side rendering via WebSocket).
|
|
2096
|
+
* Consumers should use this instead of the concrete class.
|
|
2097
|
+
*
|
|
2098
|
+
* **Lifecycle:** Call `connect()` first, then `load()` to stream VIM models
|
|
2099
|
+
* (auto-populates `vims`). Use `unload(vim)` to remove one, `clear()` to
|
|
2100
|
+
* remove all, `disconnect()` to close the server connection, and `dispose()`
|
|
2101
|
+
* to tear down the viewer entirely.
|
|
2102
|
+
*
|
|
2103
|
+
* @example
|
|
2104
|
+
* ```ts
|
|
2105
|
+
* const viewer = Core.Ultra.createViewer(parentDiv)
|
|
2106
|
+
* await viewer.connect({ url: 'wss://server:8080' })
|
|
2107
|
+
* const vim = await viewer.load({ url: 'model.vim' }).getVim()
|
|
2108
|
+
*
|
|
2109
|
+
* viewer.unload(vim) // Remove one vim
|
|
2110
|
+
* viewer.disconnect() // Close server connection
|
|
2111
|
+
* viewer.dispose() // Tear down viewer
|
|
2112
|
+
* ```
|
|
2113
|
+
*/
|
|
2114
|
+
interface IUltraViewer {
|
|
2115
|
+
readonly type: 'ultra';
|
|
2116
|
+
readonly camera: IUltraCamera;
|
|
2117
|
+
readonly inputs: IInputHandler;
|
|
2118
|
+
/** All loaded VIM models. Auto-populated on load, auto-removed on unload. */
|
|
2119
|
+
readonly vims: IUltraVim[];
|
|
2120
|
+
readonly viewport: IUltraViewport;
|
|
2121
|
+
readonly renderer: IUltraRenderer;
|
|
2122
|
+
readonly decoder: IUltraDecoder;
|
|
2123
|
+
readonly raycaster: IUltraRaycaster;
|
|
2124
|
+
readonly selection: IUltraSelection;
|
|
2125
|
+
/** The server URL this viewer is connected to, or undefined if not connected. */
|
|
2126
|
+
readonly serverUrl: string | undefined;
|
|
2127
|
+
/** Fires when the connection state changes (connecting, connected, disconnected, error). */
|
|
2128
|
+
readonly onStateChanged: ISimpleEvent<ClientState>;
|
|
2129
|
+
/** The current connection state. */
|
|
2130
|
+
readonly connectionState: ClientState;
|
|
2131
|
+
readonly sectionBox: IUltraSectionBox;
|
|
2132
|
+
/**
|
|
2133
|
+
* Connects to the Ultra rendering server. Must be awaited before calling `load()`.
|
|
2134
|
+
* Returns true on success, false on failure. Subscribe to `onStateChanged` for progress.
|
|
2135
|
+
*/
|
|
2136
|
+
connect(settings?: ConnectionSettings): Promise<boolean>;
|
|
2137
|
+
/** Disconnects from the server. Loaded vims become inoperable. */
|
|
2138
|
+
disconnect(): void;
|
|
2139
|
+
/**
|
|
2140
|
+
* Loads a VIM file via the server. Requires a successful `connect()` first.
|
|
2141
|
+
* The resulting vim is added to `vims` on success.
|
|
2142
|
+
*/
|
|
2143
|
+
load(source: VimSource): IUltraLoadRequest;
|
|
2144
|
+
/** Removes a vim from the viewer and disposes its resources. */
|
|
2145
|
+
unload(vim: IUltraVim): void;
|
|
2146
|
+
/** Removes and disposes all loaded vims. */
|
|
2147
|
+
clear(): void;
|
|
2148
|
+
/** Tears down the viewer entirely — releases canvas, connection, and all resources. */
|
|
2149
|
+
dispose(): void;
|
|
2150
|
+
}
|
|
2151
|
+
/**
|
|
2152
|
+
* Creates a headless Ultra viewer without React UI.
|
|
2153
|
+
* Use this for programmatic-only usage or custom UI frameworks.
|
|
2154
|
+
* For a full React UI viewer, use `React.Ultra.createViewer()` instead.
|
|
2155
|
+
*
|
|
2156
|
+
* @param parent - The parent HTML element to which the canvas will be appended.
|
|
2157
|
+
* @param logger - Optional logger for logging messages.
|
|
2158
|
+
* @returns A new Ultra viewer.
|
|
2159
|
+
*
|
|
2160
|
+
* @example
|
|
2161
|
+
* const viewer = Core.Ultra.createViewer(document.getElementById('app'))
|
|
2162
|
+
* await viewer.connect({ url: 'wss://server:8080' })
|
|
2163
|
+
* viewer.load({ url: 'model.vim' })
|
|
2164
|
+
*/
|
|
2165
|
+
declare function createCoreUltraViewer(parent: HTMLElement, logger?: ILogger): IUltraViewer;
|
|
2166
|
+
|
|
2167
|
+
/**
|
|
2168
|
+
* Represents the possible states an element can have in the UltraVim system.
|
|
2169
|
+
*/
|
|
2170
|
+
declare enum VisibilityState {
|
|
2171
|
+
VISIBLE = 0,
|
|
2172
|
+
HIDDEN = 1,
|
|
2173
|
+
GHOSTED = 2,
|
|
2174
|
+
HIGHLIGHTED = 16,
|
|
2175
|
+
HIDDEN_HIGHLIGHTED = 17,
|
|
2176
|
+
GHOSTED_HIGHLIGHTED = 18
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Public interface for visibility state management.
|
|
2180
|
+
* Accessed via `vim.visibility` on Ultra Vim instances.
|
|
2181
|
+
*/
|
|
2182
|
+
interface IVisibilitySynchronizer {
|
|
2183
|
+
areAllInState(state: VisibilityState | VisibilityState[]): boolean;
|
|
2184
|
+
getElementState(elementIndex: number): VisibilityState;
|
|
2185
|
+
getElementsInState(state: VisibilityState): number[] | 'all';
|
|
2186
|
+
getDefaultState(): VisibilityState;
|
|
2187
|
+
setStateForElement(elementIndex: number, state: VisibilityState): void;
|
|
2188
|
+
setStateForAll(state: VisibilityState): void;
|
|
2189
|
+
replaceState(fromState: VisibilityState | VisibilityState[], toState: VisibilityState): void;
|
|
2190
|
+
reapplyStates(): void;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
declare namespace Core_Ultra {
|
|
2194
|
+
export { INVALID_HANDLE, InputMode, Segment, VimLoadingStatus, VisibilityState, createCoreUltraViewer as createViewer, defaultRenderSettings, defaultSceneSettings };
|
|
2195
|
+
export type { ClientError, ClientState, ClientStateCompatibilityError, ClientStateConnected, ClientStateConnecting, ClientStateConnectionError, ClientStateDisconnected, ClientStateStreamError, ClientStateValidating, ConnectionSettings, ILogger, IUltraCamera, IUltraCameraMovement, IUltraDecoder, IUltraLoadRequest, IUltraRaycastResult, IUltraRaycaster, IUltraRenderer, IUltraScene, IUltraSectionBox, IUltraSelection, IUltraViewport, IUltraVim, IVisibilitySynchronizer, RenderSettings, SceneSettings, IUltraViewer as Viewer, VimLoadingState, VimRequestErrorType, VimSource };
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
declare namespace Core {
|
|
2199
|
+
export { PointerMode, Core_Ultra as Ultra, Core_Webgl as Webgl, authHeaders };
|
|
2200
|
+
export type { ClickHandler, ContextMenuHandler, DoubleClickHandler, DragCallback, DragHandler, IInputHandler, IKeyboardInput, ILoadError, ILoadRequest, ILoadSuccess, IMouseInput, IProgress, ISignal, ISimpleEvent, ITouchInput, IVim, IVimElement, LoadResult, MouseOverrides, MoveHandler, PinchHandler, PinchStartHandler, PointerButtonHandler, ProgressType, TapHandler, TouchOverrides, WheelHandler };
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
/**
|
|
2204
|
+
* @module public-api
|
|
2205
|
+
*/
|
|
2206
|
+
/**
|
|
2207
|
+
* Basic HTML structure that the webgl viewer expects
|
|
2208
|
+
*/
|
|
2209
|
+
type Container = {
|
|
2210
|
+
/**
|
|
2211
|
+
* Root of the viewer, all viewer ui should have this as an acestor.
|
|
2212
|
+
*/
|
|
2213
|
+
root: HTMLElement;
|
|
2214
|
+
/**
|
|
2215
|
+
* Div where to instantiate ui elements.
|
|
2216
|
+
*/
|
|
2217
|
+
ui: HTMLDivElement;
|
|
2218
|
+
/**
|
|
2219
|
+
* Div to hold viewer canvases and ui
|
|
2220
|
+
*/
|
|
2221
|
+
gfx: HTMLDivElement;
|
|
2222
|
+
dispose: () => void;
|
|
2223
|
+
};
|
|
2224
|
+
/**
|
|
2225
|
+
* Creates a default container for the vim viewer around a vim viewer
|
|
2226
|
+
* The element is created if not provided. The element will be made position:absolute.
|
|
2227
|
+
* @element optional HTML element to use as root
|
|
2228
|
+
*/
|
|
2229
|
+
declare function createContainer(element?: HTMLElement): Container;
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
2232
|
+
* Observable state container. Read, write, and subscribe to changes.
|
|
2233
|
+
*
|
|
2234
|
+
* @example
|
|
2235
|
+
* state.get() // Read current value
|
|
2236
|
+
* state.set(true) // Update value
|
|
2237
|
+
* state.onChange.subscribe(v => ...) // Subscribe (returns unsubscribe fn)
|
|
2238
|
+
*/
|
|
2239
|
+
interface StateRef<T> {
|
|
2240
|
+
/**
|
|
2241
|
+
* Returns the current state value.
|
|
2242
|
+
*/
|
|
2243
|
+
get(): T;
|
|
2244
|
+
/**
|
|
2245
|
+
* Updates the state to the provided value.
|
|
2246
|
+
* @param value - The new state value.
|
|
2247
|
+
*/
|
|
2248
|
+
set(value: T): void;
|
|
2249
|
+
/**
|
|
2250
|
+
* Confirms the current state (potentially applying a confirmation transformation).
|
|
2251
|
+
*/
|
|
2252
|
+
confirm(): void;
|
|
2253
|
+
onChange: ISimpleEvent<T>;
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Creates a standalone StateRef<T> without React hooks.
|
|
2257
|
+
* Use this when you need observable state outside of React components.
|
|
2258
|
+
*/
|
|
2259
|
+
declare function createState<T>(initial: T): StateRef<T>;
|
|
2260
|
+
/**
|
|
2261
|
+
* A callable function reference with middleware support.
|
|
2262
|
+
* All ref types (sync, async, with/without args) use this single interface.
|
|
2263
|
+
*
|
|
2264
|
+
* When `TArg` is `void`, `call()` can be invoked without arguments.
|
|
2265
|
+
* For async functions, use `FuncRef<void, Promise<T>>`.
|
|
2266
|
+
*
|
|
2267
|
+
* @example
|
|
2268
|
+
* ```ts
|
|
2269
|
+
* ref.call() // Execute (no-arg)
|
|
2270
|
+
* ref.call(box) // Execute (with arg)
|
|
2271
|
+
* ref.set(() => newImpl()) // Replace implementation
|
|
2272
|
+
* ref.update(prev => (...args) => { // Wrap with middleware
|
|
2273
|
+
* console.log('before')
|
|
2274
|
+
* const result = prev(...args)
|
|
2275
|
+
* console.log('after')
|
|
2276
|
+
* return result
|
|
2277
|
+
* })
|
|
2278
|
+
* ```
|
|
2279
|
+
*/
|
|
2280
|
+
interface FuncRef<TArg, TReturn> {
|
|
2281
|
+
/** Invokes the stored function. When `TArg` is `void`, no argument is needed. */
|
|
2282
|
+
call(arg: TArg): TReturn;
|
|
2283
|
+
/** Returns the current function. */
|
|
2284
|
+
get(): (arg: TArg) => TReturn;
|
|
2285
|
+
/** Replaces the stored function. */
|
|
2286
|
+
set(fn: (arg: TArg) => TReturn): void;
|
|
2287
|
+
/**
|
|
2288
|
+
* Wraps the stored function with a transform.
|
|
2289
|
+
* Use this to inject behavior before/after the original function.
|
|
2290
|
+
*
|
|
2291
|
+
* @example
|
|
2292
|
+
* ```ts
|
|
2293
|
+
* // Append behavior
|
|
2294
|
+
* ref.update(prev => async () => { await prev(); doAfter() })
|
|
2295
|
+
* // Prepend behavior
|
|
2296
|
+
* ref.update(prev => async () => { doBefore(); return await prev() })
|
|
2297
|
+
* ```
|
|
2298
|
+
*/
|
|
2299
|
+
update(transform: (prev: (arg: TArg) => TReturn) => (arg: TArg) => TReturn): void;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* Controls the section box clipping volume.
|
|
2304
|
+
* Shared between WebGL and Ultra viewers.
|
|
2305
|
+
*
|
|
2306
|
+
* @example
|
|
2307
|
+
* viewer.sectionBox.active.set(true)
|
|
2308
|
+
* viewer.sectionBox.sectionSelection.call() // Fit to selection
|
|
2309
|
+
* viewer.sectionBox.sectionScene.call() // Fit to scene
|
|
2310
|
+
*/
|
|
2311
|
+
interface SectionBoxApi {
|
|
2312
|
+
active: StateRef<boolean>;
|
|
2313
|
+
visible: StateRef<boolean>;
|
|
2314
|
+
auto: StateRef<boolean>;
|
|
2315
|
+
sectionSelection: FuncRef<void, Promise<void>>;
|
|
2316
|
+
sectionScene: FuncRef<void, Promise<void>>;
|
|
2317
|
+
sectionBox: FuncRef<THREE.Box3, void>;
|
|
2318
|
+
getBox: () => THREE.Box3;
|
|
2319
|
+
showOffsetPanel: StateRef<boolean>;
|
|
2320
|
+
topOffset: StateRef<number>;
|
|
2321
|
+
sideOffset: StateRef<number>;
|
|
2322
|
+
bottomOffset: StateRef<number>;
|
|
2323
|
+
getSelectionBox: FuncRef<void, Promise<THREE.Box3 | undefined>>;
|
|
2324
|
+
getSceneBox: FuncRef<void, Promise<THREE.Box3 | undefined>>;
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
/**
|
|
2328
|
+
* @module viw-webgl-react
|
|
2329
|
+
*/
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* High-level framing controls for the React viewer.
|
|
2333
|
+
* Provides semantic operations like "frame selection" and "frame scene".
|
|
2334
|
+
*
|
|
2335
|
+
* For low-level camera movement (orbit, pan, zoom, snap/lerp), use
|
|
2336
|
+
* `viewer.core.camera` which exposes {@link IWebglCamera}.
|
|
2337
|
+
*
|
|
2338
|
+
* @example
|
|
2339
|
+
* // Frame the current selection with animation
|
|
2340
|
+
* viewer.framing.frameSelection.call()
|
|
2341
|
+
*
|
|
2342
|
+
* // For direct camera manipulation, use the core camera:
|
|
2343
|
+
* viewer.core.camera.lerp(1).frame('all')
|
|
2344
|
+
* viewer.core.camera.snap().set(position, target)
|
|
2345
|
+
*/
|
|
2346
|
+
interface FramingApi {
|
|
2347
|
+
/** When true, automatically frames the camera on the selection whenever it changes. */
|
|
2348
|
+
autoCamera: StateRef<boolean>;
|
|
2349
|
+
/** Resets the camera to its last saved position. */
|
|
2350
|
+
reset: FuncRef<void, void>;
|
|
2351
|
+
/** Frames the camera on the current selection (or scene if nothing selected). */
|
|
2352
|
+
frameSelection: FuncRef<void, Promise<void>>;
|
|
2353
|
+
/** Frames the camera to show all loaded geometry. */
|
|
2354
|
+
frameScene: FuncRef<void, Promise<void>>;
|
|
2355
|
+
/** Returns the bounding box of the current selection, or undefined if nothing selected. */
|
|
2356
|
+
getSelectionBox: FuncRef<void, Promise<THREE.Box3 | undefined>>;
|
|
2357
|
+
/** Returns the bounding box of all loaded geometry. */
|
|
2358
|
+
getSceneBox: FuncRef<void, Promise<THREE.Box3 | undefined>>;
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* @module viw-webgl-react
|
|
2363
|
+
*/
|
|
2364
|
+
|
|
2365
|
+
type AugmentedElement = BIM.IElement & {
|
|
2366
|
+
bimDocumentName: string;
|
|
2367
|
+
categoryName: string;
|
|
2368
|
+
familyTypeName: string;
|
|
2369
|
+
levelName: string;
|
|
2370
|
+
worksetName: string;
|
|
2371
|
+
};
|
|
2372
|
+
|
|
2373
|
+
type VisibilityStatus = 'all' | 'allButSelection' | 'onlySelection' | 'some' | 'none';
|
|
2374
|
+
/**
|
|
2375
|
+
* Controls element visibility and isolation in the viewer.
|
|
2376
|
+
* Shared between WebGL and Ultra viewers.
|
|
2377
|
+
*
|
|
2378
|
+
* @example
|
|
2379
|
+
* viewer.isolation.isolateSelection() // Show only selected elements
|
|
2380
|
+
* viewer.isolation.showAll() // Reset visibility
|
|
2381
|
+
* viewer.isolation.showGhost.set(true) // Show hidden elements as ghosts
|
|
2382
|
+
*/
|
|
2383
|
+
interface IsolationApi {
|
|
2384
|
+
/** Current visibility status (observable). */
|
|
2385
|
+
visibility: StateRef<VisibilityStatus>;
|
|
2386
|
+
/** Whether auto-isolate is enabled (observable). When true, selecting an element auto-isolates it. */
|
|
2387
|
+
autoIsolate: StateRef<boolean>;
|
|
2388
|
+
/** Whether the isolation settings panel is shown (observable). */
|
|
2389
|
+
showPanel: StateRef<boolean>;
|
|
2390
|
+
/** Whether hidden elements are rendered as ghosts (observable). */
|
|
2391
|
+
showGhost: StateRef<boolean>;
|
|
2392
|
+
/** Ghost material opacity 0-1 (observable). */
|
|
2393
|
+
ghostOpacity: StateRef<number>;
|
|
2394
|
+
/** Whether transparent materials are rendered (observable). */
|
|
2395
|
+
transparency: StateRef<boolean>;
|
|
2396
|
+
/** Whether room elements are shown (observable). */
|
|
2397
|
+
showRooms: StateRef<boolean>;
|
|
2398
|
+
/** Hook called when auto-isolate triggers. Use `update()` to add middleware. */
|
|
2399
|
+
onAutoIsolate: FuncRef<void, void>;
|
|
2400
|
+
/** Hook called when visibility changes. Use `update()` to add middleware. */
|
|
2401
|
+
onVisibilityChange: FuncRef<void, void>;
|
|
2402
|
+
/** Returns true if any elements are selected. */
|
|
2403
|
+
hasSelection(): boolean;
|
|
2404
|
+
/** Returns true if any selected elements are currently visible. */
|
|
2405
|
+
hasVisibleSelection(): boolean;
|
|
2406
|
+
/** Returns true if any selected elements are currently hidden. */
|
|
2407
|
+
hasHiddenSelection(): boolean;
|
|
2408
|
+
/** Clears the current selection. */
|
|
2409
|
+
clearSelection(): void;
|
|
2410
|
+
/** Shows only selected elements, hiding everything else. */
|
|
2411
|
+
isolateSelection(): void;
|
|
2412
|
+
/** Hides the currently selected elements. */
|
|
2413
|
+
hideSelection(): void;
|
|
2414
|
+
/** Makes the currently selected elements visible. */
|
|
2415
|
+
showSelection(): void;
|
|
2416
|
+
/** Isolates elements by their instance indices (only these will be visible). */
|
|
2417
|
+
isolate(instances: number[]): void;
|
|
2418
|
+
/** Shows elements by their instance indices. */
|
|
2419
|
+
show(instances: number[]): void;
|
|
2420
|
+
/** Hides elements by their instance indices. */
|
|
2421
|
+
hide(instances: number[]): void;
|
|
2422
|
+
/** Hides all elements. */
|
|
2423
|
+
hideAll(): void;
|
|
2424
|
+
/** Resets visibility — makes all elements visible. */
|
|
2425
|
+
showAll(): void;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
type MessageBoxProps = {
|
|
2429
|
+
title: string;
|
|
2430
|
+
body: string | JSX.Element;
|
|
2431
|
+
icon?: JSX.Element;
|
|
2432
|
+
footer?: string | JSX.Element;
|
|
2433
|
+
canClose?: boolean;
|
|
2434
|
+
minimize?: boolean;
|
|
2435
|
+
onClose?: () => void;
|
|
2436
|
+
};
|
|
2437
|
+
type MessageBoxPropsTyped = MessageBoxProps & {
|
|
2438
|
+
type: 'message';
|
|
2439
|
+
};
|
|
2440
|
+
|
|
2441
|
+
type ProgressMode = 'percent' | 'bytes';
|
|
2442
|
+
/**
|
|
2443
|
+
* Interface for message information displayed in the LoadingBox.
|
|
2444
|
+
* @property message - Optional main message text.
|
|
2445
|
+
* @property info - Optional additional information or tooltip text.
|
|
2446
|
+
* @property progress - The progress of an operation.
|
|
2447
|
+
*/
|
|
2448
|
+
type LoadingBoxProps = {
|
|
2449
|
+
message?: string;
|
|
2450
|
+
progress?: number;
|
|
2451
|
+
mode?: ProgressMode;
|
|
2452
|
+
more?: ReactNode;
|
|
2453
|
+
};
|
|
2454
|
+
type LoadingBoxPropsTyped = LoadingBoxProps & {
|
|
2455
|
+
type: 'loading';
|
|
2456
|
+
};
|
|
2457
|
+
|
|
2458
|
+
/**
|
|
2459
|
+
* @module viw-webgl-react
|
|
2460
|
+
*/
|
|
2461
|
+
type HelpPropsTyped = {
|
|
2462
|
+
type: 'help';
|
|
2463
|
+
};
|
|
2464
|
+
|
|
2465
|
+
type ModalProps = (MessageBoxPropsTyped | LoadingBoxPropsTyped | HelpPropsTyped) & {
|
|
2466
|
+
canClose?: boolean;
|
|
2467
|
+
onClose?: () => void;
|
|
2468
|
+
};
|
|
2469
|
+
type ModalApi = {
|
|
2470
|
+
getActiveState(): ModalProps | undefined;
|
|
2471
|
+
loading(content: LoadingBoxProps | undefined): void;
|
|
2472
|
+
message(content: MessageBoxProps | undefined): void;
|
|
2473
|
+
help(show: boolean): void;
|
|
2474
|
+
};
|
|
2475
|
+
|
|
2476
|
+
/**
|
|
2477
|
+
* Reference to manage context menu functionality in the viewer.
|
|
2478
|
+
*/
|
|
2479
|
+
type ContextMenuApi = {
|
|
2480
|
+
/**
|
|
2481
|
+
* Defines a callback function to dynamically customize the context menu.
|
|
2482
|
+
* @param customization The configuration object specifying the customization options for the context menu.
|
|
2483
|
+
*/
|
|
2484
|
+
customize: (customization: ContextMenuCustomization) => void;
|
|
2485
|
+
};
|
|
2486
|
+
/**
|
|
2487
|
+
* Represents a button in the context menu. It can't be clicked triggering given action.
|
|
2488
|
+
*/
|
|
2489
|
+
interface IContextMenuButton {
|
|
2490
|
+
type: 'button';
|
|
2491
|
+
id: string;
|
|
2492
|
+
label: string;
|
|
2493
|
+
keyboard?: string;
|
|
2494
|
+
action: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
2495
|
+
enabled: boolean;
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Represents a divider in the context menu. It can't be clicked.
|
|
2499
|
+
*/
|
|
2500
|
+
interface IContextMenuDivider {
|
|
2501
|
+
type: 'divider';
|
|
2502
|
+
id: string;
|
|
2503
|
+
enabled: boolean;
|
|
2504
|
+
}
|
|
2505
|
+
type ContextMenuElement = IContextMenuButton | IContextMenuDivider;
|
|
2506
|
+
/**
|
|
2507
|
+
* A map function that changes the context menu.
|
|
2508
|
+
*/
|
|
2509
|
+
type ContextMenuCustomization = (e: ContextMenuElement[]) => ContextMenuElement[];
|
|
2510
|
+
|
|
2511
|
+
/**
|
|
2512
|
+
* @fileoverview This file exports types and a React hook for customizing the rendering
|
|
2513
|
+
* and data handling of a BIM info panel. The hook provides references for customizing
|
|
2514
|
+
* how data is processed and rendered in different sections of the BIM info panel.
|
|
2515
|
+
*/
|
|
2516
|
+
|
|
2517
|
+
/**
|
|
2518
|
+
* Represents an entry in the BIM info panel, such as a key-value pair in a header or body section.
|
|
2519
|
+
*/
|
|
2520
|
+
type Entry = {
|
|
2521
|
+
/**
|
|
2522
|
+
* The key of the entry, often used as a label or an identifier for the data.
|
|
2523
|
+
*/
|
|
2524
|
+
key: string | undefined;
|
|
2525
|
+
/**
|
|
2526
|
+
* The label or display name for the entry, shown to the user.
|
|
2527
|
+
*/
|
|
2528
|
+
label: string | undefined;
|
|
2529
|
+
/**
|
|
2530
|
+
* The value of the entry, displayed to the user.
|
|
2531
|
+
*/
|
|
2532
|
+
value: string | undefined;
|
|
2533
|
+
};
|
|
2534
|
+
/**
|
|
2535
|
+
* Represents a group of entries within a body section of the BIM info panel.
|
|
2536
|
+
*/
|
|
2537
|
+
type Group = {
|
|
2538
|
+
/**
|
|
2539
|
+
* The unique identifier for this group.
|
|
2540
|
+
*/
|
|
2541
|
+
key: string | undefined;
|
|
2542
|
+
/**
|
|
2543
|
+
* The title or name displayed for this group.
|
|
2544
|
+
*/
|
|
2545
|
+
title: string | undefined;
|
|
2546
|
+
/**
|
|
2547
|
+
* An array of entries that belong to this group.
|
|
2548
|
+
*/
|
|
2549
|
+
content: Entry[];
|
|
2550
|
+
};
|
|
2551
|
+
/**
|
|
2552
|
+
* Represents a section of the body, containing one or more groups of entries.
|
|
2553
|
+
*/
|
|
2554
|
+
type Section = {
|
|
2555
|
+
/**
|
|
2556
|
+
* The unique identifier for this section.
|
|
2557
|
+
*/
|
|
2558
|
+
key: string | undefined;
|
|
2559
|
+
/**
|
|
2560
|
+
* The title displayed for this section.
|
|
2561
|
+
*/
|
|
2562
|
+
title: string;
|
|
2563
|
+
/**
|
|
2564
|
+
* An array of groups that this section contains.
|
|
2565
|
+
*/
|
|
2566
|
+
content: Group[];
|
|
2567
|
+
};
|
|
2568
|
+
/**
|
|
2569
|
+
* Represents the entire data set for the BIM info panel, including the header and body sections.
|
|
2570
|
+
*/
|
|
2571
|
+
type Data = {
|
|
2572
|
+
/**
|
|
2573
|
+
* The header of the BIM info panel, typically a list of entries summarizing key information.
|
|
2574
|
+
*/
|
|
2575
|
+
header: Entry[] | undefined;
|
|
2576
|
+
/**
|
|
2577
|
+
* The body of the BIM info panel, typically containing one or more sections of grouped entries.
|
|
2578
|
+
*/
|
|
2579
|
+
body: Section[] | undefined;
|
|
2580
|
+
};
|
|
2581
|
+
/**
|
|
2582
|
+
* A customization function for modifying the panel data before rendering. It allows
|
|
2583
|
+
* developers to transform, filter, or augment the data pulled from a VIM source.
|
|
2584
|
+
*
|
|
2585
|
+
* @param data - The data to customize.
|
|
2586
|
+
* @param source - The VIM.Object or VIM.Vim instance from which the data was originally extracted.
|
|
2587
|
+
* @returns A promise that resolves to the modified Data object.
|
|
2588
|
+
*/
|
|
2589
|
+
type DataCustomization = (data: Data, source: IWebglVim | IElement3D) => Promise<Data>;
|
|
2590
|
+
/**
|
|
2591
|
+
* A rendering customization function that takes props containing data and a standard
|
|
2592
|
+
* rendering function, and returns a custom JSX element. This function enables developers
|
|
2593
|
+
* to override how data is rendered in different parts of the BIM info panel.
|
|
2594
|
+
*
|
|
2595
|
+
* @typeParam T - The type of data to render.
|
|
2596
|
+
* @param props.data - The data to render.
|
|
2597
|
+
* @param props.standard - The standard rendering function for the data.
|
|
2598
|
+
* @returns A custom JSX element to render, or `undefined` to use the default rendering.
|
|
2599
|
+
*/
|
|
2600
|
+
type DataRender<T> = ((props: {
|
|
2601
|
+
data: T;
|
|
2602
|
+
standard: () => JSX.Element;
|
|
2603
|
+
}) => JSX.Element) | undefined;
|
|
2604
|
+
/**
|
|
2605
|
+
* A reference object exposing multiple customization callbacks for transforming data and rendering
|
|
2606
|
+
* different parts of the BIM info panel. These callbacks can be updated at runtime and will be used
|
|
2607
|
+
* the next time the panel re-renders.
|
|
2608
|
+
*/
|
|
2609
|
+
type BimInfoPanelApi = {
|
|
2610
|
+
/**
|
|
2611
|
+
* A function that customizes the data before it is rendered in the BIM info panel.
|
|
2612
|
+
*/
|
|
2613
|
+
onData: DataCustomization;
|
|
2614
|
+
/**
|
|
2615
|
+
* A function that customizes the rendering of the header of the BIM info panel.
|
|
2616
|
+
*/
|
|
2617
|
+
onRenderHeader: DataRender<Entry[]>;
|
|
2618
|
+
/**
|
|
2619
|
+
* A function that customizes the rendering of each header entry in the BIM info panel.
|
|
2620
|
+
*/
|
|
2621
|
+
onRenderHeaderEntry: DataRender<Entry>;
|
|
2622
|
+
/**
|
|
2623
|
+
* A function that customizes the rendering of each entry value of the header in the BIM info panel.
|
|
2624
|
+
*/
|
|
2625
|
+
onRenderHeaderEntryValue: DataRender<Entry>;
|
|
2626
|
+
/**
|
|
2627
|
+
* A function that customizes the rendering for the body section of the BIM info panel.
|
|
2628
|
+
*/
|
|
2629
|
+
onRenderBody: DataRender<Section[]>;
|
|
2630
|
+
/**
|
|
2631
|
+
* A function that customizes the rendering of each section of the body in the BIM info panel.
|
|
2632
|
+
*/
|
|
2633
|
+
onRenderBodySection: DataRender<Section>;
|
|
2634
|
+
/**
|
|
2635
|
+
* A function that customizes the rendering of each group of the body in the BIM info panel.
|
|
2636
|
+
*/
|
|
2637
|
+
onRenderBodyGroup: DataRender<Group>;
|
|
2638
|
+
/**
|
|
2639
|
+
* A function that customizes the rendering for each entry of the body in the BIM info panel.
|
|
2640
|
+
*/
|
|
2641
|
+
onRenderBodyEntry: DataRender<Entry>;
|
|
2642
|
+
/**
|
|
2643
|
+
* A function that customizes the rendering of each value for a single body entry in the info panel.
|
|
2644
|
+
*/
|
|
2645
|
+
onRenderBodyEntryValue: DataRender<Entry>;
|
|
2646
|
+
};
|
|
2647
|
+
|
|
2648
|
+
/**
|
|
2649
|
+
* @module icons
|
|
2650
|
+
*/
|
|
2651
|
+
/**
|
|
2652
|
+
* Common Icon Options.
|
|
2653
|
+
*/
|
|
2654
|
+
type IconOptions = {
|
|
2655
|
+
height?: number | string;
|
|
2656
|
+
width?: number | string;
|
|
2657
|
+
fill?: string;
|
|
2658
|
+
className?: string;
|
|
2659
|
+
};
|
|
2660
|
+
declare function pointer({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2661
|
+
declare function filter({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2662
|
+
declare function slidersHoriz({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2663
|
+
declare function settings({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2664
|
+
declare function help({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2665
|
+
declare function trash({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2666
|
+
declare function checkmark({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2667
|
+
declare function undo({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2668
|
+
declare function closeIcon({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2669
|
+
declare function home({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2670
|
+
declare function fullScreen({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2671
|
+
declare function minimize({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2672
|
+
declare function treeView({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2673
|
+
declare function more({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2674
|
+
declare function collapse({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2675
|
+
declare function arrowLeft({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2676
|
+
declare function fullArrowLeft({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2677
|
+
declare function visible({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2678
|
+
declare function hidden({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2679
|
+
declare function frameScene({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2680
|
+
declare function autoCamera({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2681
|
+
declare function orbit({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2682
|
+
declare function look({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2683
|
+
declare function perspective({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2684
|
+
declare function orthographic({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2685
|
+
declare function camera({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2686
|
+
declare function pan({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2687
|
+
declare function zoom({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2688
|
+
declare function frameRect({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2689
|
+
declare function frameSelection({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2690
|
+
declare function showAll({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2691
|
+
declare function showSelection({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2692
|
+
declare function hideSelection({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2693
|
+
declare function isolateSelection({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2694
|
+
declare function autoIsolate({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2695
|
+
declare function toggleIsolation({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2696
|
+
declare function measure({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2697
|
+
declare function sectionBoxSettings({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2698
|
+
declare function sectionBoxAuto({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2699
|
+
declare function sectionBoxVisible({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2700
|
+
declare function sectionBox({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2701
|
+
declare function sectionBoxDisable({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2702
|
+
declare function sectionBoxClip({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2703
|
+
declare function sectionBoxIgnore({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2704
|
+
declare function sectionBoxReset({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2705
|
+
declare function sectionBoxShrink({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2706
|
+
declare function sectionBoxShrink2({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2707
|
+
declare function ghost({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2708
|
+
declare function ghostDead({ height, width, fill, className }?: IconOptions): react_jsx_runtime.JSX.Element;
|
|
2709
|
+
|
|
2710
|
+
declare namespace React_Icons {
|
|
2711
|
+
export { arrowLeft, autoCamera, autoIsolate, camera, checkmark, closeIcon, collapse, filter, frameRect, frameScene, frameSelection, fullArrowLeft, fullScreen, ghost, ghostDead, help, hidden, hideSelection, home, isolateSelection, look, measure, minimize, more, orbit, orthographic, pan, perspective, pointer, sectionBox, sectionBoxAuto, sectionBoxClip, sectionBoxDisable, sectionBoxIgnore, sectionBoxReset, sectionBoxSettings, sectionBoxShrink, sectionBoxShrink2, sectionBoxVisible, settings, showAll, showSelection, slidersHoriz, toggleIsolation, trash, treeView, undo, visible, zoom };
|
|
2712
|
+
export type { IconOptions };
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
interface IControlBarButton {
|
|
2716
|
+
id: string;
|
|
2717
|
+
enabled?: (() => boolean) | undefined;
|
|
2718
|
+
tip: string;
|
|
2719
|
+
action: () => void;
|
|
2720
|
+
icon: (options?: IconOptions) => JSX.Element;
|
|
2721
|
+
isOn?: () => boolean;
|
|
2722
|
+
style?: (on: boolean) => string;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
interface IControlBarSection {
|
|
2726
|
+
id: string;
|
|
2727
|
+
enable?: (() => boolean) | undefined;
|
|
2728
|
+
buttons: (IControlBarButton)[];
|
|
2729
|
+
style?: string;
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
/**
|
|
2733
|
+
* Reference to manage control bar functionality in the viewer.
|
|
2734
|
+
*/
|
|
2735
|
+
type ControlBarApi = {
|
|
2736
|
+
/**
|
|
2737
|
+
* Defines a callback function to dynamically customize the control bar.
|
|
2738
|
+
* @param customization The configuration object specifying the customization options for the control bar.
|
|
2739
|
+
*/
|
|
2740
|
+
customize: (customization: ControlBarCustomization) => void;
|
|
2741
|
+
};
|
|
2742
|
+
/**
|
|
2743
|
+
* A map function that customizes the control bar sections.
|
|
2744
|
+
*/
|
|
2745
|
+
type ControlBarCustomization = (e: IControlBarSection[]) => IControlBarSection[];
|
|
2746
|
+
|
|
2747
|
+
/**
|
|
2748
|
+
* A boolean setting that can be locked by the host application.
|
|
2749
|
+
* - `true` / `false` — user-toggleable default value, shown in settings UI.
|
|
2750
|
+
* - `"AlwaysTrue"` / `"AlwaysFalse"` — locked value, hidden from settings UI.
|
|
2751
|
+
*/
|
|
2752
|
+
type UserBoolean = boolean | 'AlwaysTrue' | 'AlwaysFalse';
|
|
2753
|
+
/**
|
|
2754
|
+
* Checks if a UserBoolean value is effectively true
|
|
2755
|
+
* @param {UserBoolean | boolean} value - The value to check
|
|
2756
|
+
* @returns {boolean} True if the value is true or 'AlwaysTrue'
|
|
2757
|
+
*/
|
|
2758
|
+
declare function isTrue(value: UserBoolean | boolean): value is true | "AlwaysTrue";
|
|
2759
|
+
/**
|
|
2760
|
+
* Checks if a UserBoolean value is effectively false
|
|
2761
|
+
* @param {UserBoolean | boolean} value - The value to check
|
|
2762
|
+
* @returns {boolean} True if the value is false or 'AlwaysFalse'
|
|
2763
|
+
*/
|
|
2764
|
+
declare function isFalse(value: UserBoolean | boolean): value is false | "AlwaysFalse";
|
|
2765
|
+
|
|
2766
|
+
declare const baseSectionStyle = "vc-flex vc-items-center vc-rounded-full vc-mb-2 vc-shadow-md";
|
|
2767
|
+
declare const sectionDefaultStyle: string;
|
|
2768
|
+
declare const sectionBlueStyle: string;
|
|
2769
|
+
declare const sectionNoPadStyle: string;
|
|
2770
|
+
declare const buttonBaseStyle = "vim-control-bar-button vc-rounded-full vc-items-center vc-justify-center vc-flex vc-transition-all hover:vc-scale-110";
|
|
2771
|
+
declare function buttonDefaultStyle(on: boolean): string;
|
|
2772
|
+
declare function buttonExpandStyle(on: boolean): string;
|
|
2773
|
+
declare function buttonDisableStyle(on: boolean): string;
|
|
2774
|
+
declare function buttonDisableDefaultStyle(on: boolean): string;
|
|
2775
|
+
declare function buttonBlueStyle(on: boolean): string;
|
|
2776
|
+
|
|
2777
|
+
declare namespace React_ControlBar_Style {
|
|
2778
|
+
export {
|
|
2779
|
+
baseSectionStyle,
|
|
2780
|
+
buttonBaseStyle,
|
|
2781
|
+
buttonBlueStyle,
|
|
2782
|
+
buttonDefaultStyle,
|
|
2783
|
+
buttonDisableDefaultStyle,
|
|
2784
|
+
buttonDisableStyle,
|
|
2785
|
+
buttonExpandStyle,
|
|
2786
|
+
sectionBlueStyle,
|
|
2787
|
+
sectionDefaultStyle,
|
|
2788
|
+
sectionNoPadStyle,
|
|
2789
|
+
};
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
type PartialUltraSettings = RecursivePartial<UltraSettings>;
|
|
2793
|
+
/**
|
|
2794
|
+
* React UI feature toggles for the Ultra viewer, passed to `React.Ultra.createViewer(container, settings)`.
|
|
2795
|
+
* Controls which UI panels and toolbar buttons are shown.
|
|
2796
|
+
* Access at runtime via `viewer.settings.update(s => { s.ui.panelControlBar = false })`.
|
|
2797
|
+
*
|
|
2798
|
+
* @example
|
|
2799
|
+
* const viewer = await React.Ultra.createViewer(div, {
|
|
2800
|
+
* ui: { panelControlBar: true, miscHelp: false }
|
|
2801
|
+
* })
|
|
2802
|
+
*/
|
|
2803
|
+
type UltraSettings = {
|
|
2804
|
+
ui: ControlBarCameraSettings & ControlBarCursorSettings & ControlBarSectionBoxSettings & ControlBarVisibilitySettings & {
|
|
2805
|
+
panelLogo: UserBoolean;
|
|
2806
|
+
panelControlBar: UserBoolean;
|
|
2807
|
+
miscSettings: UserBoolean;
|
|
2808
|
+
miscHelp: UserBoolean;
|
|
2809
|
+
};
|
|
2810
|
+
};
|
|
2811
|
+
declare function getDefaultUltraSettings(): UltraSettings;
|
|
2812
|
+
|
|
2813
|
+
type ControlBarSectionBoxSettings = {
|
|
2814
|
+
sectioningEnable: UserBoolean;
|
|
2815
|
+
sectioningFitToSelection: UserBoolean;
|
|
2816
|
+
sectioningReset: UserBoolean;
|
|
2817
|
+
sectioningShow: UserBoolean;
|
|
2818
|
+
sectioningAuto: UserBoolean;
|
|
2819
|
+
sectioningSettings: UserBoolean;
|
|
2820
|
+
};
|
|
2821
|
+
type ControlBarCursorSettings = {
|
|
2822
|
+
cursorOrbit: UserBoolean;
|
|
2823
|
+
cursorLookAround: UserBoolean;
|
|
2824
|
+
cursorPan: UserBoolean;
|
|
2825
|
+
cursorZoom: UserBoolean;
|
|
2826
|
+
};
|
|
2827
|
+
type ControlBarMeasureSettings = {
|
|
2828
|
+
measureEnable: UserBoolean;
|
|
2829
|
+
};
|
|
2830
|
+
type ControlBarCameraSettings = {
|
|
2831
|
+
cameraAuto: UserBoolean;
|
|
2832
|
+
cameraFrameSelection: UserBoolean;
|
|
2833
|
+
cameraFrameScene: UserBoolean;
|
|
2834
|
+
};
|
|
2835
|
+
type ControlBarVisibilitySettings = {
|
|
2836
|
+
visibilityClearSelection: UserBoolean;
|
|
2837
|
+
visibilityShowAll: UserBoolean;
|
|
2838
|
+
visibilityToggle: UserBoolean;
|
|
2839
|
+
visibilityIsolate: UserBoolean;
|
|
2840
|
+
visibilityAutoIsolate: UserBoolean;
|
|
2841
|
+
visibilitySettings: UserBoolean;
|
|
2842
|
+
};
|
|
2843
|
+
|
|
2844
|
+
type PartialWebglSettings = RecursivePartial<WebglSettings>;
|
|
2845
|
+
/**
|
|
2846
|
+
* React UI feature toggles, passed to `React.Webgl.createViewer(container, settings)`.
|
|
2847
|
+
* Controls which UI panels and toolbar buttons are shown.
|
|
2848
|
+
* Access at runtime via `viewer.settings.update(s => { s.ui.panelBimTree = false })`.
|
|
2849
|
+
* Not to be confused with {@link ViewerSettings} (renderer config) or {@link VimSettings} (per-model transform).
|
|
2850
|
+
*
|
|
2851
|
+
* @example
|
|
2852
|
+
* const viewer = await React.Webgl.createViewer(div, {
|
|
2853
|
+
* ui: { panelBimTree: false, miscHelp: false }
|
|
2854
|
+
* })
|
|
2855
|
+
*/
|
|
2856
|
+
type WebglSettings = {
|
|
2857
|
+
capacity: {
|
|
2858
|
+
canFollowUrl: boolean;
|
|
2859
|
+
canGoFullScreen: boolean;
|
|
2860
|
+
canDownload: boolean;
|
|
2861
|
+
canReadLocalStorage: boolean;
|
|
2862
|
+
};
|
|
2863
|
+
ui: ControlBarCameraSettings & ControlBarCursorSettings & ControlBarSectionBoxSettings & ControlBarVisibilitySettings & ControlBarMeasureSettings & {
|
|
2864
|
+
panelLogo: UserBoolean;
|
|
2865
|
+
panelBimTree: UserBoolean;
|
|
2866
|
+
panelBimInfo: UserBoolean;
|
|
2867
|
+
panelPerformance: UserBoolean;
|
|
2868
|
+
panelAxes: UserBoolean;
|
|
2869
|
+
panelControlBar: UserBoolean;
|
|
2870
|
+
axesOrthographic: UserBoolean;
|
|
2871
|
+
axesHome: UserBoolean;
|
|
2872
|
+
miscProjectInspector: UserBoolean;
|
|
2873
|
+
miscSettings: UserBoolean;
|
|
2874
|
+
miscHelp: UserBoolean;
|
|
2875
|
+
miscMaximise: UserBoolean;
|
|
2876
|
+
};
|
|
2877
|
+
};
|
|
2878
|
+
/**
|
|
2879
|
+
* Default settings configuration for the React Webgl Vim viewer
|
|
2880
|
+
* @constant
|
|
2881
|
+
* @type {WebglSettings}
|
|
2882
|
+
*/
|
|
2883
|
+
declare function getDefaultSettings(): WebglSettings;
|
|
2884
|
+
|
|
2885
|
+
/**
|
|
2886
|
+
* @module viw-webgl-react
|
|
2887
|
+
*/
|
|
2888
|
+
|
|
2889
|
+
type AddSettings = {
|
|
2890
|
+
/**
|
|
2891
|
+
* Controls whether to frame the camera on a vim everytime it is updated.
|
|
2892
|
+
* Default: true
|
|
2893
|
+
*/
|
|
2894
|
+
autoFrame?: boolean;
|
|
2895
|
+
};
|
|
2896
|
+
type OpenSettings = VimPartialSettings & AddSettings;
|
|
2897
|
+
|
|
2898
|
+
interface GenericTextEntry {
|
|
2899
|
+
type: "text";
|
|
2900
|
+
id: string;
|
|
2901
|
+
label: string;
|
|
2902
|
+
enabled?: () => boolean;
|
|
2903
|
+
visible?: () => boolean;
|
|
2904
|
+
state: StateRef<string>;
|
|
2905
|
+
}
|
|
2906
|
+
interface GenericNumberEntry {
|
|
2907
|
+
type: "number";
|
|
2908
|
+
id: string;
|
|
2909
|
+
label: string;
|
|
2910
|
+
enabled?: () => boolean;
|
|
2911
|
+
visible?: () => boolean;
|
|
2912
|
+
state: StateRef<number>;
|
|
2913
|
+
min?: number;
|
|
2914
|
+
max?: number;
|
|
2915
|
+
step?: number;
|
|
2916
|
+
}
|
|
2917
|
+
interface GenericBoolEntry {
|
|
2918
|
+
type: "bool";
|
|
2919
|
+
id: string;
|
|
2920
|
+
label: string;
|
|
2921
|
+
enabled?: () => boolean;
|
|
2922
|
+
visible?: () => boolean;
|
|
2923
|
+
state: StateRef<boolean>;
|
|
2924
|
+
}
|
|
2925
|
+
type GenericEntryType = GenericTextEntry | GenericBoolEntry | GenericNumberEntry;
|
|
2926
|
+
|
|
2927
|
+
type GenericPanelApi = {
|
|
2928
|
+
customize(fn: (entries: GenericEntryType[]) => GenericEntryType[]): void;
|
|
2929
|
+
};
|
|
2930
|
+
|
|
2931
|
+
/**
|
|
2932
|
+
* @module viw-webgl-react
|
|
2933
|
+
* Contains settings and type definitions for the Vim web viewer
|
|
2934
|
+
*/
|
|
2935
|
+
|
|
2936
|
+
type AnySettings = WebglSettings | UltraSettings;
|
|
2937
|
+
|
|
2938
|
+
type SettingsCustomization<T extends AnySettings> = (items: SettingsItem<T>[]) => SettingsItem<T>[];
|
|
2939
|
+
type SettingsItem<T extends AnySettings> = SettingsSubtitle | SettingsToggle<T> | SettingsBox<T> | SettingsElement;
|
|
2940
|
+
type SettingsSubtitle = {
|
|
2941
|
+
type: 'subtitle';
|
|
2942
|
+
key: string;
|
|
2943
|
+
title: string;
|
|
2944
|
+
};
|
|
2945
|
+
type SettingsToggle<T extends AnySettings> = {
|
|
2946
|
+
type: 'toggle';
|
|
2947
|
+
key: string;
|
|
2948
|
+
label: string;
|
|
2949
|
+
getter: (settings: T) => UserBoolean;
|
|
2950
|
+
setter: (settings: T, b: boolean) => void;
|
|
2951
|
+
};
|
|
2952
|
+
type SettingsBox<T extends AnySettings> = {
|
|
2953
|
+
type: 'box';
|
|
2954
|
+
key: string;
|
|
2955
|
+
label: string;
|
|
2956
|
+
info: string;
|
|
2957
|
+
transform: (value: number) => number;
|
|
2958
|
+
getter: (settings: T) => number;
|
|
2959
|
+
setter: (settings: T, b: number) => void;
|
|
2960
|
+
};
|
|
2961
|
+
type SettingsElement = {
|
|
2962
|
+
type: 'element';
|
|
2963
|
+
key: string;
|
|
2964
|
+
element: JSX.Element;
|
|
2965
|
+
};
|
|
2966
|
+
|
|
2967
|
+
/**
|
|
2968
|
+
* Settings API managing settings applied to the viewer.
|
|
2969
|
+
*/
|
|
2970
|
+
type SettingsApi<T extends AnySettings> = {
|
|
2971
|
+
/**
|
|
2972
|
+
* Allows updating settings by providing a callback function.
|
|
2973
|
+
* @param updater A function that updates the current settings.
|
|
2974
|
+
*/
|
|
2975
|
+
update: (updater: (settings: T) => void) => void;
|
|
2976
|
+
/**
|
|
2977
|
+
* Registers a callback function to be notified when settings are updated.
|
|
2978
|
+
* @param callback A function to be called when settings are updated, receiving the updated settings.
|
|
2979
|
+
*/
|
|
2980
|
+
register: (callback: (settings: T) => void) => void;
|
|
2981
|
+
/**
|
|
2982
|
+
* Customizes the settings panel by providing a customizer function.
|
|
2983
|
+
* @param customizer A function that modifies the settings items.
|
|
2984
|
+
*/
|
|
2985
|
+
customize: (customizer: (items: SettingsItem<T>[]) => SettingsItem<T>[]) => void;
|
|
2986
|
+
};
|
|
2987
|
+
|
|
2988
|
+
/**
|
|
2989
|
+
* @module public-api
|
|
2990
|
+
*/
|
|
2991
|
+
|
|
2992
|
+
/**
|
|
2993
|
+
* Root-level API of the Vim viewer.
|
|
2994
|
+
*/
|
|
2995
|
+
type WebglViewerApi = {
|
|
2996
|
+
/**
|
|
2997
|
+
* Discriminant to distinguish WebGL from Ultra viewer.
|
|
2998
|
+
*/
|
|
2999
|
+
type: 'webgl';
|
|
3000
|
+
/**
|
|
3001
|
+
* HTML structure containing the viewer.
|
|
3002
|
+
*/
|
|
3003
|
+
container: Container;
|
|
3004
|
+
/**
|
|
3005
|
+
* The underlying WebGL core viewer. Provides direct access to low-level 3D operations.
|
|
3006
|
+
*
|
|
3007
|
+
* Common uses:
|
|
3008
|
+
* - `viewer.core.camera.lerp(1).frame(element)` — animated camera movement
|
|
3009
|
+
* - `viewer.core.camera.snap().set(pos, target)` — instant camera placement
|
|
3010
|
+
* - `viewer.core.selection.select(element)` — programmatic selection
|
|
3011
|
+
* - `viewer.core.inputs.pointerMode` — change interaction mode
|
|
3012
|
+
* - `viewer.core.gizmos.sectionBox` — direct section box manipulation
|
|
3013
|
+
* - `viewer.core.renderer.requestRender()` — force re-render
|
|
3014
|
+
*/
|
|
3015
|
+
core: IWebglViewer;
|
|
3016
|
+
/**
|
|
3017
|
+
* Loads a vim file with all geometry for immediate viewing.
|
|
3018
|
+
* Wraps core.load() with progress UI (loading modal), auto-framing on completion,
|
|
3019
|
+
* and error reporting. For headless loading without UI, use core.load() directly.
|
|
3020
|
+
* @param source The url or buffer of the vim file
|
|
3021
|
+
* @param settings Optional settings for transforms and auto-framing
|
|
3022
|
+
* @returns LoadRequest to track progress and get result
|
|
3023
|
+
*/
|
|
3024
|
+
load: (source: RequestSource, settings?: OpenSettings) => IWebglLoadRequest;
|
|
3025
|
+
/**
|
|
3026
|
+
* Opens a vim file without loading geometry.
|
|
3027
|
+
* Wraps core.load() without building geometry. Use for BIM-only queries or
|
|
3028
|
+
* selective loading via vim.load(subset). For headless opening, use core.load() directly.
|
|
3029
|
+
* @param source The url or buffer of the vim file
|
|
3030
|
+
* @param settings Optional settings
|
|
3031
|
+
* @returns LoadRequest to track progress and get result
|
|
3032
|
+
*/
|
|
3033
|
+
open: (source: RequestSource, settings?: OpenSettings) => IWebglLoadRequest;
|
|
3034
|
+
/**
|
|
3035
|
+
* Unloads a vim from the viewer and disposes it.
|
|
3036
|
+
* @param vim The vim to unload
|
|
3037
|
+
*/
|
|
3038
|
+
unload: (vim: IWebglVim) => void;
|
|
3039
|
+
/**
|
|
3040
|
+
* Isolation API managing isolation state in the viewer.
|
|
3041
|
+
*/
|
|
3042
|
+
isolation: IsolationApi;
|
|
3043
|
+
/**
|
|
3044
|
+
* Section box API managing the section box in the viewer.
|
|
3045
|
+
*/
|
|
3046
|
+
sectionBox: SectionBoxApi;
|
|
3047
|
+
/**
|
|
3048
|
+
* Context menu API managing the content and behavior of the context menu.
|
|
3049
|
+
*/
|
|
3050
|
+
contextMenu: ContextMenuApi;
|
|
3051
|
+
/**
|
|
3052
|
+
* Control bar API managing the content and behavior of the control bar.
|
|
3053
|
+
*/
|
|
3054
|
+
controlBar: ControlBarApi;
|
|
3055
|
+
/**
|
|
3056
|
+
* Settings API managing settings applied to the viewer.
|
|
3057
|
+
*/
|
|
3058
|
+
settings: SettingsApi<WebglSettings>;
|
|
3059
|
+
/**
|
|
3060
|
+
* Message API to interact with the loading box.
|
|
3061
|
+
*/
|
|
3062
|
+
modal: ModalApi;
|
|
3063
|
+
/**
|
|
3064
|
+
* High-level framing API with semantic operations (frame selection, auto-camera).
|
|
3065
|
+
* For low-level camera control (orbit, pan, zoom, snap/lerp), use {@link core}.camera instead.
|
|
3066
|
+
* @see {@link FramingApi}
|
|
3067
|
+
*/
|
|
3068
|
+
framing: FramingApi;
|
|
3069
|
+
/**
|
|
3070
|
+
* API To interact with the BIM info panel.
|
|
3071
|
+
*/
|
|
3072
|
+
bimInfo: BimInfoPanelApi;
|
|
3073
|
+
/**
|
|
3074
|
+
* API to interact with the isolation panel.
|
|
3075
|
+
*/
|
|
3076
|
+
isolationPanel: GenericPanelApi;
|
|
3077
|
+
/**
|
|
3078
|
+
* API to interact with the section box panel.
|
|
3079
|
+
*/
|
|
3080
|
+
sectionBoxPanel: GenericPanelApi;
|
|
3081
|
+
/**
|
|
3082
|
+
* Cleans up and releases resources used by the viewer.
|
|
3083
|
+
*/
|
|
3084
|
+
dispose: () => void;
|
|
3085
|
+
};
|
|
3086
|
+
|
|
3087
|
+
/**
|
|
3088
|
+
* Creates a WebGL viewer with full React UI (BIM tree, context menu, control bar, etc.).
|
|
3089
|
+
* Returns a {@link WebglViewerApi} for programmatic interaction.
|
|
3090
|
+
*
|
|
3091
|
+
* @param container An optional container or DOM element. If none is provided, one will be created.
|
|
3092
|
+
* @param settings React UI feature toggles (panels, buttons). See {@link WebglSettings}.
|
|
3093
|
+
* @param coreSettings Core renderer config (camera, materials, lighting). See {@link ViewerSettings}.
|
|
3094
|
+
* @returns A promise resolving to the viewer API.
|
|
3095
|
+
*
|
|
3096
|
+
* @example
|
|
3097
|
+
* const viewer = await React.Webgl.createViewer(document.getElementById('app'))
|
|
3098
|
+
* const vim = await viewer.load({ url: 'model.vim' }).getVim()
|
|
3099
|
+
* viewer.framing.frameScene.call()
|
|
3100
|
+
*/
|
|
3101
|
+
declare function createWebglViewer(container?: Container | HTMLElement, settings?: PartialWebglSettings, coreSettings?: PartialViewerSettings): Promise<WebglViewerApi>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Represents a React viewer providing UI for the Vim viewer.
|
|
3104
|
+
* @param container The container object containing root, gfx, and UI elements for the Vim viewer.
|
|
3105
|
+
* @param viewer The Vim viewer instance for which UI is provided.
|
|
3106
|
+
* @param onMount A callback function triggered when the viewer is mounted. Receives a reference to the Vim viewer.
|
|
3107
|
+
* @param settings Optional settings for configuring the Vim viewer's behavior.
|
|
3108
|
+
*/
|
|
3109
|
+
declare function WebglViewerComponent(props: {
|
|
3110
|
+
container: Container;
|
|
3111
|
+
viewer: IWebglViewer;
|
|
3112
|
+
onMount: (viewer: WebglViewerApi) => void;
|
|
3113
|
+
settings?: PartialWebglSettings;
|
|
3114
|
+
}): react_jsx_runtime.JSX.Element;
|
|
3115
|
+
|
|
3116
|
+
declare namespace React_Webgl {
|
|
3117
|
+
export { WebglViewerComponent as ViewerComponent, createWebglViewer as createViewer, getDefaultSettings };
|
|
3118
|
+
export type { OpenSettings, PartialWebglSettings, WebglViewerApi as ViewerApi, WebglSettings };
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
type UltraViewerApi = {
|
|
3122
|
+
/**
|
|
3123
|
+
* Discriminant to distinguish Ultra from WebGL viewer.
|
|
3124
|
+
*/
|
|
3125
|
+
type: 'ultra';
|
|
3126
|
+
/**
|
|
3127
|
+
* HTML structure containing the viewer.
|
|
3128
|
+
*/
|
|
3129
|
+
container: Container;
|
|
3130
|
+
/**
|
|
3131
|
+
* The underlying Ultra core viewer. Provides direct access to the server connection,
|
|
3132
|
+
* camera, selection, raycaster, renderer, and section box.
|
|
3133
|
+
*
|
|
3134
|
+
* Common uses:
|
|
3135
|
+
* - `viewer.core.camera.lerp(1).frame(element)` — animated camera movement
|
|
3136
|
+
* - `viewer.core.camera.snap().set(pos, target)` — instant camera placement
|
|
3137
|
+
* - `viewer.core.selection.select(element)` — programmatic selection
|
|
3138
|
+
* - `viewer.core.inputs.pointerMode` — change interaction mode
|
|
3139
|
+
* - `viewer.core.sectionBox` — direct section box manipulation
|
|
3140
|
+
* - `viewer.core.renderer.ghostColor` — ghost rendering settings
|
|
3141
|
+
*/
|
|
3142
|
+
core: IUltraViewer;
|
|
3143
|
+
/**
|
|
3144
|
+
* API to manage the modal dialog.
|
|
3145
|
+
*/
|
|
3146
|
+
modal: ModalApi;
|
|
3147
|
+
/**
|
|
3148
|
+
* API to manage the section box.
|
|
3149
|
+
*/
|
|
3150
|
+
sectionBox: SectionBoxApi;
|
|
3151
|
+
/**
|
|
3152
|
+
* API to customize the control.
|
|
3153
|
+
*/
|
|
3154
|
+
controlBar: ControlBarApi;
|
|
3155
|
+
/**
|
|
3156
|
+
* High-level framing API with semantic operations (frame selection, auto-camera).
|
|
3157
|
+
* For low-level camera control (snap/lerp, set position), use {@link core}.camera instead.
|
|
3158
|
+
* @see {@link FramingApi}
|
|
3159
|
+
*/
|
|
3160
|
+
framing: FramingApi;
|
|
3161
|
+
/**
|
|
3162
|
+
* Isolation API managing element visibility and isolation state.
|
|
3163
|
+
* @see {@link IsolationApi}
|
|
3164
|
+
*/
|
|
3165
|
+
isolation: IsolationApi;
|
|
3166
|
+
/**
|
|
3167
|
+
* Settings API managing UI feature toggles applied to the viewer.
|
|
3168
|
+
* Use `update()` to modify settings at runtime.
|
|
3169
|
+
*/
|
|
3170
|
+
settings: SettingsApi<UltraSettings>;
|
|
3171
|
+
/**
|
|
3172
|
+
* API to interact with the isolation panel.
|
|
3173
|
+
*/
|
|
3174
|
+
isolationPanel: GenericPanelApi;
|
|
3175
|
+
/**
|
|
3176
|
+
* API to interact with the section box panel.
|
|
3177
|
+
*/
|
|
3178
|
+
sectionBoxPanel: GenericPanelApi;
|
|
3179
|
+
/**
|
|
3180
|
+
* Disposes of the viewer and its resources.
|
|
3181
|
+
*/
|
|
3182
|
+
dispose: () => void;
|
|
3183
|
+
/**
|
|
3184
|
+
* Loads a VIM file via the Ultra server.
|
|
3185
|
+
* Wraps core.load() with connection management, progress UI (loading modal),
|
|
3186
|
+
* and error reporting. For headless loading, use core.load() directly.
|
|
3187
|
+
* @param source The VIM source (url and optional headers)
|
|
3188
|
+
* @returns LoadRequest to track progress and get result
|
|
3189
|
+
*/
|
|
3190
|
+
load(source: VimSource): IUltraLoadRequest;
|
|
3191
|
+
/**
|
|
3192
|
+
* Unloads a vim from the viewer and disposes it.
|
|
3193
|
+
* @param vim The vim to unload
|
|
3194
|
+
*/
|
|
3195
|
+
unload(vim: IUltraVim): void;
|
|
3196
|
+
};
|
|
3197
|
+
|
|
3198
|
+
/**
|
|
3199
|
+
* Creates an Ultra viewer with React UI for server-side rendered models.
|
|
3200
|
+
* Returns an {@link UltraViewerApi} for programmatic interaction.
|
|
3201
|
+
*
|
|
3202
|
+
* @param container An optional container or DOM element. If none is provided, one will be created.
|
|
3203
|
+
* @param settings React UI feature toggles (panels, buttons). See {@link UltraSettings}.
|
|
3204
|
+
* @returns A promise resolving to the viewer API.
|
|
3205
|
+
*
|
|
3206
|
+
* @example
|
|
3207
|
+
* const viewer = await React.Ultra.createViewer(document.getElementById('app'))
|
|
3208
|
+
* await viewer.core.connect({ url: 'wss://server:8080' })
|
|
3209
|
+
* viewer.load({ url: 'model.vim' })
|
|
3210
|
+
*/
|
|
3211
|
+
declare function createUltraViewer(container?: Container | HTMLElement, settings?: PartialUltraSettings): Promise<UltraViewerApi>;
|
|
3212
|
+
/**
|
|
3213
|
+
* Represents a React viewer providing UI for the Vim viewer.
|
|
3214
|
+
* @param container The container object containing root, gfx, and UI elements for the Vim viewer.
|
|
3215
|
+
* @param viewer The Vim viewer instance for which UI is provided.
|
|
3216
|
+
* @param onMount A callback function triggered when the viewer is mounted. Receives a reference to the Vim viewer.
|
|
3217
|
+
* @param settings Optional settings for configuring the Vim viewer's behavior.
|
|
3218
|
+
*/
|
|
3219
|
+
declare function UltraViewerComponent(props: {
|
|
3220
|
+
container: Container;
|
|
3221
|
+
core: IUltraViewer;
|
|
3222
|
+
settings?: PartialUltraSettings;
|
|
3223
|
+
onMount: (viewer: UltraViewerApi) => void;
|
|
3224
|
+
}): react_jsx_runtime.JSX.Element;
|
|
3225
|
+
|
|
3226
|
+
declare namespace React_Ultra {
|
|
3227
|
+
export { UltraViewerComponent as ViewerComponent, createUltraViewer as createViewer, getDefaultUltraSettings };
|
|
3228
|
+
export type { PartialUltraSettings, UltraSettings, UltraViewerApi as ViewerApi };
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
declare const controlBarIds: {
|
|
3232
|
+
readonly cameraSpan: "controlBar.cameraSpan";
|
|
3233
|
+
readonly cameraFrameSelection: "controlBar.cameraFrameSelection";
|
|
3234
|
+
readonly cameraFrameScene: "controlBar.cameraFrameScene";
|
|
3235
|
+
readonly cameraAuto: "controlBar.cameraAuto";
|
|
3236
|
+
readonly cursorSpan: "controlBar.cursorSpan";
|
|
3237
|
+
readonly cursorOrbit: "controlBar.cursorOrbit";
|
|
3238
|
+
readonly cursorLook: "controlBar.cursorLook";
|
|
3239
|
+
readonly cursorPan: "controlBar.cursorPan";
|
|
3240
|
+
readonly cursorZoom: "controlBar.cursorZoom";
|
|
3241
|
+
readonly cursorZoomWindow: "controlBar.cursorZoomWindow";
|
|
3242
|
+
readonly visibilitySpan: "controlBar.visibilitySpan";
|
|
3243
|
+
readonly visibilityClearSelection: "controlBar.visibilityClearSelection";
|
|
3244
|
+
readonly visibilityShowAll: "controlBar.visibilityShowAll";
|
|
3245
|
+
readonly visibilityIsolateSelection: "controlBar.visibilityIsolateSelection";
|
|
3246
|
+
readonly visibilityHideSelection: "controlBar.visibilityHideSelection";
|
|
3247
|
+
readonly visibilityShowSelection: "controlBar.visibilityShowSelection";
|
|
3248
|
+
readonly visibilityAutoIsolate: "controlBar.visibilityAutoIsolate";
|
|
3249
|
+
readonly visibilitySettings: "controlBar.visibilitySettings";
|
|
3250
|
+
readonly sectioningSpan: "controlBar.sectioningSpan";
|
|
3251
|
+
readonly sectioningEnable: "controlBar.sectioningEnable";
|
|
3252
|
+
readonly sectioningVisible: "controlBar.sectioningVisible";
|
|
3253
|
+
readonly sectioningFitSelection: "controlBar.sectioningFitSelection";
|
|
3254
|
+
readonly sectioningFitScene: "controlBar.sectioningFitScene";
|
|
3255
|
+
readonly sectioningAuto: "controlBar.sectioningAuto";
|
|
3256
|
+
readonly sectioningSettings: "controlBar.sectioningSettings";
|
|
3257
|
+
readonly measureSpan: "controlBar.measureSpan";
|
|
3258
|
+
readonly measureEnable: "controlBar.measureEnable";
|
|
3259
|
+
readonly miscSpan: "controlBar.miscSpan";
|
|
3260
|
+
readonly miscInspector: "controlBar.miscInspector";
|
|
3261
|
+
readonly miscSettings: "controlBar.miscSettings";
|
|
3262
|
+
readonly miscHelp: "controlBar.miscHelp";
|
|
3263
|
+
readonly miscMaximize: "controlBar.miscMaximize";
|
|
3264
|
+
};
|
|
3265
|
+
|
|
3266
|
+
declare namespace React_ControlBar {
|
|
3267
|
+
export { controlBarIds as Ids, React_ControlBar_Style as Style };
|
|
3268
|
+
export type { ControlBarApi, ControlBarCustomization, IControlBarButton, IControlBarSection };
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
declare namespace React_Settings {
|
|
3272
|
+
export { isFalse, isTrue };
|
|
3273
|
+
export type { SettingsBox, SettingsCustomization, SettingsElement, SettingsItem, SettingsSubtitle, SettingsToggle, UserBoolean };
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3276
|
+
declare const vcColorPrimary = "vc-text-[#212733]";
|
|
3277
|
+
declare const vcColorSecondary = "vc-text-[#787C83]";
|
|
3278
|
+
declare const vcColorLink = "vc-text-[#0590CC]";
|
|
3279
|
+
declare const vcLink = "vc-text-[#0590CC] vc-underline";
|
|
3280
|
+
declare const vcLabel = "vc-text-[#3F444F]";
|
|
3281
|
+
declare const vcRoboto = "vc-font-['Roboto',sans-serif]";
|
|
3282
|
+
declare function footer(): react_jsx_runtime.JSX.Element;
|
|
3283
|
+
declare function mainText(text: JSX.Element): react_jsx_runtime.JSX.Element;
|
|
3284
|
+
declare function detailText(text: string): react_jsx_runtime.JSX.Element;
|
|
3285
|
+
declare function bold(text: string): react_jsx_runtime.JSX.Element;
|
|
3286
|
+
declare function subTitle(title: string): react_jsx_runtime.JSX.Element;
|
|
3287
|
+
declare function dotList(elements: (JSX.Element | string)[]): react_jsx_runtime.JSX.Element;
|
|
3288
|
+
declare function numList(elements: (JSX.Element | string)[]): react_jsx_runtime.JSX.Element;
|
|
3289
|
+
declare function bullet(label: string, value: string): react_jsx_runtime.JSX.Element;
|
|
3290
|
+
declare function link(url: string, text: string): react_jsx_runtime.JSX.Element;
|
|
3291
|
+
|
|
3292
|
+
declare namespace React_Errors_Style {
|
|
3293
|
+
export {
|
|
3294
|
+
bold,
|
|
3295
|
+
bullet,
|
|
3296
|
+
detailText,
|
|
3297
|
+
dotList,
|
|
3298
|
+
footer,
|
|
3299
|
+
link,
|
|
3300
|
+
mainText,
|
|
3301
|
+
numList,
|
|
3302
|
+
subTitle,
|
|
3303
|
+
vcColorLink,
|
|
3304
|
+
vcColorPrimary,
|
|
3305
|
+
vcColorSecondary,
|
|
3306
|
+
vcLabel,
|
|
3307
|
+
vcLink,
|
|
3308
|
+
vcRoboto,
|
|
3309
|
+
};
|
|
3310
|
+
}
|
|
3311
|
+
|
|
3312
|
+
declare namespace React_Errors {
|
|
3313
|
+
export {
|
|
3314
|
+
React_Errors_Style as Style,
|
|
3315
|
+
};
|
|
3316
|
+
}
|
|
3317
|
+
|
|
3318
|
+
declare const contextMenuIds: {
|
|
3319
|
+
readonly showControls: "showControls";
|
|
3320
|
+
readonly dividerCamera: "dividerCamera";
|
|
3321
|
+
readonly resetCamera: "resetCamera";
|
|
3322
|
+
readonly zoomToFit: "zoomToFit";
|
|
3323
|
+
readonly dividerSelection: "dividerSelection";
|
|
3324
|
+
readonly isolateSelection: "isolateObject";
|
|
3325
|
+
readonly selectSimilar: "selectSimilar";
|
|
3326
|
+
readonly hideObject: "hideObject";
|
|
3327
|
+
readonly showObject: "showObject";
|
|
3328
|
+
readonly clearSelection: "clearSelection";
|
|
3329
|
+
readonly showAll: "showAll";
|
|
3330
|
+
readonly dividerSection: "dividerSection";
|
|
3331
|
+
readonly ignoreSection: "ignoreSection";
|
|
3332
|
+
readonly resetSection: "resetSection";
|
|
3333
|
+
readonly fitSectionToSelection: "fitSectionToSelection";
|
|
3334
|
+
};
|
|
3335
|
+
|
|
3336
|
+
declare namespace React_ContextMenu {
|
|
3337
|
+
export { contextMenuIds as Ids };
|
|
3338
|
+
export type { ContextMenuApi, ContextMenuCustomization, ContextMenuElement, IContextMenuButton, IContextMenuDivider };
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
declare const SectionBoxPanel: {
|
|
3342
|
+
Ids: {
|
|
3343
|
+
topOffset: string;
|
|
3344
|
+
sideOffset: string;
|
|
3345
|
+
bottomOffset: string;
|
|
3346
|
+
};
|
|
3347
|
+
};
|
|
3348
|
+
declare const IsolationPanel: {
|
|
3349
|
+
Ids: {
|
|
3350
|
+
showGhost: string;
|
|
3351
|
+
ghostOpacity: string;
|
|
3352
|
+
transparency: string;
|
|
3353
|
+
};
|
|
3354
|
+
};
|
|
3355
|
+
|
|
3356
|
+
type ViewerApi = WebglViewerApi | UltraViewerApi;
|
|
3357
|
+
|
|
3358
|
+
declare namespace React {
|
|
3359
|
+
export { React_ContextMenu as ContextMenu, React_ControlBar as ControlBar, React_Errors as Errors, React_Icons as Icons, IsolationPanel, SectionBoxPanel, React_Settings as Settings, React_Ultra as Ultra, React_Webgl as Webgl, createContainer, createState };
|
|
3360
|
+
export type { AugmentedElement, BimInfoPanelApi, Container, Data, DataCustomization, DataRender, Entry, FramingApi, FuncRef, GenericBoolEntry, GenericEntryType, GenericNumberEntry, GenericPanelApi, GenericTextEntry, Group, IsolationApi, LoadingBoxProps, MessageBoxProps, ModalApi, ModalProps, ProgressMode, Section, SectionBoxApi, SettingsApi, StateRef, ViewerApi, VisibilityStatus };
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3363
|
+
export { Core as Core, React as React };
|
|
3364
|
+
export type { ISignal, ISimpleEvent };
|