@crystaldesign/real-time-viewer 25.3.0-rc.8 → 25.3.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/build/esm/index.js +267 -201
- package/build/types/real-time-viewer/src/CustomMaterial/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/SelectionHandler/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/context.d.ts +1 -1
- package/build/types/real-time-viewer/src/context.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/controls/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/parser/createCams/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/parser/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/parser/shadow/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/store/SceneStore.d.ts +4 -5
- package/build/types/real-time-viewer/src/store/SceneStore.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/store/UIStore.d.ts +13 -3
- package/build/types/real-time-viewer/src/store/UIStore.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/useRealTimeRenderData.d.ts +1 -1
- package/build/types/real-time-viewer/src/useRealTimeRenderData.d.ts.map +1 -1
- package/build/umd/1309.real-time-viewer.umd.min.js +2 -0
- package/build/umd/1309.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/1447.real-time-viewer.umd.min.js +2 -0
- package/build/umd/1447.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/1499.real-time-viewer.umd.min.js +2 -0
- package/build/umd/1499.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/1781.real-time-viewer.umd.min.js +2 -0
- package/build/umd/1781.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/1896.real-time-viewer.umd.min.js +2 -0
- package/build/umd/1896.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/1924.real-time-viewer.umd.min.js +2 -0
- package/build/umd/1924.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/2011.real-time-viewer.umd.min.js +2 -0
- package/build/umd/2011.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/2439.real-time-viewer.umd.min.js +2 -0
- package/build/umd/2439.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/2817.real-time-viewer.umd.min.js +2 -0
- package/build/umd/2817.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/2871.real-time-viewer.umd.min.js +2 -0
- package/build/umd/2871.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/3116.real-time-viewer.umd.min.js +2 -0
- package/build/umd/3116.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/3243.real-time-viewer.umd.min.js +2 -0
- package/build/umd/3243.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/3351.real-time-viewer.umd.min.js +2 -0
- package/build/umd/3351.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/3456.real-time-viewer.umd.min.js +2 -0
- package/build/umd/3456.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/3945.real-time-viewer.umd.min.js +2 -0
- package/build/umd/3945.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4091.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4091.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/410.real-time-viewer.umd.min.js +2 -0
- package/build/umd/410.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4153.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4153.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4248.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4248.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4378.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4378.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4431.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4431.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4542.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4542.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4602.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4602.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4661.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4661.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4669.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4669.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4711.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4711.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/4823.real-time-viewer.umd.min.js +2 -0
- package/build/umd/4823.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/5462.real-time-viewer.umd.min.js +2 -0
- package/build/umd/5462.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/5478.real-time-viewer.umd.min.js +2 -0
- package/build/umd/5478.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/5483.real-time-viewer.umd.min.js +2 -0
- package/build/umd/5483.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/5555.real-time-viewer.umd.min.js +2 -0
- package/build/umd/5555.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/5846.real-time-viewer.umd.min.js +2 -0
- package/build/umd/5846.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/5860.real-time-viewer.umd.min.js +2 -0
- package/build/umd/5860.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/5922.real-time-viewer.umd.min.js +2 -0
- package/build/umd/5922.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/6095.real-time-viewer.umd.min.js +2 -0
- package/build/umd/6095.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/615.real-time-viewer.umd.min.js +2 -0
- package/build/umd/615.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/6230.real-time-viewer.umd.min.js +2 -0
- package/build/umd/6230.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/6357.real-time-viewer.umd.min.js +2 -0
- package/build/umd/6357.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/653.real-time-viewer.umd.min.js +2 -0
- package/build/umd/653.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/6656.real-time-viewer.umd.min.js +2 -0
- package/build/umd/6656.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/6829.real-time-viewer.umd.min.js +2 -0
- package/build/umd/6829.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7042.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7042.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7046.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7046.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/710.real-time-viewer.umd.min.js +2 -0
- package/build/umd/710.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7142.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7142.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7144.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7144.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7229.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7229.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7276.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7276.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7352.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7352.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7501.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7501.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7607.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7607.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7729.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7729.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7751.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7751.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/7754.real-time-viewer.umd.min.js +2 -0
- package/build/umd/7754.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/8078.real-time-viewer.umd.min.js +2 -0
- package/build/umd/8078.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/8105.real-time-viewer.umd.min.js +2 -0
- package/build/umd/8105.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/815.real-time-viewer.umd.min.js +2 -0
- package/build/umd/815.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/8240.real-time-viewer.umd.min.js +2 -0
- package/build/umd/8240.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/8333.real-time-viewer.umd.min.js +2 -0
- package/build/umd/8333.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/8620.real-time-viewer.umd.min.js +2 -0
- package/build/umd/8620.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/8728.real-time-viewer.umd.min.js +2 -0
- package/build/umd/8728.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/8729.real-time-viewer.umd.min.js +2 -0
- package/build/umd/8729.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/8991.real-time-viewer.umd.min.js +2 -0
- package/build/umd/8991.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/9078.real-time-viewer.umd.min.js +2 -0
- package/build/umd/9078.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/913.real-time-viewer.umd.min.js +2 -0
- package/build/umd/913.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/930.real-time-viewer.umd.min.js +2 -0
- package/build/umd/930.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/9383.real-time-viewer.umd.min.js +2 -0
- package/build/umd/9383.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/9568.real-time-viewer.umd.min.js +2 -0
- package/build/umd/9568.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/9712.real-time-viewer.umd.min.js +2 -0
- package/build/umd/9712.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/9884.real-time-viewer.umd.min.js +2 -0
- package/build/umd/9884.real-time-viewer.umd.min.js.LICENSE.txt +1 -0
- package/build/umd/real-time-viewer.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +12 -12
package/build/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef, useEffect, memo } from 'react';
|
|
2
2
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
3
3
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
4
|
-
import {
|
|
4
|
+
import { Color4, Color3 } from '@babylonjs/core/Maths/math.color';
|
|
5
5
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
6
6
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
7
7
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
@@ -12,7 +12,6 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
|
12
12
|
import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder';
|
|
13
13
|
import { ActionManager } from '@babylonjs/core/Actions/actionManager';
|
|
14
14
|
import { ExecuteCodeAction } from '@babylonjs/core/Actions/directActions';
|
|
15
|
-
import { Color4, Color3 } from '@babylonjs/core/Maths/math.color';
|
|
16
15
|
import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial';
|
|
17
16
|
import '@babylonjs/core/Rendering/edgesRenderer';
|
|
18
17
|
import { GLTF2Export } from '@babylonjs/serializers';
|
|
@@ -29,12 +28,18 @@ import { TransformNode } from '@babylonjs/core/Meshes/transformNode';
|
|
|
29
28
|
import { AdvancedDynamicTexture } from '@babylonjs/gui/2D/advancedDynamicTexture';
|
|
30
29
|
import { Button } from '@babylonjs/gui/2D/controls/button';
|
|
31
30
|
import { Ellipse } from '@babylonjs/gui/2D/controls/ellipse';
|
|
31
|
+
import '@babylonjs/core/Engines/WebGPU/Extensions/engine.dynamicTexture';
|
|
32
|
+
import '@babylonjs/core/Engines/WebGPU/Extensions/engine.multiRender';
|
|
33
|
+
import '@babylonjs/core/Engines/WebGPU/Extensions/engine.renderTarget';
|
|
34
|
+
import '@babylonjs/core/Engines/WebGPU/Extensions/engine.renderTargetTexture';
|
|
32
35
|
import { Rectangle } from '@babylonjs/gui/2D/controls/rectangle';
|
|
33
36
|
import { TextBlock } from '@babylonjs/gui/2D/controls/textBlock';
|
|
34
37
|
import { Mesh } from '@babylonjs/core/Meshes/mesh';
|
|
35
38
|
import { Axis } from '@babylonjs/core/Maths/math.axis';
|
|
36
39
|
import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial';
|
|
37
40
|
import { Texture } from '@babylonjs/core/Materials/Textures/texture';
|
|
41
|
+
import { Constants } from '@babylonjs/core/Engines/constants';
|
|
42
|
+
import { HighlightLayer } from '@babylonjs/core/Layers';
|
|
38
43
|
import { Matrix as Matrix$1, Vector3 as Vector3$1 } from '@babylonjs/core/Maths/math';
|
|
39
44
|
import { EngineFactory } from '@babylonjs/core/Engines/engineFactory';
|
|
40
45
|
import { Scene } from '@babylonjs/core/scene';
|
|
@@ -66,7 +71,6 @@ function GetCameraControls(camera) {
|
|
|
66
71
|
var isZooming = false;
|
|
67
72
|
var initDistance = 0;
|
|
68
73
|
function renderLoop() {
|
|
69
|
-
var _sceneStore$updateCam;
|
|
70
74
|
if (!sceneStore.doRenderControlLoop || sceneStore.isInitializing || uistore.isStaticBg) return;
|
|
71
75
|
uistore.onMove();
|
|
72
76
|
var stopRender = true;
|
|
@@ -104,8 +108,7 @@ function GetCameraControls(camera) {
|
|
|
104
108
|
},
|
|
105
109
|
vertFov: camera.fov * 180 / Math.PI
|
|
106
110
|
};
|
|
107
|
-
(
|
|
108
|
-
uistore.requestNewOverlayImage(cam, sceneStore.focusedElement, sceneStore.targetCameraPosition);
|
|
111
|
+
uistore.requestNewOverlayImage(cam, sceneStore.focusedElement, sceneStore.targetCameraPosition, sceneStore.updateCameraInformation);
|
|
109
112
|
if (stopRender) {
|
|
110
113
|
sceneStore.doRenderControlLoop = false;
|
|
111
114
|
}
|
|
@@ -902,7 +905,8 @@ function createCams(scene, viewpoint) {
|
|
|
902
905
|
if (existingCam) return existingCam;
|
|
903
906
|
var camera = new UniversalCamera(name, pos, scene);
|
|
904
907
|
camera.rotation = degreesToRadians(rot);
|
|
905
|
-
camera.minZ = 0.
|
|
908
|
+
camera.minZ = 0.1;
|
|
909
|
+
camera.maxZ = 30;
|
|
906
910
|
camera.fov = 0.418879;
|
|
907
911
|
if (isEnabled) scene.activeCamera = camera;
|
|
908
912
|
if (parent) camera.parent = parent;
|
|
@@ -944,7 +948,6 @@ function updateCam(camera, scene) {
|
|
|
944
948
|
var _sceneStore$updateCam;
|
|
945
949
|
if (camera.pos.x == 0 && camera.pos.y == 0 && camera.pos.z == 0) return;
|
|
946
950
|
var utilStore = useUtilStoreContext();
|
|
947
|
-
if (!utilStore.updateCam) return;
|
|
948
951
|
var sceneStore = useSceneStoreContext();
|
|
949
952
|
var cam = scene.getCameraByName('defaultCam');
|
|
950
953
|
if (!cam) {
|
|
@@ -954,33 +957,35 @@ function updateCam(camera, scene) {
|
|
|
954
957
|
return;
|
|
955
958
|
}
|
|
956
959
|
if (camera.pos.x == cam.position.x && camera.pos.y == cam.position.y && camera.pos.z == camera.pos.z) return;
|
|
957
|
-
var
|
|
958
|
-
|
|
959
|
-
cam.rotation = utilStore.degreesToRadians(utilStore.vector3ToBVector3(_objectSpread(_objectSpread({}, camera.rot), {}, {
|
|
960
|
+
var position = utilStore.vector3ToBVector3(camera.pos).multiply(new Vector3(-0.01, 0.01, 0.01));
|
|
961
|
+
var rotation = utilStore.degreesToRadians(utilStore.vector3ToBVector3(_objectSpread(_objectSpread({}, camera.rot), {}, {
|
|
960
962
|
x: -camera.rot.x
|
|
961
963
|
})));
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
964
|
+
var target = utilStore.vector3ToBVector3(camera.targetPos).multiply(new Vector3(-0.01, 0.01, 0.01));
|
|
965
|
+
cam.position = position;
|
|
966
|
+
cam.rotation = rotation;
|
|
967
|
+
cam.setTarget(target);
|
|
968
|
+
sceneStore.targetCameraPosition = position;
|
|
969
|
+
sceneStore.cameraTargetPosition = target;
|
|
965
970
|
(_sceneStore$updateCam = sceneStore.updateCameraInformation) === null || _sceneStore$updateCam === void 0 || _sceneStore$updateCam.call(sceneStore, {
|
|
966
971
|
horiFov: cam.fov * 180 / Math.PI,
|
|
967
972
|
lensShiftX: 0,
|
|
968
973
|
lensShiftY: 0,
|
|
969
974
|
name: cam.name,
|
|
970
975
|
pos: {
|
|
971
|
-
x:
|
|
972
|
-
y:
|
|
973
|
-
z:
|
|
976
|
+
x: position.x,
|
|
977
|
+
y: position.y,
|
|
978
|
+
z: position.z
|
|
974
979
|
},
|
|
975
980
|
rot: {
|
|
976
|
-
x:
|
|
977
|
-
y:
|
|
978
|
-
z:
|
|
981
|
+
x: rotation.x * 180 / Math.PI,
|
|
982
|
+
y: rotation.y * 180 / Math.PI,
|
|
983
|
+
z: rotation.z * 180 / Math.PI
|
|
979
984
|
},
|
|
980
985
|
targetPos: {
|
|
981
|
-
x:
|
|
982
|
-
y:
|
|
983
|
-
z:
|
|
986
|
+
x: target.x,
|
|
987
|
+
y: target.y,
|
|
988
|
+
z: target.z
|
|
984
989
|
},
|
|
985
990
|
vertFov: cam.fov * 180 / Math.PI
|
|
986
991
|
});
|
|
@@ -1022,7 +1027,7 @@ var SceneStore = /*#__PURE__*/function () {
|
|
|
1022
1027
|
_defineProperty(this, "_doRenderControlLoop", false);
|
|
1023
1028
|
_defineProperty(this, "_cameraTargetPosition", Vector3.Zero());
|
|
1024
1029
|
_defineProperty(this, "_targetCameraPosition", Vector3.Zero());
|
|
1025
|
-
_defineProperty(this, "
|
|
1030
|
+
_defineProperty(this, "_selectedElements", void 0);
|
|
1026
1031
|
_defineProperty(this, "_focusedElement", void 0);
|
|
1027
1032
|
_defineProperty(this, "_isControlledViewpoint", true);
|
|
1028
1033
|
// if the current viewpoint should automatically change with the planning
|
|
@@ -1114,12 +1119,12 @@ var SceneStore = /*#__PURE__*/function () {
|
|
|
1114
1119
|
this._doRenderControlLoop = doRenderControlLoop;
|
|
1115
1120
|
}
|
|
1116
1121
|
}, {
|
|
1117
|
-
key: "
|
|
1122
|
+
key: "selectedElements",
|
|
1118
1123
|
get: function get() {
|
|
1119
|
-
return this.
|
|
1124
|
+
return this._selectedElements;
|
|
1120
1125
|
},
|
|
1121
1126
|
set: function set(element) {
|
|
1122
|
-
this.
|
|
1127
|
+
this._selectedElements = element;
|
|
1123
1128
|
}
|
|
1124
1129
|
}, {
|
|
1125
1130
|
key: "focusedElement",
|
|
@@ -1647,6 +1652,7 @@ var SceneStore = /*#__PURE__*/function () {
|
|
|
1647
1652
|
if (newPosition.x == 0 && newPosition.y == 0 && newPosition.z == 0) return;
|
|
1648
1653
|
this.cameraTargetPosition = center;
|
|
1649
1654
|
this.targetCameraPosition = newPosition;
|
|
1655
|
+
this.runRenderLoopIndefinitely(); // runs till the updated unity images
|
|
1650
1656
|
this.doRenderControlLoop = true;
|
|
1651
1657
|
this._isControlledViewpoint = true;
|
|
1652
1658
|
this._focusedElement = {
|
|
@@ -1737,7 +1743,8 @@ function SelHandler (_ref) {
|
|
|
1737
1743
|
var onElementSelected = function onElementSelected(elem, hit, doubleClick) {
|
|
1738
1744
|
var _sceneStore$focusedEl, _sceneStore$focusedEl2;
|
|
1739
1745
|
var elemName = elem.name.slice(-1);
|
|
1740
|
-
|
|
1746
|
+
var curElemName = (_sceneStore$focusedEl = sceneStore.focusedElement) === null || _sceneStore$focusedEl === void 0 || (_sceneStore$focusedEl = _sceneStore$focusedEl.name) === null || _sceneStore$focusedEl === void 0 || (_sceneStore$focusedEl2 = _sceneStore$focusedEl.slice) === null || _sceneStore$focusedEl2 === void 0 ? void 0 : _sceneStore$focusedEl2.call(_sceneStore$focusedEl, -1);
|
|
1747
|
+
if (doubleClick && curElemName == elemName && hit.pickedMesh) {
|
|
1741
1748
|
var _getParent = function getParent(mesh) {
|
|
1742
1749
|
var _mesh$parent;
|
|
1743
1750
|
if (((_mesh$parent = mesh.parent) === null || _mesh$parent === void 0 ? void 0 : _mesh$parent.getClassName()) == 'TransformNode') return mesh.parent;
|
|
@@ -1745,16 +1752,10 @@ function SelHandler (_ref) {
|
|
|
1745
1752
|
};
|
|
1746
1753
|
sceneStore.focusElement(_getParent(hit.pickedMesh));
|
|
1747
1754
|
return;
|
|
1748
|
-
} else if (
|
|
1755
|
+
} else if (curElemName != elemName && (doubleClick || curElemName == elemName)) {
|
|
1749
1756
|
sceneStore.focusElement(elem);
|
|
1750
1757
|
}
|
|
1751
|
-
|
|
1752
|
-
// is already selected
|
|
1753
|
-
if (sceneStore.selectedElement == elemName) return;
|
|
1754
|
-
sceneStore.selectedElement = elemName;
|
|
1755
|
-
uiStore.selectElem(elemName);
|
|
1756
|
-
onElSelected === null || onElSelected === void 0 || onElSelected(elem.parent.name, Number(elemName));
|
|
1757
|
-
sceneStore.runRenderLoopForTime(1000);
|
|
1758
|
+
uiStore.selectElem(elemName, elem, onElSelected);
|
|
1758
1759
|
};
|
|
1759
1760
|
return {
|
|
1760
1761
|
onSelection: onSelection
|
|
@@ -1772,8 +1773,9 @@ function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.lengt
|
|
|
1772
1773
|
*/
|
|
1773
1774
|
|
|
1774
1775
|
var UIStore = /*#__PURE__*/function () {
|
|
1775
|
-
function UIStore(scene, enableSSAO, _utilStore, uiConfig, requestNewOverlayImage, _overlayImage, onElementCopy, runRenderLoopForTime) {
|
|
1776
|
-
var _this = this
|
|
1776
|
+
function UIStore(scene, enableSSAO, _utilStore, uiConfig, requestNewOverlayImage, _overlayImage, onElementCopy, runRenderLoopForTime, tabgroupTypeActive, isMobile) {
|
|
1777
|
+
var _this = this,
|
|
1778
|
+
_overlayImage$base;
|
|
1777
1779
|
_classCallCheck(this, UIStore);
|
|
1778
1780
|
_defineProperty(this, "_utilStore", void 0);
|
|
1779
1781
|
_defineProperty(this, "_uiConfig", void 0);
|
|
@@ -1801,6 +1803,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1801
1803
|
_defineProperty(this, "_isUnityComb", false);
|
|
1802
1804
|
_defineProperty(this, "_selectedHl", void 0);
|
|
1803
1805
|
_defineProperty(this, "_runRenderLoopForTime", void 0);
|
|
1806
|
+
_defineProperty(this, "_tabgroupTypeActive", void 0);
|
|
1807
|
+
_defineProperty(this, "_isMobile", void 0);
|
|
1804
1808
|
_defineProperty(this, "updateOverlayImage", function (overlayImage) {
|
|
1805
1809
|
var _this$_diffuseTexture, _this$_runRenderLoopF;
|
|
1806
1810
|
if (!overlayImage || !_this._scene || ((_this$_diffuseTexture = _this._diffuseTexture) === null || _this$_diffuseTexture === void 0 ? void 0 : _this$_diffuseTexture.url) == overlayImage.base64) return;
|
|
@@ -1813,26 +1817,32 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1813
1817
|
_this._enableSSAO(false);
|
|
1814
1818
|
_this._plane.setEnabled(false);
|
|
1815
1819
|
_this._diffuseTexture.updateURL(overlayImage.base64, undefined, function () {
|
|
1816
|
-
_this._plane.
|
|
1817
|
-
_this.fadeInOverlayImage(_this._plane.visibility == 1);
|
|
1820
|
+
return _this.fadeInOverlayImage(_this._plane.visibility == 1);
|
|
1818
1821
|
});
|
|
1819
1822
|
(_this$_runRenderLoopF = _this._runRenderLoopForTime) === null || _this$_runRenderLoopF === void 0 || _this$_runRenderLoopF.call(_this, 2000);
|
|
1820
1823
|
});
|
|
1821
1824
|
this._scene = scene;
|
|
1822
|
-
|
|
1825
|
+
this._tabgroupTypeActive = tabgroupTypeActive;
|
|
1826
|
+
this._isMobile = !!isMobile;
|
|
1823
1827
|
var mat = new StandardMaterial('planeMat', scene);
|
|
1824
|
-
this._diffuseTexture = new Texture('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAwAB/ep3wWkAAAAASUVORK5CYII=', scene);
|
|
1828
|
+
this._diffuseTexture = new Texture((_overlayImage$base = _overlayImage === null || _overlayImage === void 0 ? void 0 : _overlayImage.base64) !== null && _overlayImage$base !== void 0 ? _overlayImage$base : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAwAB/ep3wWkAAAAASUVORK5CYII=', scene, false, true);
|
|
1829
|
+
this._diffuseTexture.anisotropicFilteringLevel = 16;
|
|
1830
|
+
this._diffuseTexture.updateSamplingMode(Texture.TRILINEAR_SAMPLINGMODE);
|
|
1831
|
+
mat.bumpTexture = null;
|
|
1825
1832
|
mat.diffuseTexture = this._diffuseTexture;
|
|
1826
1833
|
mat.emissiveTexture = this._diffuseTexture;
|
|
1827
1834
|
mat.specularColor = Color3.Black();
|
|
1835
|
+
|
|
1836
|
+
// Get aspect ratio of the current screen
|
|
1828
1837
|
this._plane = MeshBuilder.CreatePlane('overlayplane', {
|
|
1829
|
-
size:
|
|
1838
|
+
size: 1
|
|
1830
1839
|
}, scene);
|
|
1831
1840
|
this._plane.setEnabled(false);
|
|
1832
1841
|
this._plane.material = mat;
|
|
1833
1842
|
this._plane.visibility = 0;
|
|
1834
|
-
|
|
1835
|
-
|
|
1843
|
+
|
|
1844
|
+
// Position it in front of the camera
|
|
1845
|
+
this._plane.position.z = 0.11;
|
|
1836
1846
|
this._plane.isPickable = false;
|
|
1837
1847
|
this._plane.parent = scene.activeCamera;
|
|
1838
1848
|
this._selectedHl = new HighlightLayer('hl', this._scene);
|
|
@@ -1859,8 +1869,11 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1859
1869
|
}
|
|
1860
1870
|
this._isStaticBg = _overlayImage === null || _overlayImage === void 0 ? void 0 : _overlayImage.isStaticBg;
|
|
1861
1871
|
if (_overlayImage) {
|
|
1872
|
+
if (_overlayImage.base64) {
|
|
1873
|
+
this._plane.setEnabled(true);
|
|
1874
|
+
this.fadeInOverlayImage(false);
|
|
1875
|
+
}
|
|
1862
1876
|
this._isUnityComb = true;
|
|
1863
|
-
this._plane.setEnabled(false);
|
|
1864
1877
|
this._enableSSAO(false);
|
|
1865
1878
|
}
|
|
1866
1879
|
this._runRenderLoopForTime = runRenderLoopForTime;
|
|
@@ -1913,6 +1926,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1913
1926
|
value: function fadeInOverlayImage(shorter) {
|
|
1914
1927
|
var _this3 = this;
|
|
1915
1928
|
var startTime = performance.now();
|
|
1929
|
+
this._plane.setEnabled(true);
|
|
1930
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
1916
1931
|
var _animate = function animate() {
|
|
1917
1932
|
var elapsedTime = performance.now() - startTime;
|
|
1918
1933
|
var progress = Math.min(elapsedTime / (shorter ? 50 : 500), 1); // Normalize progress (0 to 1)
|
|
@@ -1924,12 +1939,14 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1924
1939
|
//animation finished
|
|
1925
1940
|
var root = _this3._scene.getTransformNodeByName('Root');
|
|
1926
1941
|
if (root) root.getChildMeshes().forEach(function (m) {
|
|
1927
|
-
m.visibility =
|
|
1942
|
+
m.visibility = 0;
|
|
1928
1943
|
if (!m.material) return;
|
|
1929
1944
|
m.material.depthFunction = Constants.ALWAYS;
|
|
1930
1945
|
m.material.disableColorWrite = true;
|
|
1931
1946
|
});
|
|
1932
|
-
_this3.
|
|
1947
|
+
_this3._selectedMeshes.forEach(function (m) {
|
|
1948
|
+
return m.visibility = 1;
|
|
1949
|
+
});
|
|
1933
1950
|
}
|
|
1934
1951
|
};
|
|
1935
1952
|
_animate();
|
|
@@ -1950,14 +1967,16 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1950
1967
|
this._utilStore.moveObjectInDirection(guiElem, Vector3.Up(), -localPos.y + 0.05);
|
|
1951
1968
|
if (!onClickDel) return;
|
|
1952
1969
|
var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
|
|
1953
|
-
|
|
1954
|
-
dtarget.
|
|
1970
|
+
var size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '35px';
|
|
1971
|
+
dtarget.width = size;
|
|
1972
|
+
dtarget.height = size;
|
|
1955
1973
|
dtarget.thickness = 1;
|
|
1956
1974
|
dtarget.background = this._colors.defaultBg;
|
|
1957
1975
|
var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
|
|
1958
1976
|
dbt.color = 'transparent';
|
|
1959
|
-
|
|
1960
|
-
dbt.
|
|
1977
|
+
var nSize = this._isMobile ? '28px' : '40px';
|
|
1978
|
+
dbt.width = this._uiConfig.templateConfig == 'standard' ? nSize : '60%';
|
|
1979
|
+
dbt.height = this._uiConfig.templateConfig == 'standard' ? nSize : '70%';
|
|
1961
1980
|
dbt.onPointerClickObservable.add(onClickDel);
|
|
1962
1981
|
dtarget.onPointerEnterObservable = new Observable(function () {
|
|
1963
1982
|
return dtarget.background = _this4._colors.hoverBg;
|
|
@@ -1984,23 +2003,68 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1984
2003
|
}, {
|
|
1985
2004
|
key: "resize",
|
|
1986
2005
|
value: function resize(scene) {
|
|
2006
|
+
if (!scene.activeCamera) return;
|
|
2007
|
+
// if rendering is cached it gets updated before resize is triggered, so check if the image is already correct
|
|
2008
|
+
var size = this._diffuseTexture.getSize();
|
|
2009
|
+
var engine = this._scene.getEngine();
|
|
2010
|
+
if (Math.round(size.width / size.height * 100) / 100 != Math.round(engine.getRenderWidth() / engine.getRenderHeight() * 100) / 100) {
|
|
2011
|
+
this.fadeOutOverlayImage();
|
|
2012
|
+
}
|
|
1987
2013
|
this._gui.dispose();
|
|
1988
2014
|
this._gui = AdvancedDynamicTexture.CreateFullscreenUI('UI', true, scene);
|
|
1989
2015
|
this._gui.renderScale = 1;
|
|
1990
2016
|
if (this._latestViewpoint) this._latestViewpoint.isOutdated = true;
|
|
1991
|
-
var
|
|
1992
|
-
|
|
2017
|
+
var aspectRatio = engine.getRenderWidth() / engine.getRenderHeight();
|
|
2018
|
+
var fov = scene.activeCamera.fov;
|
|
2019
|
+
var planeDepth = 0.11;
|
|
2020
|
+
// Calculate scaling factor based on frustum dimensions at the given depth
|
|
2021
|
+
var heightAtDepth = 2 * Math.tan(fov / 2) * planeDepth;
|
|
2022
|
+
var widthAtDepth = heightAtDepth * aspectRatio;
|
|
2023
|
+
this._plane.scaling = new Vector3(widthAtDepth, heightAtDepth, 1);
|
|
1993
2024
|
}
|
|
1994
2025
|
}, {
|
|
1995
2026
|
key: "addElementsInfo",
|
|
1996
2027
|
value: function addElementsInfo(elementsInfo) {
|
|
1997
2028
|
this._elementsInfo = elementsInfo;
|
|
1998
2029
|
}
|
|
2030
|
+
}, {
|
|
2031
|
+
key: "pointerOverElement",
|
|
2032
|
+
value: function pointerOverElement(element) {
|
|
2033
|
+
var _this$_runRenderLoopF2,
|
|
2034
|
+
_this5 = this;
|
|
2035
|
+
this.unityCombActive && ((_this$_runRenderLoopF2 = this._runRenderLoopForTime) === null || _this$_runRenderLoopF2 === void 0 ? void 0 : _this$_runRenderLoopF2.call(this, 1000));
|
|
2036
|
+
this._selectedHl.removeAllMeshes();
|
|
2037
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
2038
|
+
if (this._plane.visibility == 1) this._selectedMeshes.forEach(function (_m) {
|
|
2039
|
+
return _m.visibility = 0;
|
|
2040
|
+
});
|
|
2041
|
+
element.getChildMeshes().forEach(function (_m) {
|
|
2042
|
+
_m.visibility = 1;
|
|
2043
|
+
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
}, {
|
|
2047
|
+
key: "pointerOutElement",
|
|
2048
|
+
value: function pointerOutElement(element) {
|
|
2049
|
+
var _this$_runRenderLoopF3,
|
|
2050
|
+
_this6 = this;
|
|
2051
|
+
this.unityCombActive && ((_this$_runRenderLoopF3 = this._runRenderLoopForTime) === null || _this$_runRenderLoopF3 === void 0 ? void 0 : _this$_runRenderLoopF3.call(this, 1000));
|
|
2052
|
+
this._selectedHl.removeAllMeshes();
|
|
2053
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
2054
|
+
if (this._plane.visibility == 1) element.getChildMeshes().forEach(function (_m) {
|
|
2055
|
+
return _m.visibility = 0;
|
|
2056
|
+
});
|
|
2057
|
+
this._selectedMeshes.forEach(function (_m) {
|
|
2058
|
+
_m.visibility = 1;
|
|
2059
|
+
_this6._selectedHl.addMesh(_m, Color3.Black());
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
1999
2062
|
}, {
|
|
2000
2063
|
key: "createPosNr",
|
|
2001
2064
|
value: function createPosNr(elementInfo, element, isBoxPlanner, elementLength) {
|
|
2002
|
-
var
|
|
2003
|
-
|
|
2065
|
+
var _this$_elementsInfo,
|
|
2066
|
+
_this7 = this,
|
|
2067
|
+
_this$_tabgroupTypeAc;
|
|
2004
2068
|
var guiElem = {
|
|
2005
2069
|
elementId: elementInfo.elementId,
|
|
2006
2070
|
elements: []
|
|
@@ -2008,7 +2072,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2008
2072
|
var bbox = element.getHierarchyBoundingVectors();
|
|
2009
2073
|
var guiElemLeftBack = null;
|
|
2010
2074
|
var guiElemRightBack = null;
|
|
2011
|
-
if (!isBoxPlanner) {
|
|
2075
|
+
if (!isBoxPlanner && elementInfo.selectable) {
|
|
2012
2076
|
guiElemLeftBack = new TransformNode('guiElem_' + elementInfo.elementId, this._scene);
|
|
2013
2077
|
guiElemLeftBack.position = new Vector3(element.absolutePosition.x, bbox.min.y + (bbox.max.y - bbox.min.y), element.absolutePosition.z);
|
|
2014
2078
|
guiElem.elements.push(guiElemLeftBack);
|
|
@@ -2021,8 +2085,9 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2021
2085
|
var target = this._uiConfig.templateConfig == 'standard' ? new Ellipse('posnrEllipse') : new Rectangle('posnrRectangle');
|
|
2022
2086
|
if (this._uiConfig.templateConfig == 'gold') target.cornerRadius = 3;
|
|
2023
2087
|
guiElem.elements.push(target);
|
|
2024
|
-
|
|
2025
|
-
target.
|
|
2088
|
+
var size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '20px';
|
|
2089
|
+
target.width = size;
|
|
2090
|
+
target.height = size;
|
|
2026
2091
|
target.fontSize = this._uiConfig.templateConfig == 'standard' ? 50 : 20;
|
|
2027
2092
|
target.background = this._colors.defaultBg;
|
|
2028
2093
|
target.thickness = 0;
|
|
@@ -2045,9 +2110,14 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2045
2110
|
guiElemRightBack.position = _pos;
|
|
2046
2111
|
}
|
|
2047
2112
|
var childMeshes = element.getChildMeshes();
|
|
2113
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
2114
|
+
var cantSelect = (_this$_elementsInfo = this._elementsInfo) === null || _this$_elementsInfo === void 0 ? void 0 : _this$_elementsInfo.every(function (ei) {
|
|
2115
|
+
return ei.active;
|
|
2116
|
+
});
|
|
2048
2117
|
childMeshes.forEach(function (m) {
|
|
2049
2118
|
if (!m.material) return;
|
|
2050
|
-
if (
|
|
2119
|
+
if (_this7._plane.visibility == 1) {
|
|
2120
|
+
m.visibility = 0;
|
|
2051
2121
|
m.material.depthFunction = Constants.ALWAYS;
|
|
2052
2122
|
m.material.disableColorWrite = true;
|
|
2053
2123
|
} else {
|
|
@@ -2055,68 +2125,48 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2055
2125
|
m.material.depthFunction = Constants.LEQUAL;
|
|
2056
2126
|
m.material.disableColorWrite = false;
|
|
2057
2127
|
}
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
childMeshes.forEach(function (m) {
|
|
2064
|
-
if (_this5._plane.visibility == 1) m.visibility = 0;
|
|
2065
|
-
if (!m.actionManager) m.actionManager = new ActionManager(_this5._scene);
|
|
2066
|
-
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function (ev) {
|
|
2067
|
-
var _this5$_runRenderLoop;
|
|
2068
|
-
if (everyElementIsSelected) return;
|
|
2069
|
-
_this5.unityCombActive && ((_this5$_runRenderLoop = _this5._runRenderLoopForTime) === null || _this5$_runRenderLoop === void 0 ? void 0 : _this5$_runRenderLoop.call(_this5, 1000));
|
|
2070
|
-
_this5._selectedHl.removeAllMeshes();
|
|
2071
|
-
if (_this5._plane.visibility == 1) _this5._selectedMeshes.forEach(function (_m) {
|
|
2072
|
-
return _m.visibility = 0;
|
|
2073
|
-
});
|
|
2074
|
-
element.getChildMeshes().forEach(function (_m) {
|
|
2075
|
-
_m.visibility = 1;
|
|
2076
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2077
|
-
});
|
|
2128
|
+
if (elementInfo.active) m.visibility = 1;
|
|
2129
|
+
if (!cantSelect && !elementInfo.active && elementInfo.selectable) {
|
|
2130
|
+
if (!m.actionManager) m.actionManager = new ActionManager(_this7._scene);
|
|
2131
|
+
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function () {
|
|
2132
|
+
return _this7.pointerOverElement(element);
|
|
2078
2133
|
}));
|
|
2079
|
-
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function (
|
|
2080
|
-
|
|
2081
|
-
if (everyElementIsSelected) return;
|
|
2082
|
-
_this5.unityCombActive && ((_this5$_runRenderLoop2 = _this5._runRenderLoopForTime) === null || _this5$_runRenderLoop2 === void 0 ? void 0 : _this5$_runRenderLoop2.call(_this5, 1000));
|
|
2083
|
-
_this5._selectedHl.removeAllMeshes();
|
|
2084
|
-
if (_this5._plane.visibility == 1) element.getChildMeshes().forEach(function (_m) {
|
|
2085
|
-
return _m.visibility = 0;
|
|
2086
|
-
});
|
|
2087
|
-
_this5._selectedMeshes.forEach(function (_m) {
|
|
2088
|
-
_m.visibility = 1;
|
|
2089
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2090
|
-
});
|
|
2134
|
+
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function () {
|
|
2135
|
+
return _this7.pointerOutElement(element);
|
|
2091
2136
|
}));
|
|
2092
|
-
})
|
|
2093
|
-
|
|
2137
|
+
} else if (!cantSelect && elementInfo.active) {
|
|
2138
|
+
var _m$actionManager;
|
|
2139
|
+
_this7._selectedMeshes = [].concat(_toConsumableArray(_this7._selectedMeshes), _toConsumableArray(childMeshes));
|
|
2140
|
+
_this7._selectedHl.addMesh(m, Color3.Black());
|
|
2141
|
+
(_m$actionManager = m.actionManager) === null || _m$actionManager === void 0 || _m$actionManager.dispose();
|
|
2142
|
+
} else {
|
|
2143
|
+
var _m$actionManager2;
|
|
2144
|
+
(_m$actionManager2 = m.actionManager) === null || _m$actionManager2 === void 0 || _m$actionManager2.dispose();
|
|
2145
|
+
}
|
|
2146
|
+
});
|
|
2147
|
+
if ((_this$_tabgroupTypeAc = this._tabgroupTypeActive) !== null && _this$_tabgroupTypeAc !== void 0 && _this$_tabgroupTypeAc.call(this, 'PLANNER') && elementInfo.active) {
|
|
2094
2148
|
var _guiElemRightBack;
|
|
2095
|
-
this._selectedMeshes = childMeshes;
|
|
2096
|
-
if (elementLength > 1 && !everyElementIsSelected) this._selectedMeshes.forEach(function (_m) {
|
|
2097
|
-
_m.visibility = 1;
|
|
2098
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2099
|
-
});
|
|
2100
2149
|
var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
|
|
2101
2150
|
guiElem.elements.push(dtarget);
|
|
2102
|
-
|
|
2103
|
-
dtarget.
|
|
2151
|
+
var _size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '35px';
|
|
2152
|
+
dtarget.width = _size;
|
|
2153
|
+
dtarget.height = _size;
|
|
2104
2154
|
dtarget.thickness = 1;
|
|
2105
2155
|
dtarget.background = this._colors.defaultBg;
|
|
2106
2156
|
var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
|
|
2107
2157
|
guiElem.elements.push(dbt);
|
|
2108
2158
|
dbt.color = 'transparent';
|
|
2109
|
-
|
|
2110
|
-
dbt.
|
|
2159
|
+
var nSize = this._isMobile ? '20px' : '40px';
|
|
2160
|
+
dbt.width = this._uiConfig.templateConfig == 'standard' ? nSize : '60%';
|
|
2161
|
+
dbt.height = this._uiConfig.templateConfig == 'standard' ? nSize : '70%';
|
|
2111
2162
|
dbt.onPointerClickObservable.add(function () {
|
|
2112
|
-
return
|
|
2163
|
+
return _this7._utilStore.onElementDeleted(elementInfo.setId, elementInfo.elementId);
|
|
2113
2164
|
});
|
|
2114
|
-
if (this._uiConfig.templateConfig == 'standard' && !guiElemRightBack) dtarget.linkOffsetY = -48;
|
|
2165
|
+
if (this._uiConfig.templateConfig == 'standard' && !guiElemRightBack) dtarget.linkOffsetY = !this._isMobile ? -48 : -30;
|
|
2115
2166
|
dtarget.addControl(dbt);
|
|
2116
2167
|
this._gui.addControl(dtarget);
|
|
2117
2168
|
dtarget.linkWithMesh((_guiElemRightBack = guiElemRightBack) !== null && _guiElemRightBack !== void 0 ? _guiElemRightBack : guiElemLeftBack);
|
|
2118
2169
|
}
|
|
2119
|
-
this._selectedHl.addExcludedMesh(this._plane);
|
|
2120
2170
|
this._guiElements.push(guiElem);
|
|
2121
2171
|
}
|
|
2122
2172
|
}, {
|
|
@@ -2124,7 +2174,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2124
2174
|
value: function createBoxCopyButtons(elementInfo, element) {
|
|
2125
2175
|
var _this$_scene$activeCa,
|
|
2126
2176
|
_this$_scene$activeCa2,
|
|
2127
|
-
|
|
2177
|
+
_this8 = this,
|
|
2128
2178
|
_this$_scene$activeCa3;
|
|
2129
2179
|
var guiElem = {
|
|
2130
2180
|
elementId: elementInfo.elementId,
|
|
@@ -2150,8 +2200,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2150
2200
|
target.rotation = 0;
|
|
2151
2201
|
}
|
|
2152
2202
|
(_this$_scene$activeCa2 = this._scene.activeCamera) === null || _this$_scene$activeCa2 === void 0 || _this$_scene$activeCa2.onViewMatrixChangedObservable.add(function () {
|
|
2153
|
-
var
|
|
2154
|
-
var _dir = (
|
|
2203
|
+
var _this8$_scene$activeC;
|
|
2204
|
+
var _dir = (_this8$_scene$activeC = _this8._scene.activeCamera) === null || _this8$_scene$activeC === void 0 ? void 0 : _this8$_scene$activeC.getDirection(Axis.Z);
|
|
2155
2205
|
if (_dir.z > 0) {
|
|
2156
2206
|
target.rotation = 180 * Math.PI / 180;
|
|
2157
2207
|
} else {
|
|
@@ -2159,8 +2209,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2159
2209
|
}
|
|
2160
2210
|
});
|
|
2161
2211
|
target.onPointerClickObservable.add(function () {
|
|
2162
|
-
var
|
|
2163
|
-
return (
|
|
2212
|
+
var _this8$_onElementCopy;
|
|
2213
|
+
return (_this8$_onElementCopy = _this8._onElementCopy) === null || _this8$_onElementCopy === void 0 ? void 0 : _this8$_onElementCopy.call(_this8, elementInfo.setId, elementInfo.elementId, 'LEFT');
|
|
2164
2214
|
});
|
|
2165
2215
|
break;
|
|
2166
2216
|
case 'BoxCopyRight':
|
|
@@ -2173,8 +2223,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2173
2223
|
guiElement.position = element.absolutePosition.add(new Vector3(-(bbox.max.x - bbox.min.x), (bbox.max.y - bbox.min.y) / 2, bbox.max.z - bbox.min.z));
|
|
2174
2224
|
guiElement.rotation = new Vector3(90 * Math.PI / 180, 0, 0);
|
|
2175
2225
|
(_this$_scene$activeCa3 = this._scene.activeCamera) === null || _this$_scene$activeCa3 === void 0 || _this$_scene$activeCa3.onViewMatrixChangedObservable.add(function () {
|
|
2176
|
-
var
|
|
2177
|
-
var _dir = (
|
|
2226
|
+
var _this8$_scene$activeC2;
|
|
2227
|
+
var _dir = (_this8$_scene$activeC2 = _this8._scene.activeCamera) === null || _this8$_scene$activeC2 === void 0 ? void 0 : _this8$_scene$activeC2.getDirection(Axis.Z);
|
|
2178
2228
|
if (_dir.z < 0) {
|
|
2179
2229
|
target.rotation = 180 * Math.PI / 180;
|
|
2180
2230
|
} else {
|
|
@@ -2182,16 +2232,16 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2182
2232
|
}
|
|
2183
2233
|
});
|
|
2184
2234
|
target.onPointerClickObservable.add(function () {
|
|
2185
|
-
var
|
|
2186
|
-
return (
|
|
2235
|
+
var _this8$_onElementCopy2;
|
|
2236
|
+
return (_this8$_onElementCopy2 = _this8._onElementCopy) === null || _this8$_onElementCopy2 === void 0 ? void 0 : _this8$_onElementCopy2.call(_this8, elementInfo.setId, elementInfo.elementId, 'RIGHT');
|
|
2187
2237
|
});
|
|
2188
2238
|
break;
|
|
2189
2239
|
case 'BoxCopyTop':
|
|
2190
2240
|
target.rotation = 90 * Math.PI / 180;
|
|
2191
2241
|
guiElement.position = element.absolutePosition.add(new Vector3(-(bbox.max.x - bbox.min.x) / 2, bbox.max.y - bbox.min.y, bbox.max.z - bbox.min.z));
|
|
2192
2242
|
target.onPointerClickObservable.add(function () {
|
|
2193
|
-
var
|
|
2194
|
-
return (
|
|
2243
|
+
var _this8$_onElementCopy3;
|
|
2244
|
+
return (_this8$_onElementCopy3 = _this8._onElementCopy) === null || _this8$_onElementCopy3 === void 0 ? void 0 : _this8$_onElementCopy3.call(_this8, elementInfo.setId, elementInfo.elementId, 'TOP');
|
|
2195
2245
|
});
|
|
2196
2246
|
break;
|
|
2197
2247
|
}
|
|
@@ -2202,7 +2252,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2202
2252
|
}, {
|
|
2203
2253
|
key: "initGui",
|
|
2204
2254
|
value: function initGui(onElSelected, elements) {
|
|
2205
|
-
var
|
|
2255
|
+
var _this9 = this;
|
|
2206
2256
|
if (!this._selectionHandler) this.initSelectionHandler(onElSelected);
|
|
2207
2257
|
if (!this._scene) return;
|
|
2208
2258
|
if (!this._elementsInfo) return;
|
|
@@ -2214,20 +2264,28 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2214
2264
|
var isBoxPlanner = !this._elementsInfo.every(function (v) {
|
|
2215
2265
|
return v.type == 'PosNr';
|
|
2216
2266
|
});
|
|
2267
|
+
this._selectedHl.removeAllMeshes();
|
|
2268
|
+
this._selectedMeshes = [];
|
|
2217
2269
|
this._elementsInfo.forEach(function (elementInfo) {
|
|
2218
2270
|
var emnt = elements.find(function (el) {
|
|
2219
2271
|
return Number(el.bbn.name.slice(el.bbn.name.lastIndexOf('E') + 1, el.bbn.name.length)) == elementInfo.elementId;
|
|
2220
2272
|
});
|
|
2221
2273
|
if (!emnt) return;
|
|
2222
|
-
var element =
|
|
2274
|
+
var element = _this9._scene.getTransformNodeByName(emnt.bbn.name);
|
|
2223
2275
|
if (!element) return;
|
|
2224
|
-
if (elementInfo.type == 'PosNr')
|
|
2276
|
+
if (elementInfo.type == 'PosNr') _this9.createPosNr(elementInfo, element, isBoxPlanner, elements.length);else _this9.createBoxCopyButtons(elementInfo, element);
|
|
2225
2277
|
});
|
|
2226
2278
|
}
|
|
2227
2279
|
}, {
|
|
2228
2280
|
key: "selectElem",
|
|
2229
|
-
value: function selectElem(name) {
|
|
2230
|
-
var
|
|
2281
|
+
value: function selectElem(name, element, onElSelected) {
|
|
2282
|
+
var _this$_elementsInfo2,
|
|
2283
|
+
_this10 = this;
|
|
2284
|
+
var elementInfo = (_this$_elementsInfo2 = this._elementsInfo) === null || _this$_elementsInfo2 === void 0 ? void 0 : _this$_elementsInfo2.find(function (ef) {
|
|
2285
|
+
return ef.elementId.toString() == name;
|
|
2286
|
+
});
|
|
2287
|
+
if (!(elementInfo !== null && elementInfo !== void 0 && elementInfo.selectable) || elementInfo.active) return;
|
|
2288
|
+
this._selectedMeshes = element.getChildMeshes();
|
|
2231
2289
|
var _iterator = _createForOfIteratorHelper$5(this._gui.getControlsByType('ellipse')),
|
|
2232
2290
|
_step;
|
|
2233
2291
|
try {
|
|
@@ -2243,13 +2301,14 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2243
2301
|
this._guiElements.forEach(function (guiElem) {
|
|
2244
2302
|
return guiElem.elements.forEach(function (element) {
|
|
2245
2303
|
if (element.typeName == 'label') element.color = 'Black';
|
|
2246
|
-
if (element.typeName == 'Ellipse') element.color =
|
|
2304
|
+
if (element.typeName == 'Ellipse') element.color = _this10._colors.defaultBg;
|
|
2247
2305
|
if (guiElem.elementId.toString() == name) {
|
|
2248
|
-
if (element.typeName == 'label') element.color =
|
|
2306
|
+
if (element.typeName == 'label') element.color = _this10._colors.selectedBg;
|
|
2249
2307
|
if (element.typeName == 'Ellipse') element.color = 'White';
|
|
2250
2308
|
}
|
|
2251
2309
|
});
|
|
2252
2310
|
});
|
|
2311
|
+
onElSelected === null || onElSelected === void 0 || onElSelected(element.parent.name, Number(name));
|
|
2253
2312
|
}
|
|
2254
2313
|
}, {
|
|
2255
2314
|
key: "deactivateHighlightLayer",
|
|
@@ -2287,8 +2346,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2287
2346
|
}
|
|
2288
2347
|
}, {
|
|
2289
2348
|
key: "requestNewOverlayImage",
|
|
2290
|
-
value: function requestNewOverlayImage(viewpoint, focusedElement, targetCameraPosition) {
|
|
2291
|
-
var
|
|
2349
|
+
value: function requestNewOverlayImage(viewpoint, focusedElement, targetCameraPosition, updateCameraInformation) {
|
|
2350
|
+
var _this11 = this;
|
|
2292
2351
|
//this._overlayImage exists only when unity combi is enabled
|
|
2293
2352
|
if (!this._isUnityComb) return;
|
|
2294
2353
|
var elementId = undefined;
|
|
@@ -2304,17 +2363,18 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2304
2363
|
clearTimeout(this._timeoutId);
|
|
2305
2364
|
if (!this._latestViewpoint || this._latestViewpoint.isOutdated || Math.abs(this._latestViewpoint.pos.x - viewpoint.pos.x) > 0.05 || Math.abs(this._latestViewpoint.pos.y - viewpoint.pos.y) > 0.05 || Math.abs(this._latestViewpoint.pos.z - viewpoint.pos.z) > 0.05 || Math.abs(this._latestViewpoint.rot.x - viewpoint.rot.x) > 0.05 || Math.abs(this._latestViewpoint.rot.y - viewpoint.rot.y) > 0.05 || Math.abs(this._latestViewpoint.rot.z - viewpoint.rot.z) > 0.05) {
|
|
2306
2365
|
this._timeoutId = setTimeout(function () {
|
|
2307
|
-
var
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2366
|
+
var _this11$_requestNewOv;
|
|
2367
|
+
_this11._latestViewpoint = viewpoint;
|
|
2368
|
+
_this11._utilStore.addOutstandingImageCount();
|
|
2369
|
+
_this11._utilStore.updateCam = true;
|
|
2370
|
+
updateCameraInformation === null || updateCameraInformation === void 0 || updateCameraInformation(viewpoint);
|
|
2371
|
+
(_this11$_requestNewOv = _this11._requestNewOverlayImage) === null || _this11$_requestNewOv === void 0 || _this11$_requestNewOv.call(_this11, viewpoint, {
|
|
2311
2372
|
adjustZoomInUnity: false,
|
|
2312
2373
|
onlyAdjustZoomBBChanged: false,
|
|
2313
2374
|
rotationCenter: viewpoint.targetPos,
|
|
2314
2375
|
elementId: elementId,
|
|
2315
2376
|
setId: setId
|
|
2316
2377
|
});
|
|
2317
|
-
_this9._utilStore.updateCam = true;
|
|
2318
2378
|
}, 200);
|
|
2319
2379
|
} else {
|
|
2320
2380
|
this.fadeInOverlayImage(false);
|
|
@@ -2548,10 +2608,10 @@ var _context;
|
|
|
2548
2608
|
var unregisterContext = function unregisterContext() {
|
|
2549
2609
|
_context = undefined;
|
|
2550
2610
|
};
|
|
2551
|
-
var registerContext = function registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation) {
|
|
2611
|
+
var registerContext = function registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation, isMobile) {
|
|
2552
2612
|
var utilStore = new UtilStore(false, viewHandler);
|
|
2553
2613
|
var sceneStore = new SceneStore(scene, hqRenderScript, utilStore, apiConfig, jwt, onMissingGeo, updateCameraInformation);
|
|
2554
|
-
var uiStore = new UIStore(scene, sceneStore.enableSSAO.bind(sceneStore), utilStore, uiConfig, requestNewOverlayImage, overlayImage, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.viewPlannerHandler.onElementCopy, sceneStore.runRenderLoopForTime.bind(sceneStore));
|
|
2614
|
+
var uiStore = new UIStore(scene, sceneStore.enableSSAO.bind(sceneStore), utilStore, uiConfig, requestNewOverlayImage, overlayImage, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.viewPlannerHandler.onElementCopy, sceneStore.runRenderLoopForTime.bind(sceneStore), viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.tabgroupTypeActive, isMobile);
|
|
2555
2615
|
return _context = {
|
|
2556
2616
|
utilStore: utilStore,
|
|
2557
2617
|
sceneStore: sceneStore,
|
|
@@ -3505,7 +3565,7 @@ function shadow() {
|
|
|
3505
3565
|
var lightf = new DirectionalLight('dirf', new Vector3(0, -0.436, -0.9), scene);
|
|
3506
3566
|
var lightr = new DirectionalLight('dirr', new Vector3(0, -1, 0.3), scene);
|
|
3507
3567
|
var lightl = new DirectionalLight('dirb', new Vector3(0.2, -1, 0.2), scene);
|
|
3508
|
-
lightl.intensity =
|
|
3568
|
+
lightl.intensity = 1;
|
|
3509
3569
|
lightf.intensity = 2.2;
|
|
3510
3570
|
light.intensity = 1;
|
|
3511
3571
|
lightr.intensity = 1;
|
|
@@ -3579,16 +3639,15 @@ var parser = /*#__PURE__*/function () {
|
|
|
3579
3639
|
parentNode: parent
|
|
3580
3640
|
});
|
|
3581
3641
|
findMaterials(newCache);
|
|
3582
|
-
shadow();
|
|
3583
3642
|
});
|
|
3584
3643
|
} else if (!hasRendered) {
|
|
3644
|
+
shadow();
|
|
3585
3645
|
buildScene({
|
|
3586
3646
|
startNode: hqRenderScript.scene.nodes[0],
|
|
3587
3647
|
cache: cacheGroup,
|
|
3588
3648
|
cachedAssets: newCache
|
|
3589
3649
|
});
|
|
3590
3650
|
findMaterials(newCache);
|
|
3591
|
-
shadow();
|
|
3592
3651
|
}
|
|
3593
3652
|
utilStore.setRTVAnalyzeData();
|
|
3594
3653
|
deacCache(cacheGroup);
|
|
@@ -3606,7 +3665,7 @@ var parser = /*#__PURE__*/function () {
|
|
|
3606
3665
|
|
|
3607
3666
|
var LOG = getLogger('ARViewer', 'RealTimeRenderData');
|
|
3608
3667
|
function useRealTimeRenderData (_ref) {
|
|
3609
|
-
var
|
|
3668
|
+
var _sceneStore3;
|
|
3610
3669
|
var jwt = _ref.jwt,
|
|
3611
3670
|
actions = _ref.actions,
|
|
3612
3671
|
apiConfig = _ref.apiConfig,
|
|
@@ -3621,10 +3680,11 @@ function useRealTimeRenderData (_ref) {
|
|
|
3621
3680
|
plannedPlacesOnGrids = _ref.plannedPlacesOnGrids,
|
|
3622
3681
|
callbacks = _ref.callbacks,
|
|
3623
3682
|
uiConfig = _ref.uiConfig,
|
|
3624
|
-
renderInBackground = _ref.renderInBackground
|
|
3683
|
+
renderInBackground = _ref.renderInBackground,
|
|
3684
|
+
isMobile = _ref.isMobile;
|
|
3625
3685
|
var gameCanvas = useRef(null);
|
|
3626
3686
|
var sceneStore = useSceneStoreContext();
|
|
3627
|
-
useUtilStoreContext();
|
|
3687
|
+
var utilStore = useUtilStoreContext();
|
|
3628
3688
|
var gridStore = useGridStoreContext();
|
|
3629
3689
|
var uiStore = useUIStoreContext();
|
|
3630
3690
|
DracoCompression.Configuration = {
|
|
@@ -3665,47 +3725,48 @@ function useRealTimeRenderData (_ref) {
|
|
|
3665
3725
|
sceneStore.isInitializing = true;
|
|
3666
3726
|
if (!overlayImage) actions.toggleLoading('buildScene', false, true);
|
|
3667
3727
|
if (sceneStore.hasRendered) {
|
|
3668
|
-
_context2.next =
|
|
3728
|
+
_context2.next = 10;
|
|
3669
3729
|
break;
|
|
3670
3730
|
}
|
|
3671
3731
|
if (inBackground) sceneStore.scene.getEngine().setHardwareScalingLevel(5);
|
|
3672
3732
|
sceneStore.init(apiConfig.diva3darchive + '/', gameCanvas.current, viewpoint, resolution);
|
|
3673
|
-
|
|
3733
|
+
uiStore.resize(sceneStore.scene);
|
|
3734
|
+
_context2.next = 15;
|
|
3674
3735
|
break;
|
|
3675
|
-
case
|
|
3736
|
+
case 10:
|
|
3676
3737
|
sceneStore.hqRenderScript = JSON.parse(renderjob);
|
|
3677
3738
|
if (checkCachedData()) {
|
|
3678
|
-
_context2.next =
|
|
3739
|
+
_context2.next = 15;
|
|
3679
3740
|
break;
|
|
3680
3741
|
}
|
|
3681
3742
|
if (!overlayImage) actions.toggleLoading('buildScene', false, false);
|
|
3682
3743
|
sceneStore.isInitializing = false;
|
|
3683
3744
|
return _context2.abrupt("return");
|
|
3684
|
-
case
|
|
3745
|
+
case 15:
|
|
3685
3746
|
LOG.startTransaction({
|
|
3686
3747
|
event: 'buildScene',
|
|
3687
3748
|
message: 'Start Building Realtime Scene',
|
|
3688
3749
|
eventId: 'BUILD_SCENE'
|
|
3689
3750
|
});
|
|
3690
|
-
_context2.prev =
|
|
3751
|
+
_context2.prev = 16;
|
|
3691
3752
|
uiStore.deactivateHighlightLayer();
|
|
3692
|
-
_context2.next =
|
|
3753
|
+
_context2.next = 20;
|
|
3693
3754
|
return parser();
|
|
3694
|
-
case
|
|
3755
|
+
case 20:
|
|
3695
3756
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
3696
3757
|
if (freePlacesOnGrids || plannedPlacesOnGrids) gridStore.getGrids(freePlacesOnGrids, plannedPlacesOnGrids);
|
|
3697
|
-
_context2.next =
|
|
3758
|
+
_context2.next = 29;
|
|
3698
3759
|
break;
|
|
3699
|
-
case
|
|
3700
|
-
_context2.prev =
|
|
3701
|
-
_context2.t0 = _context2["catch"](
|
|
3760
|
+
case 24:
|
|
3761
|
+
_context2.prev = 24;
|
|
3762
|
+
_context2.t0 = _context2["catch"](16);
|
|
3702
3763
|
LOG.errorTransaction('BUILD_SCENE', 'RTS_0001', _context2.t0.message);
|
|
3703
3764
|
LOG.error(new DivaError('Error building scene', {
|
|
3704
3765
|
cause: _context2.t0,
|
|
3705
3766
|
code: 'RTS_0001'
|
|
3706
3767
|
}));
|
|
3707
3768
|
sceneStore.isInitializing = false;
|
|
3708
|
-
case
|
|
3769
|
+
case 29:
|
|
3709
3770
|
if (callbacks.setGlb) {
|
|
3710
3771
|
sceneStore.exportScene().then(function (res) {
|
|
3711
3772
|
var _callbacks$setGlb;
|
|
@@ -3720,11 +3781,11 @@ function useRealTimeRenderData (_ref) {
|
|
|
3720
3781
|
sceneStore.runRenderLoopIndefinitely();
|
|
3721
3782
|
sceneStore.scene.onAfterRenderObservable.add(onFirstFrame);
|
|
3722
3783
|
LOG.successTransaction('BUILD_SCENE');
|
|
3723
|
-
case
|
|
3784
|
+
case 34:
|
|
3724
3785
|
case "end":
|
|
3725
3786
|
return _context2.stop();
|
|
3726
3787
|
}
|
|
3727
|
-
}, _callee2, null, [[
|
|
3788
|
+
}, _callee2, null, [[16, 24]]);
|
|
3728
3789
|
}));
|
|
3729
3790
|
return _onSceneReady.apply(this, arguments);
|
|
3730
3791
|
}
|
|
@@ -3741,7 +3802,7 @@ function useRealTimeRenderData (_ref) {
|
|
|
3741
3802
|
}
|
|
3742
3803
|
|
|
3743
3804
|
// trigger if gamecanvas did not update but renderjob
|
|
3744
|
-
if (gameCanvas.current && sceneStore && sceneStore.scene) {
|
|
3805
|
+
if (gameCanvas.current && sceneStore && sceneStore.scene.getEngine()) {
|
|
3745
3806
|
var _queueRerender = function queueRerender() {
|
|
3746
3807
|
if (sceneStore.isInitializing) setTimeout(_queueRerender, 150);else {
|
|
3747
3808
|
if (sceneStore.scene.isReady()) onSceneReady();else sceneStore.scene.executeWhenReady(function () {
|
|
@@ -3752,38 +3813,42 @@ function useRealTimeRenderData (_ref) {
|
|
|
3752
3813
|
_queueRerender();
|
|
3753
3814
|
}
|
|
3754
3815
|
useEffect(function () {
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3816
|
+
var babylonScene = undefined;
|
|
3817
|
+
var babylonEngine = undefined;
|
|
3818
|
+
function init() {
|
|
3819
|
+
return _init.apply(this, arguments);
|
|
3820
|
+
}
|
|
3821
|
+
function _init() {
|
|
3822
|
+
_init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3823
|
+
var context;
|
|
3761
3824
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3762
3825
|
while (1) switch (_context.prev = _context.next) {
|
|
3763
3826
|
case 0:
|
|
3764
|
-
if (
|
|
3765
|
-
_context.next =
|
|
3827
|
+
if (gameCanvas.current) {
|
|
3828
|
+
_context.next = 2;
|
|
3766
3829
|
break;
|
|
3767
3830
|
}
|
|
3768
|
-
_context.
|
|
3831
|
+
return _context.abrupt("return");
|
|
3832
|
+
case 2:
|
|
3833
|
+
_context.next = 4;
|
|
3769
3834
|
return EngineFactory.CreateAsync(gameCanvas.current, {
|
|
3770
3835
|
antialias: true,
|
|
3771
3836
|
stencil: true,
|
|
3772
|
-
audioEngine: false
|
|
3837
|
+
audioEngine: false,
|
|
3838
|
+
adaptToDeviceRatio: true
|
|
3773
3839
|
});
|
|
3774
|
-
case
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
context = registerContext(
|
|
3840
|
+
case 4:
|
|
3841
|
+
babylonEngine = _context.sent;
|
|
3842
|
+
babylonEngine.renderEvenInBackground = renderInBackground;
|
|
3843
|
+
babylonEngine.disablePerformanceMonitorInBackground = true;
|
|
3844
|
+
babylonScene = new Scene(babylonEngine, undefined);
|
|
3845
|
+
babylonScene.clearColor = new Color4(255, 255, 255, 255);
|
|
3846
|
+
context = registerContext(babylonScene, renderjob, apiConfig, jwt, viewHandler, callbacks.onMissingGeo, callbacks.requestNewOverlayImage, overlayImage, uiConfig, callbacks.updateCameraInformation, !!isMobile);
|
|
3781
3847
|
sceneStore = context.sceneStore;
|
|
3782
|
-
context.utilStore;
|
|
3848
|
+
utilStore = context.utilStore;
|
|
3783
3849
|
gridStore = context.gridStore;
|
|
3784
3850
|
uiStore = context.uiStore;
|
|
3785
|
-
|
|
3786
|
-
if (!bScene.isReady()) {
|
|
3851
|
+
if (!babylonScene.isReady()) {
|
|
3787
3852
|
_context.next = 19;
|
|
3788
3853
|
break;
|
|
3789
3854
|
}
|
|
@@ -3793,57 +3858,58 @@ function useRealTimeRenderData (_ref) {
|
|
|
3793
3858
|
_context.next = 20;
|
|
3794
3859
|
break;
|
|
3795
3860
|
case 19:
|
|
3796
|
-
|
|
3861
|
+
babylonScene.executeWhenReady(function () {
|
|
3797
3862
|
return onSceneReady();
|
|
3798
3863
|
});
|
|
3799
3864
|
case 20:
|
|
3800
|
-
resize = function resize() {
|
|
3801
|
-
if (inBackground || !scene || !scene.getEngine()) return;
|
|
3802
|
-
if (sceneStore.hasPlanned) sceneStore.doRenderControlLoop = true;
|
|
3803
|
-
scene.getEngine().resize(true);
|
|
3804
|
-
if (uiStore) uiStore.resize(scene);
|
|
3805
|
-
};
|
|
3806
3865
|
if (window && gameCanvas.current) {
|
|
3807
3866
|
window.addEventListener('resize', resize);
|
|
3808
3867
|
new ResizeObserver(resize).observe(gameCanvas.current);
|
|
3809
3868
|
}
|
|
3810
|
-
|
|
3811
|
-
scene.getEngine().dispose();
|
|
3812
|
-
if (window) {
|
|
3813
|
-
window.removeEventListener('resize', resize);
|
|
3814
|
-
}
|
|
3815
|
-
});
|
|
3816
|
-
case 23:
|
|
3817
|
-
return _context.abrupt("return");
|
|
3818
|
-
case 24:
|
|
3869
|
+
case 21:
|
|
3819
3870
|
case "end":
|
|
3820
3871
|
return _context.stop();
|
|
3821
3872
|
}
|
|
3822
3873
|
}, _callee);
|
|
3823
3874
|
}));
|
|
3824
|
-
return
|
|
3875
|
+
return _init.apply(this, arguments);
|
|
3825
3876
|
}
|
|
3826
|
-
|
|
3827
|
-
|
|
3877
|
+
var resize = function resize() {
|
|
3878
|
+
var _sceneStore2;
|
|
3879
|
+
if (inBackground || !((_sceneStore2 = sceneStore) !== null && _sceneStore2 !== void 0 && _sceneStore2.scene) || !sceneStore.scene.getEngine() || !sceneStore.scene.isReady()) return;
|
|
3880
|
+
sceneStore.runRenderLoopIndefinitely();
|
|
3881
|
+
sceneStore.scene.getEngine().resize(true);
|
|
3882
|
+
uiStore.resize(sceneStore.scene);
|
|
3883
|
+
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
3884
|
+
};
|
|
3885
|
+
init();
|
|
3886
|
+
return function () {
|
|
3887
|
+
if (babylonEngine || babylonScene) {
|
|
3888
|
+
unregisterContext();
|
|
3889
|
+
sceneStore.scene.dispose();
|
|
3890
|
+
if (window) {
|
|
3891
|
+
window.removeEventListener('resize', resize);
|
|
3892
|
+
}
|
|
3893
|
+
}
|
|
3894
|
+
};
|
|
3828
3895
|
}, []);
|
|
3829
3896
|
useEffect(function () {
|
|
3830
|
-
if (overlayImage && uiStore) {
|
|
3897
|
+
if (overlayImage && uiStore && gameCanvas.current && sceneStore && sceneStore.scene.getEngine()) {
|
|
3898
|
+
if (!utilStore.updateCam) return;
|
|
3899
|
+
sceneStore.runRenderLoopForTime(1000);
|
|
3831
3900
|
uiStore.updateOverlayImage(overlayImage);
|
|
3832
3901
|
if (viewpoint) updateCam(viewpoint, sceneStore.scene);
|
|
3833
3902
|
}
|
|
3834
3903
|
}, [overlayImage]);
|
|
3835
3904
|
useEffect(function () {
|
|
3836
|
-
if (sceneStore && elementsInfo) {
|
|
3837
|
-
var activeElement = elementsInfo.find(function (e) {
|
|
3838
|
-
return e.active;
|
|
3839
|
-
});
|
|
3840
|
-
if (activeElement) sceneStore.selectedElement = activeElement.elementId.toString();
|
|
3905
|
+
if (sceneStore && elementsInfo && gameCanvas.current && sceneStore.scene.getEngine()) {
|
|
3841
3906
|
uiStore.addElementsInfo(elementsInfo);
|
|
3842
3907
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
3908
|
+
sceneStore.runRenderLoopForTime(1000);
|
|
3843
3909
|
}
|
|
3844
|
-
}, [elementsInfo, (
|
|
3910
|
+
}, [elementsInfo, (_sceneStore3 = sceneStore) === null || _sceneStore3 === void 0 ? void 0 : _sceneStore3.elements]);
|
|
3845
3911
|
useEffect(function () {
|
|
3846
|
-
if (!sceneStore) return;
|
|
3912
|
+
if (!gameCanvas.current || !sceneStore) return;
|
|
3847
3913
|
if (inBackground) {
|
|
3848
3914
|
sceneStore.stopRenderLoop();
|
|
3849
3915
|
} else if (sceneStore.hasRendered) {
|