@combeenation/3d-viewer 14.0.1-rc1 → 14.1.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/README.md +9 -9
- package/dist/lib-cjs/buildinfo.json +3 -3
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/dist/lib-cjs/index.d.ts +51 -62
- package/dist/lib-cjs/index.js +84 -94
- package/dist/lib-cjs/index.js.map +1 -1
- package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.d.ts +10 -10
- package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.js +131 -131
- package/dist/lib-cjs/internal/cloning-helper.d.ts +19 -19
- package/dist/lib-cjs/internal/cloning-helper.js +163 -163
- package/dist/lib-cjs/internal/device-helper.d.ts +9 -9
- package/dist/lib-cjs/internal/device-helper.js +24 -24
- package/dist/lib-cjs/internal/geometry-helper.d.ts +21 -21
- package/dist/lib-cjs/internal/geometry-helper.js +145 -145
- package/dist/lib-cjs/internal/metadata-helper.d.ts +26 -26
- package/dist/lib-cjs/internal/metadata-helper.js +50 -50
- package/dist/lib-cjs/internal/paintable-helper.d.ts +40 -40
- package/dist/lib-cjs/internal/paintable-helper.js +286 -286
- package/dist/lib-cjs/internal/tags-helper.d.ts +12 -12
- package/dist/lib-cjs/internal/tags-helper.js +37 -37
- package/dist/lib-cjs/manager/camera-manager.d.ts +110 -110
- package/dist/lib-cjs/manager/camera-manager.js +209 -206
- package/dist/lib-cjs/manager/camera-manager.js.map +1 -1
- package/dist/lib-cjs/manager/debug-manager.d.ts +60 -60
- package/dist/lib-cjs/manager/debug-manager.js +217 -217
- package/dist/lib-cjs/manager/event-manager.d.ts +52 -52
- package/dist/lib-cjs/manager/event-manager.js +71 -71
- package/dist/lib-cjs/manager/gltf-export-manager.d.ts +75 -84
- package/dist/lib-cjs/manager/gltf-export-manager.js +286 -290
- package/dist/lib-cjs/manager/gltf-export-manager.js.map +1 -1
- package/dist/lib-cjs/manager/material-manager.d.ts +35 -35
- package/dist/lib-cjs/manager/material-manager.js +125 -125
- package/dist/lib-cjs/manager/model-manager.d.ts +145 -145
- package/dist/lib-cjs/manager/model-manager.js +382 -382
- package/dist/lib-cjs/manager/parameter-manager.d.ts +210 -210
- package/dist/lib-cjs/manager/parameter-manager.js +514 -514
- package/dist/lib-cjs/manager/scene-manager.d.ts +45 -45
- package/dist/lib-cjs/manager/scene-manager.js +64 -64
- package/dist/lib-cjs/manager/texture-manager.d.ts +12 -12
- package/dist/lib-cjs/manager/texture-manager.js +43 -43
- package/dist/lib-cjs/viewer-error.d.ts +48 -48
- package/dist/lib-cjs/viewer-error.js +60 -60
- package/dist/lib-cjs/viewer.d.ts +115 -115
- package/dist/lib-cjs/viewer.js +217 -217
- package/package.json +91 -91
- package/src/buildinfo.json +3 -3
- package/src/dev.ts +47 -47
- package/src/global-types.d.ts +39 -39
- package/src/index.ts +71 -81
- package/src/internal/cbn-custom-babylon-loader-plugin.ts +159 -159
- package/src/internal/cloning-helper.ts +225 -225
- package/src/internal/device-helper.ts +25 -25
- package/src/internal/geometry-helper.ts +181 -181
- package/src/internal/metadata-helper.ts +63 -63
- package/src/internal/paintable-helper.ts +310 -310
- package/src/internal/tags-helper.ts +41 -41
- package/src/manager/camera-manager.ts +368 -365
- package/src/manager/debug-manager.ts +245 -245
- package/src/manager/event-manager.ts +72 -72
- package/src/manager/gltf-export-manager.ts +356 -357
- package/src/manager/material-manager.ts +135 -135
- package/src/manager/model-manager.ts +458 -458
- package/src/manager/parameter-manager.ts +652 -652
- package/src/manager/scene-manager.ts +101 -101
- package/src/manager/texture-manager.ts +32 -32
- package/src/viewer-error.ts +68 -68
- package/src/viewer.ts +290 -290
|
@@ -1,207 +1,210 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CameraManager = void 0;
|
|
13
|
-
const index_1 = require("../index");
|
|
14
|
-
const geometry_helper_1 = require("../internal/geometry-helper");
|
|
15
|
-
/**
|
|
16
|
-
* Manager for camera related tasks
|
|
17
|
-
*/
|
|
18
|
-
class CameraManager {
|
|
19
|
-
/** @internal */
|
|
20
|
-
constructor(viewer) {
|
|
21
|
-
this.viewer = viewer;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Focuses the camera to see every visible mesh in scene and tries to optimize wheel precision and panning
|
|
25
|
-
*/
|
|
26
|
-
autofocusActiveCamera(settings) {
|
|
27
|
-
var _a, _b, _c;
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const activeCamera = this.viewer.scene.activeCamera;
|
|
30
|
-
if (!(activeCamera instanceof index_1.ArcRotateCamera)) {
|
|
31
|
-
throw new Error(`Camera type "${activeCamera === null || activeCamera === void 0 ? void 0 : activeCamera.getClassName()}" is not implemented for "autofocusActiveCamera".`);
|
|
32
|
-
}
|
|
33
|
-
// get bounding box of all visible meshes, this is the base for the autofocus algorithm
|
|
34
|
-
const boundingInfo = this.viewer.calculateBoundingInfo(settings === null || settings === void 0 ? void 0 : settings.exclude);
|
|
35
|
-
// optionally show bounding sphere for debugging purpose
|
|
36
|
-
this.viewer.eventManager.fireEvent(index_1.ViewerEvent.AutofocusStart, boundingInfo.boundingSphere);
|
|
37
|
-
const distance = this._getAutofocusZoomingDistance(boundingInfo.boundingSphere, activeCamera);
|
|
38
|
-
const radius = boundingInfo.boundingSphere.radius;
|
|
39
|
-
const center = boundingInfo.boundingSphere.center;
|
|
40
|
-
// set lower radius limit on edge of bounding sphere to make sure that we can't dive into the meshes
|
|
41
|
-
activeCamera.lowerRadiusLimit = radius;
|
|
42
|
-
// additional settings
|
|
43
|
-
// constants for division are taken directly from Babylon.js repository
|
|
44
|
-
activeCamera.minZ = Math.min(radius / CameraManager._AUTOFOCUS_CONSTANTS.minZ, 1);
|
|
45
|
-
if ((settings === null || settings === void 0 ? void 0 : settings.adjustWheelPrecision) !== false) {
|
|
46
|
-
activeCamera.wheelPrecision = CameraManager._AUTOFOCUS_CONSTANTS.wheelPrecision / radius;
|
|
47
|
-
}
|
|
48
|
-
if ((settings === null || settings === void 0 ? void 0 : settings.adjustPanningSensibility) !== false) {
|
|
49
|
-
activeCamera.panningSensibility = CameraManager._AUTOFOCUS_CONSTANTS.panningSensibility / radius;
|
|
50
|
-
}
|
|
51
|
-
if ((settings === null || settings === void 0 ? void 0 : settings.adjustPinchPrecision) !== false) {
|
|
52
|
-
activeCamera.pinchPrecision = CameraManager._AUTOFOCUS_CONSTANTS.pinchPrecision / radius;
|
|
53
|
-
}
|
|
54
|
-
const radiusFactor = (_a = settings === null || settings === void 0 ? void 0 : settings.radiusFactor) !== null && _a !== void 0 ? _a : CameraManager._DEFAULT_AUTOFOCUS_RADIUS_FACTOR;
|
|
55
|
-
const alpha = (_b = settings === null || settings === void 0 ? void 0 : settings.alpha) !== null && _b !== void 0 ? _b : CameraManager.DEFAULT_CAMERA_POSITION.alpha;
|
|
56
|
-
const beta = (_c = settings === null || settings === void 0 ? void 0 : settings.beta) !== null && _c !== void 0 ? _c : CameraManager.DEFAULT_CAMERA_POSITION.beta;
|
|
57
|
-
const newCameraPosition = {
|
|
58
|
-
alpha: alpha,
|
|
59
|
-
beta: beta,
|
|
60
|
-
radius: distance * radiusFactor,
|
|
61
|
-
target: center,
|
|
62
|
-
};
|
|
63
|
-
yield this.moveActiveCameraTo(newCameraPosition, settings === null || settings === void 0 ? void 0 : settings.durationMs);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Moves the active camera smoothly to certain position
|
|
68
|
-
*
|
|
69
|
-
* @param durationMs defaults to 250ms if unset, use 0 for instant movement
|
|
70
|
-
*/
|
|
71
|
-
moveActiveCameraTo(position, durationMs = CameraManager._DEFAULT_CAM_SPEED_MS) {
|
|
72
|
-
var _a, _b, _c, _d;
|
|
73
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const activeCamera = this.viewer.scene.activeCamera;
|
|
75
|
-
if (!(activeCamera instanceof index_1.ArcRotateCamera)) {
|
|
76
|
-
throw new Error(`Camera type "${activeCamera === null || activeCamera === void 0 ? void 0 : activeCamera.getClassName()}" is not implemented yet for "moveActiveCameraTo".`);
|
|
77
|
-
}
|
|
78
|
-
if (durationMs === 0) {
|
|
79
|
-
// instant movement without animation
|
|
80
|
-
activeCamera.alpha = (_a = position.alpha) !== null && _a !== void 0 ? _a : activeCamera.alpha;
|
|
81
|
-
activeCamera.beta = (_b = position.beta) !== null && _b !== void 0 ? _b : activeCamera.beta;
|
|
82
|
-
activeCamera.radius = (_c = position.radius) !== null && _c !== void 0 ? _c : activeCamera.radius;
|
|
83
|
-
activeCamera.target = (_d = position.target) !== null && _d !== void 0 ? _d : activeCamera.target;
|
|
84
|
-
}
|
|
85
|
-
const framesPerSec = 100;
|
|
86
|
-
const animationGroup = new index_1.AnimationGroup(CameraManager.CAMERA_ANIMATION_NAME, this.viewer.scene);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
CameraManager._addCameraAnimationToGroup('
|
|
100
|
-
}
|
|
101
|
-
if (position.
|
|
102
|
-
CameraManager._addCameraAnimationToGroup('
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if ((settings === null || settings === void 0 ? void 0 : settings.
|
|
128
|
-
screenshotCam.
|
|
129
|
-
}
|
|
130
|
-
if ((settings === null || settings === void 0 ? void 0 : settings.
|
|
131
|
-
screenshotCam.
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
screenshotCam.setTarget(
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
CameraManager
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CameraManager = void 0;
|
|
13
|
+
const index_1 = require("../index");
|
|
14
|
+
const geometry_helper_1 = require("../internal/geometry-helper");
|
|
15
|
+
/**
|
|
16
|
+
* Manager for camera related tasks
|
|
17
|
+
*/
|
|
18
|
+
class CameraManager {
|
|
19
|
+
/** @internal */
|
|
20
|
+
constructor(viewer) {
|
|
21
|
+
this.viewer = viewer;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Focuses the camera to see every visible mesh in scene and tries to optimize wheel precision and panning
|
|
25
|
+
*/
|
|
26
|
+
autofocusActiveCamera(settings) {
|
|
27
|
+
var _a, _b, _c;
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const activeCamera = this.viewer.scene.activeCamera;
|
|
30
|
+
if (!(activeCamera instanceof index_1.ArcRotateCamera)) {
|
|
31
|
+
throw new Error(`Camera type "${activeCamera === null || activeCamera === void 0 ? void 0 : activeCamera.getClassName()}" is not implemented for "autofocusActiveCamera".`);
|
|
32
|
+
}
|
|
33
|
+
// get bounding box of all visible meshes, this is the base for the autofocus algorithm
|
|
34
|
+
const boundingInfo = this.viewer.calculateBoundingInfo(settings === null || settings === void 0 ? void 0 : settings.exclude);
|
|
35
|
+
// optionally show bounding sphere for debugging purpose
|
|
36
|
+
this.viewer.eventManager.fireEvent(index_1.ViewerEvent.AutofocusStart, boundingInfo.boundingSphere);
|
|
37
|
+
const distance = this._getAutofocusZoomingDistance(boundingInfo.boundingSphere, activeCamera);
|
|
38
|
+
const radius = boundingInfo.boundingSphere.radius;
|
|
39
|
+
const center = boundingInfo.boundingSphere.center;
|
|
40
|
+
// set lower radius limit on edge of bounding sphere to make sure that we can't dive into the meshes
|
|
41
|
+
activeCamera.lowerRadiusLimit = radius;
|
|
42
|
+
// additional settings
|
|
43
|
+
// constants for division are taken directly from Babylon.js repository
|
|
44
|
+
activeCamera.minZ = Math.min(radius / CameraManager._AUTOFOCUS_CONSTANTS.minZ, 1);
|
|
45
|
+
if ((settings === null || settings === void 0 ? void 0 : settings.adjustWheelPrecision) !== false) {
|
|
46
|
+
activeCamera.wheelPrecision = CameraManager._AUTOFOCUS_CONSTANTS.wheelPrecision / radius;
|
|
47
|
+
}
|
|
48
|
+
if ((settings === null || settings === void 0 ? void 0 : settings.adjustPanningSensibility) !== false) {
|
|
49
|
+
activeCamera.panningSensibility = CameraManager._AUTOFOCUS_CONSTANTS.panningSensibility / radius;
|
|
50
|
+
}
|
|
51
|
+
if ((settings === null || settings === void 0 ? void 0 : settings.adjustPinchPrecision) !== false) {
|
|
52
|
+
activeCamera.pinchPrecision = CameraManager._AUTOFOCUS_CONSTANTS.pinchPrecision / radius;
|
|
53
|
+
}
|
|
54
|
+
const radiusFactor = (_a = settings === null || settings === void 0 ? void 0 : settings.radiusFactor) !== null && _a !== void 0 ? _a : CameraManager._DEFAULT_AUTOFOCUS_RADIUS_FACTOR;
|
|
55
|
+
const alpha = (_b = settings === null || settings === void 0 ? void 0 : settings.alpha) !== null && _b !== void 0 ? _b : CameraManager.DEFAULT_CAMERA_POSITION.alpha;
|
|
56
|
+
const beta = (_c = settings === null || settings === void 0 ? void 0 : settings.beta) !== null && _c !== void 0 ? _c : CameraManager.DEFAULT_CAMERA_POSITION.beta;
|
|
57
|
+
const newCameraPosition = {
|
|
58
|
+
alpha: alpha,
|
|
59
|
+
beta: beta,
|
|
60
|
+
radius: distance * radiusFactor,
|
|
61
|
+
target: center,
|
|
62
|
+
};
|
|
63
|
+
yield this.moveActiveCameraTo(newCameraPosition, settings === null || settings === void 0 ? void 0 : settings.durationMs);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Moves the active camera smoothly to certain position
|
|
68
|
+
*
|
|
69
|
+
* @param durationMs defaults to 250ms if unset, use 0 for instant movement
|
|
70
|
+
*/
|
|
71
|
+
moveActiveCameraTo(position, durationMs = CameraManager._DEFAULT_CAM_SPEED_MS) {
|
|
72
|
+
var _a, _b, _c, _d;
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
const activeCamera = this.viewer.scene.activeCamera;
|
|
75
|
+
if (!(activeCamera instanceof index_1.ArcRotateCamera)) {
|
|
76
|
+
throw new Error(`Camera type "${activeCamera === null || activeCamera === void 0 ? void 0 : activeCamera.getClassName()}" is not implemented yet for "moveActiveCameraTo".`);
|
|
77
|
+
}
|
|
78
|
+
if (durationMs === 0) {
|
|
79
|
+
// instant movement without animation
|
|
80
|
+
activeCamera.alpha = (_a = position.alpha) !== null && _a !== void 0 ? _a : activeCamera.alpha;
|
|
81
|
+
activeCamera.beta = (_b = position.beta) !== null && _b !== void 0 ? _b : activeCamera.beta;
|
|
82
|
+
activeCamera.radius = (_c = position.radius) !== null && _c !== void 0 ? _c : activeCamera.radius;
|
|
83
|
+
activeCamera.target = (_d = position.target) !== null && _d !== void 0 ? _d : activeCamera.target;
|
|
84
|
+
}
|
|
85
|
+
const framesPerSec = 100;
|
|
86
|
+
const animationGroup = new index_1.AnimationGroup(CameraManager.CAMERA_ANIMATION_NAME, this.viewer.scene);
|
|
87
|
+
// it's important to start with the target, as it internally overwrites alpha, beta and radius
|
|
88
|
+
// these values can then be overwritten afterwards if provided on the input of this function
|
|
89
|
+
// for further details see CB-10015
|
|
90
|
+
if (position.target !== undefined) {
|
|
91
|
+
CameraManager._addCameraAnimationToGroup('target', activeCamera.target, position.target, framesPerSec, index_1.Animation.ANIMATIONTYPE_VECTOR3, animationGroup, activeCamera);
|
|
92
|
+
}
|
|
93
|
+
if (position.alpha !== undefined) {
|
|
94
|
+
// transform the target's alpha value into the same turn as the current camera position to avoid movements
|
|
95
|
+
// > 360 degrees
|
|
96
|
+
const alphaGap = activeCamera.alpha - position.alpha;
|
|
97
|
+
const cntTurns = Math.round(alphaGap / (2 * Math.PI));
|
|
98
|
+
const targetAlpha = position.alpha + 2 * Math.PI * cntTurns;
|
|
99
|
+
CameraManager._addCameraAnimationToGroup('alpha', activeCamera.alpha, targetAlpha, framesPerSec, index_1.Animation.ANIMATIONTYPE_FLOAT, animationGroup, activeCamera);
|
|
100
|
+
}
|
|
101
|
+
if (position.beta !== undefined) {
|
|
102
|
+
CameraManager._addCameraAnimationToGroup('beta', activeCamera.beta, position.beta, framesPerSec, index_1.Animation.ANIMATIONTYPE_FLOAT, animationGroup, activeCamera);
|
|
103
|
+
}
|
|
104
|
+
if (position.radius !== undefined) {
|
|
105
|
+
CameraManager._addCameraAnimationToGroup('radius', activeCamera.radius, position.radius, framesPerSec, index_1.Animation.ANIMATIONTYPE_FLOAT, animationGroup, activeCamera);
|
|
106
|
+
}
|
|
107
|
+
// animation is created for 1 second (100 frames), adjust speed ratio according to desired movement time
|
|
108
|
+
const speedRatio = 1000 / durationMs;
|
|
109
|
+
return new Promise(resolve => {
|
|
110
|
+
animationGroup.onAnimationGroupEndObservable.addOnce(() => {
|
|
111
|
+
animationGroup.dispose();
|
|
112
|
+
resolve();
|
|
113
|
+
});
|
|
114
|
+
animationGroup.start(false, speedRatio, 0, 100);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Takes a sceenshot the the current scene.\
|
|
120
|
+
* The result is a string containing a base64 encoded image.
|
|
121
|
+
*/
|
|
122
|
+
createScreenshot(settings) {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
const screenshotCam = (_a = this.viewer.scene.activeCamera) === null || _a === void 0 ? void 0 : _a.clone(CameraManager._SCREENSHOT_CAMERA_NAME);
|
|
126
|
+
const boundingInfo = (settings === null || settings === void 0 ? void 0 : settings.autofocusScene) ? this.viewer.calculateBoundingInfo(settings.exclude) : undefined;
|
|
127
|
+
if ((settings === null || settings === void 0 ? void 0 : settings.alpha) !== undefined) {
|
|
128
|
+
screenshotCam.alpha = settings.alpha;
|
|
129
|
+
}
|
|
130
|
+
if ((settings === null || settings === void 0 ? void 0 : settings.beta) !== undefined) {
|
|
131
|
+
screenshotCam.beta = settings.beta;
|
|
132
|
+
}
|
|
133
|
+
if ((settings === null || settings === void 0 ? void 0 : settings.radius) !== undefined) {
|
|
134
|
+
screenshotCam.radius = settings.radius;
|
|
135
|
+
}
|
|
136
|
+
else if (boundingInfo) {
|
|
137
|
+
// zoom out to have full scene in view if requested by `autofocusScene` flag
|
|
138
|
+
const distance = this._getAutofocusZoomingDistance(boundingInfo.boundingSphere, screenshotCam);
|
|
139
|
+
const radiusFactor = (_b = settings === null || settings === void 0 ? void 0 : settings.radiusFactor) !== null && _b !== void 0 ? _b : 1;
|
|
140
|
+
screenshotCam.radius = distance * radiusFactor;
|
|
141
|
+
}
|
|
142
|
+
// `cloneAlphaBetaRadius` has to be set to true, otherwise these values get adapted by setting the new target
|
|
143
|
+
// this would also be the case when setting `screenshotCam.target` directly
|
|
144
|
+
if ((settings === null || settings === void 0 ? void 0 : settings.target) !== undefined) {
|
|
145
|
+
screenshotCam.setTarget(settings.target, undefined, undefined, true);
|
|
146
|
+
}
|
|
147
|
+
else if (boundingInfo) {
|
|
148
|
+
screenshotCam.setTarget(boundingInfo.boundingSphere.center, undefined, undefined, true);
|
|
149
|
+
}
|
|
150
|
+
// don't expose internal props of `IScreenshotSize` in the API (yet), as it gets rather confusing and it shouldn't
|
|
151
|
+
// be necessary in the first place
|
|
152
|
+
// also let Babylon.js do all the fallback handling for missing properties
|
|
153
|
+
const size = { width: settings === null || settings === void 0 ? void 0 : settings.width, height: settings === null || settings === void 0 ? void 0 : settings.height };
|
|
154
|
+
// for some reason the `customizeTexture` property is not exposed in the async version of this function, therefore
|
|
155
|
+
// we create the promise here manually
|
|
156
|
+
const imageStr = yield new Promise(resolve => {
|
|
157
|
+
index_1.ScreenshotTools.CreateScreenshotUsingRenderTarget(this.viewer.engine, screenshotCam, size, (data) => resolve(data), settings === null || settings === void 0 ? void 0 : settings.mimeType, settings === null || settings === void 0 ? void 0 : settings.samples, settings === null || settings === void 0 ? void 0 : settings.antialiasing, settings === null || settings === void 0 ? void 0 : settings.fileName, settings === null || settings === void 0 ? void 0 : settings.renderSprites, settings === null || settings === void 0 ? void 0 : settings.enableStencilBuffer, settings === null || settings === void 0 ? void 0 : settings.useLayerMask, settings === null || settings === void 0 ? void 0 : settings.quality, texture => {
|
|
158
|
+
texture.renderList = this.viewer.scene.meshes.filter(mesh => !(settings === null || settings === void 0 ? void 0 : settings.exclude) || !(0, geometry_helper_1.isNodeExcluded)(mesh, settings.exclude));
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
screenshotCam.dispose();
|
|
162
|
+
return imageStr;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
static _addCameraAnimationToGroup(targetProperty, from, to, framesPerSec, dataType, animationGroup, activeCamera) {
|
|
166
|
+
const alphaAnimation = new index_1.Animation(targetProperty, targetProperty, framesPerSec, dataType, index_1.Animation.ANIMATIONLOOPMODE_CONSTANT);
|
|
167
|
+
alphaAnimation.setKeys([
|
|
168
|
+
{
|
|
169
|
+
frame: 0,
|
|
170
|
+
value: from,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
frame: 100,
|
|
174
|
+
value: to,
|
|
175
|
+
},
|
|
176
|
+
]);
|
|
177
|
+
animationGroup.addTargetedAnimation(alphaAnimation, activeCamera);
|
|
178
|
+
}
|
|
179
|
+
_getAutofocusZoomingDistance(boundingSphere, camera) {
|
|
180
|
+
// calculation is taken from Babylon.js repository, which on their side took it from this SO post:
|
|
181
|
+
// http://stackoverflow.com/questions/2866350/move-camera-to-fit-3d-scene
|
|
182
|
+
// there's a good sketch which explains the calculation quite a bit
|
|
183
|
+
const aspectRatio = this.viewer.engine.getAspectRatio(camera);
|
|
184
|
+
const frustumSlopeY = Math.tan(camera.fov / 2);
|
|
185
|
+
const frustumSlopeX = frustumSlopeY * aspectRatio;
|
|
186
|
+
const distanceForHorizontalFrustum = boundingSphere.radius * Math.sqrt(1 + 1 / (frustumSlopeX * frustumSlopeX));
|
|
187
|
+
const distanceForVerticalFrustum = boundingSphere.radius * Math.sqrt(1 + 1 / (frustumSlopeY * frustumSlopeY));
|
|
188
|
+
const distance = Math.max(distanceForHorizontalFrustum, distanceForVerticalFrustum);
|
|
189
|
+
return distance;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.CameraManager = CameraManager;
|
|
193
|
+
CameraManager.CAMERA_ANIMATION_NAME = '__cameraAnimation__';
|
|
194
|
+
/** @internal */
|
|
195
|
+
CameraManager.DEFAULT_CAMERA_POSITION = {
|
|
196
|
+
alpha: (45 * Math.PI) / 180,
|
|
197
|
+
beta: (75 * Math.PI) / 180,
|
|
198
|
+
radius: 1,
|
|
199
|
+
target: new index_1.Vector3(0, 0, 0),
|
|
200
|
+
};
|
|
201
|
+
CameraManager._AUTOFOCUS_CONSTANTS = {
|
|
202
|
+
minZ: 100,
|
|
203
|
+
wheelPrecision: 100,
|
|
204
|
+
panningSensibility: 2500,
|
|
205
|
+
pinchPrecision: 200,
|
|
206
|
+
};
|
|
207
|
+
CameraManager._DEFAULT_AUTOFOCUS_RADIUS_FACTOR = 1;
|
|
208
|
+
CameraManager._DEFAULT_CAM_SPEED_MS = 250;
|
|
209
|
+
CameraManager._SCREENSHOT_CAMERA_NAME = '__screenshotCamera__';
|
|
207
210
|
//# sourceMappingURL=camera-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"camera-manager.js","sourceRoot":"","sources":["../../../src/manager/camera-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAWkB;AAClB,iEAA6D;AA6E7D;;GAEG;AACH,MAAa,aAAa;IAsBxB,gBAAgB;IAChB,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;OAEG;IACU,qBAAqB,CAAC,QAA4B;;;YAC7D,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC;YAEpD,IAAI,CAAC,CAAC,YAAY,YAAY,uBAAe,CAAC,EAAE;gBAC9C,MAAM,IAAI,KAAK,CAAC,gBAAgB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,YAAY,EAAE,mDAAmD,CAAC,CAAC;aAClH;YAED,uFAAuF;YACvF,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,CAAC;YAC1E,wDAAwD;YACxD,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,mBAAW,CAAC,cAAc,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;YAE5F,MAAM,QAAQ,GAAG,IAAI,CAAC,4BAA4B,CAAC,YAAY,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;YAC9F,MAAM,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC;YAClD,MAAM,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,MAAM,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AC,EAAE,CAAC,EAAE,CAAC,CAAC;CAC7B,CAAC;AAEwB,kCAAoB,GAAG;IAC/C,IAAI,EAAE,GAAG;IACT,cAAc,EAAE,GAAG;IACnB,kBAAkB,EAAE,IAAI;IACxB,cAAc,EAAE,GAAG;CACpB,CAAC;AAEwB,8CAAgC,GAAG,CAAC,CAAC;AACrC,mCAAqB,GAAG,GAAG,CAAC;AAC5B,qCAAuB,GAAG,sBAAsB,CAAC"}
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { AxesViewer, BoundingSphere, Color3, IInspectorOptions, Scene, TransformNode, Vector3, Viewer } from '../index';
|
|
2
|
-
declare type DebugAxisKeys = 'X' | 'Y' | 'Z';
|
|
3
|
-
declare type DebugAxisConfig = {
|
|
4
|
-
color: Color3;
|
|
5
|
-
position: Vector3;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Manager for debugging functionalities
|
|
9
|
-
*/
|
|
10
|
-
export declare class DebugManager {
|
|
11
|
-
protected viewer: Viewer;
|
|
12
|
-
protected static _DEBUG_AXIS_MAP: Record<DebugAxisKeys, DebugAxisConfig>;
|
|
13
|
-
protected static _WORLD_COORD_ROOT_KEY: string;
|
|
14
|
-
protected static _BOUNDING_SPHERE_KEY: string;
|
|
15
|
-
protected _axesViewer: AxesViewer | null;
|
|
16
|
-
protected _showBoundingSphereForAutofocus: boolean;
|
|
17
|
-
/** @internal */
|
|
18
|
-
constructor(viewer: Viewer);
|
|
19
|
-
/**
|
|
20
|
-
* Assign callback for drawing bounding sphere on autofocusing
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
registerAutofocusStartListener(): void;
|
|
24
|
-
/**
|
|
25
|
-
* Enables the Babylon.js [Inspector](https://doc.babylonjs.com/toolsAndResources/tools/inspector).\
|
|
26
|
-
* Due to the additional size of the inspector, this function is only available in "development" builds!
|
|
27
|
-
*
|
|
28
|
-
* @returns Signalizes if inspector could be loaded
|
|
29
|
-
*/
|
|
30
|
-
showInspector(options?: IInspectorOptions): Promise<boolean>;
|
|
31
|
-
hideInspector(): void;
|
|
32
|
-
/**
|
|
33
|
-
* Show world coordinate system with given dimension.\
|
|
34
|
-
* This is especially usefull when working on project with tricky positioning. (e.g. clones)
|
|
35
|
-
*/
|
|
36
|
-
showWorldCoordinates(dimension: number): void;
|
|
37
|
-
hideWorldCoordinates(): void;
|
|
38
|
-
/**
|
|
39
|
-
* Draws a wireframe bounding sphere on the next call of {@link CameraManager.autofocusActiveCamera}.\
|
|
40
|
-
* This is usefull for checking which parts of the scene get centered.
|
|
41
|
-
*/
|
|
42
|
-
showBoundingSphereForAutofocus(): void;
|
|
43
|
-
hideBoundingSphereForAutofocus(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Adjust and enhance coordinate axes to fulfill our needs.
|
|
46
|
-
* - moves nodes into common root
|
|
47
|
-
* - adds text node
|
|
48
|
-
*/
|
|
49
|
-
protected static _prepareWorldCoordinateAxis(text: 'X' | 'Y' | 'Z', axis: TransformNode, root: TransformNode, dimension: number, utilityLayerScene: Scene): void;
|
|
50
|
-
/**
|
|
51
|
-
* Calculate factor for creating world coordinate axes with exactly one unit in length
|
|
52
|
-
*/
|
|
53
|
-
protected static _getWorldCoordinatesAxesUnifyFactor(): number;
|
|
54
|
-
/**
|
|
55
|
-
* Visualize bounding sphere which is used to zoom in via `autofocusActiveCamera` function
|
|
56
|
-
*/
|
|
57
|
-
protected _drawBoundingSphereForAutofocus(boundingSphere: BoundingSphere): void;
|
|
58
|
-
protected _removeBoundingSphereForAutofocus(): void;
|
|
59
|
-
}
|
|
60
|
-
export {};
|
|
1
|
+
import { AxesViewer, BoundingSphere, Color3, IInspectorOptions, Scene, TransformNode, Vector3, Viewer } from '../index';
|
|
2
|
+
declare type DebugAxisKeys = 'X' | 'Y' | 'Z';
|
|
3
|
+
declare type DebugAxisConfig = {
|
|
4
|
+
color: Color3;
|
|
5
|
+
position: Vector3;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Manager for debugging functionalities
|
|
9
|
+
*/
|
|
10
|
+
export declare class DebugManager {
|
|
11
|
+
protected viewer: Viewer;
|
|
12
|
+
protected static _DEBUG_AXIS_MAP: Record<DebugAxisKeys, DebugAxisConfig>;
|
|
13
|
+
protected static _WORLD_COORD_ROOT_KEY: string;
|
|
14
|
+
protected static _BOUNDING_SPHERE_KEY: string;
|
|
15
|
+
protected _axesViewer: AxesViewer | null;
|
|
16
|
+
protected _showBoundingSphereForAutofocus: boolean;
|
|
17
|
+
/** @internal */
|
|
18
|
+
constructor(viewer: Viewer);
|
|
19
|
+
/**
|
|
20
|
+
* Assign callback for drawing bounding sphere on autofocusing
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
registerAutofocusStartListener(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Enables the Babylon.js [Inspector](https://doc.babylonjs.com/toolsAndResources/tools/inspector).\
|
|
26
|
+
* Due to the additional size of the inspector, this function is only available in "development" builds!
|
|
27
|
+
*
|
|
28
|
+
* @returns Signalizes if inspector could be loaded
|
|
29
|
+
*/
|
|
30
|
+
showInspector(options?: IInspectorOptions): Promise<boolean>;
|
|
31
|
+
hideInspector(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Show world coordinate system with given dimension.\
|
|
34
|
+
* This is especially usefull when working on project with tricky positioning. (e.g. clones)
|
|
35
|
+
*/
|
|
36
|
+
showWorldCoordinates(dimension: number): void;
|
|
37
|
+
hideWorldCoordinates(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Draws a wireframe bounding sphere on the next call of {@link CameraManager.autofocusActiveCamera}.\
|
|
40
|
+
* This is usefull for checking which parts of the scene get centered.
|
|
41
|
+
*/
|
|
42
|
+
showBoundingSphereForAutofocus(): void;
|
|
43
|
+
hideBoundingSphereForAutofocus(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Adjust and enhance coordinate axes to fulfill our needs.
|
|
46
|
+
* - moves nodes into common root
|
|
47
|
+
* - adds text node
|
|
48
|
+
*/
|
|
49
|
+
protected static _prepareWorldCoordinateAxis(text: 'X' | 'Y' | 'Z', axis: TransformNode, root: TransformNode, dimension: number, utilityLayerScene: Scene): void;
|
|
50
|
+
/**
|
|
51
|
+
* Calculate factor for creating world coordinate axes with exactly one unit in length
|
|
52
|
+
*/
|
|
53
|
+
protected static _getWorldCoordinatesAxesUnifyFactor(): number;
|
|
54
|
+
/**
|
|
55
|
+
* Visualize bounding sphere which is used to zoom in via `autofocusActiveCamera` function
|
|
56
|
+
*/
|
|
57
|
+
protected _drawBoundingSphereForAutofocus(boundingSphere: BoundingSphere): void;
|
|
58
|
+
protected _removeBoundingSphereForAutofocus(): void;
|
|
59
|
+
}
|
|
60
|
+
export {};
|