vim-web 0.3.43 → 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/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 +4 -2
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +5 -0
- 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 -1
- 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/viewer.d.ts +1 -1
- package/dist/vim-web.iife.js +1109 -600
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +1109 -600
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
- /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
|
@@ -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,7 @@
|
|
|
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';
|
|
4
5
|
export declare const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
|
|
5
6
|
export type ConnectionSettings = {
|
|
6
7
|
url?: string;
|
|
@@ -66,6 +67,7 @@ export declare class SocketClient {
|
|
|
66
67
|
* @param msg - The video frame message received from the server.
|
|
67
68
|
*/
|
|
68
69
|
onVideoFrame: (msg: Protocol.VideoFrameMessage) => void;
|
|
70
|
+
onCameraPose: (msg: Segment) => void;
|
|
69
71
|
private _state;
|
|
70
72
|
private _onStatusUpdate;
|
|
71
73
|
private _connectPromise;
|
|
@@ -144,7 +146,7 @@ export declare class SocketClient {
|
|
|
144
146
|
* @param marshal - The Marshal containing the request data.
|
|
145
147
|
* @returns A promise that resolves with the response data.
|
|
146
148
|
*/
|
|
147
|
-
sendRPCWithReturn(marshal: Marshal): Promise<
|
|
149
|
+
sendRPCWithReturn(marshal: Marshal): Promise<ReadMarshal>;
|
|
148
150
|
/**
|
|
149
151
|
* Sends an RPC request without expecting a response.
|
|
150
152
|
* @param marshal - The Marshal containing the request data.
|
|
@@ -11,6 +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
|
+
import { SectionBox } from './sectionBox';
|
|
14
15
|
export declare const INVALID_HANDLE = 4294967295;
|
|
15
16
|
/**
|
|
16
17
|
* The main Viewer class responsible for managing VIM files,
|
|
@@ -66,6 +67,10 @@ export declare class Viewer {
|
|
|
66
67
|
* @returns The current ClientStatus.
|
|
67
68
|
*/
|
|
68
69
|
get state(): ClientState;
|
|
70
|
+
/**
|
|
71
|
+
* The section box API for controlling the section box.
|
|
72
|
+
*/
|
|
73
|
+
readonly sectionBox: SectionBox;
|
|
69
74
|
/**
|
|
70
75
|
* Creates a Viewer instance with a new canvas element appended to the given parent element.
|
|
71
76
|
* @param parent - The parent HTML element to which the canvas will be appended.
|
|
@@ -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,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 { Skybox } from './skybox';
|
|
9
9
|
import { Renderer } from '../rendering/renderer';
|
|
@@ -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 {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the box mesh for the section box.
|
|
4
|
+
*/
|
|
5
|
+
export declare class SectionBoxMesh extends THREE.Mesh {
|
|
6
|
+
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Resize the mesh to the given box.
|
|
9
|
+
*/
|
|
10
|
+
fitBox(box: THREE.Box3): void;
|
|
11
|
+
/**
|
|
12
|
+
* Disposes of all resources.
|
|
13
|
+
*/
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
@module viw-webgl-viewer/gizmos/sectionBox
|
|
3
|
-
*/
|
|
2
|
+
* @module viw-webgl-viewer/gizmos/sectionBox
|
|
3
|
+
*/
|
|
4
4
|
import { Viewer } from '../../viewer';
|
|
5
5
|
import * as THREE from 'three';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Manages a section box gizmo, serving as a proxy between the renderer and the user.
|
|
8
|
+
*
|
|
9
|
+
* This class:
|
|
10
|
+
* - Maintains a Three.js `Box3` that defines the clipping region.
|
|
11
|
+
* - Handles user interaction via {@link BoxInputs}.
|
|
12
|
+
* - Updates a {@link SectionBoxGizmo} to visualize the clipping box.
|
|
13
|
+
* - Dispatches signals when the box is resized or interaction state changes.
|
|
8
14
|
*/
|
|
9
15
|
export declare class SectionBox {
|
|
10
16
|
private _viewer;
|
|
17
|
+
private _gizmos;
|
|
11
18
|
private _inputs;
|
|
12
|
-
private _cube;
|
|
13
|
-
private _outline;
|
|
14
|
-
private _highlight;
|
|
15
|
-
private _normal;
|
|
16
19
|
private _clip;
|
|
17
20
|
private _visible;
|
|
18
21
|
private _interactive;
|
|
@@ -20,51 +23,82 @@ export declare class SectionBox {
|
|
|
20
23
|
private _onBoxConfirm;
|
|
21
24
|
private _onHover;
|
|
22
25
|
/**
|
|
23
|
-
*
|
|
26
|
+
* @internal
|
|
27
|
+
* A convenience getter to the viewer's renderer.
|
|
28
|
+
*/
|
|
29
|
+
private get renderer();
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
* A convenience getter to the `Section` module in the renderer.
|
|
33
|
+
*/
|
|
34
|
+
private get section();
|
|
35
|
+
/**
|
|
36
|
+
* Dispatches when any of the following properties change:
|
|
37
|
+
* - {@link clip} (clipping planes active)
|
|
38
|
+
* - {@link visible} (gizmo visibility)
|
|
39
|
+
* - {@link interactive} (pointer inputs active)
|
|
24
40
|
*/
|
|
25
41
|
get onStateChanged(): import("ste-signals").ISignal;
|
|
26
42
|
/**
|
|
27
|
-
*
|
|
43
|
+
* Dispatches when the user finishes manipulating (dragging) the box.
|
|
44
|
+
* The payload is the final {@link THREE.Box3} used for clipping.
|
|
28
45
|
*/
|
|
29
46
|
get onBoxConfirm(): import("ste-simple-events").ISimpleEvent<THREE.Box3>;
|
|
30
47
|
/**
|
|
31
|
-
*
|
|
48
|
+
* Dispatches a boolean indicating pointer hover state on the box handles:
|
|
49
|
+
* - `true` if the pointer has entered a handle
|
|
50
|
+
* - `false` if it has left or no handle is hovered
|
|
32
51
|
*/
|
|
33
52
|
get onHover(): import("ste-simple-events").ISimpleEvent<boolean>;
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Creates a new SectionBox gizmo controller.
|
|
55
|
+
*
|
|
56
|
+
* @param viewer - The parent {@link Viewer} in which the section box is rendered.
|
|
57
|
+
*/
|
|
36
58
|
constructor(viewer: Viewer);
|
|
37
59
|
/**
|
|
38
|
-
*
|
|
60
|
+
* The shared bounding box that defines the section region.
|
|
61
|
+
*
|
|
62
|
+
* To programmatically update the box, see {@link fitBox}.
|
|
39
63
|
*/
|
|
40
64
|
get box(): THREE.Box3;
|
|
41
65
|
/**
|
|
42
|
-
* Determines whether the section gizmo
|
|
66
|
+
* Determines whether the section gizmo applies clipping planes to the model.
|
|
67
|
+
*
|
|
68
|
+
* When `true`, `renderer.section.active` is enabled.
|
|
43
69
|
*/
|
|
44
70
|
get clip(): boolean;
|
|
45
71
|
set clip(value: boolean);
|
|
46
72
|
/**
|
|
47
|
-
* Determines whether the gizmo
|
|
73
|
+
* Determines whether the gizmo is interactive (i.e. responds to pointer events).
|
|
74
|
+
*
|
|
75
|
+
* When `true`, pointer events are registered and box handles can be dragged.
|
|
48
76
|
*/
|
|
49
77
|
get interactive(): boolean;
|
|
50
78
|
set interactive(value: boolean);
|
|
51
79
|
/**
|
|
52
|
-
* Determines whether the gizmo
|
|
80
|
+
* Determines whether the section box gizmo is visible in the scene.
|
|
53
81
|
*/
|
|
54
82
|
get visible(): boolean;
|
|
55
83
|
set visible(value: boolean);
|
|
56
84
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
85
|
+
* Resizes the section gizmo to match the given box, optionally expanded by a padding.
|
|
86
|
+
* After resizing, this method also updates the renderer's clipping box.
|
|
87
|
+
*
|
|
88
|
+
* @param box - The bounding box to match (required).
|
|
89
|
+
* @param padding - The scalar amount by which to expand the bounding box. Default is `1`.
|
|
60
90
|
*/
|
|
61
91
|
fitBox(box: THREE.Box3, padding?: number): void;
|
|
62
92
|
/**
|
|
63
|
-
*
|
|
93
|
+
* Updates the section box to match the current size of `this.section.box`.
|
|
94
|
+
*
|
|
95
|
+
* Call this if the renderer's section box is changed by code outside this class.
|
|
64
96
|
*/
|
|
65
97
|
update(): void;
|
|
66
98
|
/**
|
|
67
|
-
*
|
|
99
|
+
* Disposes of the gizmo and input event listeners, cleaning up related resources.
|
|
100
|
+
*
|
|
101
|
+
* After disposal, this `SectionBox` instance should no longer be used.
|
|
68
102
|
*/
|
|
69
103
|
dispose(): void;
|
|
70
104
|
}
|
|
@@ -1,47 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module viw-webgl-viewer/gizmos/sectionBox
|
|
3
|
-
*/
|
|
4
1
|
import * as THREE from 'three';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import { SectionBoxMesh } from './SectionBoxMesh';
|
|
3
|
+
import { SectionBoxOutline } from './sectionBoxOutline';
|
|
4
|
+
import { SectionBoxHandles } from './sectionBoxHandles';
|
|
5
|
+
import { Renderer } from '../../rendering/renderer';
|
|
6
|
+
export declare class SectionBoxGizmo {
|
|
7
|
+
private _renderer;
|
|
8
|
+
readonly cube: SectionBoxMesh;
|
|
9
|
+
readonly outline: SectionBoxOutline;
|
|
10
|
+
readonly handles: SectionBoxHandles;
|
|
11
|
+
private _visible;
|
|
12
|
+
get visible(): boolean;
|
|
13
|
+
set visible(value: boolean);
|
|
14
|
+
constructor(renderer: Renderer);
|
|
13
15
|
fitBox(box: THREE.Box3): void;
|
|
14
|
-
/**
|
|
15
|
-
* Disposes of all resources.
|
|
16
|
-
*/
|
|
17
|
-
dispose(): void;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Defines the box mesh for the section box.
|
|
21
|
-
*/
|
|
22
|
-
export declare class BoxMesh extends THREE.Mesh {
|
|
23
|
-
constructor();
|
|
24
|
-
/**
|
|
25
|
-
* Resize the mesh to the given box.
|
|
26
|
-
*/
|
|
27
|
-
fitBox(box: THREE.Box3): void;
|
|
28
|
-
/**
|
|
29
|
-
* Disposes of all resources.
|
|
30
|
-
*/
|
|
31
|
-
dispose(): void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Defines the face highlight on hover for the section box.
|
|
35
|
-
*/
|
|
36
|
-
export declare class BoxHighlight extends THREE.Mesh {
|
|
37
|
-
constructor();
|
|
38
|
-
/**
|
|
39
|
-
* Sets the face to highlight
|
|
40
|
-
* @param normal a direction vector from theses options (X,-X, Y,-Y, Z,-Z)
|
|
41
|
-
*/
|
|
42
|
-
highlight(box: THREE.Box3, normal: THREE.Vector3): void;
|
|
43
|
-
/**
|
|
44
|
-
* Disposes all resources.
|
|
45
|
-
*/
|
|
46
16
|
dispose(): void;
|
|
47
17
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export type Axis = 'x' | 'y' | 'z';
|
|
3
|
+
export declare class SectionBoxHandle extends THREE.Mesh {
|
|
4
|
+
readonly axis: Axis;
|
|
5
|
+
readonly sign: number;
|
|
6
|
+
private _forward;
|
|
7
|
+
private _color;
|
|
8
|
+
private _highlightColor;
|
|
9
|
+
private _materials;
|
|
10
|
+
constructor(axes: Axis, sign: number, size: number, color?: THREE.Color);
|
|
11
|
+
setPosition(position: THREE.Vector3): void;
|
|
12
|
+
get forward(): THREE.Vector3;
|
|
13
|
+
highlight(value: boolean): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module viw-webgl-viewer/gizmos/sectionBox
|
|
3
|
+
*/
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { SectionBoxHandle } from './sectionBoxHandle';
|
|
6
|
+
export declare class SectionBoxHandles {
|
|
7
|
+
readonly up: SectionBoxHandle;
|
|
8
|
+
readonly down: SectionBoxHandle;
|
|
9
|
+
readonly left: SectionBoxHandle;
|
|
10
|
+
readonly right: SectionBoxHandle;
|
|
11
|
+
readonly front: SectionBoxHandle;
|
|
12
|
+
readonly back: SectionBoxHandle;
|
|
13
|
+
readonly meshes: THREE.Group;
|
|
14
|
+
constructor();
|
|
15
|
+
get visible(): boolean;
|
|
16
|
+
set visible(value: boolean);
|
|
17
|
+
fitBox(box: THREE.Box3): void;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
}
|