vim-web 0.3.42 → 0.3.44-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/types/core-viewers/ultra/index.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/camera.d.ts +1 -13
- package/dist/types/core-viewers/ultra/viewer/marshal.d.ts +37 -24
- package/dist/types/core-viewers/ultra/viewer/rpcClient.d.ts +9 -7
- package/dist/types/core-viewers/ultra/viewer/rpcSafeClient.d.ts +8 -1
- package/dist/types/core-viewers/ultra/viewer/sectionBox.d.ts +31 -0
- package/dist/types/core-viewers/ultra/viewer/socketClient.d.ts +14 -5
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +7 -3
- package/dist/types/core-viewers/webgl/loader/materials/ghostMaterial.d.ts +16 -0
- package/dist/types/core-viewers/webgl/loader/materials/simpleMaterial.d.ts +10 -5
- package/dist/types/core-viewers/webgl/loader/materials/viewerMaterials.d.ts +9 -8
- package/dist/types/core-viewers/webgl/loader/mesh.d.ts +2 -1
- package/dist/types/core-viewers/webgl/loader/progressive/insertableMesh.d.ts +2 -1
- package/dist/types/core-viewers/webgl/loader/progressive/instancedMesh.d.ts +3 -1
- package/dist/types/core-viewers/webgl/loader/scene.d.ts +3 -2
- package/dist/types/core-viewers/webgl/viewer/camera/ICamera.d.ts +102 -0
- package/dist/types/core-viewers/webgl/viewer/environment/cameraLight.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/environment/environment.d.ts +1 -7
- package/dist/types/core-viewers/webgl/viewer/environment/skybox.d.ts +1 -1
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/SectionBoxMesh.d.ts +15 -0
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBox.d.ts +55 -21
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxGizmo.d.ts +13 -43
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandle.d.ts +15 -0
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxHandles.d.ts +19 -0
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxInputs.d.ts +143 -28
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxOutline.d.ts +15 -0
- package/dist/types/core-viewers/webgl/viewer/inputs/input.d.ts +4 -4
- package/dist/types/core-viewers/webgl/viewer/rendering/renderScene.d.ts +8 -4
- package/dist/types/core-viewers/webgl/viewer/rendering/renderer.d.ts +5 -9
- package/dist/types/core-viewers/webgl/viewer/selection.d.ts +1 -0
- package/dist/types/core-viewers/webgl/viewer/settings/viewerSettings.d.ts +4 -39
- package/dist/types/core-viewers/webgl/viewer/viewer.d.ts +1 -1
- package/dist/types/react-viewers/helpers/inputs.d.ts +1 -2
- package/dist/types/react-viewers/helpers/isolation.d.ts +91 -50
- package/dist/types/react-viewers/settings/settings.d.ts +3 -2
- package/dist/vim-web.iife.js +1507 -1199
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +1505 -1197
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/core-viewers/webgl/images.d.ts +0 -4
- package/dist/types/core-viewers/webgl/loader/materials/isolationMaterial.d.ts +0 -12
- package/dist/types/core-viewers/webgl/viewer/environment/groundPlane.d.ts +0 -25
- /package/dist/types/core-viewers/webgl/viewer/inputs/{keyboard.d.ts → keyboardHandler.d.ts} +0 -0
- /package/dist/types/core-viewers/webgl/viewer/inputs/{mouse.d.ts → mouseHandler.d.ts} +0 -0
- /package/dist/types/core-viewers/webgl/viewer/inputs/{touch.d.ts → touchHandler.d.ts} +0 -0
|
@@ -5,5 +5,5 @@ export * from './viewer/vim';
|
|
|
5
5
|
export * from './utils/math3d';
|
|
6
6
|
export * from './viewer/color';
|
|
7
7
|
export type { ILoadRequest, VimRequestErrorType } from './viewer/loadRequest';
|
|
8
|
-
export type { ClientState } from './viewer/socketClient';
|
|
8
|
+
export type { ClientState, ConnectionSettings } from './viewer/socketClient';
|
|
9
9
|
export type { VimSource } from './viewer/rpcSafeClient';
|
|
@@ -77,19 +77,7 @@ export declare class Camera implements ICamera {
|
|
|
77
77
|
* Handles camera initialization when connection is established
|
|
78
78
|
*/
|
|
79
79
|
onConnect(): void;
|
|
80
|
-
|
|
81
|
-
* Starts tracking camera position at regular intervals
|
|
82
|
-
*/
|
|
83
|
-
startTracking(): void;
|
|
84
|
-
/**
|
|
85
|
-
* Stops tracking camera position
|
|
86
|
-
*/
|
|
87
|
-
stopTracking(): void;
|
|
88
|
-
/**
|
|
89
|
-
* Updates the stored camera position
|
|
90
|
-
* @private
|
|
91
|
-
*/
|
|
92
|
-
private update;
|
|
80
|
+
onCameraPose(pose: Segment): void;
|
|
93
81
|
/**
|
|
94
82
|
* Pauses or resumes rendering
|
|
95
83
|
* @param value - True to pause rendering, false to resume
|
|
@@ -12,6 +12,13 @@ export type VimStatus = {
|
|
|
12
12
|
status: number;
|
|
13
13
|
progress: number;
|
|
14
14
|
};
|
|
15
|
+
export type SectionBoxState = {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
visible: boolean;
|
|
18
|
+
interactible: boolean;
|
|
19
|
+
clip: boolean;
|
|
20
|
+
box: Box3;
|
|
21
|
+
};
|
|
15
22
|
export type Vector4 = {
|
|
16
23
|
x: number;
|
|
17
24
|
y: number;
|
|
@@ -20,55 +27,61 @@ export type Vector4 = {
|
|
|
20
27
|
};
|
|
21
28
|
export declare class Marshal {
|
|
22
29
|
private buffer;
|
|
23
|
-
private
|
|
24
|
-
private
|
|
25
|
-
private writeOffset;
|
|
30
|
+
private _dataView;
|
|
31
|
+
private _offset;
|
|
26
32
|
constructor(initialSize?: number);
|
|
27
33
|
getBuffer(): ArrayBuffer;
|
|
28
34
|
private ensureCapacity;
|
|
29
35
|
writeData(data: ArrayBuffer): void;
|
|
30
36
|
writeMatrix44(data: Matrix44): void;
|
|
31
|
-
readMatrix44(): Matrix44;
|
|
32
37
|
writeBoolean(value: boolean): void;
|
|
33
|
-
readBoolean(): boolean;
|
|
34
38
|
writeInt(value: number): void;
|
|
35
|
-
readInt(): number;
|
|
36
39
|
writeUInt(value: number): void;
|
|
37
|
-
readUInt(): number;
|
|
38
40
|
writeFloat(value: number): void;
|
|
39
|
-
readFloat(): number;
|
|
40
41
|
writeString(value: string): void;
|
|
41
|
-
readString(): string;
|
|
42
42
|
writeHitCheckResult(data: HitCheckResult): void;
|
|
43
|
-
readHitCheckResult(): HitCheckResult;
|
|
44
43
|
writeVimStatus(data: VimStatus): void;
|
|
45
|
-
readVimStatus(): VimStatus;
|
|
46
44
|
writeVector2(data: Vector2): void;
|
|
47
|
-
readVector2(): Vector2;
|
|
48
45
|
writeVector3(data: Vector3): void;
|
|
49
|
-
readVector3(): Vector3;
|
|
50
46
|
writeVector4(data: Vector4): void;
|
|
51
|
-
readVector4(): Vector4;
|
|
52
47
|
writeRGBA(color: RGBA): void;
|
|
53
|
-
readRGBA(): RGBA;
|
|
54
48
|
writeRGB(color: RGBA): void;
|
|
55
|
-
readRGB(): RGB;
|
|
56
49
|
writeRGBA32(color: RGBA32): void;
|
|
57
|
-
readRGBA32(): RGBA32;
|
|
58
50
|
writeSegment(segment: Segment): void;
|
|
59
|
-
readSegment(): Segment;
|
|
60
51
|
writeBox3(data: Box3): void;
|
|
61
|
-
|
|
52
|
+
writeSectionBoxState(data: SectionBoxState): void;
|
|
62
53
|
writeArrayOfInt(values: number[]): void;
|
|
63
|
-
readArrayOfInt(): number[];
|
|
64
54
|
writeArrayOfUInt(values: number[]): void;
|
|
65
|
-
readArrayOfUInt(): number[];
|
|
66
55
|
writeArrayOfFloat(values: number[]): void;
|
|
67
|
-
readArrayOfFloat(): number[];
|
|
68
56
|
writeArrayOfBool(values: boolean[]): void;
|
|
69
|
-
readArrayOfBool(): boolean[];
|
|
70
57
|
writeArrayOfRGBA32(values: RGBA32[]): void;
|
|
71
|
-
readArrayOfRGBA32(): RGBA32[];
|
|
72
58
|
writeArray<T>(data: T[], sizeT: number, write: (data: T) => void): void;
|
|
59
|
+
}
|
|
60
|
+
export declare class ReadMarshal {
|
|
61
|
+
private _dataView;
|
|
62
|
+
private _offset;
|
|
63
|
+
constructor(buffer: ArrayBuffer);
|
|
64
|
+
readMatrix44(): Matrix44;
|
|
65
|
+
readInt(): number;
|
|
66
|
+
readUInt(): number;
|
|
67
|
+
readFloat(): number;
|
|
68
|
+
readBoolean(): boolean;
|
|
69
|
+
readString(): string;
|
|
70
|
+
readHitCheckResult(): HitCheckResult;
|
|
71
|
+
readVimStatus(): VimStatus;
|
|
72
|
+
readVector2(): Vector2;
|
|
73
|
+
readVector3(): Vector3;
|
|
74
|
+
readVector4(): Vector4;
|
|
75
|
+
readRGBA(): RGBA;
|
|
76
|
+
readRGB(): RGB;
|
|
77
|
+
readRGBA32(): RGBA32;
|
|
78
|
+
readBox3(): Box3;
|
|
79
|
+
readSegment(): Segment;
|
|
80
|
+
readSectionBoxState(): SectionBoxState;
|
|
81
|
+
readArrayOfInt(): number[];
|
|
82
|
+
readArrayOfUInt(): number[];
|
|
83
|
+
readArrayOfFloat(): number[];
|
|
84
|
+
readArrayOfBool(): boolean[];
|
|
85
|
+
readArrayOfRGBA32(): RGBA32[];
|
|
73
86
|
readArray<T>(read: () => T): T[];
|
|
74
87
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SocketClient } from './socketClient';
|
|
2
|
-
import { HitCheckResult, VimStatus } from './marshal';
|
|
2
|
+
import { HitCheckResult, VimStatus, SectionBoxState } from './marshal';
|
|
3
3
|
import { Box3, RGBA, RGBA32, Segment, Vector2, Vector3, Matrix44 } from '../utils/math3d';
|
|
4
4
|
export type MaterialHandle = 4294967295 | 6 | 2 | 0 | 1 | 3 | 4 | 5 | 7 | 8;
|
|
5
5
|
export declare class MaterialHandles {
|
|
@@ -16,11 +16,11 @@ export declare class MaterialHandles {
|
|
|
16
16
|
}
|
|
17
17
|
export declare const materialHandles: MaterialHandle[];
|
|
18
18
|
export declare class RpcClient {
|
|
19
|
-
private readonly
|
|
20
|
-
get url(): string;
|
|
19
|
+
private readonly _socket;
|
|
21
20
|
get connected(): boolean;
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
get url(): string;
|
|
22
|
+
constructor(_socket: SocketClient);
|
|
23
|
+
readonly API_VERSION = "5.1.0";
|
|
24
24
|
RPCAddNodeFlags(componentHandle: number, nodes: number[], flags: number): void;
|
|
25
25
|
RPCClearMaterialOverrides(componentHandle: number): void;
|
|
26
26
|
RPCClearScene(): void;
|
|
@@ -28,16 +28,18 @@ export declare class RpcClient {
|
|
|
28
28
|
RPCCreateText(position: Vector3, color: RGBA32, text: string): Promise<number>;
|
|
29
29
|
RPCDestroyMaterialInstances(materialInstanceHandle: number[]): void;
|
|
30
30
|
RPCDestroyText(componentHandle: number): void;
|
|
31
|
-
RPCEnableSectionBox(enable: boolean): void;
|
|
32
31
|
RPCFrameAll(blendTime: number): Promise<Segment>;
|
|
33
32
|
RPCFrameBox(box: Box3, blendTime: number): Promise<Segment>;
|
|
34
33
|
RPCFrameInstances(componentHandle: number, nodes: number[], blendTime: number): Promise<Segment>;
|
|
35
34
|
RPCFrameVim(componentHandle: number, blendTime: number): Promise<Segment>;
|
|
36
35
|
RPCGetAPIVersion(): Promise<string>;
|
|
37
36
|
RPCGetBoundingBox(componentHandle: number, nodes: number[]): Promise<Box3>;
|
|
37
|
+
RPCGetBoundingBoxAll(componentHandle: number): Promise<Box3>;
|
|
38
38
|
RPCGetCameraPosition(): Promise<Segment>;
|
|
39
39
|
RPCGetIblRotation(): Promise<Matrix44>;
|
|
40
40
|
RPCGetLastError(): Promise<string>;
|
|
41
|
+
RPCGetSceneAABB(): Promise<Box3>;
|
|
42
|
+
RPCGetSectionBox(): Promise<SectionBoxState>;
|
|
41
43
|
RPCGetVimLoadingState(componentHandle: number): Promise<VimStatus>;
|
|
42
44
|
RPCGhost(componentHandle: number, nodes: number[]): void;
|
|
43
45
|
RPCGhostAll(componentHandle: number): void;
|
|
@@ -68,7 +70,7 @@ export declare class RpcClient {
|
|
|
68
70
|
RPCSetLighting(toneMappingWhitePoint: number, hdrScale: number, hdrBackgroundScale: number, hdrBackgroundSaturation: number, backgroundBlur: number, backgroundColor: RGBA): void;
|
|
69
71
|
RPCSetMaterialOverrides(componentHandle: number, nodes: number[], materialInstanceHandles: number[]): void;
|
|
70
72
|
RPCSetMoveSpeed(speed: number): void;
|
|
71
|
-
RPCSetSectionBox(
|
|
73
|
+
RPCSetSectionBox(state: SectionBoxState): void;
|
|
72
74
|
RPCShow(componentHandle: number, nodes: number[]): void;
|
|
73
75
|
RPCShowAABBs(componentHandle: number, nodes: number[], colors: RGBA32[]): void;
|
|
74
76
|
RPCShowAll(componentHandle: number): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Box3, RGBA, RGBA32, Segment, Vector2, Vector3 } from "../utils/math3d";
|
|
2
|
-
import { HitCheckResult } from "./marshal";
|
|
2
|
+
import { HitCheckResult, SectionBoxState } from "./marshal";
|
|
3
3
|
import { MaterialHandle, RpcClient } from "./rpcClient";
|
|
4
4
|
export type VimSource = {
|
|
5
5
|
url: string;
|
|
@@ -137,6 +137,12 @@ export declare class RpcSafeClient {
|
|
|
137
137
|
* @throws {Error} If the component handle is invalid
|
|
138
138
|
*/
|
|
139
139
|
RPCDestroyText(componentHandle: number): void;
|
|
140
|
+
/*******************************************************************************
|
|
141
|
+
* SECTION BOX METHODS
|
|
142
|
+
* Methods for controlling section box visibility and position.
|
|
143
|
+
******************************************************************************/
|
|
144
|
+
RPCSetSectionBox(state: SectionBoxState): void;
|
|
145
|
+
RPCGetSectionBox(): Promise<SectionBoxState | undefined>;
|
|
140
146
|
/*******************************************************************************
|
|
141
147
|
* CAMERA AND VIEW METHODS
|
|
142
148
|
* Methods for controlling camera position, movement, framing, and view settings.
|
|
@@ -153,6 +159,7 @@ export declare class RpcSafeClient {
|
|
|
153
159
|
* @throws {Error} If segment is invalid or blendTime is negative
|
|
154
160
|
*/
|
|
155
161
|
RPCSetCameraPosition(segment: Segment, blendTime: number): void;
|
|
162
|
+
RPCGetBoundingBoxAll(componentHandle: number): Promise<any>;
|
|
156
163
|
/**
|
|
157
164
|
* Calculates the bounding box for specified nodes in a component.
|
|
158
165
|
* Large node arrays are automatically processed in batches for better performance.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Box3 } from "../utils/math3d";
|
|
2
|
+
import { RpcSafeClient } from "./rpcSafeClient";
|
|
3
|
+
export declare class SectionBox {
|
|
4
|
+
private _enabled;
|
|
5
|
+
private _visible;
|
|
6
|
+
private _interactible;
|
|
7
|
+
private _clip;
|
|
8
|
+
private _box;
|
|
9
|
+
private _rpc;
|
|
10
|
+
private _interval;
|
|
11
|
+
private _animationFrame;
|
|
12
|
+
private _onUpdate;
|
|
13
|
+
get onUpdate(): import("ste-signals").ISignal;
|
|
14
|
+
private get needUpdate();
|
|
15
|
+
constructor(rpc: RpcSafeClient);
|
|
16
|
+
onConnect(): Promise<void>;
|
|
17
|
+
scheduleUpdate(): void;
|
|
18
|
+
private pull;
|
|
19
|
+
private push;
|
|
20
|
+
get enabled(): boolean;
|
|
21
|
+
set enabled(value: boolean);
|
|
22
|
+
get visible(): boolean;
|
|
23
|
+
set visible(value: boolean);
|
|
24
|
+
get interactible(): boolean;
|
|
25
|
+
set interactible(value: boolean);
|
|
26
|
+
get clip(): boolean;
|
|
27
|
+
set clip(value: boolean);
|
|
28
|
+
fitBox(box: Box3): void;
|
|
29
|
+
getBox(): Box3;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import * as Protocol from './protocol';
|
|
2
|
-
import { Marshal } from './marshal';
|
|
2
|
+
import { Marshal, ReadMarshal } from './marshal';
|
|
3
3
|
import { ILogger } from './logger';
|
|
4
|
+
import { Segment } from '../utils/math3d';
|
|
5
|
+
export declare const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
|
|
6
|
+
export type ConnectionSettings = {
|
|
7
|
+
url?: string;
|
|
8
|
+
retries?: number;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
retryDelay?: number;
|
|
11
|
+
};
|
|
4
12
|
export type ClientState = ClientStateConnecting | ClientStateConnected | ClientStateDisconnected | ClientStateValidating | ClientError;
|
|
5
13
|
export type ClientError = ClientStateCompatibilityError | ClientStateConnectionError | ClientStreamError;
|
|
6
14
|
export type ClientStateConnecting = {
|
|
@@ -59,8 +67,11 @@ export declare class SocketClient {
|
|
|
59
67
|
* @param msg - The video frame message received from the server.
|
|
60
68
|
*/
|
|
61
69
|
onVideoFrame: (msg: Protocol.VideoFrameMessage) => void;
|
|
70
|
+
onCameraPose: (msg: Segment) => void;
|
|
62
71
|
private _state;
|
|
63
72
|
private _onStatusUpdate;
|
|
73
|
+
private _connectPromise;
|
|
74
|
+
private _connectionSettings;
|
|
64
75
|
/**
|
|
65
76
|
* Event that is triggered when the connection status updates.
|
|
66
77
|
* @returns An event dispatcher for connection status updates.
|
|
@@ -76,8 +87,6 @@ export declare class SocketClient {
|
|
|
76
87
|
* @param state - The new connection state.
|
|
77
88
|
*/
|
|
78
89
|
private updateState;
|
|
79
|
-
private _connectPromise;
|
|
80
|
-
private _connectingUrl;
|
|
81
90
|
/**
|
|
82
91
|
* Gets the URL to which the messenger is currently connecting or connected.
|
|
83
92
|
* @returns The WebSocket URL as a string, or undefined if not set.
|
|
@@ -94,7 +103,7 @@ export declare class SocketClient {
|
|
|
94
103
|
* @param url - The WebSocket URL to connect to.
|
|
95
104
|
* @returns A promise that resolves when the connection is established.
|
|
96
105
|
*/
|
|
97
|
-
connect(
|
|
106
|
+
connect(settings: ConnectionSettings): Promise<boolean>;
|
|
98
107
|
/**
|
|
99
108
|
* Disconnects from the current WebSocket server.
|
|
100
109
|
*/
|
|
@@ -137,7 +146,7 @@ export declare class SocketClient {
|
|
|
137
146
|
* @param marshal - The Marshal containing the request data.
|
|
138
147
|
* @returns A promise that resolves with the response data.
|
|
139
148
|
*/
|
|
140
|
-
sendRPCWithReturn(marshal: Marshal): Promise<
|
|
149
|
+
sendRPCWithReturn(marshal: Marshal): Promise<ReadMarshal>;
|
|
141
150
|
/**
|
|
142
151
|
* Sends an RPC request without expecting a response.
|
|
143
152
|
* @param marshal - The Marshal containing the request data.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IInputs } from './inputs/inputs';
|
|
2
|
-
import { ClientState } from './socketClient';
|
|
2
|
+
import { ClientState, ConnectionSettings } from './socketClient';
|
|
3
3
|
import { IDecoder } from './decoder';
|
|
4
4
|
import { Vim } from './vim';
|
|
5
5
|
import { ILoadRequest } from './loadRequest';
|
|
@@ -11,7 +11,7 @@ import { RpcSafeClient, VimSource } from './rpcSafeClient';
|
|
|
11
11
|
import { ISimpleEvent } from 'ste-simple-events';
|
|
12
12
|
import { IReadonlyVimCollection } from './vimCollection';
|
|
13
13
|
import { IRenderer } from './renderer';
|
|
14
|
-
|
|
14
|
+
import { SectionBox } from './sectionBox';
|
|
15
15
|
export declare const INVALID_HANDLE = 4294967295;
|
|
16
16
|
/**
|
|
17
17
|
* The main Viewer class responsible for managing VIM files,
|
|
@@ -67,6 +67,10 @@ export declare class Viewer {
|
|
|
67
67
|
* @returns The current ClientStatus.
|
|
68
68
|
*/
|
|
69
69
|
get state(): ClientState;
|
|
70
|
+
/**
|
|
71
|
+
* The section box API for controlling the section box.
|
|
72
|
+
*/
|
|
73
|
+
readonly sectionBox: SectionBox;
|
|
70
74
|
/**
|
|
71
75
|
* Creates a Viewer instance with a new canvas element appended to the given parent element.
|
|
72
76
|
* @param parent - The parent HTML element to which the canvas will be appended.
|
|
@@ -97,7 +101,7 @@ export declare class Viewer {
|
|
|
97
101
|
* @param url - The server URL to connect to. Defaults to 'ws://localhost:8123'.
|
|
98
102
|
* @returns A promise that resolves when the connection is established.
|
|
99
103
|
*/
|
|
100
|
-
connect(
|
|
104
|
+
connect(settings?: ConnectionSettings): Promise<boolean>;
|
|
101
105
|
/**
|
|
102
106
|
* Disconnects from the current VIM Ultra server.
|
|
103
107
|
*/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module vim-loader/materials
|
|
3
|
+
* This module provides materials for rendering specific visualization modes in VIM.
|
|
4
|
+
*/
|
|
5
|
+
import * as THREE from 'three';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a material for the ghost effect in isolation mode.
|
|
8
|
+
*
|
|
9
|
+
* - **Non-visible items**: Rendered as transparent objects using a customizable fill color.
|
|
10
|
+
* - **Visible items**: Completely excluded from rendering.
|
|
11
|
+
* - Designed for use with instanced or merged meshes.
|
|
12
|
+
* - Includes clipping plane support, vertex colors, and transparency.
|
|
13
|
+
*
|
|
14
|
+
* @returns {THREE.ShaderMaterial} A custom shader material for the ghost effect.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createGhostMaterial(): THREE.ShaderMaterial;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module vim-loader/materials
|
|
3
|
+
* This module provides custom materials for visualizing and isolating objects in VIM.
|
|
3
4
|
*/
|
|
4
5
|
import * as THREE from 'three';
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* Creates a material for isolation mode.
|
|
8
|
+
*
|
|
9
|
+
* - **Non-visible items**: Completely excluded from rendering by pushing them out of view.
|
|
10
|
+
* - **Visible items**: Rendered with flat shading and basic pseudo-lighting.
|
|
11
|
+
* - **Object coloring**: Supports both instance-based and vertex-based coloring for visible objects.
|
|
12
|
+
*
|
|
13
|
+
* This material is optimized for both instanced and merged meshes, with support for clipping planes.
|
|
14
|
+
*
|
|
15
|
+
* @returns {THREE.ShaderMaterial} A custom shader material for isolation mode.
|
|
11
16
|
*/
|
|
12
17
|
export declare function createSimpleMaterial(): THREE.ShaderMaterial;
|
|
@@ -7,6 +7,7 @@ import { OutlineMaterial } from './outlineMaterial';
|
|
|
7
7
|
import { ViewerSettings } from '../../viewer/settings/viewerSettings';
|
|
8
8
|
import { MergeMaterial } from './mergeMaterial';
|
|
9
9
|
import { SkyboxMaterial } from './skyboxMaterial';
|
|
10
|
+
export type ModelMaterial = THREE.Material | THREE.Material[] | undefined;
|
|
10
11
|
/**
|
|
11
12
|
* Defines the materials to be used by the vim loader and allows for material injection.
|
|
12
13
|
*/
|
|
@@ -33,7 +34,7 @@ export declare class ViewerMaterials {
|
|
|
33
34
|
/**
|
|
34
35
|
* Material used to show traces of hidden objects.
|
|
35
36
|
*/
|
|
36
|
-
readonly
|
|
37
|
+
readonly ghost: THREE.Material;
|
|
37
38
|
/**
|
|
38
39
|
* Material used to filter out what is not selected for selection outline effect.
|
|
39
40
|
*/
|
|
@@ -57,7 +58,7 @@ export declare class ViewerMaterials {
|
|
|
57
58
|
private _focusIntensity;
|
|
58
59
|
private _focusColor;
|
|
59
60
|
private _onUpdate;
|
|
60
|
-
constructor(opaque?: StandardMaterial, transparent?: StandardMaterial, simple?: THREE.Material, wireframe?: THREE.LineBasicMaterial,
|
|
61
|
+
constructor(opaque?: StandardMaterial, transparent?: StandardMaterial, simple?: THREE.Material, wireframe?: THREE.LineBasicMaterial, ghost?: THREE.Material, mask?: THREE.ShaderMaterial, outline?: OutlineMaterial, merge?: MergeMaterial, skyBox?: SkyboxMaterial);
|
|
61
62
|
/**
|
|
62
63
|
* Updates material settings based on the provided configuration.
|
|
63
64
|
* @param {ViewerSettings} settings - The settings to apply to the materials.
|
|
@@ -73,15 +74,15 @@ export declare class ViewerMaterials {
|
|
|
73
74
|
get modelColor(): THREE.Color;
|
|
74
75
|
set modelColor(color: THREE.Color);
|
|
75
76
|
/**
|
|
76
|
-
* Determines the opacity of the
|
|
77
|
+
* Determines the opacity of the ghost material.
|
|
77
78
|
*/
|
|
78
|
-
get
|
|
79
|
-
set
|
|
79
|
+
get ghostOpacity(): number;
|
|
80
|
+
set ghostOpacity(opacity: number);
|
|
80
81
|
/**
|
|
81
|
-
* Determines the color of the
|
|
82
|
+
* Determines the color of the ghost material.
|
|
82
83
|
*/
|
|
83
|
-
get
|
|
84
|
-
set
|
|
84
|
+
get ghostColor(): THREE.Color;
|
|
85
|
+
set ghostColor(color: THREE.Color);
|
|
85
86
|
/**
|
|
86
87
|
* Determines the color intensity of the highlight effect on mouse hover.
|
|
87
88
|
*/
|
|
@@ -5,6 +5,7 @@ import * as THREE from 'three';
|
|
|
5
5
|
import { InsertableSubmesh } from './progressive/insertableSubmesh';
|
|
6
6
|
import { Vim } from './vim';
|
|
7
7
|
import { InstancedSubmesh } from './progressive/instancedSubmesh';
|
|
8
|
+
import { ModelMaterial } from './materials/viewerMaterials';
|
|
8
9
|
/**
|
|
9
10
|
* Wrapper around THREE.Mesh
|
|
10
11
|
* Keeps track of what VIM instances are part of this mesh.
|
|
@@ -53,7 +54,7 @@ export declare class Mesh {
|
|
|
53
54
|
/**
|
|
54
55
|
* Overrides mesh material, set to undefine to restore initial material.
|
|
55
56
|
*/
|
|
56
|
-
setMaterial(value:
|
|
57
|
+
setMaterial(value: ModelMaterial): void;
|
|
57
58
|
/**
|
|
58
59
|
* Returns submesh for given index.
|
|
59
60
|
*/
|
|
@@ -7,6 +7,7 @@ import { InsertableGeometry } from './insertableGeometry';
|
|
|
7
7
|
import { InsertableSubmesh } from './insertableSubmesh';
|
|
8
8
|
import { G3dMeshOffsets } from './g3dOffsets';
|
|
9
9
|
import { Vim } from '../vim';
|
|
10
|
+
import { ModelMaterial } from '../materials/viewerMaterials';
|
|
10
11
|
export declare class InsertableMesh {
|
|
11
12
|
offsets: G3dMeshOffsets;
|
|
12
13
|
mesh: THREE.Mesh;
|
|
@@ -55,5 +56,5 @@ export declare class InsertableMesh {
|
|
|
55
56
|
/**
|
|
56
57
|
* Overrides mesh material, set to undefine to restore initial material.
|
|
57
58
|
*/
|
|
58
|
-
setMaterial(value:
|
|
59
|
+
setMaterial(value: ModelMaterial): void;
|
|
59
60
|
}
|
|
@@ -5,6 +5,7 @@ import * as THREE from 'three';
|
|
|
5
5
|
import { Vim } from '../vim';
|
|
6
6
|
import { InstancedSubmesh } from './instancedSubmesh';
|
|
7
7
|
import { G3d, G3dMesh } from 'vim-format';
|
|
8
|
+
import { ModelMaterial } from '../materials/viewerMaterials';
|
|
8
9
|
export declare class InstancedMesh {
|
|
9
10
|
g3dMesh: G3dMesh | G3d;
|
|
10
11
|
vim: Vim;
|
|
@@ -15,6 +16,7 @@ export declare class InstancedMesh {
|
|
|
15
16
|
boxes: THREE.Box3[];
|
|
16
17
|
ignoreSceneMaterial: boolean;
|
|
17
18
|
private _material;
|
|
19
|
+
readonly size: number;
|
|
18
20
|
constructor(g3d: G3dMesh | G3d, mesh: THREE.InstancedMesh, instances: Array<number>);
|
|
19
21
|
get merged(): boolean;
|
|
20
22
|
/**
|
|
@@ -25,7 +27,7 @@ export declare class InstancedMesh {
|
|
|
25
27
|
* Returns all submeshes for given index.
|
|
26
28
|
*/
|
|
27
29
|
getSubmeshes(): InstancedSubmesh[];
|
|
28
|
-
setMaterial(value:
|
|
30
|
+
setMaterial(value: ModelMaterial): void;
|
|
29
31
|
private computeBoundingBoxes;
|
|
30
32
|
private importBoundingBoxes;
|
|
31
33
|
computeBoundingBox(boxes: THREE.Box3[]): THREE.Box3;
|
|
@@ -6,6 +6,7 @@ import { Mesh, Submesh } from './mesh';
|
|
|
6
6
|
import { Vim } from './vim';
|
|
7
7
|
import { InsertableMesh } from './progressive/insertableMesh';
|
|
8
8
|
import { InstancedMesh } from './progressive/instancedMesh';
|
|
9
|
+
import { ModelMaterial } from './materials/viewerMaterials';
|
|
9
10
|
/**
|
|
10
11
|
* Interface for a renderer object, providing methods to add and remove objects from a scene, update bounding boxes, and notify scene updates.
|
|
11
12
|
*/
|
|
@@ -76,11 +77,11 @@ export declare class Scene {
|
|
|
76
77
|
/**
|
|
77
78
|
* Gets the current material override or undefined if none.
|
|
78
79
|
*/
|
|
79
|
-
get material():
|
|
80
|
+
get material(): ModelMaterial;
|
|
80
81
|
/**
|
|
81
82
|
* Sets and apply a material override to the scene, set to undefined to remove override.
|
|
82
83
|
*/
|
|
83
|
-
set material(value:
|
|
84
|
+
set material(value: ModelMaterial);
|
|
84
85
|
/**
|
|
85
86
|
* Unloads and disposes all meshes and leaves the scene ready to add new ones.
|
|
86
87
|
*/
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ISignal } from 'ste-signals';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { CameraMovement } from './cameraMovement';
|
|
4
|
+
/**
|
|
5
|
+
* Interface representing a camera with various properties and methods for controlling its behavior.
|
|
6
|
+
*/
|
|
7
|
+
export interface ICamera {
|
|
8
|
+
/**
|
|
9
|
+
* A signal that is dispatched when camera settings change.
|
|
10
|
+
*/
|
|
11
|
+
onSettingsChanged: ISignal;
|
|
12
|
+
/**
|
|
13
|
+
* A signal that is dispatched when camera moves.
|
|
14
|
+
*/
|
|
15
|
+
onMoved: ISignal;
|
|
16
|
+
/**
|
|
17
|
+
* True if the camera has moved this frame.
|
|
18
|
+
*/
|
|
19
|
+
get hasMoved(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Represents allowed movement along each axis using a Vector3 object.
|
|
22
|
+
* Each component of the Vector3 should be either 0 or 1 to enable/disable movement along the corresponding axis.
|
|
23
|
+
*/
|
|
24
|
+
allowedMovement: THREE.Vector3;
|
|
25
|
+
/**
|
|
26
|
+
* Represents allowed rotation using a Vector2 object.
|
|
27
|
+
* Each component of the Vector2 should be either 0 or 1 to enable/disable rotation around the corresponding axis.
|
|
28
|
+
*/
|
|
29
|
+
allowedRotation: THREE.Vector2;
|
|
30
|
+
/**
|
|
31
|
+
* The default forward direction that can be used to initialize the camera.
|
|
32
|
+
*/
|
|
33
|
+
defaultForward: THREE.Vector3;
|
|
34
|
+
/**
|
|
35
|
+
* Interface for instantaneously moving the camera.
|
|
36
|
+
* @param {boolean} [force=false] - Set to true to ignore locked axis and rotation.
|
|
37
|
+
* @returns {CameraMovement} The camera movement api.
|
|
38
|
+
*/
|
|
39
|
+
snap(force?: boolean): CameraMovement;
|
|
40
|
+
/**
|
|
41
|
+
* Interface for smoothly moving the camera over time.
|
|
42
|
+
* @param {number} [duration=1] - The duration of the camera movement animation.
|
|
43
|
+
* @param {boolean} [force=false] - Set to true to ignore locked axis and rotation.
|
|
44
|
+
* @returns {CameraMovement} The camera movement api.
|
|
45
|
+
*/
|
|
46
|
+
lerp(duration: number, force?: boolean): CameraMovement;
|
|
47
|
+
/**
|
|
48
|
+
* Calculates the frustum size at a given point in the scene.
|
|
49
|
+
* @param {THREE.Vector3} point - The point in the scene to calculate the frustum size at.
|
|
50
|
+
* @returns {number} The frustum size at the specified point.
|
|
51
|
+
*/
|
|
52
|
+
frustrumSizeAt(point: THREE.Vector3): THREE.Vector2;
|
|
53
|
+
/**
|
|
54
|
+
* The current THREE Camera
|
|
55
|
+
*/
|
|
56
|
+
get three(): THREE.Camera;
|
|
57
|
+
/**
|
|
58
|
+
* The quaternion representing the orientation of the object.
|
|
59
|
+
*/
|
|
60
|
+
get quaternion(): THREE.Quaternion;
|
|
61
|
+
/**
|
|
62
|
+
* The position of the camera.
|
|
63
|
+
*/
|
|
64
|
+
get position(): THREE.Vector3;
|
|
65
|
+
/**
|
|
66
|
+
* The matrix representing the transformation of the camera.
|
|
67
|
+
*/
|
|
68
|
+
get matrix(): THREE.Matrix4;
|
|
69
|
+
/**
|
|
70
|
+
* The forward direction of the camera.
|
|
71
|
+
*/
|
|
72
|
+
get forward(): THREE.Vector3;
|
|
73
|
+
get isLerping(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The camera speed factor.
|
|
76
|
+
*/
|
|
77
|
+
speed: number;
|
|
78
|
+
/**
|
|
79
|
+
* The current or target velocity of the camera.
|
|
80
|
+
*/
|
|
81
|
+
localVelocity: THREE.Vector3;
|
|
82
|
+
/**
|
|
83
|
+
* Immediately stops the camera movement.
|
|
84
|
+
*/
|
|
85
|
+
stop(): void;
|
|
86
|
+
/**
|
|
87
|
+
* The target at which the camera is looking at and around which it rotates.
|
|
88
|
+
*/
|
|
89
|
+
get target(): THREE.Vector3;
|
|
90
|
+
/**
|
|
91
|
+
* The distance from the camera to the target.
|
|
92
|
+
*/
|
|
93
|
+
get orbitDistance(): number;
|
|
94
|
+
/**
|
|
95
|
+
* Saves current camera orientation to restore on next reset.
|
|
96
|
+
*/
|
|
97
|
+
save(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Represents whether the camera projection is orthographic.
|
|
100
|
+
*/
|
|
101
|
+
orthographic: boolean;
|
|
102
|
+
}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { ViewerSettings } from '../settings/viewerSettings';
|
|
6
|
-
import { ICamera } from '../camera/
|
|
6
|
+
import { ICamera } from '../camera/ICamera';
|
|
7
7
|
import { ViewerMaterials } from '../../loader/materials/viewerMaterials';
|
|
8
|
-
import { GroundPlane } from './groundPlane';
|
|
9
8
|
import { Skybox } from './skybox';
|
|
10
9
|
import { Renderer } from '../rendering/renderer';
|
|
11
10
|
import { CameraLight } from './cameraLight';
|
|
@@ -23,10 +22,6 @@ export declare class Environment {
|
|
|
23
22
|
* The array of directional lights in the scene.
|
|
24
23
|
*/
|
|
25
24
|
readonly sunLights: ReadonlyArray<CameraLight>;
|
|
26
|
-
/**
|
|
27
|
-
* The ground plane under the model in the scene.
|
|
28
|
-
*/
|
|
29
|
-
readonly groundPlane: GroundPlane;
|
|
30
25
|
readonly skybox: Skybox;
|
|
31
26
|
constructor(camera: ICamera, renderer: Renderer, viewerMaterials: ViewerMaterials, settings: ViewerSettings);
|
|
32
27
|
/**
|
|
@@ -36,7 +31,6 @@ export declare class Environment {
|
|
|
36
31
|
private createSkyLight;
|
|
37
32
|
private createSunLights;
|
|
38
33
|
private addObjectsToRenderer;
|
|
39
|
-
private setupRendererListeners;
|
|
40
34
|
/**
|
|
41
35
|
* Dispose of all resources.
|
|
42
36
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { ViewerSettings } from '../settings/viewerSettings';
|
|
6
|
-
import { ICamera } from '../camera/
|
|
6
|
+
import { ICamera } from '../camera/ICamera';
|
|
7
7
|
import { ViewerMaterials } from '../../loader/materials/viewerMaterials';
|
|
8
8
|
import { Renderer } from '../rendering/renderer';
|
|
9
9
|
export declare class Skybox {
|