@shapediver/viewer.rendering-engine.camera-engine 2.12.8 → 3.0.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/implementation/CameraEngine.d.ts +5 -7
- package/dist/implementation/CameraEngine.d.ts.map +1 -1
- package/dist/implementation/CameraEngine.js +68 -27
- package/dist/implementation/CameraEngine.js.map +1 -1
- package/dist/implementation/camera/AbstractCamera.d.ts +7 -5
- package/dist/implementation/camera/AbstractCamera.d.ts.map +1 -1
- package/dist/implementation/camera/AbstractCamera.js +15 -8
- package/dist/implementation/camera/AbstractCamera.js.map +1 -1
- package/dist/implementation/camera/OrthographicCamera.d.ts +10 -13
- package/dist/implementation/camera/OrthographicCamera.d.ts.map +1 -1
- package/dist/implementation/camera/OrthographicCamera.js +53 -52
- package/dist/implementation/camera/OrthographicCamera.js.map +1 -1
- package/dist/implementation/camera/PerspectiveCamera.d.ts +9 -12
- package/dist/implementation/camera/PerspectiveCamera.d.ts.map +1 -1
- package/dist/implementation/camera/PerspectiveCamera.js +33 -38
- package/dist/implementation/camera/PerspectiveCamera.js.map +1 -1
- package/dist/implementation/controls/AbstractCameraControls.d.ts +156 -5
- package/dist/implementation/controls/AbstractCameraControls.d.ts.map +1 -1
- package/dist/implementation/controls/AbstractCameraControls.js +260 -6
- package/dist/implementation/controls/AbstractCameraControls.js.map +1 -1
- package/dist/implementation/controls/CameraControlsEventDistribution.d.ts +38 -0
- package/dist/implementation/controls/CameraControlsEventDistribution.d.ts.map +1 -0
- package/dist/implementation/controls/{perspective/CameraControlsEventDistribution.js → CameraControlsEventDistribution.js} +71 -71
- package/dist/implementation/controls/CameraControlsEventDistribution.js.map +1 -0
- package/dist/implementation/controls/{perspective/CameraControlsLogic.d.ts → CameraControlsLogic.d.ts} +5 -5
- package/dist/implementation/controls/CameraControlsLogic.d.ts.map +1 -0
- package/dist/implementation/controls/{perspective/CameraControlsLogic.js → CameraControlsLogic.js} +74 -44
- package/dist/implementation/controls/CameraControlsLogic.js.map +1 -0
- package/dist/implementation/controls/OrthographicCameraControls.d.ts +4 -67
- package/dist/implementation/controls/OrthographicCameraControls.d.ts.map +1 -1
- package/dist/implementation/controls/OrthographicCameraControls.js +22 -90
- package/dist/implementation/controls/OrthographicCameraControls.js.map +1 -1
- package/dist/implementation/controls/PerspectiveCameraControls.d.ts +4 -151
- package/dist/implementation/controls/PerspectiveCameraControls.d.ts.map +1 -1
- package/dist/implementation/controls/PerspectiveCameraControls.js +21 -247
- package/dist/implementation/controls/PerspectiveCameraControls.js.map +1 -1
- package/dist/implementation/interpolation/CameraInterpolationManager.d.ts +3 -3
- package/dist/implementation/interpolation/CameraInterpolationManager.d.ts.map +1 -1
- package/dist/implementation/interpolation/CameraInterpolationManager.js +5 -5
- package/dist/implementation/interpolation/CameraInterpolationManager.js.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraCylindricalInterpolation.d.ts +3 -3
- package/dist/implementation/interpolation/interpolationMethods/CameraCylindricalInterpolation.d.ts.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraCylindricalInterpolation.js +11 -11
- package/dist/implementation/interpolation/interpolationMethods/CameraCylindricalInterpolation.js.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraLinearInterpolation.d.ts +3 -3
- package/dist/implementation/interpolation/interpolationMethods/CameraLinearInterpolation.d.ts.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraLinearInterpolation.js +6 -6
- package/dist/implementation/interpolation/interpolationMethods/CameraLinearInterpolation.js.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraMultipleInterpolation.d.ts +4 -4
- package/dist/implementation/interpolation/interpolationMethods/CameraMultipleInterpolation.d.ts.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraMultipleInterpolation.js +6 -6
- package/dist/implementation/interpolation/interpolationMethods/CameraMultipleInterpolation.js.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraOrthographicInterpolation.d.ts +3 -3
- package/dist/implementation/interpolation/interpolationMethods/CameraOrthographicInterpolation.d.ts.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraOrthographicInterpolation.js +6 -6
- package/dist/implementation/interpolation/interpolationMethods/CameraOrthographicInterpolation.js.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraSphericalInterpolation.d.ts +3 -3
- package/dist/implementation/interpolation/interpolationMethods/CameraSphericalInterpolation.d.ts.map +1 -1
- package/dist/implementation/interpolation/interpolationMethods/CameraSphericalInterpolation.js +9 -9
- package/dist/implementation/interpolation/interpolationMethods/CameraSphericalInterpolation.js.map +1 -1
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces/ICameraEngine.d.ts +7 -7
- package/dist/interfaces/ICameraEngine.d.ts.map +1 -1
- package/dist/interfaces/ICameraEngine.js +3 -0
- package/dist/interfaces/ICameraEngine.js.map +1 -1
- package/dist/interfaces/camera/ICamera.d.ts +23 -22
- package/dist/interfaces/camera/ICamera.d.ts.map +1 -1
- package/dist/interfaces/camera/ICamera.js +1 -0
- package/dist/interfaces/camera/ICamera.js.map +1 -1
- package/dist/interfaces/camera/IOrthographicCamera.d.ts +8 -7
- package/dist/interfaces/camera/IOrthographicCamera.d.ts.map +1 -1
- package/dist/interfaces/camera/IOrthographicCamera.js +4 -0
- package/dist/interfaces/camera/IOrthographicCamera.js.map +1 -1
- package/dist/interfaces/camera/IPerspectiveCamera.d.ts +2 -2
- package/dist/interfaces/camera/IPerspectiveCamera.d.ts.map +1 -1
- package/dist/interfaces/controls/ICameraControls.d.ts +73 -2
- package/dist/interfaces/controls/ICameraControls.d.ts.map +1 -1
- package/dist/interfaces/controls/ICameraControls.js +1 -0
- package/dist/interfaces/controls/ICameraControls.js.map +1 -1
- package/dist/interfaces/controls/ICameraControlsEventDistribution.d.ts +1 -1
- package/dist/interfaces/controls/ICameraControlsEventDistribution.d.ts.map +1 -1
- package/dist/interfaces/controls/ICameraControlsLogic.d.ts +4 -1
- package/dist/interfaces/controls/ICameraControlsLogic.d.ts.map +1 -1
- package/dist/interfaces/interpolation/ICameraInterpolation.d.ts +2 -2
- package/dist/interfaces/interpolation/ICameraInterpolation.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/implementation/CameraEngine.ts +111 -70
- package/src/implementation/camera/AbstractCamera.ts +24 -16
- package/src/implementation/camera/OrthographicCamera.ts +84 -85
- package/src/implementation/camera/PerspectiveCamera.ts +64 -69
- package/src/implementation/controls/AbstractCameraControls.ts +303 -14
- package/src/implementation/controls/{perspective/CameraControlsEventDistribution.ts → CameraControlsEventDistribution.ts} +96 -75
- package/src/implementation/controls/{perspective/CameraControlsLogic.ts → CameraControlsLogic.ts} +90 -53
- package/src/implementation/controls/OrthographicCameraControls.ts +27 -121
- package/src/implementation/controls/PerspectiveCameraControls.ts +28 -294
- package/src/implementation/interpolation/CameraInterpolationManager.ts +40 -45
- package/src/implementation/interpolation/interpolationMethods/CameraCylindricalInterpolation.ts +19 -22
- package/src/implementation/interpolation/interpolationMethods/CameraLinearInterpolation.ts +15 -16
- package/src/implementation/interpolation/interpolationMethods/CameraMultipleInterpolation.ts +17 -19
- package/src/implementation/interpolation/interpolationMethods/CameraOrthographicInterpolation.ts +12 -14
- package/src/implementation/interpolation/interpolationMethods/CameraSphericalInterpolation.ts +18 -20
- package/src/index.ts +18 -21
- package/src/interfaces/ICameraEngine.ts +24 -11
- package/src/interfaces/camera/ICamera.ts +45 -41
- package/src/interfaces/camera/IOrthographicCamera.ts +27 -9
- package/src/interfaces/camera/IPerspectiveCamera.ts +13 -5
- package/src/interfaces/controls/ICameraControls.ts +49 -6
- package/src/interfaces/controls/ICameraControlsEventDistribution.ts +5 -2
- package/src/interfaces/controls/ICameraControlsLogic.ts +6 -3
- package/src/interfaces/interpolation/ICameraInterpolation.ts +6 -2
- package/dist/implementation/controls/orthographic/CameraControlsEventDistribution.d.ts +0 -32
- package/dist/implementation/controls/orthographic/CameraControlsEventDistribution.d.ts.map +0 -1
- package/dist/implementation/controls/orthographic/CameraControlsEventDistribution.js +0 -230
- package/dist/implementation/controls/orthographic/CameraControlsEventDistribution.js.map +0 -1
- package/dist/implementation/controls/orthographic/CameraControlsLogic.d.ts +0 -28
- package/dist/implementation/controls/orthographic/CameraControlsLogic.d.ts.map +0 -1
- package/dist/implementation/controls/orthographic/CameraControlsLogic.js +0 -243
- package/dist/implementation/controls/orthographic/CameraControlsLogic.js.map +0 -1
- package/dist/implementation/controls/perspective/CameraControlsEventDistribution.d.ts +0 -32
- package/dist/implementation/controls/perspective/CameraControlsEventDistribution.d.ts.map +0 -1
- package/dist/implementation/controls/perspective/CameraControlsEventDistribution.js.map +0 -1
- package/dist/implementation/controls/perspective/CameraControlsLogic.d.ts.map +0 -1
- package/dist/implementation/controls/perspective/CameraControlsLogic.js.map +0 -1
- package/dist/interfaces/controls/ICameraControlsUsage.d.ts +0 -22
- package/dist/interfaces/controls/ICameraControlsUsage.d.ts.map +0 -1
- package/dist/interfaces/controls/ICameraControlsUsage.js +0 -3
- package/dist/interfaces/controls/ICameraControlsUsage.js.map +0 -1
- package/dist/interfaces/controls/IOrthographicCameraControls.d.ts +0 -30
- package/dist/interfaces/controls/IOrthographicCameraControls.d.ts.map +0 -1
- package/dist/interfaces/controls/IOrthographicCameraControls.js +0 -3
- package/dist/interfaces/controls/IOrthographicCameraControls.js.map +0 -1
- package/dist/interfaces/controls/IPerspectiveCameraControls.d.ts +0 -65
- package/dist/interfaces/controls/IPerspectiveCameraControls.d.ts.map +0 -1
- package/dist/interfaces/controls/IPerspectiveCameraControls.js +0 -3
- package/dist/interfaces/controls/IPerspectiveCameraControls.js.map +0 -1
- package/src/implementation/controls/orthographic/CameraControlsEventDistribution.ts +0 -234
- package/src/implementation/controls/orthographic/CameraControlsLogic.ts +0 -271
- package/src/interfaces/controls/ICameraControlsUsage.ts +0 -30
- package/src/interfaces/controls/IOrthographicCameraControls.ts +0 -13
- package/src/interfaces/controls/IPerspectiveCameraControls.ts +0 -33
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
import { mat4, vec2, vec3 } from 'gl-matrix';
|
|
2
|
-
import { EventEngine, EVENTTYPE } from '@shapediver/viewer.shared.services';
|
|
3
|
-
|
|
4
|
-
import { CAMERA_TYPE } from '../../interfaces/ICameraEngine';
|
|
5
|
-
import { ICamera, ICameraOptions } from '../../interfaces/camera/ICamera';
|
|
6
|
-
import { ICameraControlsUsage } from '../../interfaces/controls/ICameraControlsUsage';
|
|
7
1
|
import { CameraInterpolationManager } from '../interpolation/CameraInterpolationManager';
|
|
2
|
+
import { Converter, EventEngine, EVENTTYPE, SettingsEngine } from '@shapediver/viewer.shared.services';
|
|
3
|
+
import { ICamera, ICameraOptions } from '../../interfaces/camera/ICamera';
|
|
4
|
+
import { ICameraControls } from '../../interfaces/controls/ICameraControls';
|
|
8
5
|
import { ICameraControlsEventDistribution } from '../../interfaces/controls/ICameraControlsEventDistribution';
|
|
9
6
|
import { ICameraControlsLogic } from '../../interfaces/controls/ICameraControlsLogic';
|
|
7
|
+
import { mat4, vec2, vec3 } from 'gl-matrix';
|
|
8
|
+
import { ICameraControlsSettings } from '@shapediver/viewer.settings';
|
|
10
9
|
|
|
11
|
-
export class AbstractCameraControls implements
|
|
12
|
-
// #region Properties (
|
|
10
|
+
export abstract class AbstractCameraControls implements ICameraControls {
|
|
11
|
+
// #region Properties (38)
|
|
13
12
|
|
|
14
13
|
private readonly _cameraInterpolationManager: CameraInterpolationManager;
|
|
14
|
+
private readonly _converter: Converter = Converter.instance;
|
|
15
15
|
private readonly _eventEngine: EventEngine = EventEngine.instance;
|
|
16
16
|
|
|
17
|
+
private _autoRotationSpeed: number = 0;
|
|
17
18
|
private _canvas?: HTMLCanvasElement;
|
|
19
|
+
private _cubePositionRestriction: { min: vec3, max: vec3 } = { min: vec3.fromValues(-Infinity, -Infinity, -Infinity), max: vec3.fromValues(Infinity, Infinity, Infinity) };
|
|
20
|
+
private _cubeTargetRestriction: { min: vec3, max: vec3 } = { min: vec3.fromValues(-Infinity, -Infinity, -Infinity), max: vec3.fromValues(Infinity, Infinity, Infinity) };
|
|
21
|
+
private _damping: number = 0.1;
|
|
22
|
+
private _enableAutoRotation: boolean = false;
|
|
23
|
+
private _enableAzimuthRotation: boolean = true;
|
|
24
|
+
private _enableKeyPan: boolean = false;
|
|
25
|
+
private _enableObjectControls: boolean = false;
|
|
26
|
+
private _enablePan: boolean = true;
|
|
27
|
+
private _enablePolarRotation: boolean = true;
|
|
28
|
+
private _enableRotation: boolean = true;
|
|
29
|
+
private _enableTurntableControls: boolean = false;
|
|
30
|
+
private _enableZoom: boolean = true;
|
|
31
|
+
private _input: { keys: { up: number, down: number, left: number, right: number }, mouse: { rotate: number, zoom: number, pan: number }, touch: { rotate: number, zoom: number, pan: number } } = { keys: { up: 38, down: 40, left: 37, right: 39 }, mouse: { rotate: 0, zoom: 1, pan: 2 }, touch: { rotate: 1, zoom: 2, pan: 2 }, };
|
|
32
|
+
private _keyPanSpeed: number = 0.5;
|
|
18
33
|
private _manualInteraction: boolean = false;
|
|
19
34
|
private _manualInteractionTransformations: {
|
|
20
35
|
position: {
|
|
@@ -30,6 +45,7 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
30
45
|
phi: number
|
|
31
46
|
}[]
|
|
32
47
|
};
|
|
48
|
+
private _movementSmoothness: number = 0.5;
|
|
33
49
|
private _moving: boolean = false;
|
|
34
50
|
private _movingDuration: number = 0;
|
|
35
51
|
private _nonmanualInteraction: boolean = false;
|
|
@@ -47,22 +63,30 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
47
63
|
phi: number
|
|
48
64
|
}[]
|
|
49
65
|
};
|
|
66
|
+
private _objectControlsCenter: vec3 = vec3.create();
|
|
67
|
+
private _panSpeed: number = 0.5;
|
|
50
68
|
private _position: vec3 = vec3.create();
|
|
69
|
+
private _rotationRestriction: { minPolarAngle: number, maxPolarAngle: number, minAzimuthAngle: number, maxAzimuthAngle: number } = { minPolarAngle: 0, maxPolarAngle: 180, minAzimuthAngle: -Infinity, maxAzimuthAngle: Infinity };
|
|
70
|
+
private _rotationSpeed: number = 0.5;
|
|
51
71
|
private _sceneRotation: vec2 = vec2.create();
|
|
72
|
+
private _spherePositionRestriction: { center: vec3, radius: number } = { center: vec3.create(), radius: Infinity };
|
|
73
|
+
private _sphereTargetRestriction: { center: vec3, radius: number } = { center: vec3.create(), radius: Infinity };
|
|
52
74
|
private _target: vec3 = vec3.create();
|
|
75
|
+
private _turntableCenter: vec3 = vec3.create();
|
|
53
76
|
private _viewportId?: string;
|
|
77
|
+
private _zoomRestriction: { minDistance: number, maxDistance: number } = { minDistance: 0, maxDistance: Infinity };
|
|
78
|
+
private _zoomSpeed: number = 0.5;
|
|
54
79
|
|
|
55
80
|
protected _cameraControlsEventDistribution!: ICameraControlsEventDistribution;
|
|
56
81
|
protected _cameraLogic!: ICameraControlsLogic;
|
|
57
82
|
|
|
58
|
-
// #endregion Properties (
|
|
83
|
+
// #endregion Properties (38)
|
|
59
84
|
|
|
60
85
|
// #region Constructors (1)
|
|
61
86
|
|
|
62
87
|
constructor(
|
|
63
88
|
private _camera: ICamera,
|
|
64
|
-
private _enabled: boolean
|
|
65
|
-
type: CAMERA_TYPE
|
|
89
|
+
private _enabled: boolean
|
|
66
90
|
) {
|
|
67
91
|
this._cameraInterpolationManager = new CameraInterpolationManager(this._camera, this);
|
|
68
92
|
this._manualInteractionTransformations = { position: [], target: [], sceneRotation: [] };
|
|
@@ -71,7 +95,15 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
71
95
|
|
|
72
96
|
// #endregion Constructors (1)
|
|
73
97
|
|
|
74
|
-
// #region Public
|
|
98
|
+
// #region Public Getters And Setters (59)
|
|
99
|
+
|
|
100
|
+
public get autoRotationSpeed(): number {
|
|
101
|
+
return this._autoRotationSpeed;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public set autoRotationSpeed(value: number) {
|
|
105
|
+
this._autoRotationSpeed = value;
|
|
106
|
+
}
|
|
75
107
|
|
|
76
108
|
public get camera(): ICamera {
|
|
77
109
|
return this._camera;
|
|
@@ -93,6 +125,102 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
93
125
|
this._canvas = value;
|
|
94
126
|
}
|
|
95
127
|
|
|
128
|
+
public get cubePositionRestriction(): { min: vec3, max: vec3 } {
|
|
129
|
+
return this._cubePositionRestriction;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public set cubePositionRestriction(value: { min: vec3, max: vec3 }) {
|
|
133
|
+
this._cubePositionRestriction = value;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public get cubeTargetRestriction(): { min: vec3, max: vec3 } {
|
|
137
|
+
return this._cubeTargetRestriction;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public set cubeTargetRestriction(value: { min: vec3, max: vec3 }) {
|
|
141
|
+
this._cubeTargetRestriction = value;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
public get damping(): number {
|
|
145
|
+
return this._damping;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public set damping(value: number) {
|
|
149
|
+
this._damping = value;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public get enableAutoRotation(): boolean {
|
|
153
|
+
return this._enableAutoRotation;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
public set enableAutoRotation(value: boolean) {
|
|
157
|
+
this._enableAutoRotation = value;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public get enableAzimuthRotation(): boolean {
|
|
161
|
+
return this._enableAzimuthRotation;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
public set enableAzimuthRotation(value: boolean) {
|
|
165
|
+
this._enableAzimuthRotation = value;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public get enableKeyPan(): boolean {
|
|
169
|
+
return this._enableKeyPan;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
public set enableKeyPan(value: boolean) {
|
|
173
|
+
this._enableKeyPan = value;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
public get enableObjectControls(): boolean {
|
|
177
|
+
return this._enableObjectControls;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public set enableObjectControls(value: boolean) {
|
|
181
|
+
this._enableObjectControls = value;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
public get enablePan(): boolean {
|
|
185
|
+
return this._enablePan;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
public set enablePan(value: boolean) {
|
|
189
|
+
this._enablePan = value;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
public get enablePolarRotation(): boolean {
|
|
193
|
+
return this._enablePolarRotation;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
public set enablePolarRotation(value: boolean) {
|
|
197
|
+
this._enablePolarRotation = value;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public get enableRotation(): boolean {
|
|
201
|
+
return this._enableRotation;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
public set enableRotation(value: boolean) {
|
|
205
|
+
this._enableRotation = value;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
public get enableTurntableControls(): boolean {
|
|
209
|
+
return this._enableTurntableControls;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
public set enableTurntableControls(value: boolean) {
|
|
213
|
+
this._enableTurntableControls = value;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
public get enableZoom(): boolean {
|
|
217
|
+
return this._enableZoom;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
public set enableZoom(value: boolean) {
|
|
221
|
+
this._enableZoom = value;
|
|
222
|
+
}
|
|
223
|
+
|
|
96
224
|
public get enabled(): boolean {
|
|
97
225
|
return this._enabled;
|
|
98
226
|
}
|
|
@@ -110,6 +238,46 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
110
238
|
this._enabled = value;
|
|
111
239
|
}
|
|
112
240
|
|
|
241
|
+
public get input(): { keys: { up: number, down: number, left: number, right: number }, mouse: { rotate: number, zoom: number, pan: number }, touch: { rotate: number, zoom: number, pan: number } } {
|
|
242
|
+
return this._input;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
public set input(value: { keys: { up: number, down: number, left: number, right: number }, mouse: { rotate: number, zoom: number, pan: number }, touch: { rotate: number, zoom: number, pan: number } }) {
|
|
246
|
+
this._input = value;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
public get keyPanSpeed(): number {
|
|
250
|
+
return this._keyPanSpeed;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
public set keyPanSpeed(value: number) {
|
|
254
|
+
this._keyPanSpeed = value;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public get movementSmoothness(): number {
|
|
258
|
+
return this._movementSmoothness;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
public set movementSmoothness(value: number) {
|
|
262
|
+
this._movementSmoothness = value;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
public get objectControlsCenter(): vec3 {
|
|
266
|
+
return this._objectControlsCenter;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
public set objectControlsCenter(value: vec3) {
|
|
270
|
+
this._objectControlsCenter = value;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
public get panSpeed(): number {
|
|
274
|
+
return this._panSpeed;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
public set panSpeed(value: number) {
|
|
278
|
+
this._panSpeed = value;
|
|
279
|
+
}
|
|
280
|
+
|
|
113
281
|
public get position(): vec3 {
|
|
114
282
|
return this._position;
|
|
115
283
|
}
|
|
@@ -118,6 +286,22 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
118
286
|
this._position = value;
|
|
119
287
|
}
|
|
120
288
|
|
|
289
|
+
public get rotationRestriction(): { minPolarAngle: number, maxPolarAngle: number, minAzimuthAngle: number, maxAzimuthAngle: number } {
|
|
290
|
+
return this._rotationRestriction;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
public set rotationRestriction(value: { minPolarAngle: number, maxPolarAngle: number, minAzimuthAngle: number, maxAzimuthAngle: number }) {
|
|
294
|
+
this._rotationRestriction = value;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
public get rotationSpeed(): number {
|
|
298
|
+
return this._rotationSpeed;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
public set rotationSpeed(value: number) {
|
|
302
|
+
this._rotationSpeed = value;
|
|
303
|
+
}
|
|
304
|
+
|
|
121
305
|
public get sceneRotation(): vec2 {
|
|
122
306
|
return this._sceneRotation;
|
|
123
307
|
}
|
|
@@ -126,6 +310,22 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
126
310
|
this._sceneRotation = value;
|
|
127
311
|
}
|
|
128
312
|
|
|
313
|
+
public get spherePositionRestriction(): { center: vec3, radius: number } {
|
|
314
|
+
return this._spherePositionRestriction;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
public set spherePositionRestriction(value: { center: vec3, radius: number }) {
|
|
318
|
+
this._spherePositionRestriction = value;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
public get sphereTargetRestriction(): { center: vec3, radius: number } {
|
|
322
|
+
return this._sphereTargetRestriction;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
public set sphereTargetRestriction(value: { center: vec3, radius: number }) {
|
|
326
|
+
this._sphereTargetRestriction = value;
|
|
327
|
+
}
|
|
328
|
+
|
|
129
329
|
public get target(): vec3 {
|
|
130
330
|
return this._target;
|
|
131
331
|
}
|
|
@@ -134,7 +334,31 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
134
334
|
this._target = value;
|
|
135
335
|
}
|
|
136
336
|
|
|
137
|
-
|
|
337
|
+
public get turntableCenter(): vec3 {
|
|
338
|
+
return this._turntableCenter;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
public set turntableCenter(value: vec3) {
|
|
342
|
+
this._turntableCenter = value;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
public get zoomRestriction(): { minDistance: number, maxDistance: number } {
|
|
346
|
+
return this._zoomRestriction;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
public set zoomRestriction(value: { minDistance: number, maxDistance: number }) {
|
|
350
|
+
this._zoomRestriction = value;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
public get zoomSpeed(): number {
|
|
354
|
+
return this._zoomSpeed;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
public set zoomSpeed(value: number) {
|
|
358
|
+
this._zoomSpeed = value;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// #endregion Public Getters And Setters (59)
|
|
138
362
|
|
|
139
363
|
// #region Public Methods (16)
|
|
140
364
|
|
|
@@ -180,6 +404,71 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
180
404
|
}
|
|
181
405
|
}
|
|
182
406
|
|
|
407
|
+
|
|
408
|
+
public applySettings(settingsEngine: SettingsEngine) {
|
|
409
|
+
const cameraSetting = settingsEngine.camera.cameras[this.camera.id];
|
|
410
|
+
if (!cameraSetting) return;
|
|
411
|
+
this.reset();
|
|
412
|
+
const controlsSettings = <ICameraControlsSettings>cameraSetting.controls;
|
|
413
|
+
this.autoRotationSpeed = controlsSettings.autoRotationSpeed;
|
|
414
|
+
this.damping = controlsSettings.damping;
|
|
415
|
+
this.enableAutoRotation = controlsSettings.enableAutoRotation;
|
|
416
|
+
this.enableKeyPan = controlsSettings.enableKeyPan;
|
|
417
|
+
this.enablePan = controlsSettings.enablePan;
|
|
418
|
+
this.enableRotation = controlsSettings.enableRotation;
|
|
419
|
+
this.enableZoom = controlsSettings.enableZoom;
|
|
420
|
+
// this.input = controlsSettings.input;
|
|
421
|
+
this.keyPanSpeed = controlsSettings.keyPanSpeed;
|
|
422
|
+
this.movementSmoothness = controlsSettings.movementSmoothness;
|
|
423
|
+
this.rotationSpeed = controlsSettings.rotationSpeed;
|
|
424
|
+
this.panSpeed = controlsSettings.panSpeed;
|
|
425
|
+
this.zoomSpeed = controlsSettings.zoomSpeed;
|
|
426
|
+
|
|
427
|
+
this.enableAzimuthRotation = controlsSettings.enableAzimuthRotation;
|
|
428
|
+
this.enablePolarRotation = controlsSettings.enablePolarRotation;
|
|
429
|
+
this.enableTurntableControls = controlsSettings.enableTurntableControls;
|
|
430
|
+
this.enableObjectControls = controlsSettings.enableObjectControls;
|
|
431
|
+
this.turntableCenter = this._converter.toVec3(controlsSettings.turntableCenter);
|
|
432
|
+
this.objectControlsCenter = this._converter.toVec3(controlsSettings.objectControlsCenter);
|
|
433
|
+
|
|
434
|
+
if (controlsSettings.restrictions.position.cube.min.x === null) controlsSettings.restrictions.position.cube.min.x = -Infinity;
|
|
435
|
+
if (controlsSettings.restrictions.position.cube.min.y === null) controlsSettings.restrictions.position.cube.min.y = -Infinity;
|
|
436
|
+
if (controlsSettings.restrictions.position.cube.min.z === null) controlsSettings.restrictions.position.cube.min.z = -Infinity;
|
|
437
|
+
if (controlsSettings.restrictions.position.cube.max.x === null) controlsSettings.restrictions.position.cube.max.x = Infinity;
|
|
438
|
+
if (controlsSettings.restrictions.position.cube.max.y === null) controlsSettings.restrictions.position.cube.max.y = Infinity;
|
|
439
|
+
if (controlsSettings.restrictions.position.cube.max.z === null) controlsSettings.restrictions.position.cube.max.z = Infinity;
|
|
440
|
+
if (controlsSettings.restrictions.position.sphere.radius === null) controlsSettings.restrictions.position.sphere.radius = Infinity;
|
|
441
|
+
if (controlsSettings.restrictions.target.cube.min.x === null) controlsSettings.restrictions.target.cube.min.x = -Infinity;
|
|
442
|
+
if (controlsSettings.restrictions.target.cube.min.y === null) controlsSettings.restrictions.target.cube.min.y = -Infinity;
|
|
443
|
+
if (controlsSettings.restrictions.target.cube.min.z === null) controlsSettings.restrictions.target.cube.min.z = -Infinity;
|
|
444
|
+
if (controlsSettings.restrictions.target.cube.max.x === null) controlsSettings.restrictions.target.cube.max.x = Infinity;
|
|
445
|
+
if (controlsSettings.restrictions.target.cube.max.y === null) controlsSettings.restrictions.target.cube.max.y = Infinity;
|
|
446
|
+
if (controlsSettings.restrictions.target.cube.max.z === null) controlsSettings.restrictions.target.cube.max.z = Infinity;
|
|
447
|
+
if (controlsSettings.restrictions.target.sphere.radius === null) controlsSettings.restrictions.target.sphere.radius = Infinity;
|
|
448
|
+
if (controlsSettings.restrictions.rotation.minAzimuthAngle === null) controlsSettings.restrictions.rotation.minAzimuthAngle = -Infinity;
|
|
449
|
+
if (controlsSettings.restrictions.rotation.maxAzimuthAngle === null) controlsSettings.restrictions.rotation.maxAzimuthAngle = Infinity;
|
|
450
|
+
if (controlsSettings.restrictions.zoom.maxDistance === null) controlsSettings.restrictions.zoom.maxDistance = Infinity;
|
|
451
|
+
|
|
452
|
+
this.cubePositionRestriction = {
|
|
453
|
+
min: this._converter.toVec3(controlsSettings.restrictions.position.cube.min),
|
|
454
|
+
max: this._converter.toVec3(controlsSettings.restrictions.position.cube.max)
|
|
455
|
+
};
|
|
456
|
+
this.spherePositionRestriction = {
|
|
457
|
+
center: this._converter.toVec3(controlsSettings.restrictions.position.sphere.center),
|
|
458
|
+
radius: controlsSettings.restrictions.position.sphere.radius
|
|
459
|
+
};
|
|
460
|
+
this.cubeTargetRestriction = {
|
|
461
|
+
min: this._converter.toVec3(controlsSettings.restrictions.target.cube.min),
|
|
462
|
+
max: this._converter.toVec3(controlsSettings.restrictions.target.cube.max)
|
|
463
|
+
};
|
|
464
|
+
this.sphereTargetRestriction = {
|
|
465
|
+
center: this._converter.toVec3(controlsSettings.restrictions.target.sphere.center),
|
|
466
|
+
radius: controlsSettings.restrictions.target.sphere.radius
|
|
467
|
+
};
|
|
468
|
+
this.rotationRestriction = controlsSettings.restrictions.rotation;
|
|
469
|
+
this.zoomRestriction = controlsSettings.restrictions.zoom;
|
|
470
|
+
}
|
|
471
|
+
|
|
183
472
|
public applyTargetMatrix(matrix: mat4, manualInteraction?: boolean | undefined): void {
|
|
184
473
|
if (this._manualInteraction || manualInteraction) {
|
|
185
474
|
this._manualInteraction = true;
|
|
@@ -267,7 +556,7 @@ export class AbstractCameraControls implements ICameraControlsUsage {
|
|
|
267
556
|
if (this._manualInteraction === true && this._cameraInterpolationManager.active())
|
|
268
557
|
this._cameraInterpolationManager.stop();
|
|
269
558
|
|
|
270
|
-
const { position, target, sceneRotation } = this._cameraLogic.restrict(this.getPosition(), this.getTarget(), this.getSceneRotation());
|
|
559
|
+
const { position , target, sceneRotation } = this._cameraLogic.restrict(this.getPosition(), this.getTarget(), this.getSceneRotation());
|
|
271
560
|
this._position = vec3.clone(position);
|
|
272
561
|
this._target = vec3.clone(target);
|
|
273
562
|
this._sceneRotation = sceneRotation ? vec2.clone(sceneRotation) : vec2.create();
|