vim-web 0.5.0-dev.9 → 0.6.0-dev.0
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/dist/style.css +34 -7
- package/dist/types/core-viewers/shared/index.d.ts +2 -0
- package/dist/types/core-viewers/shared/inputAdapter.d.ts +2 -1
- package/dist/types/core-viewers/shared/keyboardHandler.d.ts +1 -1
- package/dist/types/core-viewers/shared/loadResult.d.ts +55 -0
- package/dist/types/core-viewers/shared/mouseHandler.d.ts +4 -1
- package/dist/types/core-viewers/shared/raycaster.d.ts +5 -5
- package/dist/types/core-viewers/shared/vimCollection.d.ts +25 -0
- package/dist/types/core-viewers/ultra/loadRequest.d.ts +6 -28
- package/dist/types/core-viewers/ultra/viewer.d.ts +6 -1
- package/dist/types/core-viewers/ultra/viewport.d.ts +6 -0
- package/dist/types/core-viewers/ultra/vim.d.ts +3 -1
- package/dist/types/core-viewers/ultra/vimCollection.d.ts +15 -11
- package/dist/types/core-viewers/webgl/index.d.ts +0 -1
- package/dist/types/core-viewers/webgl/loader/index.d.ts +3 -3
- package/dist/types/core-viewers/webgl/loader/materials/index.d.ts +1 -0
- package/dist/types/core-viewers/webgl/loader/materials/pickingMaterial.d.ts +42 -0
- package/dist/types/core-viewers/webgl/loader/mesh.d.ts +3 -1
- package/dist/types/core-viewers/webgl/loader/progressive/insertableGeometry.d.ts +6 -1
- package/dist/types/core-viewers/webgl/loader/progressive/insertableMesh.d.ts +6 -3
- package/dist/types/core-viewers/webgl/loader/progressive/instancedMesh.d.ts +5 -0
- package/dist/types/core-viewers/webgl/loader/progressive/instancedMeshFactory.d.ts +8 -1
- package/dist/types/core-viewers/webgl/loader/progressive/legacyMeshFactory.d.ts +4 -1
- package/dist/types/core-viewers/webgl/loader/progressive/loadRequest.d.ts +21 -0
- package/dist/types/core-viewers/webgl/loader/progressive/subsetBuilder.d.ts +2 -1
- package/dist/types/core-viewers/webgl/loader/progressive/subsetRequest.d.ts +3 -2
- package/dist/types/core-viewers/webgl/loader/vim.d.ts +12 -2
- package/dist/types/core-viewers/webgl/loader/vimCollection.d.ts +78 -0
- package/dist/types/core-viewers/webgl/loader/vimSettings.d.ts +11 -4
- package/dist/types/core-viewers/webgl/viewer/camera/cameraMovement.d.ts +8 -0
- package/dist/types/core-viewers/webgl/viewer/gizmos/gizmoOrbit.d.ts +22 -17
- package/dist/types/core-viewers/webgl/viewer/gizmos/markers/gizmoMarker.d.ts +1 -0
- package/dist/types/core-viewers/webgl/viewer/raycaster.d.ts +3 -1
- package/dist/types/core-viewers/webgl/viewer/rendering/gpuPicker.d.ts +127 -0
- package/dist/types/core-viewers/webgl/viewer/rendering/renderScene.d.ts +2 -2
- package/dist/types/core-viewers/webgl/viewer/rendering/renderer.d.ts +7 -0
- package/dist/types/core-viewers/webgl/viewer/rendering/renderingSection.d.ts +4 -0
- package/dist/types/core-viewers/webgl/viewer/settings/viewerSettings.d.ts +11 -6
- package/dist/types/core-viewers/webgl/viewer/viewer.d.ts +16 -1
- package/dist/types/core-viewers/webgl/viewer/viewport.d.ts +1 -1
- package/dist/types/react-viewers/bim/bimPanel.d.ts +3 -3
- package/dist/types/react-viewers/controlbar/controlBarIds.d.ts +32 -36
- package/dist/types/react-viewers/errors/errorStyle.d.ts +1 -1
- package/dist/types/react-viewers/helpers/loadRequest.d.ts +14 -16
- package/dist/types/react-viewers/helpers/reactUtils.d.ts +2 -1
- package/dist/types/react-viewers/helpers/utils.d.ts +8 -0
- package/dist/types/react-viewers/panels/axesPanel.d.ts +2 -1
- package/dist/types/react-viewers/panels/index.d.ts +1 -0
- package/dist/types/react-viewers/panels/isolationPanel.d.ts +2 -0
- package/dist/types/react-viewers/panels/loadingBox.d.ts +1 -1
- package/dist/types/react-viewers/panels/messageBox.d.ts +2 -0
- package/dist/types/react-viewers/panels/sidePanel.d.ts +1 -1
- package/dist/types/react-viewers/settings/anySettings.d.ts +7 -0
- package/dist/types/react-viewers/settings/index.d.ts +1 -1
- package/dist/types/react-viewers/settings/settingsInputBox.d.ts +4 -0
- package/dist/types/react-viewers/settings/settingsItem.d.ts +30 -0
- package/dist/types/react-viewers/settings/settingsKeys.d.ts +46 -0
- package/dist/types/react-viewers/settings/settingsPanel.d.ts +5 -4
- package/dist/types/react-viewers/settings/settingsPanelContent.d.ts +6 -0
- package/dist/types/react-viewers/settings/settingsState.d.ts +11 -11
- package/dist/types/react-viewers/settings/settingsStorage.d.ts +3 -3
- package/dist/types/react-viewers/settings/settingsSubtitle.d.ts +2 -0
- package/dist/types/react-viewers/settings/settingsToggle.d.ts +11 -0
- package/dist/types/react-viewers/state/controlBarState.d.ts +41 -7
- package/dist/types/react-viewers/state/sharedIsolation.d.ts +2 -0
- package/dist/types/react-viewers/ultra/controlBar.d.ts +4 -1
- package/dist/types/react-viewers/ultra/index.d.ts +1 -0
- package/dist/types/react-viewers/ultra/settings.d.ts +13 -0
- package/dist/types/react-viewers/ultra/settingsPanel.d.ts +5 -0
- package/dist/types/react-viewers/ultra/viewer.d.ts +3 -1
- package/dist/types/react-viewers/ultra/viewerRef.d.ts +3 -0
- package/dist/types/react-viewers/urls.d.ts +0 -1
- package/dist/types/react-viewers/webgl/index.d.ts +1 -0
- package/dist/types/react-viewers/webgl/loading.d.ts +19 -24
- package/dist/types/react-viewers/webgl/settings.d.ts +36 -0
- package/dist/types/react-viewers/webgl/settingsPanel.d.ts +12 -0
- package/dist/types/react-viewers/webgl/viewer.d.ts +3 -3
- package/dist/types/react-viewers/webgl/viewerRef.d.ts +32 -8
- package/dist/types/utils/asyncQueue.d.ts +15 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/vim-web.iife.js +49873 -49090
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +49690 -48907
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/core-viewers/webgl/loader/progressive/open.d.ts +0 -12
- package/dist/types/core-viewers/webgl/loader/progressive/vimRequest.d.ts +0 -44
- package/dist/types/react-viewers/settings/settings.d.ts +0 -61
- package/dist/types/utils/result.d.ts +0 -13
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Scene } from '../scene';
|
|
5
5
|
import { G3dMaterial, G3d } from 'vim-format';
|
|
6
6
|
import { G3dSubset } from './g3dSubset';
|
|
7
|
+
import { ElementMapping } from '../elementMapping';
|
|
7
8
|
/**
|
|
8
9
|
* Mesh factory to load a standard vim using the progressive pipeline.
|
|
9
10
|
*/
|
|
@@ -12,7 +13,9 @@ export declare class VimMeshFactory {
|
|
|
12
13
|
private _materials;
|
|
13
14
|
private _instancedFactory;
|
|
14
15
|
private _scene;
|
|
15
|
-
|
|
16
|
+
private _mapping;
|
|
17
|
+
private _vimIndex;
|
|
18
|
+
constructor(g3d: G3d, materials: G3dMaterial, scene: Scene, mapping: ElementMapping, vimIndex?: number);
|
|
16
19
|
/**
|
|
17
20
|
* Adds all instances from subset to the scene
|
|
18
21
|
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { VimPartialSettings } from '../vimSettings';
|
|
2
|
+
import { Vim } from '../vim';
|
|
3
|
+
import { LoadRequest as BaseLoadRequest, ILoadRequest as BaseILoadRequest } from '../../../shared/loadResult';
|
|
4
|
+
import { VimSource } from '../..';
|
|
5
|
+
export type RequestSource = {
|
|
6
|
+
url?: string;
|
|
7
|
+
buffer?: ArrayBuffer;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
export type ILoadRequest = BaseILoadRequest<Vim>;
|
|
11
|
+
/**
|
|
12
|
+
* A request to load a VIM file. Extends the base LoadRequest to add BFast abort handling.
|
|
13
|
+
* Loading starts immediately upon construction.
|
|
14
|
+
*/
|
|
15
|
+
export declare class LoadRequest extends BaseLoadRequest<Vim> {
|
|
16
|
+
private _bfast;
|
|
17
|
+
constructor(source: VimSource, settings: VimPartialSettings, vimIndex: number);
|
|
18
|
+
private startRequest;
|
|
19
|
+
private loadFromVim;
|
|
20
|
+
abort(): void;
|
|
21
|
+
}
|
|
@@ -41,11 +41,12 @@ export declare class VimSubsetBuilder implements SubsetBuilder {
|
|
|
41
41
|
export declare class VimxSubsetBuilder {
|
|
42
42
|
private _localVimx;
|
|
43
43
|
private _scene;
|
|
44
|
+
private _vimIndex;
|
|
44
45
|
private _set;
|
|
45
46
|
private _onUpdate;
|
|
46
47
|
get onUpdate(): ISignal;
|
|
47
48
|
get isLoading(): boolean;
|
|
48
|
-
constructor(localVimx: Vimx, scene: Scene);
|
|
49
|
+
constructor(localVimx: Vimx, scene: Scene, vimIndex?: number);
|
|
49
50
|
getFullSet(): G3dSubset;
|
|
50
51
|
loadSubset(subset: G3dSubset, settings?: LoadPartialSettings): Promise<void>;
|
|
51
52
|
clear(): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module vim-loader
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Scene } from '../scene';
|
|
5
|
+
import { Vimx } from './vimx';
|
|
5
6
|
import { G3dSubset } from './g3dSubset';
|
|
6
7
|
export type LoadSettings = {
|
|
7
8
|
/** Delay in ms between each rendering list update. @default: 400ms */
|
|
@@ -27,7 +28,7 @@ export declare class SubsetRequest {
|
|
|
27
28
|
private _started;
|
|
28
29
|
private _scene;
|
|
29
30
|
getBoundingBox(): import("three").Box3;
|
|
30
|
-
constructor(scene: Scene, localVimx: Vimx, subset: G3dSubset);
|
|
31
|
+
constructor(scene: Scene, localVimx: Vimx, subset: G3dSubset, vimIndex?: number);
|
|
31
32
|
dispose(): void;
|
|
32
33
|
start(settings: LoadPartialSettings): Promise<void>;
|
|
33
34
|
private nextFrame;
|
|
@@ -18,6 +18,16 @@ type VimFormat = 'vim' | 'vimx';
|
|
|
18
18
|
* Facilitates high-level scene manipulation by providing access to objects.
|
|
19
19
|
*/
|
|
20
20
|
export declare class Vim implements IVim<Element3D> {
|
|
21
|
+
/**
|
|
22
|
+
* The type of the viewer, indicating it is a WebGL viewer.
|
|
23
|
+
* Useful for distinguishing between different viewer types in a multi-viewer application.
|
|
24
|
+
*/
|
|
25
|
+
readonly type = "webgl";
|
|
26
|
+
/**
|
|
27
|
+
* The stable ID of this vim in the scene's vim collection (0-255).
|
|
28
|
+
* Used for GPU picking to identify which vim an element belongs to.
|
|
29
|
+
*/
|
|
30
|
+
readonly vimIndex: number;
|
|
21
31
|
/**
|
|
22
32
|
* Indicates whether the vim was opened from a vim or vimx file.
|
|
23
33
|
*/
|
|
@@ -76,13 +86,13 @@ export declare class Vim implements IVim<Element3D> {
|
|
|
76
86
|
* @param {G3d | undefined} g3d - The G3d object, if available.
|
|
77
87
|
* @param {Scene} scene - The scene containing the vim's geometry.
|
|
78
88
|
* @param {VimSettings} settings - The settings used to open this vim.
|
|
89
|
+
* @param {number} vimIndex - The stable ID of this vim (0-255) for GPU picking.
|
|
79
90
|
* @param {ElementMapping | ElementNoMapping | ElementMapping2} map - The element mapping.
|
|
80
91
|
* @param {SubsetBuilder} builder - The subset builder for constructing subsets of the Vim object.
|
|
81
92
|
* @param {string} source - The source of the Vim object.
|
|
82
93
|
* @param {VimFormat} format - The format of the Vim object.
|
|
83
|
-
* @param {boolean} isLegacy - Indicates whether the Vim object uses a legacy loading pipeline.
|
|
84
94
|
*/
|
|
85
|
-
constructor(header: VimHeader | undefined, document: VimDocument, g3d: G3d | undefined, scene: Scene, settings: VimSettings, map: ElementMapping | ElementNoMapping | ElementMapping2, builder: SubsetBuilder, source: string, format: VimFormat);
|
|
95
|
+
constructor(header: VimHeader | undefined, document: VimDocument, g3d: G3d | undefined, scene: Scene, settings: VimSettings, vimIndex: number, map: ElementMapping | ElementNoMapping | ElementMapping2, builder: SubsetBuilder, source: string, format: VimFormat);
|
|
86
96
|
getBoundingBox(): Promise<THREE.Box3>;
|
|
87
97
|
/**
|
|
88
98
|
* Retrieves the matrix representation of the Vim object's position, rotation, and scale.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module vim-loader
|
|
3
|
+
*/
|
|
4
|
+
import { ISignal } from 'ste-signals';
|
|
5
|
+
import { IVimCollection } from '../../shared/vimCollection';
|
|
6
|
+
import { Vim } from './vim';
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of vims that can be loaded simultaneously.
|
|
9
|
+
* Limited by the 8-bit vimIndex in GPU picking (256 values: 0-255).
|
|
10
|
+
*/
|
|
11
|
+
export declare const MAX_VIMS = 256;
|
|
12
|
+
/**
|
|
13
|
+
* Manages a collection of Vim objects with stable IDs for GPU picking.
|
|
14
|
+
*
|
|
15
|
+
* Each vim is assigned a stable ID (0-255) that persists for its lifetime.
|
|
16
|
+
* IDs are allocated sequentially and only reused after all 256 have been used.
|
|
17
|
+
* This ensures GPU picker can correctly identify vims even after removals.
|
|
18
|
+
*/
|
|
19
|
+
export declare class VimCollection implements IVimCollection<Vim> {
|
|
20
|
+
private _vimsById;
|
|
21
|
+
private _nextId;
|
|
22
|
+
private _freedIds;
|
|
23
|
+
private _count;
|
|
24
|
+
private _onChanged;
|
|
25
|
+
/**
|
|
26
|
+
* Signal dispatched when collection changes (add/remove/clear).
|
|
27
|
+
*/
|
|
28
|
+
get onChanged(): ISignal;
|
|
29
|
+
/**
|
|
30
|
+
* Allocates a stable ID for a new vim.
|
|
31
|
+
* Fresh IDs are allocated sequentially (0, 1, 2, ..., 255).
|
|
32
|
+
* Freed IDs are only reused after all 256 have been allocated once.
|
|
33
|
+
* @returns The allocated ID, or undefined if all 256 IDs are in use
|
|
34
|
+
*/
|
|
35
|
+
allocateId(): number | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the collection has reached maximum capacity (256 vims).
|
|
38
|
+
*/
|
|
39
|
+
get isFull(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The number of vims currently in the collection.
|
|
42
|
+
*/
|
|
43
|
+
get count(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Adds a vim to the collection using its vimIndex as the ID.
|
|
46
|
+
* The vim's vimIndex should have been allocated via allocateId().
|
|
47
|
+
* @param vim The vim to add
|
|
48
|
+
* @throws Error if the vim's vimIndex slot is already occupied
|
|
49
|
+
*/
|
|
50
|
+
add(vim: Vim): void;
|
|
51
|
+
/**
|
|
52
|
+
* Removes a vim from the collection and frees its ID for reuse.
|
|
53
|
+
* @param vim The vim to remove
|
|
54
|
+
* @throws Error if the vim is not in the collection
|
|
55
|
+
*/
|
|
56
|
+
remove(vim: Vim): void;
|
|
57
|
+
/**
|
|
58
|
+
* Gets a vim by its stable ID.
|
|
59
|
+
* @param id The stable ID (0-255)
|
|
60
|
+
* @returns The vim at that ID, or undefined if empty
|
|
61
|
+
*/
|
|
62
|
+
getFromId(id: number): Vim | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Checks if a vim is in the collection.
|
|
65
|
+
* @param vim The vim to check
|
|
66
|
+
* @returns True if the vim is in the collection
|
|
67
|
+
*/
|
|
68
|
+
has(vim: Vim): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Returns all vims as a packed array (for iteration).
|
|
71
|
+
* @returns Array of all vims currently in the collection
|
|
72
|
+
*/
|
|
73
|
+
getAll(): Vim[];
|
|
74
|
+
/**
|
|
75
|
+
* Clears all vims from the collection and resets ID allocation.
|
|
76
|
+
*/
|
|
77
|
+
clear(): void;
|
|
78
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Transparency } from './geometry';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
|
-
|
|
6
|
+
type FileType = 'vim' | 'vimx' | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* Represents settings for configuring the behavior and rendering of a vim object.
|
|
9
9
|
*/
|
|
@@ -33,6 +33,12 @@ export type VimSettings = {
|
|
|
33
33
|
* Set to true to enable verbose HTTP logging.
|
|
34
34
|
*/
|
|
35
35
|
verboseHttp: boolean;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Internal settings type that includes vimx-specific fields.
|
|
39
|
+
* Used internally for loading vimx files.
|
|
40
|
+
*/
|
|
41
|
+
export type VimSettingsFull = VimSettings & {
|
|
36
42
|
/**
|
|
37
43
|
* Specifies the file type (vim or vimx) if it cannot or should not be inferred from the file extension.
|
|
38
44
|
*/
|
|
@@ -49,7 +55,7 @@ export type VimSettings = {
|
|
|
49
55
|
/**
|
|
50
56
|
* Default configuration settings for a vim object.
|
|
51
57
|
*/
|
|
52
|
-
export declare function getDefaultVimSettings():
|
|
58
|
+
export declare function getDefaultVimSettings(): VimSettingsFull;
|
|
53
59
|
/**
|
|
54
60
|
* Represents a partial configuration of settings for a vim object.
|
|
55
61
|
*/
|
|
@@ -57,6 +63,7 @@ export type VimPartialSettings = Partial<VimSettings>;
|
|
|
57
63
|
/**
|
|
58
64
|
* Wraps Vim options, converting values to related THREE.js types and providing default values.
|
|
59
65
|
* @param {VimPartialSettings} [options] - Optional partial settings for the Vim object.
|
|
60
|
-
* @returns {
|
|
66
|
+
* @returns {VimSettingsFull} The complete settings for the Vim object, including defaults.
|
|
61
67
|
*/
|
|
62
|
-
export declare function createVimSettings(options?: VimPartialSettings):
|
|
68
|
+
export declare function createVimSettings(options?: VimPartialSettings): VimSettingsFull;
|
|
69
|
+
export {};
|
|
@@ -39,6 +39,14 @@ export declare abstract class CameraMovement {
|
|
|
39
39
|
* @param {number} amount - The factor by which to change the distance (e.g., 0.5 for halving the distance, 2 for doubling the distance).
|
|
40
40
|
*/
|
|
41
41
|
abstract zoom(amount: number): void;
|
|
42
|
+
/**
|
|
43
|
+
* Zooms toward a specific point, making it the new orbit target.
|
|
44
|
+
* Preserves the camera's forward direction while moving closer/farther from the point.
|
|
45
|
+
* If point is undefined, falls back to regular zoom.
|
|
46
|
+
* @param {THREE.Vector3 | undefined} point - The world position to zoom toward, or undefined for regular zoom
|
|
47
|
+
* @param {number} amount - The zoom factor (< 1 zooms in, > 1 zooms out)
|
|
48
|
+
*/
|
|
49
|
+
zoomTo(point: THREE.Vector3 | undefined, amount: number): void;
|
|
42
50
|
/**
|
|
43
51
|
* Sets the distance between the camera and its target to the specified value.
|
|
44
52
|
* @param {number} dist - The new distance between the camera and its target.
|
|
@@ -7,26 +7,33 @@ import { Camera } from '../camera/camera';
|
|
|
7
7
|
import { ViewerSettings } from '../settings/viewerSettings';
|
|
8
8
|
import { type InputHandler } from '../../../shared';
|
|
9
9
|
/**
|
|
10
|
-
* Manages the camera target gizmo
|
|
10
|
+
* Manages the camera target gizmo - displays orbital rings at the camera target
|
|
11
|
+
* 2 vertical rings (great circles) + 3 horizontal rings (latitude circles)
|
|
12
|
+
* Each rendered twice: once with depth test, once always visible (for see-through effect)
|
|
11
13
|
*/
|
|
12
14
|
export declare class GizmoOrbit {
|
|
13
15
|
private _renderer;
|
|
14
16
|
private _camera;
|
|
15
17
|
private _inputs;
|
|
16
18
|
private _size;
|
|
17
|
-
private _color;
|
|
18
|
-
private _opacity;
|
|
19
|
-
private _opacityAlways;
|
|
20
19
|
private _showDurationMs;
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private
|
|
20
|
+
private _torusGeometry;
|
|
21
|
+
private _verticalMaterialDepth;
|
|
22
|
+
private _verticalMaterialAlways;
|
|
23
|
+
private _horizontalMaterialDepth;
|
|
24
|
+
private _horizontalMaterialAlways;
|
|
25
|
+
private _verticalMeshDepth;
|
|
26
|
+
private _verticalMeshAlways;
|
|
27
|
+
private _horizontalMeshDepth;
|
|
28
|
+
private _horizontalMeshAlways;
|
|
25
29
|
private _gizmos;
|
|
26
30
|
private _disconnectCamera;
|
|
27
31
|
private _timeout;
|
|
28
32
|
private _active;
|
|
29
|
-
private
|
|
33
|
+
private _color;
|
|
34
|
+
private _colorHorizontal;
|
|
35
|
+
private _opacity;
|
|
36
|
+
private _opacityAlways;
|
|
30
37
|
constructor(renderer: Renderer, camera: Camera, input: InputHandler, settings: ViewerSettings);
|
|
31
38
|
private connect;
|
|
32
39
|
private onUpdate;
|
|
@@ -47,23 +54,21 @@ export declare class GizmoOrbit {
|
|
|
47
54
|
setPosition(position: THREE.Vector3): void;
|
|
48
55
|
/**
|
|
49
56
|
* Updates the size of the orbit gizmo.
|
|
50
|
-
* @param {number} size - The new size of
|
|
57
|
+
* @param {number} size - The new size as fraction of screen (0-1).
|
|
51
58
|
*/
|
|
52
59
|
setSize(size: number): void;
|
|
53
60
|
/**
|
|
54
|
-
* Updates the
|
|
55
|
-
* @param {number} opacity - The opacity of the non-occluded part.
|
|
56
|
-
* @param {number} opacityAlways - The opacity of the occluded part.
|
|
61
|
+
* Updates the colors of the orbit gizmo.
|
|
57
62
|
*/
|
|
58
|
-
|
|
63
|
+
setColors(color: THREE.Color, colorHorizontal: THREE.Color): void;
|
|
59
64
|
/**
|
|
60
|
-
* Updates the
|
|
61
|
-
* @param {THREE.Color} color - The new color for the orbit gizmo.
|
|
65
|
+
* Updates the opacities of the orbit gizmo.
|
|
62
66
|
*/
|
|
63
|
-
|
|
67
|
+
setOpacity(opacity: number, opacityAlways: number): void;
|
|
64
68
|
private applySettings;
|
|
65
69
|
private updateScale;
|
|
66
70
|
private createGizmo;
|
|
71
|
+
private createInstancedMesh;
|
|
67
72
|
/**
|
|
68
73
|
* Disposes of all resources.
|
|
69
74
|
*/
|
|
@@ -31,7 +31,9 @@ export declare class RaycastResult implements IRaycastResult {
|
|
|
31
31
|
constructor(intersections: ThreeIntersectionList, firstHit?: THREE.Intersection, object?: Element3D | Marker);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Performs raycasting operations.
|
|
34
|
+
* Performs CPU-based raycasting operations using Three.js.
|
|
35
|
+
* This is kept as a reference/fallback implementation.
|
|
36
|
+
* The primary raycaster is GpuPicker which implements IRaycaster.
|
|
35
37
|
*/
|
|
36
38
|
export declare class Raycaster implements IRaycaster {
|
|
37
39
|
private _camera;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module viw-webgl-viewer/rendering
|
|
3
|
+
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { Camera } from '../camera/camera';
|
|
6
|
+
import { RenderScene } from './renderScene';
|
|
7
|
+
import { RenderingSection } from './renderingSection';
|
|
8
|
+
import { Element3D } from '../../loader/element3d';
|
|
9
|
+
import { Vim } from '../../loader/vim';
|
|
10
|
+
import { VimCollection } from '../../loader/vimCollection';
|
|
11
|
+
import type { IRaycaster, IRaycastResult } from '../../../shared';
|
|
12
|
+
import { Marker } from '../gizmos/markers/gizmoMarker';
|
|
13
|
+
/** Raycastable objects for the GpuPicker */
|
|
14
|
+
export type GpuRaycastableObject = Element3D | Marker;
|
|
15
|
+
/**
|
|
16
|
+
* Packs vimIndex (8 bits) and elementIndex (24 bits) into a single uint32.
|
|
17
|
+
* Used for GPU picking attribute.
|
|
18
|
+
*/
|
|
19
|
+
export declare function packPickingId(vimIndex: number, elementIndex: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Unpacks vimIndex and elementIndex from a packed uint32.
|
|
22
|
+
*/
|
|
23
|
+
export declare function unpackPickingId(packedId: number): {
|
|
24
|
+
vimIndex: number;
|
|
25
|
+
elementIndex: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Result of a GPU pick operation containing element index, world position, and surface normal.
|
|
29
|
+
* Implements IRaycastResult for compatibility with the raycaster interface.
|
|
30
|
+
*/
|
|
31
|
+
export declare class GpuPickResult implements IRaycastResult<GpuRaycastableObject> {
|
|
32
|
+
/** The element index in the vim */
|
|
33
|
+
readonly elementIndex: number;
|
|
34
|
+
/** The vim index identifying which vim the element belongs to */
|
|
35
|
+
readonly vimIndex: number;
|
|
36
|
+
/** The world position of the hit */
|
|
37
|
+
readonly worldPosition: THREE.Vector3;
|
|
38
|
+
/** The world normal at the hit point */
|
|
39
|
+
readonly worldNormal: THREE.Vector3;
|
|
40
|
+
/** Reference to the vim containing the element */
|
|
41
|
+
private _vim;
|
|
42
|
+
constructor(elementIndex: number, vimIndex: number, worldPosition: THREE.Vector3, worldNormal: THREE.Vector3, vim: Vim | undefined);
|
|
43
|
+
/**
|
|
44
|
+
* The object property for IRaycastResult interface.
|
|
45
|
+
* Returns the Element3D for the picked element.
|
|
46
|
+
*/
|
|
47
|
+
get object(): Element3D | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the Element3D object for the picked element.
|
|
50
|
+
* @returns The Element3D object, or undefined if not found
|
|
51
|
+
*/
|
|
52
|
+
getElement(): Element3D | undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Unified GPU picker that outputs element index, depth, vim index, and surface normal in a single render pass.
|
|
56
|
+
* Implements IRaycaster for compatibility with the viewer's raycaster interface.
|
|
57
|
+
*
|
|
58
|
+
* Uses a Float32 render target with:
|
|
59
|
+
* - R = packed(vimIndex * 16777216 + elementIndex) - supports 256 vims × 16M elements
|
|
60
|
+
* - G = depth (distance along camera direction, 0 = miss)
|
|
61
|
+
* - B = normal.x (surface normal X component)
|
|
62
|
+
* - A = normal.y (surface normal Y component)
|
|
63
|
+
*
|
|
64
|
+
* Normal.z is reconstructed as: sqrt(1 - x² - y²), always positive since normal faces camera.
|
|
65
|
+
*/
|
|
66
|
+
export declare class GpuPicker implements IRaycaster<GpuRaycastableObject> {
|
|
67
|
+
private _renderer;
|
|
68
|
+
private _camera;
|
|
69
|
+
private _scene;
|
|
70
|
+
private _vims;
|
|
71
|
+
private _section;
|
|
72
|
+
private _renderTarget;
|
|
73
|
+
private _pickingMaterial;
|
|
74
|
+
private _readBuffer;
|
|
75
|
+
debug: boolean;
|
|
76
|
+
private _debugSphere;
|
|
77
|
+
private _debugLine;
|
|
78
|
+
constructor(renderer: THREE.WebGLRenderer, camera: Camera, scene: RenderScene, vims: VimCollection, section: RenderingSection, width: number, height: number);
|
|
79
|
+
/**
|
|
80
|
+
* Updates the render target size to match viewport.
|
|
81
|
+
*/
|
|
82
|
+
setSize(width: number, height: number): void;
|
|
83
|
+
/**
|
|
84
|
+
* Performs GPU picking at the given screen coordinates.
|
|
85
|
+
* Returns a result object with element index, world position, and getElement() method.
|
|
86
|
+
*
|
|
87
|
+
* @param screenPos Screen position in 0-1 range (0,0 is top-left)
|
|
88
|
+
* @returns Pick result with element index, world position, and getElement(), or undefined if no hit
|
|
89
|
+
*/
|
|
90
|
+
pick(screenPos: THREE.Vector2): GpuPickResult | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Shows debug visuals (sphere at hit point, line showing normal direction).
|
|
93
|
+
*/
|
|
94
|
+
private showDebugVisuals;
|
|
95
|
+
/**
|
|
96
|
+
* Reconstructs world position from screen coordinates and depth value.
|
|
97
|
+
*/
|
|
98
|
+
private reconstructWorldPosition;
|
|
99
|
+
/**
|
|
100
|
+
* Removes debug visuals (sphere and normal line) from the scene.
|
|
101
|
+
*/
|
|
102
|
+
clearDebugVisuals(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Raycasts from camera to the screen position to find the first object hit.
|
|
105
|
+
* Implements IRaycaster interface.
|
|
106
|
+
* @param position - Screen position in 0-1 range (0,0 is top-left)
|
|
107
|
+
* @returns A promise that resolves to the raycast result, or undefined if no hit
|
|
108
|
+
*/
|
|
109
|
+
raycastFromScreen(position: THREE.Vector2): Promise<GpuPickResult | undefined>;
|
|
110
|
+
/**
|
|
111
|
+
* Raycasts from camera towards a world position to find the first object hit.
|
|
112
|
+
* Implements IRaycaster interface.
|
|
113
|
+
* @param position - The world position to raycast towards
|
|
114
|
+
* @returns A promise that resolves to the raycast result, or undefined if no hit
|
|
115
|
+
*/
|
|
116
|
+
raycastFromWorld(position: THREE.Vector3): Promise<GpuPickResult | undefined>;
|
|
117
|
+
/**
|
|
118
|
+
* Converts a world position to screen coordinates (0-1 range).
|
|
119
|
+
* @param worldPos - The world position to convert
|
|
120
|
+
* @returns Screen position in 0-1 range, or undefined if behind camera
|
|
121
|
+
*/
|
|
122
|
+
private worldToScreen;
|
|
123
|
+
/**
|
|
124
|
+
* Disposes of all resources.
|
|
125
|
+
*/
|
|
126
|
+
dispose(): void;
|
|
127
|
+
}
|
|
@@ -12,13 +12,13 @@ export declare class RenderScene {
|
|
|
12
12
|
threeScene: THREE.Scene;
|
|
13
13
|
boxUpdated: boolean;
|
|
14
14
|
smallGhostThreshold: number | undefined;
|
|
15
|
-
private
|
|
15
|
+
private _vimScenesById;
|
|
16
16
|
private _boundingBox;
|
|
17
17
|
private _memory;
|
|
18
18
|
private _2dCount;
|
|
19
19
|
private _outlineCount;
|
|
20
20
|
private _modelMaterial;
|
|
21
|
-
get meshes(): (import("../..").
|
|
21
|
+
get meshes(): (InstancedMesh | import("../..").Mesh | import("../..").InsertableMesh)[];
|
|
22
22
|
constructor();
|
|
23
23
|
get estimatedMemory(): number;
|
|
24
24
|
has2dObjects(): boolean;
|
|
@@ -62,8 +62,15 @@ export declare class Renderer implements IRenderer {
|
|
|
62
62
|
*/
|
|
63
63
|
get background(): THREE.Color | THREE.Texture;
|
|
64
64
|
set background(color: THREE.Color | THREE.Texture);
|
|
65
|
+
/**
|
|
66
|
+
* Sets the material used to render models. If set to undefined, the default model or mesh material is used.
|
|
67
|
+
*/
|
|
65
68
|
get modelMaterial(): ModelMaterial;
|
|
66
69
|
set modelMaterial(material: ModelMaterial);
|
|
70
|
+
/**
|
|
71
|
+
* The material that will be used when setting model material to undefined.
|
|
72
|
+
*/
|
|
73
|
+
defaultModelMaterial: ModelMaterial;
|
|
67
74
|
/**
|
|
68
75
|
* Signal dispatched at the end of each frame if the scene was updated, such as visibility changes.
|
|
69
76
|
*/
|
|
@@ -106,23 +106,28 @@ export type ViewerSettings = {
|
|
|
106
106
|
*/
|
|
107
107
|
enable: boolean;
|
|
108
108
|
/**
|
|
109
|
-
* Size of camera gizmo.
|
|
110
|
-
* Default: 0.
|
|
109
|
+
* Size of camera gizmo as fraction of screen (0-1).
|
|
110
|
+
* Default: 0.1
|
|
111
111
|
*/
|
|
112
112
|
size: number;
|
|
113
113
|
/**
|
|
114
|
-
* Color of
|
|
115
|
-
* Default: THREE.Color(
|
|
114
|
+
* Color of vertical rings (great circles).
|
|
115
|
+
* Default: THREE.Color(0x0590cc) - VIM blue
|
|
116
116
|
*/
|
|
117
117
|
color: THREE.Color;
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* Color of horizontal rings (latitude circles).
|
|
120
|
+
* Default: THREE.Color(0x58b5dd) - Primary_300
|
|
121
|
+
*/
|
|
122
|
+
colorHorizontal: THREE.Color;
|
|
123
|
+
/**
|
|
124
|
+
* Opacity of the camera gizmo when in front of objects.
|
|
120
125
|
* Default: 0.5
|
|
121
126
|
*/
|
|
122
127
|
opacity: number;
|
|
123
128
|
/**
|
|
124
129
|
* Opacity of the camera gizmo when behind objects.
|
|
125
|
-
* Default: 0.
|
|
130
|
+
* Default: 0.1
|
|
126
131
|
*/
|
|
127
132
|
opacityAlways: number;
|
|
128
133
|
};
|
|
@@ -17,6 +17,11 @@ import { Renderer } from './rendering/renderer';
|
|
|
17
17
|
* Viewer and loader for vim files.
|
|
18
18
|
*/
|
|
19
19
|
export declare class Viewer {
|
|
20
|
+
/**
|
|
21
|
+
* The type of the viewer, indicating it is a WebGL viewer.
|
|
22
|
+
* Useful for distinguishing between different viewer types in a multi-viewer application.
|
|
23
|
+
*/
|
|
24
|
+
readonly type = "webgl";
|
|
20
25
|
/**
|
|
21
26
|
* The settings configuration used by the viewer.
|
|
22
27
|
*/
|
|
@@ -63,7 +68,7 @@ export declare class Viewer {
|
|
|
63
68
|
get onVimLoaded(): ISignal;
|
|
64
69
|
private _camera;
|
|
65
70
|
private _clock;
|
|
66
|
-
private
|
|
71
|
+
private _vimCollection;
|
|
67
72
|
private _onVimLoaded;
|
|
68
73
|
private _updateId;
|
|
69
74
|
constructor(settings?: PartialViewerSettings);
|
|
@@ -77,6 +82,16 @@ export declare class Viewer {
|
|
|
77
82
|
* The number of Vim objects currently loaded in the viewer.
|
|
78
83
|
*/
|
|
79
84
|
get vimCount(): number;
|
|
85
|
+
/**
|
|
86
|
+
* Allocates a stable ID for a new vim to be loaded.
|
|
87
|
+
* The ID persists for the vim's lifetime and is used for GPU picking.
|
|
88
|
+
* @returns The allocated ID (0-255), or undefined if all 256 slots are in use
|
|
89
|
+
*/
|
|
90
|
+
allocateVimId(): number | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the viewer has reached maximum capacity (256 vims).
|
|
93
|
+
*/
|
|
94
|
+
get isVimsFull(): boolean;
|
|
80
95
|
/**
|
|
81
96
|
* Adds a Vim object to the renderer, triggering the appropriate actions and dispatching events upon successful addition.
|
|
82
97
|
* @param {Vim} vim - The Vim object to add to the renderer.
|
|
@@ -62,7 +62,7 @@ export declare class Viewport {
|
|
|
62
62
|
/**
|
|
63
63
|
* Resizes the canvas and updates the camera to match new parent dimensions.
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
resizeToParent(): void;
|
|
66
66
|
/**
|
|
67
67
|
* Set a callback for canvas resize with debouncing
|
|
68
68
|
* https://stackoverflow.com/questions/5825447/javascript-event-for-canvas-resize/30688151
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import * as Core from '../../core-viewers';
|
|
6
|
-
import { Settings } from '../settings';
|
|
7
6
|
import { CameraRef } from '../state/cameraState';
|
|
8
7
|
import { IsolationRef } from '../state/sharedIsolation';
|
|
9
8
|
import { ViewerState } from '../webgl/viewerState';
|
|
10
9
|
import { BimInfoPanelRef } from './bimInfoData';
|
|
11
10
|
import { TreeActionRef } from './bimTree';
|
|
11
|
+
import { WebglSettings } from '../webgl/settings';
|
|
12
12
|
export declare function OptionalBimPanel(props: {
|
|
13
13
|
viewer: Core.Webgl.Viewer;
|
|
14
14
|
camera: CameraRef;
|
|
15
15
|
viewerState: ViewerState;
|
|
16
16
|
isolation: IsolationRef;
|
|
17
17
|
visible: boolean;
|
|
18
|
-
settings:
|
|
18
|
+
settings: WebglSettings;
|
|
19
19
|
treeRef: React.MutableRefObject<TreeActionRef | undefined>;
|
|
20
20
|
bimInfoRef: BimInfoPanelRef;
|
|
21
21
|
}): JSX.Element;
|
|
@@ -34,7 +34,7 @@ export declare function BimPanel(props: {
|
|
|
34
34
|
viewerState: ViewerState;
|
|
35
35
|
isolation: IsolationRef;
|
|
36
36
|
visible: boolean;
|
|
37
|
-
settings:
|
|
37
|
+
settings: WebglSettings;
|
|
38
38
|
treeRef: React.MutableRefObject<TreeActionRef | undefined>;
|
|
39
39
|
bimInfoRef: BimInfoPanelRef;
|
|
40
40
|
}): import("react/jsx-runtime").JSX.Element;
|