@crystaldesign/real-time-viewer 25.4.0-beta.52 → 25.4.0-beta.53
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 +281 -219
- 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,37 +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
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
|
-
_this.
|
|
1817
|
-
_this.
|
|
1818
|
+
_this._plane.setEnabled(false);
|
|
1819
|
+
_this._diffuseTexture.updateURL(overlayImage.base64, undefined, function () {
|
|
1820
|
+
return _this.fadeInOverlayImage(_this._plane.visibility == 1);
|
|
1821
|
+
});
|
|
1818
1822
|
(_this$_runRenderLoopF = _this._runRenderLoopForTime) === null || _this$_runRenderLoopF === void 0 || _this$_runRenderLoopF.call(_this, 2000);
|
|
1819
1823
|
});
|
|
1820
1824
|
this._scene = scene;
|
|
1821
|
-
|
|
1825
|
+
this._tabgroupTypeActive = tabgroupTypeActive;
|
|
1826
|
+
this._isMobile = !!isMobile;
|
|
1822
1827
|
var mat = new StandardMaterial('planeMat', scene);
|
|
1823
|
-
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;
|
|
1824
1832
|
mat.diffuseTexture = this._diffuseTexture;
|
|
1825
1833
|
mat.emissiveTexture = this._diffuseTexture;
|
|
1826
1834
|
mat.specularColor = Color3.Black();
|
|
1835
|
+
|
|
1836
|
+
// Get aspect ratio of the current screen
|
|
1827
1837
|
this._plane = MeshBuilder.CreatePlane('overlayplane', {
|
|
1828
|
-
size:
|
|
1838
|
+
size: 1
|
|
1829
1839
|
}, scene);
|
|
1830
1840
|
this._plane.setEnabled(false);
|
|
1831
1841
|
this._plane.material = mat;
|
|
1832
1842
|
this._plane.visibility = 0;
|
|
1833
|
-
|
|
1834
|
-
|
|
1843
|
+
|
|
1844
|
+
// Position it in front of the camera
|
|
1845
|
+
this._plane.position.z = 0.11;
|
|
1835
1846
|
this._plane.isPickable = false;
|
|
1836
1847
|
this._plane.parent = scene.activeCamera;
|
|
1837
1848
|
this._selectedHl = new HighlightLayer('hl', this._scene);
|
|
@@ -1858,8 +1869,11 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1858
1869
|
}
|
|
1859
1870
|
this._isStaticBg = _overlayImage === null || _overlayImage === void 0 ? void 0 : _overlayImage.isStaticBg;
|
|
1860
1871
|
if (_overlayImage) {
|
|
1872
|
+
if (_overlayImage.base64) {
|
|
1873
|
+
this._plane.setEnabled(true);
|
|
1874
|
+
this.fadeInOverlayImage(false);
|
|
1875
|
+
}
|
|
1861
1876
|
this._isUnityComb = true;
|
|
1862
|
-
this._plane.setEnabled(false);
|
|
1863
1877
|
this._enableSSAO(false);
|
|
1864
1878
|
}
|
|
1865
1879
|
this._runRenderLoopForTime = runRenderLoopForTime;
|
|
@@ -1903,7 +1917,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1903
1917
|
if (root) root.getChildMeshes().forEach(function (m) {
|
|
1904
1918
|
m.visibility = 1;
|
|
1905
1919
|
if (!m.material) return;
|
|
1906
|
-
m.material.depthFunction = Constants.
|
|
1920
|
+
m.material.depthFunction = Constants.LEQUAL;
|
|
1907
1921
|
m.material.disableColorWrite = false;
|
|
1908
1922
|
});
|
|
1909
1923
|
}
|
|
@@ -1912,6 +1926,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1912
1926
|
value: function fadeInOverlayImage(shorter) {
|
|
1913
1927
|
var _this3 = this;
|
|
1914
1928
|
var startTime = performance.now();
|
|
1929
|
+
this._plane.setEnabled(true);
|
|
1930
|
+
this._selectedHl.addExcludedMesh(this._plane);
|
|
1915
1931
|
var _animate = function animate() {
|
|
1916
1932
|
var elapsedTime = performance.now() - startTime;
|
|
1917
1933
|
var progress = Math.min(elapsedTime / (shorter ? 50 : 500), 1); // Normalize progress (0 to 1)
|
|
@@ -1923,12 +1939,14 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1923
1939
|
//animation finished
|
|
1924
1940
|
var root = _this3._scene.getTransformNodeByName('Root');
|
|
1925
1941
|
if (root) root.getChildMeshes().forEach(function (m) {
|
|
1926
|
-
m.visibility =
|
|
1942
|
+
m.visibility = 0;
|
|
1927
1943
|
if (!m.material) return;
|
|
1928
1944
|
m.material.depthFunction = Constants.ALWAYS;
|
|
1929
1945
|
m.material.disableColorWrite = true;
|
|
1930
1946
|
});
|
|
1931
|
-
_this3.
|
|
1947
|
+
_this3._selectedMeshes.forEach(function (m) {
|
|
1948
|
+
return m.visibility = 1;
|
|
1949
|
+
});
|
|
1932
1950
|
}
|
|
1933
1951
|
};
|
|
1934
1952
|
_animate();
|
|
@@ -1949,14 +1967,16 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1949
1967
|
this._utilStore.moveObjectInDirection(guiElem, Vector3.Up(), -localPos.y + 0.05);
|
|
1950
1968
|
if (!onClickDel) return;
|
|
1951
1969
|
var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
|
|
1952
|
-
|
|
1953
|
-
dtarget.
|
|
1970
|
+
var size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '35px';
|
|
1971
|
+
dtarget.width = size;
|
|
1972
|
+
dtarget.height = size;
|
|
1954
1973
|
dtarget.thickness = 1;
|
|
1955
1974
|
dtarget.background = this._colors.defaultBg;
|
|
1956
1975
|
var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
|
|
1957
1976
|
dbt.color = 'transparent';
|
|
1958
|
-
|
|
1959
|
-
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%';
|
|
1960
1980
|
dbt.onPointerClickObservable.add(onClickDel);
|
|
1961
1981
|
dtarget.onPointerEnterObservable = new Observable(function () {
|
|
1962
1982
|
return dtarget.background = _this4._colors.hoverBg;
|
|
@@ -1983,23 +2003,68 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1983
2003
|
}, {
|
|
1984
2004
|
key: "resize",
|
|
1985
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
|
+
}
|
|
1986
2013
|
this._gui.dispose();
|
|
1987
2014
|
this._gui = AdvancedDynamicTexture.CreateFullscreenUI('UI', true, scene);
|
|
1988
2015
|
this._gui.renderScale = 1;
|
|
1989
2016
|
if (this._latestViewpoint) this._latestViewpoint.isOutdated = true;
|
|
1990
|
-
var
|
|
1991
|
-
|
|
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);
|
|
1992
2024
|
}
|
|
1993
2025
|
}, {
|
|
1994
2026
|
key: "addElementsInfo",
|
|
1995
2027
|
value: function addElementsInfo(elementsInfo) {
|
|
1996
2028
|
this._elementsInfo = elementsInfo;
|
|
1997
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
|
+
}
|
|
1998
2062
|
}, {
|
|
1999
2063
|
key: "createPosNr",
|
|
2000
2064
|
value: function createPosNr(elementInfo, element, isBoxPlanner, elementLength) {
|
|
2001
|
-
var
|
|
2002
|
-
|
|
2065
|
+
var _this$_elementsInfo,
|
|
2066
|
+
_this7 = this,
|
|
2067
|
+
_this$_tabgroupTypeAc;
|
|
2003
2068
|
var guiElem = {
|
|
2004
2069
|
elementId: elementInfo.elementId,
|
|
2005
2070
|
elements: []
|
|
@@ -2007,9 +2072,9 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2007
2072
|
var bbox = element.getHierarchyBoundingVectors();
|
|
2008
2073
|
var guiElemLeftBack = null;
|
|
2009
2074
|
var guiElemRightBack = null;
|
|
2010
|
-
if (!isBoxPlanner) {
|
|
2075
|
+
if (!isBoxPlanner && elementInfo.selectable) {
|
|
2011
2076
|
guiElemLeftBack = new TransformNode('guiElem_' + elementInfo.elementId, this._scene);
|
|
2012
|
-
guiElemLeftBack.position = element.absolutePosition.
|
|
2077
|
+
guiElemLeftBack.position = new Vector3(element.absolutePosition.x, bbox.min.y + (bbox.max.y - bbox.min.y), element.absolutePosition.z);
|
|
2013
2078
|
guiElem.elements.push(guiElemLeftBack);
|
|
2014
2079
|
guiElemRightBack = undefined;
|
|
2015
2080
|
if (this._uiConfig.posTrashIcon == 'TOP_RIGHT_BACK' || isBoxPlanner) {
|
|
@@ -2020,8 +2085,9 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2020
2085
|
var target = this._uiConfig.templateConfig == 'standard' ? new Ellipse('posnrEllipse') : new Rectangle('posnrRectangle');
|
|
2021
2086
|
if (this._uiConfig.templateConfig == 'gold') target.cornerRadius = 3;
|
|
2022
2087
|
guiElem.elements.push(target);
|
|
2023
|
-
|
|
2024
|
-
target.
|
|
2088
|
+
var size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '20px';
|
|
2089
|
+
target.width = size;
|
|
2090
|
+
target.height = size;
|
|
2025
2091
|
target.fontSize = this._uiConfig.templateConfig == 'standard' ? 50 : 20;
|
|
2026
2092
|
target.background = this._colors.defaultBg;
|
|
2027
2093
|
target.thickness = 0;
|
|
@@ -2044,77 +2110,63 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2044
2110
|
guiElemRightBack.position = _pos;
|
|
2045
2111
|
}
|
|
2046
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
|
+
});
|
|
2047
2117
|
childMeshes.forEach(function (m) {
|
|
2048
|
-
if (
|
|
2118
|
+
if (!m.material) return;
|
|
2119
|
+
if (_this7._plane.visibility == 1) {
|
|
2120
|
+
m.visibility = 0;
|
|
2049
2121
|
m.material.depthFunction = Constants.ALWAYS;
|
|
2050
2122
|
m.material.disableColorWrite = true;
|
|
2051
2123
|
} else {
|
|
2052
2124
|
m.visibility = 1;
|
|
2053
|
-
m.material.depthFunction = Constants.
|
|
2125
|
+
m.material.depthFunction = Constants.LEQUAL;
|
|
2054
2126
|
m.material.disableColorWrite = false;
|
|
2055
2127
|
}
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
childMeshes.forEach(function (m) {
|
|
2062
|
-
if (_this5._plane.visibility == 1) m.visibility = 0;
|
|
2063
|
-
if (!m.actionManager) m.actionManager = new ActionManager(_this5._scene);
|
|
2064
|
-
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function (ev) {
|
|
2065
|
-
var _this5$_runRenderLoop;
|
|
2066
|
-
if (everyElementIsSelected) return;
|
|
2067
|
-
(_this5$_runRenderLoop = _this5._runRenderLoopForTime) === null || _this5$_runRenderLoop === void 0 || _this5$_runRenderLoop.call(_this5, 1000);
|
|
2068
|
-
_this5._selectedHl.removeAllMeshes();
|
|
2069
|
-
if (_this5._plane.visibility == 1) _this5._selectedMeshes.forEach(function (_m) {
|
|
2070
|
-
return _m.visibility = 0;
|
|
2071
|
-
});
|
|
2072
|
-
element.getChildMeshes().forEach(function (_m) {
|
|
2073
|
-
_m.visibility = 1;
|
|
2074
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2075
|
-
});
|
|
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);
|
|
2076
2133
|
}));
|
|
2077
|
-
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function (
|
|
2078
|
-
|
|
2079
|
-
if (everyElementIsSelected) return;
|
|
2080
|
-
(_this5$_runRenderLoop2 = _this5._runRenderLoopForTime) === null || _this5$_runRenderLoop2 === void 0 || _this5$_runRenderLoop2.call(_this5, 1000);
|
|
2081
|
-
_this5._selectedHl.removeAllMeshes();
|
|
2082
|
-
if (_this5._plane.visibility == 1) element.getChildMeshes().forEach(function (_m) {
|
|
2083
|
-
return _m.visibility = 0;
|
|
2084
|
-
});
|
|
2085
|
-
_this5._selectedMeshes.forEach(function (_m) {
|
|
2086
|
-
_m.visibility = 1;
|
|
2087
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2088
|
-
});
|
|
2134
|
+
m.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function () {
|
|
2135
|
+
return _this7.pointerOutElement(element);
|
|
2089
2136
|
}));
|
|
2090
|
-
})
|
|
2091
|
-
|
|
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) {
|
|
2092
2148
|
var _guiElemRightBack;
|
|
2093
|
-
this._selectedMeshes = childMeshes;
|
|
2094
|
-
if (elementLength > 1 && !everyElementIsSelected) this._selectedMeshes.forEach(function (_m) {
|
|
2095
|
-
_m.visibility = 1;
|
|
2096
|
-
_this5._selectedHl.addMesh(_m, Color3.Black());
|
|
2097
|
-
});
|
|
2098
2149
|
var dtarget = this._uiConfig.templateConfig == 'standard' ? new Ellipse('deleteEllipse') : new Rectangle('deleteEllipse');
|
|
2099
2150
|
guiElem.elements.push(dtarget);
|
|
2100
|
-
|
|
2101
|
-
dtarget.
|
|
2151
|
+
var _size = this._uiConfig.templateConfig == 'standard' ? this._isMobile ? '28px' : '40px' : '35px';
|
|
2152
|
+
dtarget.width = _size;
|
|
2153
|
+
dtarget.height = _size;
|
|
2102
2154
|
dtarget.thickness = 1;
|
|
2103
2155
|
dtarget.background = this._colors.defaultBg;
|
|
2104
2156
|
var dbt = Button.CreateImageOnlyButton('buttond', this._uiConfig.templateConfig == 'standard' ? delButton : gdelButton);
|
|
2105
2157
|
guiElem.elements.push(dbt);
|
|
2106
2158
|
dbt.color = 'transparent';
|
|
2107
|
-
|
|
2108
|
-
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%';
|
|
2109
2162
|
dbt.onPointerClickObservable.add(function () {
|
|
2110
|
-
return
|
|
2163
|
+
return _this7._utilStore.onElementDeleted(elementInfo.setId, elementInfo.elementId);
|
|
2111
2164
|
});
|
|
2112
|
-
if (this._uiConfig.templateConfig == 'standard' && !guiElemRightBack) dtarget.linkOffsetY = -48;
|
|
2165
|
+
if (this._uiConfig.templateConfig == 'standard' && !guiElemRightBack) dtarget.linkOffsetY = !this._isMobile ? -48 : -30;
|
|
2113
2166
|
dtarget.addControl(dbt);
|
|
2114
2167
|
this._gui.addControl(dtarget);
|
|
2115
2168
|
dtarget.linkWithMesh((_guiElemRightBack = guiElemRightBack) !== null && _guiElemRightBack !== void 0 ? _guiElemRightBack : guiElemLeftBack);
|
|
2116
2169
|
}
|
|
2117
|
-
this._selectedHl.addExcludedMesh(this._plane);
|
|
2118
2170
|
this._guiElements.push(guiElem);
|
|
2119
2171
|
}
|
|
2120
2172
|
}, {
|
|
@@ -2122,7 +2174,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2122
2174
|
value: function createBoxCopyButtons(elementInfo, element) {
|
|
2123
2175
|
var _this$_scene$activeCa,
|
|
2124
2176
|
_this$_scene$activeCa2,
|
|
2125
|
-
|
|
2177
|
+
_this8 = this,
|
|
2126
2178
|
_this$_scene$activeCa3;
|
|
2127
2179
|
var guiElem = {
|
|
2128
2180
|
elementId: elementInfo.elementId,
|
|
@@ -2148,8 +2200,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2148
2200
|
target.rotation = 0;
|
|
2149
2201
|
}
|
|
2150
2202
|
(_this$_scene$activeCa2 = this._scene.activeCamera) === null || _this$_scene$activeCa2 === void 0 || _this$_scene$activeCa2.onViewMatrixChangedObservable.add(function () {
|
|
2151
|
-
var
|
|
2152
|
-
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);
|
|
2153
2205
|
if (_dir.z > 0) {
|
|
2154
2206
|
target.rotation = 180 * Math.PI / 180;
|
|
2155
2207
|
} else {
|
|
@@ -2157,8 +2209,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2157
2209
|
}
|
|
2158
2210
|
});
|
|
2159
2211
|
target.onPointerClickObservable.add(function () {
|
|
2160
|
-
var
|
|
2161
|
-
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');
|
|
2162
2214
|
});
|
|
2163
2215
|
break;
|
|
2164
2216
|
case 'BoxCopyRight':
|
|
@@ -2171,8 +2223,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2171
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));
|
|
2172
2224
|
guiElement.rotation = new Vector3(90 * Math.PI / 180, 0, 0);
|
|
2173
2225
|
(_this$_scene$activeCa3 = this._scene.activeCamera) === null || _this$_scene$activeCa3 === void 0 || _this$_scene$activeCa3.onViewMatrixChangedObservable.add(function () {
|
|
2174
|
-
var
|
|
2175
|
-
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);
|
|
2176
2228
|
if (_dir.z < 0) {
|
|
2177
2229
|
target.rotation = 180 * Math.PI / 180;
|
|
2178
2230
|
} else {
|
|
@@ -2180,16 +2232,16 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2180
2232
|
}
|
|
2181
2233
|
});
|
|
2182
2234
|
target.onPointerClickObservable.add(function () {
|
|
2183
|
-
var
|
|
2184
|
-
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');
|
|
2185
2237
|
});
|
|
2186
2238
|
break;
|
|
2187
2239
|
case 'BoxCopyTop':
|
|
2188
2240
|
target.rotation = 90 * Math.PI / 180;
|
|
2189
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));
|
|
2190
2242
|
target.onPointerClickObservable.add(function () {
|
|
2191
|
-
var
|
|
2192
|
-
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');
|
|
2193
2245
|
});
|
|
2194
2246
|
break;
|
|
2195
2247
|
}
|
|
@@ -2200,7 +2252,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2200
2252
|
}, {
|
|
2201
2253
|
key: "initGui",
|
|
2202
2254
|
value: function initGui(onElSelected, elements) {
|
|
2203
|
-
var
|
|
2255
|
+
var _this9 = this;
|
|
2204
2256
|
if (!this._selectionHandler) this.initSelectionHandler(onElSelected);
|
|
2205
2257
|
if (!this._scene) return;
|
|
2206
2258
|
if (!this._elementsInfo) return;
|
|
@@ -2212,20 +2264,28 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2212
2264
|
var isBoxPlanner = !this._elementsInfo.every(function (v) {
|
|
2213
2265
|
return v.type == 'PosNr';
|
|
2214
2266
|
});
|
|
2267
|
+
this._selectedHl.removeAllMeshes();
|
|
2268
|
+
this._selectedMeshes = [];
|
|
2215
2269
|
this._elementsInfo.forEach(function (elementInfo) {
|
|
2216
2270
|
var emnt = elements.find(function (el) {
|
|
2217
2271
|
return Number(el.bbn.name.slice(el.bbn.name.lastIndexOf('E') + 1, el.bbn.name.length)) == elementInfo.elementId;
|
|
2218
2272
|
});
|
|
2219
2273
|
if (!emnt) return;
|
|
2220
|
-
var element =
|
|
2274
|
+
var element = _this9._scene.getTransformNodeByName(emnt.bbn.name);
|
|
2221
2275
|
if (!element) return;
|
|
2222
|
-
if (elementInfo.type == 'PosNr')
|
|
2276
|
+
if (elementInfo.type == 'PosNr') _this9.createPosNr(elementInfo, element, isBoxPlanner, elements.length);else _this9.createBoxCopyButtons(elementInfo, element);
|
|
2223
2277
|
});
|
|
2224
2278
|
}
|
|
2225
2279
|
}, {
|
|
2226
2280
|
key: "selectElem",
|
|
2227
|
-
value: function selectElem(name) {
|
|
2228
|
-
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();
|
|
2229
2289
|
var _iterator = _createForOfIteratorHelper$5(this._gui.getControlsByType('ellipse')),
|
|
2230
2290
|
_step;
|
|
2231
2291
|
try {
|
|
@@ -2241,13 +2301,14 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2241
2301
|
this._guiElements.forEach(function (guiElem) {
|
|
2242
2302
|
return guiElem.elements.forEach(function (element) {
|
|
2243
2303
|
if (element.typeName == 'label') element.color = 'Black';
|
|
2244
|
-
if (element.typeName == 'Ellipse') element.color =
|
|
2304
|
+
if (element.typeName == 'Ellipse') element.color = _this10._colors.defaultBg;
|
|
2245
2305
|
if (guiElem.elementId.toString() == name) {
|
|
2246
|
-
if (element.typeName == 'label') element.color =
|
|
2306
|
+
if (element.typeName == 'label') element.color = _this10._colors.selectedBg;
|
|
2247
2307
|
if (element.typeName == 'Ellipse') element.color = 'White';
|
|
2248
2308
|
}
|
|
2249
2309
|
});
|
|
2250
2310
|
});
|
|
2311
|
+
onElSelected === null || onElSelected === void 0 || onElSelected(element.parent.name, Number(name));
|
|
2251
2312
|
}
|
|
2252
2313
|
}, {
|
|
2253
2314
|
key: "deactivateHighlightLayer",
|
|
@@ -2285,8 +2346,8 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2285
2346
|
}
|
|
2286
2347
|
}, {
|
|
2287
2348
|
key: "requestNewOverlayImage",
|
|
2288
|
-
value: function requestNewOverlayImage(viewpoint, focusedElement, targetCameraPosition) {
|
|
2289
|
-
var
|
|
2349
|
+
value: function requestNewOverlayImage(viewpoint, focusedElement, targetCameraPosition, updateCameraInformation) {
|
|
2350
|
+
var _this11 = this;
|
|
2290
2351
|
//this._overlayImage exists only when unity combi is enabled
|
|
2291
2352
|
if (!this._isUnityComb) return;
|
|
2292
2353
|
var elementId = undefined;
|
|
@@ -2302,17 +2363,18 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2302
2363
|
clearTimeout(this._timeoutId);
|
|
2303
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) {
|
|
2304
2365
|
this._timeoutId = setTimeout(function () {
|
|
2305
|
-
var
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
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, {
|
|
2309
2372
|
adjustZoomInUnity: false,
|
|
2310
2373
|
onlyAdjustZoomBBChanged: false,
|
|
2311
2374
|
rotationCenter: viewpoint.targetPos,
|
|
2312
2375
|
elementId: elementId,
|
|
2313
2376
|
setId: setId
|
|
2314
2377
|
});
|
|
2315
|
-
_this9._utilStore.updateCam = true;
|
|
2316
2378
|
}, 200);
|
|
2317
2379
|
} else {
|
|
2318
2380
|
this.fadeInOverlayImage(false);
|
|
@@ -2546,10 +2608,10 @@ var _context;
|
|
|
2546
2608
|
var unregisterContext = function unregisterContext() {
|
|
2547
2609
|
_context = undefined;
|
|
2548
2610
|
};
|
|
2549
|
-
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) {
|
|
2550
2612
|
var utilStore = new UtilStore(false, viewHandler);
|
|
2551
2613
|
var sceneStore = new SceneStore(scene, hqRenderScript, utilStore, apiConfig, jwt, onMissingGeo, updateCameraInformation);
|
|
2552
|
-
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);
|
|
2553
2615
|
return _context = {
|
|
2554
2616
|
utilStore: utilStore,
|
|
2555
2617
|
sceneStore: sceneStore,
|
|
@@ -2763,14 +2825,12 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2763
2825
|
path: _customMat.blob,
|
|
2764
2826
|
sizeMb: 0
|
|
2765
2827
|
});
|
|
2766
|
-
parsedMat.depthFunction = Constants.ALWAYS;
|
|
2767
|
-
parsedMat.disableColorWrite = true;
|
|
2768
2828
|
return _context.abrupt("return", {
|
|
2769
2829
|
mat: parsedMat,
|
|
2770
2830
|
found: true
|
|
2771
2831
|
});
|
|
2772
|
-
case
|
|
2773
|
-
_context.prev =
|
|
2832
|
+
case 29:
|
|
2833
|
+
_context.prev = 29;
|
|
2774
2834
|
_context.t0 = _context["catch"](8);
|
|
2775
2835
|
if (setDataRow) useUtilStoreContext().setAnalyzeDataRow({
|
|
2776
2836
|
type: 'MAT',
|
|
@@ -2780,19 +2840,17 @@ var customMat = /*#__PURE__*/function () {
|
|
|
2780
2840
|
path: _customMat.blob,
|
|
2781
2841
|
sizeMb: 0
|
|
2782
2842
|
});
|
|
2783
|
-
case
|
|
2843
|
+
case 32:
|
|
2784
2844
|
mat = new PBRMetallicRoughnessMaterial(_customMat.name, _customMat.scene);
|
|
2785
|
-
mat.depthFunction = Constants.ALWAYS;
|
|
2786
|
-
mat.disableColorWrite = true;
|
|
2787
2845
|
return _context.abrupt("return", {
|
|
2788
2846
|
mat: mat,
|
|
2789
2847
|
found: true
|
|
2790
2848
|
});
|
|
2791
|
-
case
|
|
2849
|
+
case 34:
|
|
2792
2850
|
case "end":
|
|
2793
2851
|
return _context.stop();
|
|
2794
2852
|
}
|
|
2795
|
-
}, _callee, null, [[8,
|
|
2853
|
+
}, _callee, null, [[8, 29]]);
|
|
2796
2854
|
}));
|
|
2797
2855
|
return function customMat(_x) {
|
|
2798
2856
|
return _ref.apply(this, arguments);
|
|
@@ -3507,7 +3565,7 @@ function shadow() {
|
|
|
3507
3565
|
var lightf = new DirectionalLight('dirf', new Vector3(0, -0.436, -0.9), scene);
|
|
3508
3566
|
var lightr = new DirectionalLight('dirr', new Vector3(0, -1, 0.3), scene);
|
|
3509
3567
|
var lightl = new DirectionalLight('dirb', new Vector3(0.2, -1, 0.2), scene);
|
|
3510
|
-
lightl.intensity =
|
|
3568
|
+
lightl.intensity = 1;
|
|
3511
3569
|
lightf.intensity = 2.2;
|
|
3512
3570
|
light.intensity = 1;
|
|
3513
3571
|
lightr.intensity = 1;
|
|
@@ -3527,8 +3585,6 @@ function shadow() {
|
|
|
3527
3585
|
z: 0
|
|
3528
3586
|
});
|
|
3529
3587
|
var std_mat = new PBRMetallicRoughnessMaterial('std_mat', scene);
|
|
3530
|
-
std_mat.depthFunction = Constants.ALWAYS;
|
|
3531
|
-
std_mat.disableColorWrite = true;
|
|
3532
3588
|
std_mat.metallic = 0;
|
|
3533
3589
|
scene.defaultMaterial = std_mat;
|
|
3534
3590
|
var mat = new PBRMetallicRoughnessMaterial('white', scene);
|
|
@@ -3583,16 +3639,15 @@ var parser = /*#__PURE__*/function () {
|
|
|
3583
3639
|
parentNode: parent
|
|
3584
3640
|
});
|
|
3585
3641
|
findMaterials(newCache);
|
|
3586
|
-
shadow();
|
|
3587
3642
|
});
|
|
3588
3643
|
} else if (!hasRendered) {
|
|
3644
|
+
shadow();
|
|
3589
3645
|
buildScene({
|
|
3590
3646
|
startNode: hqRenderScript.scene.nodes[0],
|
|
3591
3647
|
cache: cacheGroup,
|
|
3592
3648
|
cachedAssets: newCache
|
|
3593
3649
|
});
|
|
3594
3650
|
findMaterials(newCache);
|
|
3595
|
-
shadow();
|
|
3596
3651
|
}
|
|
3597
3652
|
utilStore.setRTVAnalyzeData();
|
|
3598
3653
|
deacCache(cacheGroup);
|
|
@@ -3610,7 +3665,7 @@ var parser = /*#__PURE__*/function () {
|
|
|
3610
3665
|
|
|
3611
3666
|
var LOG = getLogger('ARViewer', 'RealTimeRenderData');
|
|
3612
3667
|
function useRealTimeRenderData (_ref) {
|
|
3613
|
-
var
|
|
3668
|
+
var _sceneStore3;
|
|
3614
3669
|
var jwt = _ref.jwt,
|
|
3615
3670
|
actions = _ref.actions,
|
|
3616
3671
|
apiConfig = _ref.apiConfig,
|
|
@@ -3625,10 +3680,11 @@ function useRealTimeRenderData (_ref) {
|
|
|
3625
3680
|
plannedPlacesOnGrids = _ref.plannedPlacesOnGrids,
|
|
3626
3681
|
callbacks = _ref.callbacks,
|
|
3627
3682
|
uiConfig = _ref.uiConfig,
|
|
3628
|
-
renderInBackground = _ref.renderInBackground
|
|
3683
|
+
renderInBackground = _ref.renderInBackground,
|
|
3684
|
+
isMobile = _ref.isMobile;
|
|
3629
3685
|
var gameCanvas = useRef(null);
|
|
3630
3686
|
var sceneStore = useSceneStoreContext();
|
|
3631
|
-
useUtilStoreContext();
|
|
3687
|
+
var utilStore = useUtilStoreContext();
|
|
3632
3688
|
var gridStore = useGridStoreContext();
|
|
3633
3689
|
var uiStore = useUIStoreContext();
|
|
3634
3690
|
DracoCompression.Configuration = {
|
|
@@ -3669,47 +3725,48 @@ function useRealTimeRenderData (_ref) {
|
|
|
3669
3725
|
sceneStore.isInitializing = true;
|
|
3670
3726
|
if (!overlayImage) actions.toggleLoading('buildScene', false, true);
|
|
3671
3727
|
if (sceneStore.hasRendered) {
|
|
3672
|
-
_context2.next =
|
|
3728
|
+
_context2.next = 10;
|
|
3673
3729
|
break;
|
|
3674
3730
|
}
|
|
3675
3731
|
if (inBackground) sceneStore.scene.getEngine().setHardwareScalingLevel(5);
|
|
3676
3732
|
sceneStore.init(apiConfig.diva3darchive + '/', gameCanvas.current, viewpoint, resolution);
|
|
3677
|
-
|
|
3733
|
+
uiStore.resize(sceneStore.scene);
|
|
3734
|
+
_context2.next = 15;
|
|
3678
3735
|
break;
|
|
3679
|
-
case
|
|
3736
|
+
case 10:
|
|
3680
3737
|
sceneStore.hqRenderScript = JSON.parse(renderjob);
|
|
3681
3738
|
if (checkCachedData()) {
|
|
3682
|
-
_context2.next =
|
|
3739
|
+
_context2.next = 15;
|
|
3683
3740
|
break;
|
|
3684
3741
|
}
|
|
3685
3742
|
if (!overlayImage) actions.toggleLoading('buildScene', false, false);
|
|
3686
3743
|
sceneStore.isInitializing = false;
|
|
3687
3744
|
return _context2.abrupt("return");
|
|
3688
|
-
case
|
|
3745
|
+
case 15:
|
|
3689
3746
|
LOG.startTransaction({
|
|
3690
3747
|
event: 'buildScene',
|
|
3691
3748
|
message: 'Start Building Realtime Scene',
|
|
3692
3749
|
eventId: 'BUILD_SCENE'
|
|
3693
3750
|
});
|
|
3694
|
-
_context2.prev =
|
|
3751
|
+
_context2.prev = 16;
|
|
3695
3752
|
uiStore.deactivateHighlightLayer();
|
|
3696
|
-
_context2.next =
|
|
3753
|
+
_context2.next = 20;
|
|
3697
3754
|
return parser();
|
|
3698
|
-
case
|
|
3755
|
+
case 20:
|
|
3699
3756
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
3700
3757
|
if (freePlacesOnGrids || plannedPlacesOnGrids) gridStore.getGrids(freePlacesOnGrids, plannedPlacesOnGrids);
|
|
3701
|
-
_context2.next =
|
|
3758
|
+
_context2.next = 29;
|
|
3702
3759
|
break;
|
|
3703
|
-
case
|
|
3704
|
-
_context2.prev =
|
|
3705
|
-
_context2.t0 = _context2["catch"](
|
|
3760
|
+
case 24:
|
|
3761
|
+
_context2.prev = 24;
|
|
3762
|
+
_context2.t0 = _context2["catch"](16);
|
|
3706
3763
|
LOG.errorTransaction('BUILD_SCENE', 'RTS_0001', _context2.t0.message);
|
|
3707
3764
|
LOG.error(new DivaError('Error building scene', {
|
|
3708
3765
|
cause: _context2.t0,
|
|
3709
3766
|
code: 'RTS_0001'
|
|
3710
3767
|
}));
|
|
3711
3768
|
sceneStore.isInitializing = false;
|
|
3712
|
-
case
|
|
3769
|
+
case 29:
|
|
3713
3770
|
if (callbacks.setGlb) {
|
|
3714
3771
|
sceneStore.exportScene().then(function (res) {
|
|
3715
3772
|
var _callbacks$setGlb;
|
|
@@ -3724,11 +3781,11 @@ function useRealTimeRenderData (_ref) {
|
|
|
3724
3781
|
sceneStore.runRenderLoopIndefinitely();
|
|
3725
3782
|
sceneStore.scene.onAfterRenderObservable.add(onFirstFrame);
|
|
3726
3783
|
LOG.successTransaction('BUILD_SCENE');
|
|
3727
|
-
case
|
|
3784
|
+
case 34:
|
|
3728
3785
|
case "end":
|
|
3729
3786
|
return _context2.stop();
|
|
3730
3787
|
}
|
|
3731
|
-
}, _callee2, null, [[
|
|
3788
|
+
}, _callee2, null, [[16, 24]]);
|
|
3732
3789
|
}));
|
|
3733
3790
|
return _onSceneReady.apply(this, arguments);
|
|
3734
3791
|
}
|
|
@@ -3745,7 +3802,7 @@ function useRealTimeRenderData (_ref) {
|
|
|
3745
3802
|
}
|
|
3746
3803
|
|
|
3747
3804
|
// trigger if gamecanvas did not update but renderjob
|
|
3748
|
-
if (gameCanvas.current && sceneStore && sceneStore.scene) {
|
|
3805
|
+
if (gameCanvas.current && sceneStore && sceneStore.scene.getEngine()) {
|
|
3749
3806
|
var _queueRerender = function queueRerender() {
|
|
3750
3807
|
if (sceneStore.isInitializing) setTimeout(_queueRerender, 150);else {
|
|
3751
3808
|
if (sceneStore.scene.isReady()) onSceneReady();else sceneStore.scene.executeWhenReady(function () {
|
|
@@ -3756,38 +3813,42 @@ function useRealTimeRenderData (_ref) {
|
|
|
3756
3813
|
_queueRerender();
|
|
3757
3814
|
}
|
|
3758
3815
|
useEffect(function () {
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
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;
|
|
3765
3824
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3766
3825
|
while (1) switch (_context.prev = _context.next) {
|
|
3767
3826
|
case 0:
|
|
3768
|
-
if (
|
|
3769
|
-
_context.next =
|
|
3827
|
+
if (gameCanvas.current) {
|
|
3828
|
+
_context.next = 2;
|
|
3770
3829
|
break;
|
|
3771
3830
|
}
|
|
3772
|
-
_context.
|
|
3831
|
+
return _context.abrupt("return");
|
|
3832
|
+
case 2:
|
|
3833
|
+
_context.next = 4;
|
|
3773
3834
|
return EngineFactory.CreateAsync(gameCanvas.current, {
|
|
3774
3835
|
antialias: true,
|
|
3775
3836
|
stencil: true,
|
|
3776
|
-
audioEngine: false
|
|
3837
|
+
audioEngine: false,
|
|
3838
|
+
adaptToDeviceRatio: true
|
|
3777
3839
|
});
|
|
3778
|
-
case
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
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);
|
|
3785
3847
|
sceneStore = context.sceneStore;
|
|
3786
|
-
context.utilStore;
|
|
3848
|
+
utilStore = context.utilStore;
|
|
3787
3849
|
gridStore = context.gridStore;
|
|
3788
3850
|
uiStore = context.uiStore;
|
|
3789
|
-
|
|
3790
|
-
if (!bScene.isReady()) {
|
|
3851
|
+
if (!babylonScene.isReady()) {
|
|
3791
3852
|
_context.next = 19;
|
|
3792
3853
|
break;
|
|
3793
3854
|
}
|
|
@@ -3797,57 +3858,58 @@ function useRealTimeRenderData (_ref) {
|
|
|
3797
3858
|
_context.next = 20;
|
|
3798
3859
|
break;
|
|
3799
3860
|
case 19:
|
|
3800
|
-
|
|
3861
|
+
babylonScene.executeWhenReady(function () {
|
|
3801
3862
|
return onSceneReady();
|
|
3802
3863
|
});
|
|
3803
3864
|
case 20:
|
|
3804
|
-
resize = function resize() {
|
|
3805
|
-
if (inBackground || !scene || !scene.getEngine()) return;
|
|
3806
|
-
if (sceneStore.hasPlanned) sceneStore.doRenderControlLoop = true;
|
|
3807
|
-
scene.getEngine().resize(true);
|
|
3808
|
-
if (uiStore) uiStore.resize(scene);
|
|
3809
|
-
};
|
|
3810
3865
|
if (window && gameCanvas.current) {
|
|
3811
3866
|
window.addEventListener('resize', resize);
|
|
3812
3867
|
new ResizeObserver(resize).observe(gameCanvas.current);
|
|
3813
3868
|
}
|
|
3814
|
-
|
|
3815
|
-
scene.getEngine().dispose();
|
|
3816
|
-
if (window) {
|
|
3817
|
-
window.removeEventListener('resize', resize);
|
|
3818
|
-
}
|
|
3819
|
-
});
|
|
3820
|
-
case 23:
|
|
3821
|
-
return _context.abrupt("return");
|
|
3822
|
-
case 24:
|
|
3869
|
+
case 21:
|
|
3823
3870
|
case "end":
|
|
3824
3871
|
return _context.stop();
|
|
3825
3872
|
}
|
|
3826
3873
|
}, _callee);
|
|
3827
3874
|
}));
|
|
3828
|
-
return
|
|
3875
|
+
return _init.apply(this, arguments);
|
|
3829
3876
|
}
|
|
3830
|
-
|
|
3831
|
-
|
|
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
|
+
};
|
|
3832
3895
|
}, []);
|
|
3833
3896
|
useEffect(function () {
|
|
3834
|
-
if (overlayImage && uiStore) {
|
|
3897
|
+
if (overlayImage && uiStore && gameCanvas.current && sceneStore && sceneStore.scene.getEngine()) {
|
|
3898
|
+
if (!utilStore.updateCam) return;
|
|
3899
|
+
sceneStore.runRenderLoopForTime(1000);
|
|
3835
3900
|
uiStore.updateOverlayImage(overlayImage);
|
|
3836
3901
|
if (viewpoint) updateCam(viewpoint, sceneStore.scene);
|
|
3837
3902
|
}
|
|
3838
3903
|
}, [overlayImage]);
|
|
3839
3904
|
useEffect(function () {
|
|
3840
|
-
if (sceneStore && elementsInfo) {
|
|
3841
|
-
var activeElement = elementsInfo.find(function (e) {
|
|
3842
|
-
return e.active;
|
|
3843
|
-
});
|
|
3844
|
-
if (activeElement) sceneStore.selectedElement = activeElement.elementId.toString();
|
|
3905
|
+
if (sceneStore && elementsInfo && gameCanvas.current && sceneStore.scene.getEngine()) {
|
|
3845
3906
|
uiStore.addElementsInfo(elementsInfo);
|
|
3846
3907
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
3908
|
+
sceneStore.runRenderLoopForTime(1000);
|
|
3847
3909
|
}
|
|
3848
|
-
}, [elementsInfo, (
|
|
3910
|
+
}, [elementsInfo, (_sceneStore3 = sceneStore) === null || _sceneStore3 === void 0 ? void 0 : _sceneStore3.elements]);
|
|
3849
3911
|
useEffect(function () {
|
|
3850
|
-
if (!sceneStore) return;
|
|
3912
|
+
if (!gameCanvas.current || !sceneStore) return;
|
|
3851
3913
|
if (inBackground) {
|
|
3852
3914
|
sceneStore.stopRenderLoop();
|
|
3853
3915
|
} else if (sceneStore.hasRendered) {
|