@crystaldesign/real-time-viewer 25.3.0-rc.2 → 25.3.0-rc.20
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 +279 -220
- 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,41 +1803,46 @@ 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;
|
|
1807
1811
|
var utilStore = useUtilStoreContext();
|
|
1808
|
-
if (!utilStore.updateCam) return;
|
|
1812
|
+
if (!utilStore || !utilStore.updateCam) return;
|
|
1809
1813
|
_this._isStaticBg = overlayImage.isStaticBg;
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
if (_this._isStaticBg) {
|
|
1814
|
+
if (_this._isStaticBg)
|
|
1815
|
+
// no highlightlayer on static room bg
|
|
1813
1816
|
_this.deactivateHighlightLayer();
|
|
1814
|
-
}
|
|
1815
1817
|
_this._enableSSAO(false);
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
_this.
|
|
1819
|
-
_this._diffuseTexture = tex;
|
|
1818
|
+
_this._plane.setEnabled(false);
|
|
1819
|
+
_this._diffuseTexture.updateURL(overlayImage.base64, undefined, function () {
|
|
1820
|
+
return _this.fadeInOverlayImage(_this._plane.visibility == 1);
|
|
1820
1821
|
});
|
|
1821
|
-
_this.fadeInOverlayImage(_this._plane.visibility == 1);
|
|
1822
1822
|
(_this$_runRenderLoopF = _this._runRenderLoopForTime) === null || _this$_runRenderLoopF === void 0 || _this$_runRenderLoopF.call(_this, 2000);
|
|
1823
1823
|
});
|
|
1824
1824
|
this._scene = scene;
|
|
1825
|
-
|
|
1825
|
+
this._tabgroupTypeActive = tabgroupTypeActive;
|
|
1826
|
+
this._isMobile = !!isMobile;
|
|
1826
1827
|
var mat = new StandardMaterial('planeMat', scene);
|
|
1827
|
-
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;
|
|
1828
1832
|
mat.diffuseTexture = this._diffuseTexture;
|
|
1829
1833
|
mat.emissiveTexture = this._diffuseTexture;
|
|
1830
1834
|
mat.specularColor = Color3.Black();
|
|
1835
|
+
|
|
1836
|
+
// Get aspect ratio of the current screen
|
|
1831
1837
|
this._plane = MeshBuilder.CreatePlane('overlayplane', {
|
|
1832
|
-
size:
|
|
1838
|
+
size: 1
|
|
1833
1839
|
}, scene);
|
|
1834
1840
|
this._plane.setEnabled(false);
|
|
1835
1841
|
this._plane.material = mat;
|
|
1836
1842
|
this._plane.visibility = 0;
|
|
1837
|
-
|
|
1838
|
-
|
|
1843
|
+
|
|
1844
|
+
// Position it in front of the camera
|
|
1845
|
+
this._plane.position.z = 0.11;
|
|
1839
1846
|
this._plane.isPickable = false;
|
|
1840
1847
|
this._plane.parent = scene.activeCamera;
|
|
1841
1848
|
this._selectedHl = new HighlightLayer('hl', this._scene);
|
|
@@ -1862,8 +1869,11 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1862
1869
|
}
|
|
1863
1870
|
this._isStaticBg = _overlayImage === null || _overlayImage === void 0 ? void 0 : _overlayImage.isStaticBg;
|
|
1864
1871
|
if (_overlayImage) {
|
|
1872
|
+
if (_overlayImage.base64) {
|
|
1873
|
+
this._plane.setEnabled(true);
|
|
1874
|
+
this.fadeInOverlayImage(false);
|
|
1875
|
+
}
|
|
1865
1876
|
this._isUnityComb = true;
|
|
1866
|
-
this._plane.setEnabled(false);
|
|
1867
1877
|
this._enableSSAO(false);
|
|
1868
1878
|
}
|
|
1869
1879
|
this._runRenderLoopForTime = runRenderLoopForTime;
|
|
@@ -1907,7 +1917,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1907
1917
|
if (root) root.getChildMeshes().forEach(function (m) {
|
|
1908
1918
|
m.visibility = 1;
|
|
1909
1919
|
if (!m.material) return;
|
|
1910
|
-
m.material.depthFunction = Constants.
|
|
1920
|
+
m.material.depthFunction = Constants.LEQUAL;
|
|
1911
1921
|
m.material.disableColorWrite = false;
|
|
1912
1922
|
});
|
|
1913
1923
|
}
|
|
@@ -1916,6 +1926,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1916
1926
|
value: function fadeInOverlayImage(shorter) {
|
|
1917
1927
|
var _this3 = this;
|
|
1918
1928
|
var startTime = performance.now();
|
|
1929
|
+
this._plane.setEnabled(true);
|
|
1930
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
1919
1931
|
var _animate = function animate() {
|
|
1920
1932
|
var elapsedTime = performance.now() - startTime;
|
|
1921
1933
|
var progress = Math.min(elapsedTime / (shorter ? 50 : 500), 1); // Normalize progress (0 to 1)
|
|
@@ -1927,12 +1939,14 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1927
1939
|
//animation finished
|
|
1928
1940
|
var root = _this3._scene.getTransformNodeByName('Root');
|
|
1929
1941
|
if (root) root.getChildMeshes().forEach(function (m) {
|
|
1930
|
-
m.visibility =
|
|
1942
|
+
m.visibility = 0;
|
|
1931
1943
|
if (!m.material) return;
|
|
1932
1944
|
m.material.depthFunction = Constants.ALWAYS;
|
|
1933
1945
|
m.material.disableColorWrite = true;
|
|
1934
1946
|
});
|
|
1935
|
-
_this3.
|
|
1947
|
+
_this3._selectedMeshes.forEach(function (m) {
|
|
1948
|
+
return m.visibility = 1;
|
|
1949
|
+
});
|
|
1936
1950
|
}
|
|
1937
1951
|
};
|
|
1938
1952
|
_animate();
|
|
@@ -1953,14 +1967,16 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1953
1967
|
this._utilStore.moveObjectInDirection(guiElem, Vector3.Up(), -localPos.y + 0.05);
|
|
1954
1968
|
if (!onClickDel) return;
|
|
1955
1969
|
var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
|
|
1956
|
-
|
|
1957
|
-
dtarget.
|
|
1970
|
+
var size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '35px';
|
|
1971
|
+
dtarget.width = size;
|
|
1972
|
+
dtarget.height = size;
|
|
1958
1973
|
dtarget.thickness = 1;
|
|
1959
1974
|
dtarget.background = this._colors.defaultBg;
|
|
1960
1975
|
var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
|
|
1961
1976
|
dbt.color = 'transparent';
|
|
1962
|
-
|
|
1963
|
-
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%';
|
|
1964
1980
|
dbt.onPointerClickObservable.add(onClickDel);
|
|
1965
1981
|
dtarget.onPointerEnterObservable = new Observable(function () {
|
|
1966
1982
|
return dtarget.background = _this4._colors.hoverBg;
|
|
@@ -1987,22 +2003,63 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1987
2003
|
}, {
|
|
1988
2004
|
key: "resize",
|
|
1989
2005
|
value: function resize(scene) {
|
|
2006
|
+
if (!scene.activeCamera) return;
|
|
1990
2007
|
this._gui.dispose();
|
|
1991
2008
|
this._gui = AdvancedDynamicTexture.CreateFullscreenUI('UI', true, scene);
|
|
1992
2009
|
this._gui.renderScale = 1;
|
|
1993
2010
|
if (this._latestViewpoint) this._latestViewpoint.isOutdated = true;
|
|
1994
2011
|
var engine = scene.getEngine();
|
|
1995
|
-
|
|
2012
|
+
var aspectRatio = engine.getRenderWidth() / engine.getRenderHeight();
|
|
2013
|
+
var fov = scene.activeCamera.fov;
|
|
2014
|
+
var planeDepth = 0.11;
|
|
2015
|
+
// Calculate scaling factor based on frustum dimensions at the given depth
|
|
2016
|
+
var heightAtDepth = 2 * Math.tan(fov / 2) * planeDepth;
|
|
2017
|
+
var widthAtDepth = heightAtDepth * aspectRatio;
|
|
2018
|
+
this._plane.scaling = new Vector3(widthAtDepth, heightAtDepth, 1);
|
|
1996
2019
|
}
|
|
1997
2020
|
}, {
|
|
1998
2021
|
key: "addElementsInfo",
|
|
1999
2022
|
value: function addElementsInfo(elementsInfo) {
|
|
2000
2023
|
this._elementsInfo = elementsInfo;
|
|
2001
2024
|
}
|
|
2025
|
+
}, {
|
|
2026
|
+
key: "pointerOverElement",
|
|
2027
|
+
value: function pointerOverElement(element) {
|
|
2028
|
+
var _this$_runRenderLoopF2,
|
|
2029
|
+
_this5 = this;
|
|
2030
|
+
this.unityCombActive && ((_this$_runRenderLoopF2 = this._runRenderLoopForTime) === null || _this$_runRenderLoopF2 === void 0 ? void 0 : _this$_runRenderLoopF2.call(this, 1000));
|
|
2031
|
+
this._selectedHl.removeAllMeshes();
|
|
2032
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
2033
|
+
if (this._plane.visibility == 1) this._selectedMeshes.forEach(function (_m) {
|
|
2034
|
+
return _m.visibility = 0;
|
|
2035
|
+
});
|
|
2036
|
+
element.getChildMeshes().forEach(function (_m) {
|
|
2037
|
+
_m.visibility = 1;
|
|
2038
|
+
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2039
|
+
});
|
|
2040
|
+
}
|
|
2041
|
+
}, {
|
|
2042
|
+
key: "pointerOutElement",
|
|
2043
|
+
value: function pointerOutElement(element) {
|
|
2044
|
+
var _this$_runRenderLoopF3,
|
|
2045
|
+
_this6 = this;
|
|
2046
|
+
this.unityCombActive && ((_this$_runRenderLoopF3 = this._runRenderLoopForTime) === null || _this$_runRenderLoopF3 === void 0 ? void 0 : _this$_runRenderLoopF3.call(this, 1000));
|
|
2047
|
+
this._selectedHl.removeAllMeshes();
|
|
2048
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
2049
|
+
if (this._plane.visibility == 1) element.getChildMeshes().forEach(function (_m) {
|
|
2050
|
+
return _m.visibility = 0;
|
|
2051
|
+
});
|
|
2052
|
+
this._selectedMeshes.forEach(function (_m) {
|
|
2053
|
+
_m.visibility = 1;
|
|
2054
|
+
_this6._selectedHl.addMesh(_m, Color3.Black());
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2002
2057
|
}, {
|
|
2003
2058
|
key: "createPosNr",
|
|
2004
|
-
value: function createPosNr(elementInfo, element, isBoxPlanner) {
|
|
2005
|
-
var
|
|
2059
|
+
value: function createPosNr(elementInfo, element, isBoxPlanner, elementLength) {
|
|
2060
|
+
var _this$_elementsInfo,
|
|
2061
|
+
_this7 = this,
|
|
2062
|
+
_this$_tabgroupTypeAc;
|
|
2006
2063
|
var guiElem = {
|
|
2007
2064
|
elementId: elementInfo.elementId,
|
|
2008
2065
|
elements: []
|
|
@@ -2010,9 +2067,9 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2010
2067
|
var bbox = element.getHierarchyBoundingVectors();
|
|
2011
2068
|
var guiElemLeftBack = null;
|
|
2012
2069
|
var guiElemRightBack = null;
|
|
2013
|
-
if (!isBoxPlanner) {
|
|
2070
|
+
if (!isBoxPlanner && elementInfo.selectable) {
|
|
2014
2071
|
guiElemLeftBack = new TransformNode('guiElem_' + elementInfo.elementId, this._scene);
|
|
2015
|
-
guiElemLeftBack.position = element.absolutePosition.
|
|
2072
|
+
guiElemLeftBack.position = new Vector3(element.absolutePosition.x, bbox.min.y + (bbox.max.y - bbox.min.y), element.absolutePosition.z);
|
|
2016
2073
|
guiElem.elements.push(guiElemLeftBack);
|
|
2017
2074
|
guiElemRightBack = undefined;
|
|
2018
2075
|
if (this._uiConfig.posTrashIcon == 'TOP_RIGHT_BACK' || isBoxPlanner) {
|
|
@@ -2023,8 +2080,9 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2023
2080
|
var target = this._uiConfig.templateConfig == 'standard' ? new Ellipse('posnrEllipse') : new Rectangle('posnrRectangle');
|
|
2024
2081
|
if (this._uiConfig.templateConfig == 'gold') target.cornerRadius = 3;
|
|
2025
2082
|
guiElem.elements.push(target);
|
|
2026
|
-
|
|
2027
|
-
target.
|
|
2083
|
+
var size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '20px';
|
|
2084
|
+
target.width = size;
|
|
2085
|
+
target.height = size;
|
|
2028
2086
|
target.fontSize = this._uiConfig.templateConfig == 'standard' ? 50 : 20;
|
|
2029
2087
|
target.background = this._colors.defaultBg;
|
|
2030
2088
|
target.thickness = 0;
|
|
@@ -2047,72 +2105,63 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2047
2105
|
guiElemRightBack.position = _pos;
|
|
2048
2106
|
}
|
|
2049
2107
|
var childMeshes = element.getChildMeshes();
|
|
2108
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
2109
|
+
var cantSelect = (_this$_elementsInfo = this._elementsInfo) === null || _this$_elementsInfo === void 0 ? void 0 : _this$_elementsInfo.every(function (ei) {
|
|
2110
|
+
return ei.active;
|
|
2111
|
+
});
|
|
2050
2112
|
childMeshes.forEach(function (m) {
|
|
2051
|
-
if (
|
|
2113
|
+
if (!m.material) return;
|
|
2114
|
+
if (_this7._plane.visibility == 1) {
|
|
2115
|
+
m.visibility = 0;
|
|
2052
2116
|
m.material.depthFunction = Constants.ALWAYS;
|
|
2053
2117
|
m.material.disableColorWrite = true;
|
|
2054
2118
|
} else {
|
|
2055
2119
|
m.visibility = 1;
|
|
2056
|
-
m.material.depthFunction = Constants.
|
|
2120
|
+
m.material.depthFunction = Constants.LEQUAL;
|
|
2057
2121
|
m.material.disableColorWrite = false;
|
|
2058
2122
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function (ev) {
|
|
2065
|
-
var _this5$_runRenderLoop;
|
|
2066
|
-
(_this5$_runRenderLoop = _this5._runRenderLoopForTime) === null || _this5$_runRenderLoop === void 0 || _this5$_runRenderLoop.call(_this5, 1000);
|
|
2067
|
-
_this5._selectedHl.removeAllMeshes();
|
|
2068
|
-
if (_this5._plane.visibility == 1) _this5._selectedMeshes.forEach(function (_m) {
|
|
2069
|
-
return _m.visibility = 0;
|
|
2070
|
-
});
|
|
2071
|
-
element.getChildMeshes().forEach(function (_m) {
|
|
2072
|
-
_m.visibility = 1;
|
|
2073
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2074
|
-
});
|
|
2123
|
+
if (elementInfo.active) m.visibility = 1;
|
|
2124
|
+
if (!cantSelect && !elementInfo.active && elementInfo.selectable) {
|
|
2125
|
+
if (!m.actionManager) m.actionManager = new ActionManager(_this7._scene);
|
|
2126
|
+
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function () {
|
|
2127
|
+
return _this7.pointerOverElement(element);
|
|
2075
2128
|
}));
|
|
2076
|
-
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function (
|
|
2077
|
-
|
|
2078
|
-
(_this5$_runRenderLoop2 = _this5._runRenderLoopForTime) === null || _this5$_runRenderLoop2 === void 0 || _this5$_runRenderLoop2.call(_this5, 1000);
|
|
2079
|
-
_this5._selectedHl.removeAllMeshes();
|
|
2080
|
-
if (_this5._plane.visibility == 1) element.getChildMeshes().forEach(function (_m) {
|
|
2081
|
-
return _m.visibility = 0;
|
|
2082
|
-
});
|
|
2083
|
-
_this5._selectedMeshes.forEach(function (_m) {
|
|
2084
|
-
_m.visibility = 1;
|
|
2085
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2086
|
-
});
|
|
2129
|
+
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function () {
|
|
2130
|
+
return _this7.pointerOutElement(element);
|
|
2087
2131
|
}));
|
|
2088
|
-
})
|
|
2089
|
-
|
|
2132
|
+
} else if (!cantSelect && elementInfo.active) {
|
|
2133
|
+
var _m$actionManager;
|
|
2134
|
+
_this7._selectedMeshes = [].concat(_toConsumableArray(_this7._selectedMeshes), _toConsumableArray(childMeshes));
|
|
2135
|
+
_this7._selectedHl.addMesh(m, Color3.Black());
|
|
2136
|
+
(_m$actionManager = m.actionManager) === null || _m$actionManager === void 0 || _m$actionManager.dispose();
|
|
2137
|
+
} else {
|
|
2138
|
+
var _m$actionManager2;
|
|
2139
|
+
(_m$actionManager2 = m.actionManager) === null || _m$actionManager2 === void 0 || _m$actionManager2.dispose();
|
|
2140
|
+
}
|
|
2141
|
+
});
|
|
2142
|
+
if ((_this$_tabgroupTypeAc = this._tabgroupTypeActive) !== null && _this$_tabgroupTypeAc !== void 0 && _this$_tabgroupTypeAc.call(this, 'PLANNER') && elementInfo.active) {
|
|
2090
2143
|
var _guiElemRightBack;
|
|
2091
|
-
this._selectedMeshes = childMeshes;
|
|
2092
|
-
this._selectedMeshes.forEach(function (_m) {
|
|
2093
|
-
_m.visibility = 1;
|
|
2094
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2095
|
-
});
|
|
2096
2144
|
var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
|
|
2097
2145
|
guiElem.elements.push(dtarget);
|
|
2098
|
-
|
|
2099
|
-
dtarget.
|
|
2146
|
+
var _size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '35px';
|
|
2147
|
+
dtarget.width = _size;
|
|
2148
|
+
dtarget.height = _size;
|
|
2100
2149
|
dtarget.thickness = 1;
|
|
2101
2150
|
dtarget.background = this._colors.defaultBg;
|
|
2102
2151
|
var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
|
|
2103
2152
|
guiElem.elements.push(dbt);
|
|
2104
2153
|
dbt.color = 'transparent';
|
|
2105
|
-
|
|
2106
|
-
dbt.
|
|
2154
|
+
var nSize = this._isMobile ? '20px' : '40px';
|
|
2155
|
+
dbt.width = this._uiConfig.templateConfig == 'standard' ? nSize : '60%';
|
|
2156
|
+
dbt.height = this._uiConfig.templateConfig == 'standard' ? nSize : '70%';
|
|
2107
2157
|
dbt.onPointerClickObservable.add(function () {
|
|
2108
|
-
return
|
|
2158
|
+
return _this7._utilStore.onElementDeleted(elementInfo.setId, elementInfo.elementId);
|
|
2109
2159
|
});
|
|
2110
|
-
if (this._uiConfig.templateConfig == 'standard' && !guiElemRightBack) dtarget.linkOffsetY = -48;
|
|
2160
|
+
if (this._uiConfig.templateConfig == 'standard' && !guiElemRightBack) dtarget.linkOffsetY = !this._isMobile ? -48 : -30;
|
|
2111
2161
|
dtarget.addControl(dbt);
|
|
2112
2162
|
this._gui.addControl(dtarget);
|
|
2113
2163
|
dtarget.linkWithMesh((_guiElemRightBack = guiElemRightBack) !== null && _guiElemRightBack !== void 0 ? _guiElemRightBack : guiElemLeftBack);
|
|
2114
2164
|
}
|
|
2115
|
-
this._selectedHl.addExcludedMesh(this._plane);
|
|
2116
2165
|
this._guiElements.push(guiElem);
|
|
2117
2166
|
}
|
|
2118
2167
|
}, {
|
|
@@ -2120,7 +2169,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2120
2169
|
value: function createBoxCopyButtons(elementInfo, element) {
|
|
2121
2170
|
var _this$_scene$activeCa,
|
|
2122
2171
|
_this$_scene$activeCa2,
|
|
2123
|
-
|
|
2172
|
+
_this8 = this,
|
|
2124
2173
|
_this$_scene$activeCa3;
|
|
2125
2174
|
var guiElem = {
|
|
2126
2175
|
elementId: elementInfo.elementId,
|
|
@@ -2146,8 +2195,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2146
2195
|
target.rotation = 0;
|
|
2147
2196
|
}
|
|
2148
2197
|
(_this$_scene$activeCa2 = this._scene.activeCamera) === null || _this$_scene$activeCa2 === void 0 || _this$_scene$activeCa2.onViewMatrixChangedObservable.add(function () {
|
|
2149
|
-
var
|
|
2150
|
-
var _dir = (
|
|
2198
|
+
var _this8$_scene$activeC;
|
|
2199
|
+
var _dir = (_this8$_scene$activeC = _this8._scene.activeCamera) === null || _this8$_scene$activeC === void 0 ? void 0 : _this8$_scene$activeC.getDirection(Axis.Z);
|
|
2151
2200
|
if (_dir.z > 0) {
|
|
2152
2201
|
target.rotation = 180 * Math.PI / 180;
|
|
2153
2202
|
} else {
|
|
@@ -2155,8 +2204,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2155
2204
|
}
|
|
2156
2205
|
});
|
|
2157
2206
|
target.onPointerClickObservable.add(function () {
|
|
2158
|
-
var
|
|
2159
|
-
return (
|
|
2207
|
+
var _this8$_onElementCopy;
|
|
2208
|
+
return (_this8$_onElementCopy = _this8._onElementCopy) === null || _this8$_onElementCopy === void 0 ? void 0 : _this8$_onElementCopy.call(_this8, elementInfo.setId, elementInfo.elementId, 'LEFT');
|
|
2160
2209
|
});
|
|
2161
2210
|
break;
|
|
2162
2211
|
case 'BoxCopyRight':
|
|
@@ -2169,8 +2218,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2169
2218
|
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));
|
|
2170
2219
|
guiElement.rotation = new Vector3(90 * Math.PI / 180, 0, 0);
|
|
2171
2220
|
(_this$_scene$activeCa3 = this._scene.activeCamera) === null || _this$_scene$activeCa3 === void 0 || _this$_scene$activeCa3.onViewMatrixChangedObservable.add(function () {
|
|
2172
|
-
var
|
|
2173
|
-
var _dir = (
|
|
2221
|
+
var _this8$_scene$activeC2;
|
|
2222
|
+
var _dir = (_this8$_scene$activeC2 = _this8._scene.activeCamera) === null || _this8$_scene$activeC2 === void 0 ? void 0 : _this8$_scene$activeC2.getDirection(Axis.Z);
|
|
2174
2223
|
if (_dir.z < 0) {
|
|
2175
2224
|
target.rotation = 180 * Math.PI / 180;
|
|
2176
2225
|
} else {
|
|
@@ -2178,16 +2227,16 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2178
2227
|
}
|
|
2179
2228
|
});
|
|
2180
2229
|
target.onPointerClickObservable.add(function () {
|
|
2181
|
-
var
|
|
2182
|
-
return (
|
|
2230
|
+
var _this8$_onElementCopy2;
|
|
2231
|
+
return (_this8$_onElementCopy2 = _this8._onElementCopy) === null || _this8$_onElementCopy2 === void 0 ? void 0 : _this8$_onElementCopy2.call(_this8, elementInfo.setId, elementInfo.elementId, 'RIGHT');
|
|
2183
2232
|
});
|
|
2184
2233
|
break;
|
|
2185
2234
|
case 'BoxCopyTop':
|
|
2186
2235
|
target.rotation = 90 * Math.PI / 180;
|
|
2187
2236
|
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));
|
|
2188
2237
|
target.onPointerClickObservable.add(function () {
|
|
2189
|
-
var
|
|
2190
|
-
return (
|
|
2238
|
+
var _this8$_onElementCopy3;
|
|
2239
|
+
return (_this8$_onElementCopy3 = _this8._onElementCopy) === null || _this8$_onElementCopy3 === void 0 ? void 0 : _this8$_onElementCopy3.call(_this8, elementInfo.setId, elementInfo.elementId, 'TOP');
|
|
2191
2240
|
});
|
|
2192
2241
|
break;
|
|
2193
2242
|
}
|
|
@@ -2198,7 +2247,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2198
2247
|
}, {
|
|
2199
2248
|
key: "initGui",
|
|
2200
2249
|
value: function initGui(onElSelected, elements) {
|
|
2201
|
-
var
|
|
2250
|
+
var _this9 = this;
|
|
2202
2251
|
if (!this._selectionHandler) this.initSelectionHandler(onElSelected);
|
|
2203
2252
|
if (!this._scene) return;
|
|
2204
2253
|
if (!this._elementsInfo) return;
|
|
@@ -2210,20 +2259,28 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2210
2259
|
var isBoxPlanner = !this._elementsInfo.every(function (v) {
|
|
2211
2260
|
return v.type == 'PosNr';
|
|
2212
2261
|
});
|
|
2262
|
+
this._selectedHl.removeAllMeshes();
|
|
2263
|
+
this._selectedMeshes = [];
|
|
2213
2264
|
this._elementsInfo.forEach(function (elementInfo) {
|
|
2214
2265
|
var emnt = elements.find(function (el) {
|
|
2215
2266
|
return Number(el.bbn.name.slice(el.bbn.name.lastIndexOf('E') + 1, el.bbn.name.length)) == elementInfo.elementId;
|
|
2216
2267
|
});
|
|
2217
2268
|
if (!emnt) return;
|
|
2218
|
-
var element =
|
|
2269
|
+
var element = _this9._scene.getTransformNodeByName(emnt.bbn.name);
|
|
2219
2270
|
if (!element) return;
|
|
2220
|
-
if (elementInfo.type == 'PosNr')
|
|
2271
|
+
if (elementInfo.type == 'PosNr') _this9.createPosNr(elementInfo, element, isBoxPlanner, elements.length);else _this9.createBoxCopyButtons(elementInfo, element);
|
|
2221
2272
|
});
|
|
2222
2273
|
}
|
|
2223
2274
|
}, {
|
|
2224
2275
|
key: "selectElem",
|
|
2225
|
-
value: function selectElem(name) {
|
|
2226
|
-
var
|
|
2276
|
+
value: function selectElem(name, element, onElSelected) {
|
|
2277
|
+
var _this$_elementsInfo2,
|
|
2278
|
+
_this10 = this;
|
|
2279
|
+
var elementInfo = (_this$_elementsInfo2 = this._elementsInfo) === null || _this$_elementsInfo2 === void 0 ? void 0 : _this$_elementsInfo2.find(function (ef) {
|
|
2280
|
+
return ef.elementId.toString() == name;
|
|
2281
|
+
});
|
|
2282
|
+
if (!(elementInfo !== null && elementInfo !== void 0 && elementInfo.selectable) || elementInfo.active) return;
|
|
2283
|
+
this._selectedMeshes = element.getChildMeshes();
|
|
2227
2284
|
var _iterator = _createForOfIteratorHelper$5(this._gui.getControlsByType('ellipse')),
|
|
2228
2285
|
_step;
|
|
2229
2286
|
try {
|
|
@@ -2239,13 +2296,14 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2239
2296
|
this._guiElements.forEach(function (guiElem) {
|
|
2240
2297
|
return guiElem.elements.forEach(function (element) {
|
|
2241
2298
|
if (element.typeName == 'label') element.color = 'Black';
|
|
2242
|
-
if (element.typeName == 'Ellipse') element.color =
|
|
2299
|
+
if (element.typeName == 'Ellipse') element.color = _this10._colors.defaultBg;
|
|
2243
2300
|
if (guiElem.elementId.toString() == name) {
|
|
2244
|
-
if (element.typeName == 'label') element.color =
|
|
2301
|
+
if (element.typeName == 'label') element.color = _this10._colors.selectedBg;
|
|
2245
2302
|
if (element.typeName == 'Ellipse') element.color = 'White';
|
|
2246
2303
|
}
|
|
2247
2304
|
});
|
|
2248
2305
|
});
|
|
2306
|
+
onElSelected === null || onElSelected === void 0 || onElSelected(element.parent.name, Number(name));
|
|
2249
2307
|
}
|
|
2250
2308
|
}, {
|
|
2251
2309
|
key: "deactivateHighlightLayer",
|
|
@@ -2283,8 +2341,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2283
2341
|
}
|
|
2284
2342
|
}, {
|
|
2285
2343
|
key: "requestNewOverlayImage",
|
|
2286
|
-
value: function requestNewOverlayImage(viewpoint, focusedElement, targetCameraPosition) {
|
|
2287
|
-
var
|
|
2344
|
+
value: function requestNewOverlayImage(viewpoint, focusedElement, targetCameraPosition, updateCameraInformation) {
|
|
2345
|
+
var _this11 = this;
|
|
2288
2346
|
//this._overlayImage exists only when unity combi is enabled
|
|
2289
2347
|
if (!this._isUnityComb) return;
|
|
2290
2348
|
var elementId = undefined;
|
|
@@ -2300,17 +2358,18 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2300
2358
|
clearTimeout(this._timeoutId);
|
|
2301
2359
|
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) {
|
|
2302
2360
|
this._timeoutId = setTimeout(function () {
|
|
2303
|
-
var
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2361
|
+
var _this11$_requestNewOv;
|
|
2362
|
+
_this11._latestViewpoint = viewpoint;
|
|
2363
|
+
_this11._utilStore.addOutstandingImageCount();
|
|
2364
|
+
_this11._utilStore.updateCam = true;
|
|
2365
|
+
updateCameraInformation === null || updateCameraInformation === void 0 || updateCameraInformation(viewpoint);
|
|
2366
|
+
(_this11$_requestNewOv = _this11._requestNewOverlayImage) === null || _this11$_requestNewOv === void 0 || _this11$_requestNewOv.call(_this11, viewpoint, {
|
|
2307
2367
|
adjustZoomInUnity: false,
|
|
2308
2368
|
onlyAdjustZoomBBChanged: false,
|
|
2309
2369
|
rotationCenter: viewpoint.targetPos,
|
|
2310
2370
|
elementId: elementId,
|
|
2311
2371
|
setId: setId
|
|
2312
2372
|
});
|
|
2313
|
-
_this9._utilStore.updateCam = true;
|
|
2314
2373
|
}, 200);
|
|
2315
2374
|
} else {
|
|
2316
2375
|
this.fadeInOverlayImage(false);
|
|
@@ -2544,10 +2603,10 @@ var _context;
|
|
|
2544
2603
|
var unregisterContext = function unregisterContext() {
|
|
2545
2604
|
_context = undefined;
|
|
2546
2605
|
};
|
|
2547
|
-
var registerContext = function registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation) {
|
|
2606
|
+
var registerContext = function registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation, isMobile) {
|
|
2548
2607
|
var utilStore = new UtilStore(false, viewHandler);
|
|
2549
2608
|
var sceneStore = new SceneStore(scene, hqRenderScript, utilStore, apiConfig, jwt, onMissingGeo, updateCameraInformation);
|
|
2550
|
-
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));
|
|
2609
|
+
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);
|
|
2551
2610
|
return _context = {
|
|
2552
2611
|
utilStore: utilStore,
|
|
2553
2612
|
sceneStore: sceneStore,
|
|
@@ -2761,14 +2820,12 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2761
2820
|
path: _customMat.blob,
|
|
2762
2821
|
sizeMb: 0
|
|
2763
2822
|
});
|
|
2764
|
-
parsedMat.depthFunction = Constants.ALWAYS;
|
|
2765
|
-
parsedMat.disableColorWrite = true;
|
|
2766
2823
|
return _context.abrupt("return", {
|
|
2767
2824
|
mat: parsedMat,
|
|
2768
2825
|
found: true
|
|
2769
2826
|
});
|
|
2770
|
-
case
|
|
2771
|
-
_context.prev =
|
|
2827
|
+
case 29:
|
|
2828
|
+
_context.prev = 29;
|
|
2772
2829
|
_context.t0 = _context["catch"](8);
|
|
2773
2830
|
if (setDataRow) useUtilStoreContext().setAnalyzeDataRow({
|
|
2774
2831
|
type: 'MAT',
|
|
@@ -2778,19 +2835,17 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2778
2835
|
path: _customMat.blob,
|
|
2779
2836
|
sizeMb: 0
|
|
2780
2837
|
});
|
|
2781
|
-
case
|
|
2838
|
+
case 32:
|
|
2782
2839
|
mat = new PBRMetallicRoughnessMaterial(_customMat.name, _customMat.scene);
|
|
2783
|
-
mat.depthFunction = Constants.ALWAYS;
|
|
2784
|
-
mat.disableColorWrite = true;
|
|
2785
2840
|
return _context.abrupt("return", {
|
|
2786
2841
|
mat: mat,
|
|
2787
2842
|
found: true
|
|
2788
2843
|
});
|
|
2789
|
-
case
|
|
2844
|
+
case 34:
|
|
2790
2845
|
case "end":
|
|
2791
2846
|
return _context.stop();
|
|
2792
2847
|
}
|
|
2793
|
-
}, _callee, null, [[8,
|
|
2848
|
+
}, _callee, null, [[8, 29]]);
|
|
2794
2849
|
}));
|
|
2795
2850
|
return function customMat(_x) {
|
|
2796
2851
|
return _ref.apply(this, arguments);
|
|
@@ -3505,7 +3560,7 @@ function shadow() {
|
|
|
3505
3560
|
var lightf = new DirectionalLight('dirf', new Vector3(0, -0.436, -0.9), scene);
|
|
3506
3561
|
var lightr = new DirectionalLight('dirr', new Vector3(0, -1, 0.3), scene);
|
|
3507
3562
|
var lightl = new DirectionalLight('dirb', new Vector3(0.2, -1, 0.2), scene);
|
|
3508
|
-
lightl.intensity =
|
|
3563
|
+
lightl.intensity = 1;
|
|
3509
3564
|
lightf.intensity = 2.2;
|
|
3510
3565
|
light.intensity = 1;
|
|
3511
3566
|
lightr.intensity = 1;
|
|
@@ -3525,8 +3580,6 @@ function shadow() {
|
|
|
3525
3580
|
z: 0
|
|
3526
3581
|
});
|
|
3527
3582
|
var std_mat = new PBRMetallicRoughnessMaterial('std_mat', scene);
|
|
3528
|
-
std_mat.depthFunction = Constants.ALWAYS;
|
|
3529
|
-
std_mat.disableColorWrite = true;
|
|
3530
3583
|
std_mat.metallic = 0;
|
|
3531
3584
|
scene.defaultMaterial = std_mat;
|
|
3532
3585
|
var mat = new PBRMetallicRoughnessMaterial('white', scene);
|
|
@@ -3581,16 +3634,15 @@ var parser = /*#__PURE__*/function () {
|
|
|
3581
3634
|
parentNode: parent
|
|
3582
3635
|
});
|
|
3583
3636
|
findMaterials(newCache);
|
|
3584
|
-
shadow();
|
|
3585
3637
|
});
|
|
3586
3638
|
} else if (!hasRendered) {
|
|
3639
|
+
shadow();
|
|
3587
3640
|
buildScene({
|
|
3588
3641
|
startNode: hqRenderScript.scene.nodes[0],
|
|
3589
3642
|
cache: cacheGroup,
|
|
3590
3643
|
cachedAssets: newCache
|
|
3591
3644
|
});
|
|
3592
3645
|
findMaterials(newCache);
|
|
3593
|
-
shadow();
|
|
3594
3646
|
}
|
|
3595
3647
|
utilStore.setRTVAnalyzeData();
|
|
3596
3648
|
deacCache(cacheGroup);
|
|
@@ -3608,7 +3660,7 @@ var parser = /*#__PURE__*/function () {
|
|
|
3608
3660
|
|
|
3609
3661
|
var LOG = getLogger('ARViewer', 'RealTimeRenderData');
|
|
3610
3662
|
function useRealTimeRenderData (_ref) {
|
|
3611
|
-
var
|
|
3663
|
+
var _sceneStore3;
|
|
3612
3664
|
var jwt = _ref.jwt,
|
|
3613
3665
|
actions = _ref.actions,
|
|
3614
3666
|
apiConfig = _ref.apiConfig,
|
|
@@ -3623,10 +3675,11 @@ function useRealTimeRenderData (_ref) {
|
|
|
3623
3675
|
plannedPlacesOnGrids = _ref.plannedPlacesOnGrids,
|
|
3624
3676
|
callbacks = _ref.callbacks,
|
|
3625
3677
|
uiConfig = _ref.uiConfig,
|
|
3626
|
-
renderInBackground = _ref.renderInBackground
|
|
3678
|
+
renderInBackground = _ref.renderInBackground,
|
|
3679
|
+
isMobile = _ref.isMobile;
|
|
3627
3680
|
var gameCanvas = useRef(null);
|
|
3628
3681
|
var sceneStore = useSceneStoreContext();
|
|
3629
|
-
useUtilStoreContext();
|
|
3682
|
+
var utilStore = useUtilStoreContext();
|
|
3630
3683
|
var gridStore = useGridStoreContext();
|
|
3631
3684
|
var uiStore = useUIStoreContext();
|
|
3632
3685
|
DracoCompression.Configuration = {
|
|
@@ -3667,47 +3720,48 @@ function useRealTimeRenderData (_ref) {
|
|
|
3667
3720
|
sceneStore.isInitializing = true;
|
|
3668
3721
|
if (!overlayImage) actions.toggleLoading('buildScene', false, true);
|
|
3669
3722
|
if (sceneStore.hasRendered) {
|
|
3670
|
-
_context2.next =
|
|
3723
|
+
_context2.next = 10;
|
|
3671
3724
|
break;
|
|
3672
3725
|
}
|
|
3673
3726
|
if (inBackground) sceneStore.scene.getEngine().setHardwareScalingLevel(5);
|
|
3674
3727
|
sceneStore.init(apiConfig.diva3darchive + '/', gameCanvas.current, viewpoint, resolution);
|
|
3675
|
-
|
|
3728
|
+
uiStore.resize(sceneStore.scene);
|
|
3729
|
+
_context2.next = 15;
|
|
3676
3730
|
break;
|
|
3677
|
-
case
|
|
3731
|
+
case 10:
|
|
3678
3732
|
sceneStore.hqRenderScript = JSON.parse(renderjob);
|
|
3679
3733
|
if (checkCachedData()) {
|
|
3680
|
-
_context2.next =
|
|
3734
|
+
_context2.next = 15;
|
|
3681
3735
|
break;
|
|
3682
3736
|
}
|
|
3683
3737
|
if (!overlayImage) actions.toggleLoading('buildScene', false, false);
|
|
3684
3738
|
sceneStore.isInitializing = false;
|
|
3685
3739
|
return _context2.abrupt("return");
|
|
3686
|
-
case
|
|
3740
|
+
case 15:
|
|
3687
3741
|
LOG.startTransaction({
|
|
3688
3742
|
event: 'buildScene',
|
|
3689
3743
|
message: 'Start Building Realtime Scene',
|
|
3690
3744
|
eventId: 'BUILD_SCENE'
|
|
3691
3745
|
});
|
|
3692
|
-
_context2.prev =
|
|
3746
|
+
_context2.prev = 16;
|
|
3693
3747
|
uiStore.deactivateHighlightLayer();
|
|
3694
|
-
_context2.next =
|
|
3748
|
+
_context2.next = 20;
|
|
3695
3749
|
return parser();
|
|
3696
|
-
case
|
|
3750
|
+
case 20:
|
|
3697
3751
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
3698
3752
|
if (freePlacesOnGrids || plannedPlacesOnGrids) gridStore.getGrids(freePlacesOnGrids, plannedPlacesOnGrids);
|
|
3699
|
-
_context2.next =
|
|
3753
|
+
_context2.next = 29;
|
|
3700
3754
|
break;
|
|
3701
|
-
case
|
|
3702
|
-
_context2.prev =
|
|
3703
|
-
_context2.t0 = _context2["catch"](
|
|
3755
|
+
case 24:
|
|
3756
|
+
_context2.prev = 24;
|
|
3757
|
+
_context2.t0 = _context2["catch"](16);
|
|
3704
3758
|
LOG.errorTransaction('BUILD_SCENE', 'RTS_0001', _context2.t0.message);
|
|
3705
3759
|
LOG.error(new DivaError('Error building scene', {
|
|
3706
3760
|
cause: _context2.t0,
|
|
3707
3761
|
code: 'RTS_0001'
|
|
3708
3762
|
}));
|
|
3709
3763
|
sceneStore.isInitializing = false;
|
|
3710
|
-
case
|
|
3764
|
+
case 29:
|
|
3711
3765
|
if (callbacks.setGlb) {
|
|
3712
3766
|
sceneStore.exportScene().then(function (res) {
|
|
3713
3767
|
var _callbacks$setGlb;
|
|
@@ -3717,16 +3771,16 @@ function useRealTimeRenderData (_ref) {
|
|
|
3717
3771
|
LOG.debug('callbacks.setGlb is undefined');
|
|
3718
3772
|
}
|
|
3719
3773
|
if (!sceneStore.hasRendered) {
|
|
3720
|
-
sceneStore.runRenderLoopIndefinitely();
|
|
3721
3774
|
sceneStore.hasRendered = true;
|
|
3722
3775
|
}
|
|
3776
|
+
sceneStore.runRenderLoopIndefinitely();
|
|
3723
3777
|
sceneStore.scene.onAfterRenderObservable.add(onFirstFrame);
|
|
3724
3778
|
LOG.successTransaction('BUILD_SCENE');
|
|
3725
|
-
case
|
|
3779
|
+
case 34:
|
|
3726
3780
|
case "end":
|
|
3727
3781
|
return _context2.stop();
|
|
3728
3782
|
}
|
|
3729
|
-
}, _callee2, null, [[
|
|
3783
|
+
}, _callee2, null, [[16, 24]]);
|
|
3730
3784
|
}));
|
|
3731
3785
|
return _onSceneReady.apply(this, arguments);
|
|
3732
3786
|
}
|
|
@@ -3743,7 +3797,7 @@ function useRealTimeRenderData (_ref) {
|
|
|
3743
3797
|
}
|
|
3744
3798
|
|
|
3745
3799
|
// trigger if gamecanvas did not update but renderjob
|
|
3746
|
-
if (gameCanvas.current && sceneStore && sceneStore.scene) {
|
|
3800
|
+
if (gameCanvas.current && sceneStore && sceneStore.scene.getEngine()) {
|
|
3747
3801
|
var _queueRerender = function queueRerender() {
|
|
3748
3802
|
if (sceneStore.isInitializing) setTimeout(_queueRerender, 150);else {
|
|
3749
3803
|
if (sceneStore.scene.isReady()) onSceneReady();else sceneStore.scene.executeWhenReady(function () {
|
|
@@ -3754,38 +3808,42 @@ function useRealTimeRenderData (_ref) {
|
|
|
3754
3808
|
_queueRerender();
|
|
3755
3809
|
}
|
|
3756
3810
|
useEffect(function () {
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3811
|
+
var babylonScene = undefined;
|
|
3812
|
+
var babylonEngine = undefined;
|
|
3813
|
+
function init() {
|
|
3814
|
+
return _init.apply(this, arguments);
|
|
3815
|
+
}
|
|
3816
|
+
function _init() {
|
|
3817
|
+
_init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3818
|
+
var context;
|
|
3763
3819
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3764
3820
|
while (1) switch (_context.prev = _context.next) {
|
|
3765
3821
|
case 0:
|
|
3766
|
-
if (
|
|
3767
|
-
_context.next =
|
|
3822
|
+
if (gameCanvas.current) {
|
|
3823
|
+
_context.next = 2;
|
|
3768
3824
|
break;
|
|
3769
3825
|
}
|
|
3770
|
-
_context.
|
|
3826
|
+
return _context.abrupt("return");
|
|
3827
|
+
case 2:
|
|
3828
|
+
_context.next = 4;
|
|
3771
3829
|
return EngineFactory.CreateAsync(gameCanvas.current, {
|
|
3772
3830
|
antialias: true,
|
|
3773
3831
|
stencil: true,
|
|
3774
|
-
audioEngine: false
|
|
3832
|
+
audioEngine: false,
|
|
3833
|
+
adaptToDeviceRatio: true
|
|
3775
3834
|
});
|
|
3776
|
-
case
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
context = registerContext(
|
|
3835
|
+
case 4:
|
|
3836
|
+
babylonEngine = _context.sent;
|
|
3837
|
+
babylonEngine.renderEvenInBackground = renderInBackground;
|
|
3838
|
+
babylonEngine.disablePerformanceMonitorInBackground = true;
|
|
3839
|
+
babylonScene = new Scene(babylonEngine, undefined);
|
|
3840
|
+
babylonScene.clearColor = new Color4(255, 255, 255, 255);
|
|
3841
|
+
context = registerContext(babylonScene, renderjob, apiConfig, jwt, viewHandler, callbacks.onMissingGeo, callbacks.requestNewOverlayImage, overlayImage, uiConfig, callbacks.updateCameraInformation, !!isMobile);
|
|
3783
3842
|
sceneStore = context.sceneStore;
|
|
3784
|
-
context.utilStore;
|
|
3843
|
+
utilStore = context.utilStore;
|
|
3785
3844
|
gridStore = context.gridStore;
|
|
3786
3845
|
uiStore = context.uiStore;
|
|
3787
|
-
|
|
3788
|
-
if (!bScene.isReady()) {
|
|
3846
|
+
if (!babylonScene.isReady()) {
|
|
3789
3847
|
_context.next = 19;
|
|
3790
3848
|
break;
|
|
3791
3849
|
}
|
|
@@ -3795,57 +3853,58 @@ function useRealTimeRenderData (_ref) {
|
|
|
3795
3853
|
_context.next = 20;
|
|
3796
3854
|
break;
|
|
3797
3855
|
case 19:
|
|
3798
|
-
|
|
3856
|
+
babylonScene.executeWhenReady(function () {
|
|
3799
3857
|
return onSceneReady();
|
|
3800
3858
|
});
|
|
3801
3859
|
case 20:
|
|
3802
|
-
|
|
3803
|
-
if (inBackground || !scene || !scene.getEngine()) return;
|
|
3804
|
-
if (sceneStore.hasPlanned) sceneStore.doRenderControlLoop = true;
|
|
3805
|
-
scene.getEngine().resize(true);
|
|
3806
|
-
if (uiStore) uiStore.resize(scene);
|
|
3807
|
-
};
|
|
3808
|
-
if (window) {
|
|
3860
|
+
if (window && gameCanvas.current) {
|
|
3809
3861
|
window.addEventListener('resize', resize);
|
|
3810
3862
|
new ResizeObserver(resize).observe(gameCanvas.current);
|
|
3811
3863
|
}
|
|
3812
|
-
|
|
3813
|
-
scene.getEngine().dispose();
|
|
3814
|
-
if (window) {
|
|
3815
|
-
window.removeEventListener('resize', resize);
|
|
3816
|
-
}
|
|
3817
|
-
});
|
|
3818
|
-
case 23:
|
|
3819
|
-
return _context.abrupt("return");
|
|
3820
|
-
case 24:
|
|
3864
|
+
case 21:
|
|
3821
3865
|
case "end":
|
|
3822
3866
|
return _context.stop();
|
|
3823
3867
|
}
|
|
3824
3868
|
}, _callee);
|
|
3825
3869
|
}));
|
|
3826
|
-
return
|
|
3827
|
-
}
|
|
3828
|
-
|
|
3829
|
-
|
|
3870
|
+
return _init.apply(this, arguments);
|
|
3871
|
+
}
|
|
3872
|
+
var resize = function resize() {
|
|
3873
|
+
var _sceneStore2;
|
|
3874
|
+
if (inBackground || !((_sceneStore2 = sceneStore) !== null && _sceneStore2 !== void 0 && _sceneStore2.scene) || !sceneStore.scene.getEngine()) return;
|
|
3875
|
+
if (sceneStore.hasPlanned) sceneStore.doRenderControlLoop = true;
|
|
3876
|
+
sceneStore.scene.getEngine().resize(true);
|
|
3877
|
+
if (uiStore) uiStore.resize(sceneStore.scene);
|
|
3878
|
+
};
|
|
3879
|
+
init();
|
|
3880
|
+
return function () {
|
|
3881
|
+
if (babylonEngine || babylonScene) {
|
|
3882
|
+
unregisterContext();
|
|
3883
|
+
babylonScene.getEngine().dispose();
|
|
3884
|
+
sceneStore.scene.dispose();
|
|
3885
|
+
if (window) {
|
|
3886
|
+
window.removeEventListener('resize', resize);
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
};
|
|
3830
3890
|
}, []);
|
|
3831
3891
|
useEffect(function () {
|
|
3832
|
-
if (overlayImage && uiStore) {
|
|
3892
|
+
if (overlayImage && uiStore && gameCanvas.current && sceneStore && sceneStore.scene.getEngine()) {
|
|
3893
|
+
if (!utilStore.updateCam) return;
|
|
3894
|
+
sceneStore.runRenderLoopForTime(1000);
|
|
3833
3895
|
uiStore.updateOverlayImage(overlayImage);
|
|
3834
3896
|
if (viewpoint) updateCam(viewpoint, sceneStore.scene);
|
|
3835
3897
|
}
|
|
3836
3898
|
}, [overlayImage]);
|
|
3837
3899
|
useEffect(function () {
|
|
3838
|
-
if (sceneStore && elementsInfo) {
|
|
3839
|
-
var activeElement = elementsInfo.find(function (e) {
|
|
3840
|
-
return e.active;
|
|
3841
|
-
});
|
|
3842
|
-
if (activeElement) sceneStore.selectedElement = activeElement.elementId.toString();
|
|
3900
|
+
if (sceneStore && elementsInfo && gameCanvas.current && sceneStore.scene.getEngine()) {
|
|
3843
3901
|
uiStore.addElementsInfo(elementsInfo);
|
|
3844
3902
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
3903
|
+
sceneStore.runRenderLoopForTime(1000);
|
|
3845
3904
|
}
|
|
3846
|
-
}, [elementsInfo, (
|
|
3905
|
+
}, [elementsInfo, (_sceneStore3 = sceneStore) === null || _sceneStore3 === void 0 ? void 0 : _sceneStore3.elements]);
|
|
3847
3906
|
useEffect(function () {
|
|
3848
|
-
if (!sceneStore) return;
|
|
3907
|
+
if (!gameCanvas.current || !sceneStore) return;
|
|
3849
3908
|
if (inBackground) {
|
|
3850
3909
|
sceneStore.stopRenderLoop();
|
|
3851
3910
|
} else if (sceneStore.hasRendered) {
|