@crystaldesign/real-time-viewer 25.13.0-beta.9 → 25.14.0-beta.1
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 +188 -119
- package/build/types/real-time-viewer/src/context.d.ts +0 -6
- 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/grids/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/store/GridStore.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/store/UIStore.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/types.d.ts +5 -10
- package/build/types/real-time-viewer/src/types.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/useRealTimeRenderData.d.ts.map +1 -1
- package/build/umd/real-time-viewer.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { useRef, useEffect, memo } from 'react';
|
|
1
|
+
import { useRef, useState, useEffect, memo } from 'react';
|
|
2
2
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
4
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
4
5
|
import { Color4, Color3 } from '@babylonjs/core/Maths/math.color';
|
|
5
6
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
6
7
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
7
8
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
8
9
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
10
|
+
import { makeAutoObservable, toJS } from 'mobx';
|
|
9
11
|
import { Tags } from '@babylonjs/core/Misc/tags';
|
|
10
12
|
import { MeshBuilder } from '@babylonjs/core/Meshes/meshBuilder';
|
|
11
13
|
import { Vector3, Matrix, Vector2 } from '@babylonjs/core/Maths/math.vector';
|
|
12
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
13
14
|
import { ActionManager } from '@babylonjs/core/Actions/actionManager';
|
|
14
15
|
import { ExecuteCodeAction } from '@babylonjs/core/Actions/directActions';
|
|
15
16
|
import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial';
|
|
@@ -49,7 +50,6 @@ import { DracoCompression } from '@babylonjs/core/Meshes/Compression/dracoCompre
|
|
|
49
50
|
import { loadAssetContainerAsync } from '@babylonjs/core/Loading/index';
|
|
50
51
|
import '@babylonjs/loaders/glTF/2.0/';
|
|
51
52
|
import { UniversalCamera } from '@babylonjs/core/Cameras/universalCamera';
|
|
52
|
-
import { toJS } from 'mobx';
|
|
53
53
|
import { jsx } from 'react/jsx-runtime';
|
|
54
54
|
|
|
55
55
|
(function() {
|
|
@@ -89,26 +89,26 @@ function GetCameraControls(camera) {
|
|
|
89
89
|
stopRender = false;
|
|
90
90
|
}
|
|
91
91
|
var cam = {
|
|
92
|
-
horiFov: camera.fov * 180 / Math.PI,
|
|
92
|
+
horiFov: Math.round(camera.fov * 180 / Math.PI * 1000) / 1000,
|
|
93
93
|
lensShiftX: 0,
|
|
94
94
|
lensShiftY: 0,
|
|
95
95
|
name: camera.name,
|
|
96
96
|
pos: {
|
|
97
|
-
x: -camera.position.x,
|
|
98
|
-
y: camera.position.y,
|
|
99
|
-
z: camera.position.z
|
|
97
|
+
x: Math.round(-camera.position.x * 1000) / 1000,
|
|
98
|
+
y: Math.round(camera.position.y * 1000) / 1000,
|
|
99
|
+
z: Math.round(camera.position.z * 1000) / 1000
|
|
100
100
|
},
|
|
101
101
|
rot: {
|
|
102
|
-
x: -camera.rotation.x * 180 / Math.PI,
|
|
103
|
-
y: 180 - camera.rotation.y * 180 / Math.PI,
|
|
104
|
-
z: camera.rotation.z * 180 / Math.PI
|
|
102
|
+
x: Math.round(-camera.rotation.x * 180 / Math.PI * 1000) / 1000,
|
|
103
|
+
y: Math.round((180 - camera.rotation.y * 180 / Math.PI) * 1000) / 1000,
|
|
104
|
+
z: Math.round(camera.rotation.z * 180 / Math.PI * 1000) / 1000
|
|
105
105
|
},
|
|
106
106
|
targetPos: {
|
|
107
|
-
x: -camera.target.x,
|
|
108
|
-
y: camera.target.y,
|
|
109
|
-
z: camera.target.z
|
|
107
|
+
x: Math.round(-camera.target.x * 1000) / 1000,
|
|
108
|
+
y: Math.round(camera.target.y * 1000) / 1000,
|
|
109
|
+
z: Math.round(camera.target.z * 1000) / 1000
|
|
110
110
|
},
|
|
111
|
-
vertFov: camera.fov * 180 / Math.PI
|
|
111
|
+
vertFov: Math.round(camera.fov * 180 / Math.PI * 1000) / 1000
|
|
112
112
|
};
|
|
113
113
|
uistore.requestNewOverlayImage(cam, sceneStore.focusedElement, sceneStore.targetCameraPosition, sceneStore.updateCameraInformation);
|
|
114
114
|
if (stopRender) {
|
|
@@ -335,7 +335,7 @@ function getGridControls(scene, element, selected, elements, selectMesh) {
|
|
|
335
335
|
if (closestGrid) {
|
|
336
336
|
var _closestGrid$metadata, _closestGrid$metadata2;
|
|
337
337
|
scene.getMeshesByTags('free').forEach(function (mesh) {
|
|
338
|
-
return mesh.material.alpha = 0.
|
|
338
|
+
return mesh.material.alpha = 0.1;
|
|
339
339
|
});
|
|
340
340
|
actualHQRObj.setAbsolutePosition(new Vector3(closestGrid.absolutePosition.x, closestGrid.absolutePosition.y, closestGrid.absolutePosition.z));
|
|
341
341
|
actualHQRObj.position = actualHQRObj.position.addInPlace((_closestGrid$metadata = (_closestGrid$metadata2 = closestGrid.metadata) === null || _closestGrid$metadata2 === void 0 ? void 0 : _closestGrid$metadata2.geoPos) !== null && _closestGrid$metadata !== void 0 ? _closestGrid$metadata : Vector3.Zero());
|
|
@@ -386,15 +386,15 @@ function getGridControls(scene, element, selected, elements, selectMesh) {
|
|
|
386
386
|
_curGrid = scene.getMeshByName((_curGrid4 = _curGrid) === null || _curGrid4 === void 0 ? void 0 : _curGrid4.name);
|
|
387
387
|
if (!_curGrid) return;
|
|
388
388
|
var r = _curGrid.name.split('_');
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
(_utilStore$viewHandle2 = utilStore.viewHandler) === null || _utilStore$viewHandle2 === void 0 || _utilStore$viewHandle2.viewPlannerHandler.onElementCopy(_curGrid.metadata.setId, _curGrid.metadata.elementId, {
|
|
389
|
+
selected.name.split('_');
|
|
390
|
+
var absoluteNewIndex = {
|
|
392
391
|
x: Number(r[1]),
|
|
393
392
|
y: Number(r[2]),
|
|
394
393
|
z: 0
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
|
|
394
|
+
};
|
|
395
|
+
(_scene$activeCamera3 = scene.activeCamera) === null || _scene$activeCamera3 === void 0 || _scene$activeCamera3.attachControl();
|
|
396
|
+
if (_curGrid.metadata.planned) return;
|
|
397
|
+
(_utilStore$viewHandle2 = utilStore.viewHandler) === null || _utilStore$viewHandle2 === void 0 || _utilStore$viewHandle2.paletteViewHandler.movePlannerElement(_curGrid.metadata.setId, _curGrid.metadata.elementId, absoluteNewIndex);
|
|
398
398
|
};
|
|
399
399
|
element === null || element === void 0 || element.addEventListener('pointermove', onGridMove, false);
|
|
400
400
|
element === null || element === void 0 || element.addEventListener('pointerup', _onGridMoveOut2, false);
|
|
@@ -423,19 +423,31 @@ function Grids () {
|
|
|
423
423
|
}
|
|
424
424
|
function setupPreviewBoxs(generalPlanningState) {
|
|
425
425
|
var entries = Object.entries(generalPlanningState);
|
|
426
|
+
var isMovableToNegativeSpace = false;
|
|
426
427
|
entries.forEach(function (_ref) {
|
|
427
428
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
428
429
|
key = _ref2[0],
|
|
429
430
|
gp = _ref2[1];
|
|
430
431
|
gp.grids.forEach(function (grid) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
432
|
+
var countX = 0;
|
|
433
|
+
var matrix = grid.matrix;
|
|
434
|
+
for (var x = 0; x < matrix.length; countX++) {
|
|
435
|
+
var _row$0$plannedElement, _row$0$plannedElement2;
|
|
436
|
+
var row = matrix[x];
|
|
437
|
+
var countY = 0;
|
|
438
|
+
for (var y = 0; y < row.length; countY++) {
|
|
439
|
+
var _cell$plannedElement$, _cell$plannedElement, _cell$plannedElement$2, _cell$plannedElement2, _gp$selectedElement, _cell$plannedElement3, _cell$plannedElement$3, _cell$plannedElement4;
|
|
440
|
+
var cell = row[y];
|
|
434
441
|
if (!gp.selectedElement) return; // no selection=no planning; can only delete existing
|
|
435
442
|
var name = 'box_' + cell.index.x + '_' + cell.index.y;
|
|
436
443
|
var size = (_cell$plannedElement$ = (_cell$plannedElement = cell.plannedElement) === null || _cell$plannedElement === void 0 ? void 0 : _cell$plannedElement.size) !== null && _cell$plannedElement$ !== void 0 ? _cell$plannedElement$ : gp.selectedElement.size;
|
|
437
|
-
var pos = new Vector3(size.width *
|
|
438
|
-
|
|
444
|
+
var pos = new Vector3(size.width * countX / 100, (size.height * countY + size.height / 2) / 100, 0);
|
|
445
|
+
if (cell.index.x == -1) {
|
|
446
|
+
isMovableToNegativeSpace = true;
|
|
447
|
+
pos.x = size.width * -0.01;
|
|
448
|
+
countX -= 1;
|
|
449
|
+
}
|
|
450
|
+
var box = createPreviewBox('box', name, {
|
|
439
451
|
width: (size.width + 1) / 100,
|
|
440
452
|
height: (size.height + 1) / 100,
|
|
441
453
|
depth: (size.depth + 1) / 100
|
|
@@ -443,10 +455,15 @@ function Grids () {
|
|
|
443
455
|
elementId: (_cell$plannedElement$2 = (_cell$plannedElement2 = cell.plannedElement) === null || _cell$plannedElement2 === void 0 ? void 0 : _cell$plannedElement2.elementId) !== null && _cell$plannedElement$2 !== void 0 ? _cell$plannedElement$2 : (_gp$selectedElement = gp.selectedElement) === null || _gp$selectedElement === void 0 ? void 0 : _gp$selectedElement.elementId,
|
|
444
456
|
setId: key,
|
|
445
457
|
direction: cell.index.y > 0 ? 'TOP' : cell.index.x < 0 ? 'LEFT' : 'RIGHT',
|
|
446
|
-
type: 'BOX'
|
|
458
|
+
type: 'BOX',
|
|
459
|
+
planned: !!cell.plannedElement
|
|
447
460
|
});
|
|
448
|
-
|
|
449
|
-
|
|
461
|
+
if (gp.selectedElement.elementId == ((_cell$plannedElement3 = cell.plannedElement) === null || _cell$plannedElement3 === void 0 ? void 0 : _cell$plannedElement3.elementId)) gridStore.selectBox(box);
|
|
462
|
+
y = (_cell$plannedElement$3 = (_cell$plannedElement4 = cell.plannedElement) === null || _cell$plannedElement4 === void 0 ? void 0 : _cell$plannedElement4.area.toY) !== null && _cell$plannedElement$3 !== void 0 ? _cell$plannedElement$3 : y + 1;
|
|
463
|
+
}
|
|
464
|
+
var toX = (_row$0$plannedElement = (_row$0$plannedElement2 = row[0].plannedElement) === null || _row$0$plannedElement2 === void 0 ? void 0 : _row$0$plannedElement2.area.toX) !== null && _row$0$plannedElement !== void 0 ? _row$0$plannedElement : x + 1;
|
|
465
|
+
x = isMovableToNegativeSpace && row[0].plannedElement ? toX + 1 : toX;
|
|
466
|
+
}
|
|
450
467
|
if (grid.overlapping) {
|
|
451
468
|
console.warn("overlapping logic is not yet implemented");
|
|
452
469
|
}
|
|
@@ -586,7 +603,7 @@ function Grids () {
|
|
|
586
603
|
type: 'GRID'
|
|
587
604
|
});
|
|
588
605
|
var bboxDiff = data.bboxSize.subtract(data.geoSize);
|
|
589
|
-
utilStore.moveObjectInDirection(box, new Vector3(1, 0, 0), (shelfIdx *
|
|
606
|
+
utilStore.moveObjectInDirection(box, new Vector3(-1, 0, 0), (shelfIdx * grid.deltaGrid.x + data.geoPosition.x) / 100 - (data.geoSize.x + bboxDiff.x) / 200 - box.metadata.rulePos.x);
|
|
590
607
|
utilStore.moveObjectInDirection(box, new Vector3(0, 1, 0), (shelfIdx * grid.deltaGrid.y + data.geoPosition.y) / 100 + (data.geoSize.y + bboxDiff.y) / 200 - box.metadata.rulePos.y);
|
|
591
608
|
utilStore.moveObjectInDirection(box, new Vector3(0, 0, 1), (shelfIdx * grid.deltaGrid.z + data.geoPosition.z) / 100 + (data.geoSize.z + bboxDiff.z) / 200 - box.metadata.rulePos.z);
|
|
592
609
|
Tags.AddTagsTo(box, noDelete ? 'disableDelete' : 'allowDelete');
|
|
@@ -608,19 +625,19 @@ function Grids () {
|
|
|
608
625
|
if (rotationY) box.rotation.y = (360 - rotationY) * Math.PI / 180;
|
|
609
626
|
box.metadata = metadata;
|
|
610
627
|
box.material = (_sceneStore$scene$get = sceneStore.scene.getMaterialByName('grid_visible')) !== null && _sceneStore$scene$get !== void 0 ? _sceneStore$scene$get : new PBRMaterial('grid_visible', sceneStore.scene);
|
|
611
|
-
box.material.alpha = 0.6;
|
|
628
|
+
box.material.alpha = type == "grid" ? 0.6 : 0;
|
|
612
629
|
if (!isFree) {
|
|
613
630
|
var _sceneStore$scene$get2;
|
|
614
631
|
box.material = (_sceneStore$scene$get2 = sceneStore.scene.getMaterialByName('grid_invisible')) !== null && _sceneStore$scene$get2 !== void 0 ? _sceneStore$scene$get2 : new PBRMaterial('grid_invisible', sceneStore.scene);
|
|
615
632
|
box.material.alpha = 0;
|
|
616
633
|
}
|
|
617
634
|
box.enableEdgesRendering();
|
|
618
|
-
box.edgesWidth = 0.
|
|
635
|
+
box.edgesWidth = type == "grid" ? 0.1 : 0;
|
|
619
636
|
box.edgesColor = new Color4(0.15, 0.15, 0.3, 1);
|
|
620
637
|
box.material.environmentIntensity = 0;
|
|
621
638
|
box.material.emissiveColor = new Color3(0.5, 0.5, 0.5);
|
|
622
639
|
box.material = (_sceneStore$scene$get3 = sceneStore.scene.getMaterialByName('grid_visible')) !== null && _sceneStore$scene$get3 !== void 0 ? _sceneStore$scene$get3 : new PBRMaterial('grid_visible', sceneStore.scene);
|
|
623
|
-
box.material.alpha = 0.6;
|
|
640
|
+
box.material.alpha = type == "grid" ? 0.6 : 0;
|
|
624
641
|
if (!isFree) {
|
|
625
642
|
var _sceneStore$scene$get4;
|
|
626
643
|
box.material = (_sceneStore$scene$get4 = sceneStore.scene.getMaterialByName('grid_invisible')) !== null && _sceneStore$scene$get4 !== void 0 ? _sceneStore$scene$get4 : new PBRMaterial('grid_invisible', sceneStore.scene);
|
|
@@ -629,9 +646,9 @@ function Grids () {
|
|
|
629
646
|
|
|
630
647
|
// the actionmanager can't use the bbox, therefore need to fake it https://forum.babylonjs.com/t/action-manager-pointer-trigger-with-bounding-box/43891
|
|
631
648
|
var fakeBBox = MeshBuilder.CreateBox('binfo_' + box.name, {
|
|
632
|
-
width: size.width * 1.
|
|
633
|
-
height: size.height * 1.
|
|
634
|
-
depth: size.depth * 1.
|
|
649
|
+
width: size.width * 1.2,
|
|
650
|
+
height: size.height * 1.2,
|
|
651
|
+
depth: size.depth * 1.2
|
|
635
652
|
}, sceneStore.scene);
|
|
636
653
|
fakeBBox.metadata = metadata;
|
|
637
654
|
fakeBBox.parent = box;
|
|
@@ -643,17 +660,17 @@ function Grids () {
|
|
|
643
660
|
fakeBBox.actionManager = new ActionManager(sceneStore.scene);
|
|
644
661
|
fakeBBox.actionManager.hoverCursor = 'pointer';
|
|
645
662
|
fakeBBox.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOverTrigger, function () {
|
|
646
|
-
return box.edgesWidth = 0.
|
|
663
|
+
return box.edgesWidth = type == "grid" ? 0.1 : 0;
|
|
647
664
|
}));
|
|
648
665
|
fakeBBox.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPickTrigger, function () {
|
|
649
666
|
return onPreviewClick(gridStore.getSelectedGrid());
|
|
650
667
|
}));
|
|
651
668
|
fakeBBox.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPickDownTrigger, function () {
|
|
652
669
|
var _gridStore$selectedGr, _gridStore$getSelecte;
|
|
653
|
-
|
|
670
|
+
if (((_gridStore$selectedGr = gridStore.selectedGrid) === null || _gridStore$selectedGr === void 0 ? void 0 : _gridStore$selectedGr.id) == ((_gridStore$getSelecte = gridStore.getSelectedGrid()) === null || _gridStore$getSelecte === void 0 ? void 0 : _gridStore$getSelecte.id) && noMove == false) gridStore.onGridMove(gridStore.getSelectedGrid());
|
|
654
671
|
}));
|
|
655
672
|
fakeBBox.actionManager.registerAction(new ExecuteCodeAction(ActionManager.OnPointerOutTrigger, function () {
|
|
656
|
-
return box.edgesWidth = 0.
|
|
673
|
+
return box.edgesWidth = type == "grid" ? 0.1 : 0;
|
|
657
674
|
}));
|
|
658
675
|
Tags.AddTagsTo(box, type);
|
|
659
676
|
Tags.AddTagsTo(box, isFree ? 'free' : 'planned');
|
|
@@ -795,9 +812,9 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
795
812
|
key: "selectBox",
|
|
796
813
|
value: function selectBox(mesh) {
|
|
797
814
|
this._sceneStore.scene.getMeshesByTags('box').forEach(function (mesh) {
|
|
798
|
-
return mesh.edgesWidth = 0
|
|
815
|
+
return mesh.edgesWidth = 0;
|
|
799
816
|
});
|
|
800
|
-
mesh.edgesWidth = 0
|
|
817
|
+
mesh.edgesWidth = 0;
|
|
801
818
|
mesh.enableEdgesRendering();
|
|
802
819
|
this._selectedGrid = mesh;
|
|
803
820
|
}
|
|
@@ -806,9 +823,9 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
806
823
|
value: function selectGrid(mesh, gridIdx, shelfIdx, basketId, disableDelete, disableMove) {
|
|
807
824
|
var _this = this;
|
|
808
825
|
this._sceneStore.scene.getMeshesByTags('grid').forEach(function (mesh) {
|
|
809
|
-
return mesh.edgesWidth = 0.
|
|
826
|
+
return mesh.edgesWidth = 0.1;
|
|
810
827
|
});
|
|
811
|
-
mesh.edgesWidth = 0.
|
|
828
|
+
mesh.edgesWidth = 0.1;
|
|
812
829
|
mesh.enableEdgesRendering();
|
|
813
830
|
this._selectedGrid = mesh;
|
|
814
831
|
this._uiStore.createGridGui(this._selectedGrid, !disableDelete ? function () {
|
|
@@ -932,7 +949,7 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
932
949
|
case 15:
|
|
933
950
|
this._allGrids = _context2.sent;
|
|
934
951
|
case 16:
|
|
935
|
-
_context2.next =
|
|
952
|
+
_context2.next = 26;
|
|
936
953
|
break;
|
|
937
954
|
case 18:
|
|
938
955
|
this._generalPlanningState = generalPlanningState;
|
|
@@ -945,28 +962,30 @@ var GridStore = /*#__PURE__*/function () {
|
|
|
945
962
|
return _context2.abrupt("return");
|
|
946
963
|
case 23:
|
|
947
964
|
this._grid.setupPreviewBoxs(generalPlanningState);
|
|
965
|
+
this._uiStore.excludePreviewBoxes();
|
|
948
966
|
callback === null || callback === void 0 || callback();
|
|
949
|
-
case
|
|
967
|
+
case 26:
|
|
950
968
|
if (this._allGrids) {
|
|
951
|
-
_context2.next =
|
|
969
|
+
_context2.next = 28;
|
|
952
970
|
break;
|
|
953
971
|
}
|
|
954
972
|
return _context2.abrupt("return");
|
|
955
|
-
case
|
|
973
|
+
case 28:
|
|
956
974
|
if (!(!((_this$_viewHandler4 = this._viewHandler) !== null && _this$_viewHandler4 !== void 0 && _this$_viewHandler4.tabgroupTypeActive('SHELFPLANNER')) || !freePlacesOnGrids && !plannedPlacesOnGrids)) {
|
|
957
|
-
_context2.next =
|
|
975
|
+
_context2.next = 32;
|
|
958
976
|
break;
|
|
959
977
|
}
|
|
960
978
|
this._grid.deleteAllGrids();
|
|
961
979
|
this._uiStore.removeGridGui();
|
|
962
980
|
return _context2.abrupt("return");
|
|
963
|
-
case
|
|
981
|
+
case 32:
|
|
964
982
|
if (plannedPlacesOnGrids) this._grid.setupPreviewGrids(this._allGrids, plannedPlacesOnGrids, freePlacesOnGrids);
|
|
983
|
+
this._uiStore.excludePreviewBoxes();
|
|
965
984
|
if (!doNotOverwrite) {
|
|
966
985
|
this._freePlacesOnGrids = freePlacesOnGrids;
|
|
967
986
|
this._plannedPlacesOnGrids = plannedPlacesOnGrids;
|
|
968
987
|
}
|
|
969
|
-
case
|
|
988
|
+
case 35:
|
|
970
989
|
case "end":
|
|
971
990
|
return _context2.stop();
|
|
972
991
|
}
|
|
@@ -1910,7 +1929,7 @@ function SelHandler (_ref) {
|
|
|
1910
1929
|
};
|
|
1911
1930
|
var onElementSelected = function onElementSelected(elem, hit, doubleClick) {
|
|
1912
1931
|
var _sceneStore$focusedEl, _sceneStore$focusedEl2;
|
|
1913
|
-
var elemName = elem.name.slice(
|
|
1932
|
+
var elemName = elem.name.slice(elem.name.lastIndexOf('E') + 1);
|
|
1914
1933
|
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);
|
|
1915
1934
|
if (doubleClick && curElemName == elemName && hit.pickedMesh) {
|
|
1916
1935
|
var _getParent = function getParent(mesh) {
|
|
@@ -1983,15 +2002,19 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
1983
2002
|
var utilStore = useUtilStoreContext();
|
|
1984
2003
|
if (!utilStore || !utilStore.updateCam) return;
|
|
1985
2004
|
_this._isStaticBg = overlayImage.isStaticBg;
|
|
2005
|
+
_this._plane.parent = _this._scene.activeCamera;
|
|
2006
|
+
_this._plane.setEnabled(true);
|
|
1986
2007
|
if (_this._isStaticBg) {
|
|
1987
2008
|
// no highlightlayer on static room bg
|
|
1988
2009
|
_this.deactivateHighlightLayer();
|
|
1989
|
-
_this._plane.setEnabled(true);
|
|
1990
2010
|
} // never switch to rtv when in room
|
|
1991
|
-
|
|
1992
|
-
_this.resize()
|
|
1993
|
-
|
|
1994
|
-
|
|
2011
|
+
|
|
2012
|
+
_this.resize(function () {
|
|
2013
|
+
return setTimeout(function () {
|
|
2014
|
+
return _this._diffuseTexture.updateURL(overlayImage.base64, undefined, function () {
|
|
2015
|
+
return _this.fadeInOverlayImage(_this._plane.visibility == 1 || !!_this._isStaticBg);
|
|
2016
|
+
});
|
|
2017
|
+
}, 100);
|
|
1995
2018
|
});
|
|
1996
2019
|
});
|
|
1997
2020
|
this._scene = scene;
|
|
@@ -2060,6 +2083,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2060
2083
|
this._isStaticBg = _overlayImage === null || _overlayImage === void 0 ? void 0 : _overlayImage.isStaticBg;
|
|
2061
2084
|
if (_overlayImage) {
|
|
2062
2085
|
this._plane.visibility = 1;
|
|
2086
|
+
this._plane.setEnabled(true);
|
|
2063
2087
|
this._isUnityComb = true;
|
|
2064
2088
|
this._enableSSAO(false);
|
|
2065
2089
|
if (_overlayImage.isStaticBg) this.fadeInOverlayImage(true);
|
|
@@ -2153,7 +2177,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2153
2177
|
value: function excludePreviewBoxes() {
|
|
2154
2178
|
var _this4 = this;
|
|
2155
2179
|
this._scene.getMeshesByTags('box').forEach(function (m) {
|
|
2156
|
-
|
|
2180
|
+
_this4._selectedHl.addExcludedMesh(m);
|
|
2157
2181
|
});
|
|
2158
2182
|
}
|
|
2159
2183
|
}, {
|
|
@@ -2209,7 +2233,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2209
2233
|
key: "resize",
|
|
2210
2234
|
value: function resize(callback) {
|
|
2211
2235
|
var _this$_runRenderLoopF;
|
|
2212
|
-
if (!this._scene || !this._scene.getEngine() || !this._scene.
|
|
2236
|
+
if (!this._scene || !this._scene.getEngine() || !this._scene.activeCamera) return;
|
|
2213
2237
|
(_this$_runRenderLoopF = this._runRenderLoopForTime) === null || _this$_runRenderLoopF === void 0 || _this$_runRenderLoopF.call(this, 10000);
|
|
2214
2238
|
this._scene.getEngine().resize(true);
|
|
2215
2239
|
// if rendering is cached it gets updated before resize is triggered, so check if the image is already correct
|
|
@@ -2245,10 +2269,12 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2245
2269
|
this.unityCombActive && ((_this$_runRenderLoopF2 = this._runRenderLoopForTime) === null || _this$_runRenderLoopF2 === void 0 ? void 0 : _this$_runRenderLoopF2.call(this, 5000));
|
|
2246
2270
|
this._selectedHl.removeAllMeshes();
|
|
2247
2271
|
this._selectedHl.addExcludedMesh(this._plane);
|
|
2272
|
+
this.excludePreviewBoxes();
|
|
2248
2273
|
if (this._plane.visibility == 1) this._selectedMeshes.forEach(function (_m) {
|
|
2249
2274
|
return _m.visibility = 0;
|
|
2250
2275
|
});
|
|
2251
2276
|
element.getChildMeshes().forEach(function (_m) {
|
|
2277
|
+
if (_m.name.includes("ABDECKPLATTE")) return;
|
|
2252
2278
|
_m.visibility = 1;
|
|
2253
2279
|
_this6._selectedHl.addMesh(_m, Color3.Black());
|
|
2254
2280
|
});
|
|
@@ -2261,10 +2287,12 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2261
2287
|
this.unityCombActive && ((_this$_runRenderLoopF3 = this._runRenderLoopForTime) === null || _this$_runRenderLoopF3 === void 0 ? void 0 : _this$_runRenderLoopF3.call(this, 5000));
|
|
2262
2288
|
this._selectedHl.removeAllMeshes();
|
|
2263
2289
|
this._selectedHl.addExcludedMesh(this._plane);
|
|
2290
|
+
this.excludePreviewBoxes();
|
|
2264
2291
|
if (this._plane.visibility == 1) element.getChildMeshes().forEach(function (_m) {
|
|
2265
2292
|
return _m.visibility = 0;
|
|
2266
2293
|
});
|
|
2267
2294
|
this._selectedMeshes.forEach(function (_m) {
|
|
2295
|
+
if (_m.name.includes("ABDECKPLATTE")) return;
|
|
2268
2296
|
_m.visibility = 1;
|
|
2269
2297
|
_this7._selectedHl.addMesh(_m, Color3.Black());
|
|
2270
2298
|
});
|
|
@@ -2373,6 +2401,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2373
2401
|
if (elementInfo.active) this.createTrash(guiElem, (_guiElemRightBack = guiElemRightBack) !== null && _guiElemRightBack !== void 0 ? _guiElemRightBack : guiElemLeftBack, elementInfo);
|
|
2374
2402
|
var childMeshes = element.getChildMeshes();
|
|
2375
2403
|
this._selectedHl.addExcludedMesh(this._plane);
|
|
2404
|
+
this.excludePreviewBoxes();
|
|
2376
2405
|
var cantSelect = (_this$_elementsInfo = this._elementsInfo) === null || _this$_elementsInfo === void 0 ? void 0 : _this$_elementsInfo.every(function (ei) {
|
|
2377
2406
|
return ei.active;
|
|
2378
2407
|
});
|
|
@@ -2399,7 +2428,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2399
2428
|
} else if (!cantSelect && elementInfo.active) {
|
|
2400
2429
|
var _m$actionManager;
|
|
2401
2430
|
_this9._selectedMeshes = [].concat(_toConsumableArray(_this9._selectedMeshes), _toConsumableArray(childMeshes));
|
|
2402
|
-
_this9._selectedHl.addMesh(m, Color3.Black());
|
|
2431
|
+
if (!m.name.includes("ABDECKPLATTE")) _this9._selectedHl.addMesh(m, Color3.Black());
|
|
2403
2432
|
(_m$actionManager = m.actionManager) === null || _m$actionManager === void 0 || _m$actionManager.dispose();
|
|
2404
2433
|
} else {
|
|
2405
2434
|
var _m$actionManager2;
|
|
@@ -2419,7 +2448,10 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2419
2448
|
elementId: elementInfo.elementId,
|
|
2420
2449
|
elements: []
|
|
2421
2450
|
};
|
|
2422
|
-
var bbox = element.getHierarchyBoundingVectors()
|
|
2451
|
+
var bbox = element.getHierarchyBoundingVectors(true, function (m) {
|
|
2452
|
+
if (m.name.includes("ABDECKPLATTE")) return false;
|
|
2453
|
+
return true;
|
|
2454
|
+
});
|
|
2423
2455
|
var guiElement = new TransformNode('boxCopyButton', this._scene);
|
|
2424
2456
|
guiElem.elements.push(guiElement);
|
|
2425
2457
|
guiElement.billboardMode = Mesh.BILLBOARDMODE_ALL;
|
|
@@ -2430,9 +2462,9 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2430
2462
|
target.height = '40px';
|
|
2431
2463
|
var dir = (_this$_scene$activeCa = this._scene.activeCamera) === null || _this$_scene$activeCa === void 0 ? void 0 : _this$_scene$activeCa.getDirection(Axis.Z);
|
|
2432
2464
|
switch (elementInfo.type) {
|
|
2433
|
-
case '
|
|
2434
|
-
guiElement.position = element.absolutePosition.add(new Vector3(
|
|
2435
|
-
target.name = '
|
|
2465
|
+
case 'BoxCopyRight':
|
|
2466
|
+
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));
|
|
2467
|
+
target.name = 'copyright';
|
|
2436
2468
|
if (dir.z > 0) {
|
|
2437
2469
|
target.rotation = 180 * Math.PI / 180;
|
|
2438
2470
|
} else {
|
|
@@ -2450,20 +2482,20 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2450
2482
|
target.onPointerClickObservable.add(function () {
|
|
2451
2483
|
var _this10$_onElementCop;
|
|
2452
2484
|
return (_this10$_onElementCop = _this10._onElementCopy) === null || _this10$_onElementCop === void 0 ? void 0 : _this10$_onElementCop.call(_this10, elementInfo.setId, elementInfo.elementId, {
|
|
2453
|
-
x:
|
|
2485
|
+
x: 1,
|
|
2454
2486
|
y: 0,
|
|
2455
2487
|
z: 0
|
|
2456
2488
|
});
|
|
2457
2489
|
});
|
|
2458
2490
|
break;
|
|
2459
|
-
case '
|
|
2491
|
+
case 'BoxCopyLeft':
|
|
2460
2492
|
if (dir.z < 0) {
|
|
2461
2493
|
target.rotation = 180 * Math.PI / 180;
|
|
2462
2494
|
} else {
|
|
2463
2495
|
target.rotation = 0;
|
|
2464
2496
|
}
|
|
2465
|
-
target.name = '
|
|
2466
|
-
guiElement.position = element.absolutePosition.add(new Vector3(
|
|
2497
|
+
target.name = 'copyleft';
|
|
2498
|
+
guiElement.position = element.absolutePosition.add(new Vector3(0, (bbox.max.y - bbox.min.y) / 2, bbox.max.z - bbox.min.z));
|
|
2467
2499
|
guiElement.rotation = new Vector3(90 * Math.PI / 180, 0, 0);
|
|
2468
2500
|
(_this$_scene$activeCa3 = this._scene.activeCamera) === null || _this$_scene$activeCa3 === void 0 || _this$_scene$activeCa3.onViewMatrixChangedObservable.add(function () {
|
|
2469
2501
|
var _this10$_scene$active2;
|
|
@@ -2477,7 +2509,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2477
2509
|
target.onPointerClickObservable.add(function () {
|
|
2478
2510
|
var _this10$_onElementCop2;
|
|
2479
2511
|
return (_this10$_onElementCop2 = _this10._onElementCopy) === null || _this10$_onElementCop2 === void 0 ? void 0 : _this10$_onElementCop2.call(_this10, elementInfo.setId, elementInfo.elementId, {
|
|
2480
|
-
x: 1,
|
|
2512
|
+
x: -1,
|
|
2481
2513
|
y: 0,
|
|
2482
2514
|
z: 0
|
|
2483
2515
|
});
|
|
@@ -2485,7 +2517,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2485
2517
|
break;
|
|
2486
2518
|
case 'BoxCopyTop':
|
|
2487
2519
|
target.rotation = 90 * Math.PI / 180;
|
|
2488
|
-
guiElement.position = element.absolutePosition.add(new Vector3(
|
|
2520
|
+
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));
|
|
2489
2521
|
target.onPointerClickObservable.add(function () {
|
|
2490
2522
|
var _this10$_onElementCop3;
|
|
2491
2523
|
return (_this10$_onElementCop3 = _this10._onElementCopy) === null || _this10$_onElementCop3 === void 0 ? void 0 : _this10$_onElementCop3.call(_this10, elementInfo.setId, elementInfo.elementId, {
|
|
@@ -2506,9 +2538,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2506
2538
|
var _this11 = this;
|
|
2507
2539
|
// elementinfo update before unity -- return and wait for after buildscene
|
|
2508
2540
|
if (!this._selectionHandler) this.initSelectionHandler(onElSelected);
|
|
2509
|
-
if (!this._scene || !this._elementsInfo
|
|
2510
|
-
return !!e.posNr;
|
|
2511
|
-
}).length > elements.length) return;
|
|
2541
|
+
if (!this._scene || !this._elementsInfo) return;
|
|
2512
2542
|
this.clearGui();
|
|
2513
2543
|
if (this._plane.parent == null) this._plane.parent = this._scene.activeCamera;
|
|
2514
2544
|
this._selectedHl.removeAllMeshes();
|
|
@@ -2521,6 +2551,7 @@ var UIStore = /*#__PURE__*/function () {
|
|
|
2521
2551
|
var element = _this11._scene.getTransformNodeByName(emnt.bbn.name);
|
|
2522
2552
|
if (!element || _this11._uiConfig.hideUiIcons) return;
|
|
2523
2553
|
if (elementInfo.type == 'PosNr') _this11.createPosNr(elementInfo, element, onElSelected);
|
|
2554
|
+
if (elementInfo.type == 'BoxCopyLeft' || elementInfo.type == 'BoxCopyRight' || elementInfo.type == 'BoxCopyTop') _this11.createBoxCopyButtons(elementInfo, element);
|
|
2524
2555
|
});
|
|
2525
2556
|
}
|
|
2526
2557
|
}, {
|
|
@@ -2852,19 +2883,37 @@ var UtilStore = /*#__PURE__*/function () {
|
|
|
2852
2883
|
}();
|
|
2853
2884
|
|
|
2854
2885
|
var _context;
|
|
2886
|
+
var Context = /*#__PURE__*/function () {
|
|
2887
|
+
function Context() {
|
|
2888
|
+
_classCallCheck(this, Context);
|
|
2889
|
+
_defineProperty(this, "sceneStore", void 0);
|
|
2890
|
+
_defineProperty(this, "utilStore", void 0);
|
|
2891
|
+
_defineProperty(this, "gridStore", void 0);
|
|
2892
|
+
_defineProperty(this, "uiStore", void 0);
|
|
2893
|
+
makeAutoObservable(this);
|
|
2894
|
+
}
|
|
2895
|
+
return _createClass(Context, [{
|
|
2896
|
+
key: "registerContext",
|
|
2897
|
+
value: function registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation, isMobile) {
|
|
2898
|
+
this.utilStore = new UtilStore(false, viewHandler);
|
|
2899
|
+
this.sceneStore = new SceneStore(scene, hqRenderScript, this.utilStore, apiConfig, jwt, onMissingGeo, updateCameraInformation);
|
|
2900
|
+
this.uiStore = new UIStore(scene, this.sceneStore.enableSSAO.bind(this.sceneStore), this.utilStore, uiConfig, requestNewOverlayImage, overlayImage, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.viewPlannerHandler.onElementCopy, this.sceneStore.runRenderLoopForTime.bind(this.sceneStore), viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.tabgroupTypeActive.bind(viewHandler), isMobile, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.divaWebPlanner.getPlannerInteractionInformation.bind(viewHandler.divaWebPlanner));
|
|
2901
|
+
this.gridStore = new GridStore(this.sceneStore, this.uiStore, uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.plannerMode, viewHandler);
|
|
2902
|
+
return {
|
|
2903
|
+
utilStore: this.utilStore,
|
|
2904
|
+
sceneStore: this.sceneStore,
|
|
2905
|
+
uiStore: this.uiStore,
|
|
2906
|
+
gridStore: this.gridStore
|
|
2907
|
+
};
|
|
2908
|
+
}
|
|
2909
|
+
}]);
|
|
2910
|
+
}();
|
|
2855
2911
|
var unregisterContext = function unregisterContext() {
|
|
2856
2912
|
_context = null;
|
|
2857
2913
|
};
|
|
2858
2914
|
var registerContext = function registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation, isMobile) {
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
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.bind(viewHandler), isMobile, viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.divaWebPlanner.getPlannerInteractionInformation.bind(viewHandler.divaWebPlanner));
|
|
2862
|
-
return _context = {
|
|
2863
|
-
utilStore: utilStore,
|
|
2864
|
-
sceneStore: sceneStore,
|
|
2865
|
-
uiStore: uiStore,
|
|
2866
|
-
gridStore: new GridStore(sceneStore, uiStore, uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.plannerMode, viewHandler)
|
|
2867
|
-
};
|
|
2915
|
+
_context = new Context();
|
|
2916
|
+
return _context.registerContext(scene, hqRenderScript, apiConfig, jwt, viewHandler, onMissingGeo, requestNewOverlayImage, overlayImage, uiConfig, updateCameraInformation, isMobile);
|
|
2868
2917
|
};
|
|
2869
2918
|
var useContext = function useContext() {
|
|
2870
2919
|
var _context2, _context3, _context4, _context5;
|
|
@@ -3987,33 +4036,32 @@ function updateCam(camera, scene) {
|
|
|
3987
4036
|
sceneStore.targetCameraPosition = position;
|
|
3988
4037
|
sceneStore.cameraTargetPosition = target;
|
|
3989
4038
|
var camInfo = {
|
|
3990
|
-
horiFov: cam.fov * 180 / Math.PI,
|
|
4039
|
+
horiFov: Math.round(cam.fov * 180 / Math.PI * 1000) / 1000,
|
|
3991
4040
|
lensShiftX: 0,
|
|
3992
4041
|
lensShiftY: 0,
|
|
3993
4042
|
name: cam.name,
|
|
3994
4043
|
pos: {
|
|
3995
|
-
x: -cam.position.x,
|
|
3996
|
-
y: cam.position.y,
|
|
3997
|
-
z: cam.position.z
|
|
4044
|
+
x: Math.round(-cam.position.x * 1000) / 1000,
|
|
4045
|
+
y: Math.round(cam.position.y * 1000) / 1000,
|
|
4046
|
+
z: Math.round(cam.position.z * 1000) / 1000
|
|
3998
4047
|
},
|
|
3999
4048
|
rot: {
|
|
4000
|
-
x: -cam.rotation.x * 180 / Math.PI,
|
|
4001
|
-
y: 180 - cam.rotation.y * 180 / Math.PI,
|
|
4002
|
-
z: cam.rotation.z * 180 / Math.PI
|
|
4049
|
+
x: Math.round(-cam.rotation.x * 180 / Math.PI * 1000) / 1000,
|
|
4050
|
+
y: Math.round((180 - cam.rotation.y * 180 / Math.PI) * 1000) / 1000,
|
|
4051
|
+
z: Math.round(cam.rotation.z * 180 / Math.PI * 1000) / 1000
|
|
4003
4052
|
},
|
|
4004
4053
|
targetPos: {
|
|
4005
|
-
x: -cam.target.x,
|
|
4006
|
-
y: cam.target.y,
|
|
4007
|
-
z: cam.target.z
|
|
4054
|
+
x: Math.round(-cam.target.x * 1000) / 1000,
|
|
4055
|
+
y: Math.round(cam.target.y * 1000) / 1000,
|
|
4056
|
+
z: Math.round(cam.target.z * 1000) / 1000
|
|
4008
4057
|
},
|
|
4009
|
-
vertFov: cam.fov * 180 / Math.PI
|
|
4058
|
+
vertFov: Math.round(cam.fov * 180 / Math.PI * 1000) / 1000
|
|
4010
4059
|
};
|
|
4011
4060
|
(_sceneStore$updateCam = sceneStore.updateCameraInformation) === null || _sceneStore$updateCam === void 0 || _sceneStore$updateCam.call(sceneStore, camInfo);
|
|
4012
4061
|
}
|
|
4013
4062
|
|
|
4014
4063
|
var LOG = getLogger('ARViewer', 'RealTimeRenderData');
|
|
4015
4064
|
function useRealTimeRenderData (_ref) {
|
|
4016
|
-
var _sceneStore4;
|
|
4017
4065
|
var jwt = _ref.jwt,
|
|
4018
4066
|
apiConfig = _ref.apiConfig,
|
|
4019
4067
|
renderjob = _ref.renderjob,
|
|
@@ -4032,11 +4080,15 @@ function useRealTimeRenderData (_ref) {
|
|
|
4032
4080
|
disableToggleLoading = _ref.disableToggleLoading;
|
|
4033
4081
|
var gameCanvas = useRef(null);
|
|
4034
4082
|
var actions = useDivaCore().actions;
|
|
4083
|
+
var _useState = useState(useContext()),
|
|
4084
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
4085
|
+
context = _useState2[0],
|
|
4086
|
+
setContext = _useState2[1];
|
|
4035
4087
|
var _useContext = useContext(),
|
|
4036
4088
|
sceneStore = _useContext.sceneStore,
|
|
4037
4089
|
uiStore = _useContext.uiStore,
|
|
4038
|
-
gridStore = _useContext.gridStore
|
|
4039
|
-
|
|
4090
|
+
gridStore = _useContext.gridStore;
|
|
4091
|
+
_useContext.utilStore;
|
|
4040
4092
|
DracoCompression.Configuration = {
|
|
4041
4093
|
decoder: {
|
|
4042
4094
|
wasmUrl: apiConfig.diva3darchive + '/draco/draco_decoder_gltf.js',
|
|
@@ -4103,7 +4155,7 @@ function useRealTimeRenderData (_ref) {
|
|
|
4103
4155
|
return parser();
|
|
4104
4156
|
case 20:
|
|
4105
4157
|
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
4106
|
-
if ((uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.plannerMode) == 'BoxPlanner' && viewHandler !== null && viewHandler !== void 0 && viewHandler.settingsState.generalPlanningState) gridStore.getGrids('BoxPlanner', viewHandler.settingsState.generalPlanningState
|
|
4158
|
+
if ((uiConfig === null || uiConfig === void 0 ? void 0 : uiConfig.plannerMode) == 'BoxPlanner' && freePlacesOnGrids || plannedPlacesOnGrids) gridStore.getGrids('ShelfPlanner', undefined, freePlacesOnGrids, plannedPlacesOnGrids);else if (viewHandler !== null && viewHandler !== void 0 && viewHandler.settingsState.generalPlanningState) gridStore.getGrids('BoxPlanner', viewHandler.settingsState.generalPlanningState);
|
|
4107
4159
|
_context2.next = 29;
|
|
4108
4160
|
break;
|
|
4109
4161
|
case 24:
|
|
@@ -4137,6 +4189,7 @@ function useRealTimeRenderData (_ref) {
|
|
|
4137
4189
|
}
|
|
4138
4190
|
function onFirstFrame() {
|
|
4139
4191
|
var _callbacks$onInitiali2;
|
|
4192
|
+
//sceneStore?.scene?.debugLayer?.show?.();
|
|
4140
4193
|
sceneStore.isInitializing = false;
|
|
4141
4194
|
sceneStore.scene.onAfterRenderObservable.removeCallback(onFirstFrame);
|
|
4142
4195
|
if (!overlayImage && !disableToggleLoading) actions.toggleLoading('buildScene', false, false);
|
|
@@ -4186,13 +4239,7 @@ function useRealTimeRenderData (_ref) {
|
|
|
4186
4239
|
}
|
|
4187
4240
|
return _context.abrupt("return");
|
|
4188
4241
|
case 2:
|
|
4189
|
-
|
|
4190
|
-
_context.next = 4;
|
|
4191
|
-
break;
|
|
4192
|
-
}
|
|
4193
|
-
return _context.abrupt("return");
|
|
4194
|
-
case 4:
|
|
4195
|
-
_context.next = 6;
|
|
4242
|
+
_context.next = 4;
|
|
4196
4243
|
return EngineFactory.CreateAsync(gameCanvas.current, {
|
|
4197
4244
|
antialias: true,
|
|
4198
4245
|
stencil: true,
|
|
@@ -4209,25 +4256,26 @@ function useRealTimeRenderData (_ref) {
|
|
|
4209
4256
|
wasmPath: apiConfig.diva3darchive + '/twgsl/twgsl.wasm'
|
|
4210
4257
|
}
|
|
4211
4258
|
});
|
|
4212
|
-
case
|
|
4259
|
+
case 4:
|
|
4213
4260
|
babylonEngine = _context.sent;
|
|
4214
4261
|
engine = babylonEngine;
|
|
4215
4262
|
if (!disposed) {
|
|
4216
|
-
_context.next =
|
|
4263
|
+
_context.next = 9;
|
|
4217
4264
|
break;
|
|
4218
4265
|
}
|
|
4219
4266
|
engine.dispose();
|
|
4220
4267
|
return _context.abrupt("return");
|
|
4221
|
-
case
|
|
4268
|
+
case 9:
|
|
4222
4269
|
babylonEngine.renderEvenInBackground = renderInBackground;
|
|
4223
4270
|
babylonEngine.disablePerformanceMonitorInBackground = true;
|
|
4224
4271
|
babylonScene = new Scene(babylonEngine, undefined);
|
|
4225
4272
|
babylonScene.useRightHandedSystem = true;
|
|
4226
4273
|
babylonScene.clearColor = new Color4(255, 255, 255, 255);
|
|
4227
4274
|
context = registerContext(babylonScene, renderjob, apiConfig, jwt, viewHandler, callbacks.onMissingGeo, callbacks.requestNewOverlayImage, overlayImage, uiConfig, callbacks.updateCameraInformation, !!isMobile);
|
|
4275
|
+
setContext(context);
|
|
4228
4276
|
createCams(babylonScene, viewpoint);
|
|
4229
4277
|
sceneStore = context.sceneStore;
|
|
4230
|
-
|
|
4278
|
+
context.utilStore;
|
|
4231
4279
|
gridStore = context.gridStore;
|
|
4232
4280
|
uiStore = context.uiStore;
|
|
4233
4281
|
babylonScene.executeWhenReady(function () {
|
|
@@ -4238,7 +4286,7 @@ function useRealTimeRenderData (_ref) {
|
|
|
4238
4286
|
_observer = new ResizeObserver(resize);
|
|
4239
4287
|
_observer.observe(gameCanvas.current);
|
|
4240
4288
|
}
|
|
4241
|
-
case
|
|
4289
|
+
case 23:
|
|
4242
4290
|
case "end":
|
|
4243
4291
|
return _context.stop();
|
|
4244
4292
|
}
|
|
@@ -4271,13 +4319,26 @@ function useRealTimeRenderData (_ref) {
|
|
|
4271
4319
|
};
|
|
4272
4320
|
}, []);
|
|
4273
4321
|
useEffect(function () {
|
|
4274
|
-
|
|
4322
|
+
function debounceUpdateWithUnityData() {
|
|
4323
|
+
var _useContext2 = useContext(),
|
|
4324
|
+
sceneStore = _useContext2.sceneStore,
|
|
4325
|
+
uiStore = _useContext2.uiStore,
|
|
4326
|
+
utilStore = _useContext2.utilStore;
|
|
4327
|
+
if (!overlayImage || !uiStore || !gameCanvas.current || !sceneStore || !sceneStore.scene.getEngine()) {
|
|
4328
|
+
setTimeout(function () {
|
|
4329
|
+
return debounceUpdateWithUnityData();
|
|
4330
|
+
}, 300);
|
|
4331
|
+
return;
|
|
4332
|
+
}
|
|
4275
4333
|
if (!utilStore.updateCam) return;
|
|
4276
4334
|
sceneStore.runRenderLoopForTime(5000);
|
|
4277
4335
|
shadow(); // make sure the lighting is set up otherwise the image has a wrong color
|
|
4278
|
-
|
|
4279
|
-
|
|
4336
|
+
sceneStore.scene.executeWhenReady(function () {
|
|
4337
|
+
uiStore.updateOverlayImage(overlayImage);
|
|
4338
|
+
if (viewpoint) updateCam(viewpoint, sceneStore.scene);
|
|
4339
|
+
});
|
|
4280
4340
|
}
|
|
4341
|
+
debounceUpdateWithUnityData();
|
|
4281
4342
|
}, [overlayImage]);
|
|
4282
4343
|
useEffect(function () {
|
|
4283
4344
|
var _sceneStore2;
|
|
@@ -4285,20 +4346,28 @@ function useRealTimeRenderData (_ref) {
|
|
|
4285
4346
|
if ((freePlacesOnGrids || plannedPlacesOnGrids) && uiConfig.plannerMode != 'BoxPlanner') {
|
|
4286
4347
|
gridStore.getGrids('ShelfPlanner', undefined, freePlacesOnGrids, plannedPlacesOnGrids);
|
|
4287
4348
|
} else if (viewHandler.settingsState.generalPlanningState) {
|
|
4349
|
+
gridStore.getGrids('BoxPlanner', viewHandler.settingsState.generalPlanningState);
|
|
4288
4350
|
LOG.debug('rtv -> generalPlanningState: ', toJS(viewHandler.settingsState.generalPlanningState));
|
|
4289
|
-
sceneStore.scene.executeWhenReady(function () {
|
|
4290
|
-
return gridStore.getGrids('BoxPlanner', viewHandler.settingsState.generalPlanningState, undefined, undefined, false, false, uiStore.excludePreviewBoxes.bind(uiStore));
|
|
4291
|
-
});
|
|
4292
4351
|
sceneStore.runRenderLoopForTime(5000);
|
|
4293
4352
|
}
|
|
4294
4353
|
}, [viewHandler === null || viewHandler === void 0 ? void 0 : viewHandler.settingsState.generalPlanningState, freePlacesOnGrids, plannedPlacesOnGrids]);
|
|
4295
4354
|
useEffect(function () {
|
|
4296
|
-
|
|
4297
|
-
if (!elementsInfo || !gameCanvas.current || !((_sceneStore3 = sceneStore) !== null && _sceneStore3 !== void 0 && (_sceneStore3 = _sceneStore3.scene) !== null && _sceneStore3 !== void 0 && (_sceneStore3$getEngin = _sceneStore3.getEngine) !== null && _sceneStore3$getEngin !== void 0 && _sceneStore3$getEngin.call(_sceneStore3))) return;
|
|
4355
|
+
if (!elementsInfo || !uiStore) return;
|
|
4298
4356
|
uiStore.addElementsInfo(elementsInfo);
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4357
|
+
function initGuiAwaiter() {
|
|
4358
|
+
if (!elementsInfo || elementsInfo.filter(function (e) {
|
|
4359
|
+
return !!e.posNr;
|
|
4360
|
+
}).length > sceneStore.elements.length) {
|
|
4361
|
+
setTimeout(function () {
|
|
4362
|
+
return initGuiAwaiter();
|
|
4363
|
+
}, 1000);
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4366
|
+
uiStore.initGui(callbacks.onElementSelected, sceneStore.elements);
|
|
4367
|
+
sceneStore.runRenderLoopForTime(5000);
|
|
4368
|
+
}
|
|
4369
|
+
initGuiAwaiter();
|
|
4370
|
+
}, [elementsInfo, context]);
|
|
4302
4371
|
useEffect(function () {
|
|
4303
4372
|
if (!gameCanvas.current || !sceneStore) return;
|
|
4304
4373
|
if (inBackground) sceneStore.stopRenderLoop();else if (sceneStore.hasRendered) sceneStore.runRenderLoopIndefinitely();
|