@shopware-ag/dive 1.12.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/build/dive.cjs +458 -405
  2. package/build/dive.cjs.map +1 -1
  3. package/build/dive.d.cts +314 -78
  4. package/build/dive.d.ts +314 -78
  5. package/build/dive.js +430 -377
  6. package/build/dive.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/__test__/DIVE.test.ts +33 -29
  9. package/src/axiscamera/AxisCamera.ts +1 -1
  10. package/src/axiscamera/__test__/AxisCamera.test.ts +1 -1
  11. package/src/com/Communication.ts +59 -14
  12. package/src/com/__test__/Communication.test.ts +111 -31
  13. package/src/com/actions/index.ts +2 -0
  14. package/src/com/actions/object/addobject.ts +1 -1
  15. package/src/com/actions/object/deleteobject.ts +1 -1
  16. package/src/com/actions/object/deselectobject.ts +1 -1
  17. package/src/com/actions/object/getallobjects.ts +1 -1
  18. package/src/com/actions/object/getobjects.ts +1 -1
  19. package/src/com/actions/object/selectobject.ts +1 -1
  20. package/src/com/actions/object/setparent.ts +9 -0
  21. package/src/com/actions/object/updateobject.ts +1 -1
  22. package/src/com/actions/scene/getallscenedata.ts +1 -1
  23. package/src/com/types/COMBaseEntity.ts +9 -0
  24. package/src/com/types/COMEntity.ts +7 -0
  25. package/src/com/types/COMEntityType.ts +1 -0
  26. package/src/com/types/COMGeometry.ts +6 -0
  27. package/src/com/types/COMGroup.ts +9 -0
  28. package/src/com/types/COMLight.ts +10 -0
  29. package/src/com/types/COMMaterial.ts +12 -0
  30. package/src/com/types/COMModel.ts +12 -0
  31. package/src/com/types/COMPov.ts +8 -0
  32. package/src/com/types/COMPrimitive.ts +12 -0
  33. package/src/com/types/index.ts +21 -0
  34. package/src/dive.ts +9 -16
  35. package/src/grid/Grid.ts +1 -1
  36. package/src/grid/__test__/Grid.test.ts +1 -1
  37. package/src/group/Group.ts +126 -0
  38. package/src/group/__test__/Group.test.ts +100 -0
  39. package/src/helper/findSceneRecursive/findSceneRecursive.ts +1 -1
  40. package/src/light/AmbientLight.ts +3 -0
  41. package/src/light/PointLight.ts +6 -3
  42. package/src/light/SceneLight.ts +2 -0
  43. package/src/light/__test__/PointLight.test.ts +8 -6
  44. package/src/light/__test__/SceneLight.test.ts +8 -6
  45. package/src/loadingmanager/LoadingManager.ts +1 -1
  46. package/src/loadingmanager/__test__/LoadingManager.test.ts +1 -1
  47. package/src/mediacreator/MediaCreator.ts +1 -1
  48. package/src/mediacreator/__test__/MediaCreator.test.ts +6 -4
  49. package/src/model/Model.ts +8 -7
  50. package/src/model/__test__/Model.test.ts +13 -10
  51. package/src/primitive/Primitive.ts +4 -3
  52. package/src/primitive/__test__/Primitive.test.ts +9 -7
  53. package/src/primitive/floor/Floor.ts +1 -1
  54. package/src/primitive/floor/__test__/Floor.test.ts +1 -1
  55. package/src/renderer/__test__/Renderer.test.ts +1 -1
  56. package/src/scene/Scene.ts +29 -9
  57. package/src/scene/__test__/Scene.test.ts +33 -19
  58. package/src/scene/root/Root.ts +239 -72
  59. package/src/scene/root/__test__/Root.test.ts +476 -114
  60. package/src/toolbox/BaseTool.ts +1 -1
  61. package/src/toolbox/Toolbox.ts +1 -1
  62. package/src/toolbox/__test__/BaseTool.test.ts +1 -1
  63. package/src/toolbox/__test__/Toolbox.test.ts +1 -1
  64. package/src/toolbox/select/SelectTool.ts +1 -1
  65. package/src/toolbox/select/__test__/SelectTool.test.ts +11 -9
  66. package/src/toolbox/transform/TransformTool.ts +1 -1
  67. package/src/toolbox/transform/__test__/TransformTool.test.ts +12 -10
  68. package/src/types/SceneObjects.ts +14 -0
  69. package/src/types/index.ts +5 -0
  70. package/src/com/index.ts +0 -3
  71. package/src/com/types.ts +0 -58
  72. package/src/scene/root/lightroot/LightRoot.ts +0 -99
  73. package/src/scene/root/lightroot/__test__/LightRoot.test.ts +0 -145
  74. package/src/scene/root/modelroot/ModelRoot.ts +0 -98
  75. package/src/scene/root/modelroot/__test__/ModelRoot.test.ts +0 -189
  76. package/src/scene/root/primitiveroot/PrimitiveRoot.ts +0 -88
  77. package/src/scene/root/primitiveroot/__test__/PrimitiveRoot.test.ts +0 -181
package/build/dive.js CHANGED
@@ -649,13 +649,10 @@ var DIVERenderer = class extends WebGLRenderer {
649
649
  };
650
650
 
651
651
  // src/scene/Scene.ts
652
- import { Color as Color8, Scene as Scene2 } from "three";
652
+ import { Color as Color7, Scene as Scene2 } from "three";
653
653
 
654
654
  // src/scene/root/Root.ts
655
- import { Box3 as Box33, Object3D as Object3D11 } from "three";
656
-
657
- // src/scene/root/lightroot/LightRoot.ts
658
- import { Color as Color4, Object3D as Object3D5 } from "three";
655
+ import { Box3 as Box34, Color as Color5, Object3D as Object3D8 } from "three";
659
656
 
660
657
  // src/light/AmbientLight.ts
661
658
  init_VisibilityLayerMask();
@@ -663,6 +660,8 @@ import { AmbientLight, Object3D } from "three";
663
660
  var DIVEAmbientLight = class extends Object3D {
664
661
  constructor() {
665
662
  super();
663
+ this.isDIVELight = true;
664
+ this.isDIVEAmbientLight = true;
666
665
  this.name = "DIVEAmbientLight";
667
666
  this._light = new AmbientLight(16777215, 1);
668
667
  this._light.layers.mask = PRODUCT_LAYER_MASK;
@@ -818,6 +817,10 @@ var _DIVECommunication = class _DIVECommunication {
818
817
  returnValue = this.generateMedia(payload);
819
818
  break;
820
819
  }
820
+ case "SET_PARENT": {
821
+ returnValue = this.setParent(payload);
822
+ break;
823
+ }
821
824
  }
822
825
  this.dispatch(action, payload);
823
826
  return returnValue;
@@ -844,8 +847,8 @@ var _DIVECommunication = class _DIVECommunication {
844
847
  name: this.scene.name,
845
848
  mediaItem: null,
846
849
  backgroundColor: "#" + this.scene.background.getHexString(),
847
- floorEnabled: this.scene.Root.Floor.visible,
848
- floorColor: "#" + this.scene.Root.Floor.material.color.getHexString(),
850
+ floorEnabled: this.scene.Floor.visible,
851
+ floorColor: "#" + this.scene.Floor.material.color.getHexString(),
849
852
  userCamera: {
850
853
  position: this.controller.object.position.clone(),
851
854
  target: this.controller.target.clone()
@@ -873,6 +876,7 @@ var _DIVECommunication = class _DIVECommunication {
873
876
  }
874
877
  addObject(payload) {
875
878
  if (this.registered.get(payload.id)) return false;
879
+ if (payload.parent === void 0) payload.parent = null;
876
880
  this.registered.set(payload.id, payload);
877
881
  this.scene.AddSceneObject(payload);
878
882
  return true;
@@ -882,7 +886,7 @@ var _DIVECommunication = class _DIVECommunication {
882
886
  if (!objectToUpdate) return false;
883
887
  this.registered.set(payload.id, __spreadValues(__spreadValues({}, objectToUpdate), payload));
884
888
  const updatedObject = this.registered.get(payload.id);
885
- this.scene.UpdateSceneObject(updatedObject);
889
+ this.scene.UpdateSceneObject(__spreadProps(__spreadValues({}, payload), { id: updatedObject.id, entityType: updatedObject.entityType }));
886
890
  Object.assign(payload, updatedObject);
887
891
  return true;
888
892
  }
@@ -1001,14 +1005,14 @@ var _DIVECommunication = class _DIVECommunication {
1001
1005
  updateScene(payload) {
1002
1006
  if (payload.name !== void 0) this.scene.name = payload.name;
1003
1007
  if (payload.backgroundColor !== void 0) this.scene.SetBackground(payload.backgroundColor);
1004
- if (payload.gridEnabled !== void 0) this.scene.Root.Grid.SetVisibility(payload.gridEnabled);
1005
- if (payload.floorEnabled !== void 0) this.scene.Root.Floor.SetVisibility(payload.floorEnabled);
1006
- if (payload.floorColor !== void 0) this.scene.Root.Floor.SetColor(payload.floorColor);
1008
+ if (payload.gridEnabled !== void 0) this.scene.Grid.SetVisibility(payload.gridEnabled);
1009
+ if (payload.floorEnabled !== void 0) this.scene.Floor.SetVisibility(payload.floorEnabled);
1010
+ if (payload.floorColor !== void 0) this.scene.Floor.SetColor(payload.floorColor);
1007
1011
  payload.name = this.scene.name;
1008
1012
  payload.backgroundColor = "#" + this.scene.background.getHexString();
1009
- payload.gridEnabled = this.scene.Root.Grid.visible;
1010
- payload.floorEnabled = this.scene.Root.Floor.visible;
1011
- payload.floorColor = "#" + this.scene.Root.Floor.material.color.getHexString();
1013
+ payload.gridEnabled = this.scene.Grid.visible;
1014
+ payload.floorEnabled = this.scene.Floor.visible;
1015
+ payload.floorColor = "#" + this.scene.Floor.material.color.getHexString();
1012
1016
  return true;
1013
1017
  }
1014
1018
  generateMedia(payload) {
@@ -1024,6 +1028,31 @@ var _DIVECommunication = class _DIVECommunication {
1024
1028
  payload.dataUri = this.mediaGenerator.GenerateMedia(position, target, payload.width, payload.height);
1025
1029
  return true;
1026
1030
  }
1031
+ setParent(payload) {
1032
+ const object = this.registered.get(payload.object.id);
1033
+ if (!object) return false;
1034
+ const sceneObject = this.scene.GetSceneObject(object);
1035
+ if (!sceneObject) return false;
1036
+ if (payload.parent === null) {
1037
+ this.scene.Root.attach(sceneObject);
1038
+ return true;
1039
+ }
1040
+ if (payload.object.id === payload.parent.id) {
1041
+ return false;
1042
+ }
1043
+ const parent = this.registered.get(payload.parent.id);
1044
+ if (!parent) {
1045
+ this.scene.Root.attach(sceneObject);
1046
+ return true;
1047
+ }
1048
+ const parentObject = this.scene.GetSceneObject(parent);
1049
+ if (!parentObject) {
1050
+ this.scene.Root.attach(sceneObject);
1051
+ return true;
1052
+ }
1053
+ parentObject.attach(sceneObject);
1054
+ return true;
1055
+ }
1027
1056
  };
1028
1057
  _DIVECommunication.__instances = [];
1029
1058
  var DIVECommunication = _DIVECommunication;
@@ -1033,6 +1062,8 @@ init_VisibilityLayerMask();
1033
1062
  var DIVEPointLight = class extends Object3D3 {
1034
1063
  constructor() {
1035
1064
  super();
1065
+ this.isDIVELight = true;
1066
+ this.isDIVEPointLight = true;
1036
1067
  this.isMoveable = true;
1037
1068
  this.isSelectable = true;
1038
1069
  this.gizmo = null;
@@ -1081,6 +1112,8 @@ import { DirectionalLight, HemisphereLight, Object3D as Object3D4 } from "three"
1081
1112
  var DIVESceneLight = class extends Object3D4 {
1082
1113
  constructor() {
1083
1114
  super();
1115
+ this.isDIVELight = true;
1116
+ this.isDIVESceneLight = true;
1084
1117
  this.name = "DIVESceneLight";
1085
1118
  this._hemiLight = new HemisphereLight(16777215, 16777215, 2);
1086
1119
  this._hemiLight.layers.mask = PRODUCT_LAYER_MASK;
@@ -1115,87 +1148,9 @@ var DIVESceneLight = class extends Object3D4 {
1115
1148
  }
1116
1149
  };
1117
1150
 
1118
- // src/scene/root/lightroot/LightRoot.ts
1119
- var DIVELightRoot = class extends Object3D5 {
1120
- constructor() {
1121
- super();
1122
- this.name = "LightRoot";
1123
- }
1124
- GetLight(object) {
1125
- if (object.id === void 0) {
1126
- console.warn("LightRoot.GetLight: object.id is undefined");
1127
- return void 0;
1128
- }
1129
- return this.children.find((object3D) => object3D.userData.id === object.id);
1130
- }
1131
- UpdateLight(light) {
1132
- if (light.id === void 0) {
1133
- console.warn(`LightRoot.UpdateLight: light.id is undefined`);
1134
- return;
1135
- }
1136
- let sceneObject = this.children.find((object3D) => object3D.userData.id === light.id);
1137
- if (!sceneObject) {
1138
- switch (light.type) {
1139
- case "scene": {
1140
- sceneObject = new DIVESceneLight();
1141
- break;
1142
- }
1143
- case "ambient": {
1144
- sceneObject = new DIVEAmbientLight();
1145
- break;
1146
- }
1147
- case "point": {
1148
- sceneObject = new DIVEPointLight();
1149
- break;
1150
- }
1151
- default: {
1152
- console.warn(`LightRoot.UpdateLight: Unknown light type: ${light.type}`);
1153
- return;
1154
- }
1155
- }
1156
- sceneObject.userData.id = light.id;
1157
- this.add(sceneObject);
1158
- }
1159
- if (light.name !== void 0 && light.name !== null) sceneObject.name = light.name;
1160
- if (light.position !== void 0 && light.position !== null) sceneObject.position.set(light.position.x, light.position.y, light.position.z);
1161
- if (light.intensity !== void 0 && light.intensity !== null) sceneObject.SetIntensity(light.intensity);
1162
- if (light.enabled !== void 0 && light.enabled !== null) sceneObject.SetEnabled(light.enabled);
1163
- if (light.color !== void 0 && light.color !== null) sceneObject.SetColor(new Color4(light.color));
1164
- if (light.visible !== void 0 && light.visible !== null) sceneObject.visible = light.visible;
1165
- }
1166
- DeleteLight(light) {
1167
- if (light.id === void 0) {
1168
- console.warn("LightRoot.DeleteLight: light.id is undefined");
1169
- return;
1170
- }
1171
- const sceneObject = this.children.find((object3D) => object3D.userData.id === light.id);
1172
- if (!sceneObject) {
1173
- console.warn(`LightRoot.DeleteLight: Light with id ${light.id} not found`);
1174
- return;
1175
- }
1176
- const findScene = (object) => {
1177
- if (object.parent !== null) {
1178
- return findScene(object.parent);
1179
- }
1180
- ;
1181
- return object;
1182
- };
1183
- const scene = findScene(sceneObject);
1184
- scene.children.find((object) => {
1185
- if ("isTransformControls" in object) {
1186
- object.detach();
1187
- }
1188
- });
1189
- this.remove(sceneObject);
1190
- }
1191
- };
1192
-
1193
- // src/scene/root/modelroot/ModelRoot.ts
1194
- import { Object3D as Object3D7 } from "three";
1195
-
1196
1151
  // src/model/Model.ts
1197
1152
  init_VisibilityLayerMask();
1198
- import { Box3, Color as Color5, MeshStandardMaterial, Object3D as Object3D6, Raycaster as Raycaster2, Vector3 as Vector32 } from "three";
1153
+ import { Box3, MeshStandardMaterial, Object3D as Object3D5, Raycaster as Raycaster2, Vector3 as Vector32 } from "three";
1199
1154
 
1200
1155
  // src/helper/findSceneRecursive/findSceneRecursive.ts
1201
1156
  var findSceneRecursive = (object) => {
@@ -1206,9 +1161,10 @@ var findSceneRecursive = (object) => {
1206
1161
  };
1207
1162
 
1208
1163
  // src/model/Model.ts
1209
- var DIVEModel = class extends Object3D6 {
1164
+ var DIVEModel = class extends Object3D5 {
1210
1165
  constructor() {
1211
1166
  super();
1167
+ this.isDIVEModel = true;
1212
1168
  this.isSelectable = true;
1213
1169
  this.isMoveable = true;
1214
1170
  this.gizmo = null;
@@ -1257,7 +1213,7 @@ var DIVEModel = class extends Object3D6 {
1257
1213
  this._material.vertexColors = material.vertexColors;
1258
1214
  }
1259
1215
  if (material.color !== void 0) {
1260
- this._material.color = new Color5(material.color);
1216
+ this._material.color.set(material.color);
1261
1217
  }
1262
1218
  if (material.map !== void 0) {
1263
1219
  this._material.map = material.map;
@@ -1285,7 +1241,6 @@ var DIVEModel = class extends Object3D6 {
1285
1241
  }
1286
1242
  if (this._mesh) {
1287
1243
  this._mesh.material = this._material;
1288
- this._mesh.material.needsUpdate = true;
1289
1244
  }
1290
1245
  }
1291
1246
  SetToWorldOrigin() {
@@ -1368,85 +1323,13 @@ var DIVELoadingManager = class {
1368
1323
  }
1369
1324
  };
1370
1325
 
1371
- // src/scene/root/modelroot/ModelRoot.ts
1372
- var DIVEModelRoot = class extends Object3D7 {
1373
- constructor() {
1374
- super();
1375
- this.name = "ModelRoot";
1376
- this.loadingManager = new DIVELoadingManager();
1377
- }
1378
- GetModel(object) {
1379
- if (object.id === void 0) {
1380
- console.warn("ModelRoot.GetModel: object.id is undefined");
1381
- return void 0;
1382
- }
1383
- return this.children.find((object3D) => object3D.userData.id === object.id);
1384
- }
1385
- UpdateModel(object) {
1386
- if (object.id === void 0) {
1387
- console.warn("ModelRoot.UpdateModel: object.id is undefined");
1388
- return;
1389
- }
1390
- let sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
1391
- if (!sceneObject && object.uri !== void 0) {
1392
- const model = new DIVEModel();
1393
- sceneObject = model;
1394
- sceneObject.userData.id = object.id;
1395
- this.add(sceneObject);
1396
- this.loadingManager.LoadGLTF(object.uri).then((gltf) => {
1397
- var _a;
1398
- model.SetModel(gltf);
1399
- (_a = DIVECommunication.get(object.id)) == null ? void 0 : _a.PerformAction("MODEL_LOADED", { id: object.id });
1400
- });
1401
- }
1402
- if (object.position !== void 0) sceneObject.SetPosition(object.position);
1403
- if (object.rotation !== void 0) sceneObject.SetRotation(object.rotation);
1404
- if (object.scale !== void 0) sceneObject.SetScale(object.scale);
1405
- if (object.visible !== void 0) sceneObject.SetVisibility(object.visible);
1406
- if (object.material !== void 0) sceneObject.SetMaterial(object.material);
1407
- }
1408
- DeleteModel(object) {
1409
- if (object.id === void 0) {
1410
- console.warn(`ModelRoot.DeleteModel: object.id is undefined`);
1411
- return;
1412
- }
1413
- const sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
1414
- if (!sceneObject) {
1415
- console.warn(`ModelRoot.DeleteModel: Model with id ${object.id} not found`);
1416
- return;
1417
- }
1418
- const findScene = (object2) => {
1419
- if (object2.parent !== null) {
1420
- return findScene(object2.parent);
1421
- }
1422
- ;
1423
- return object2;
1424
- };
1425
- const scene = findScene(sceneObject);
1426
- scene.children.find((object2) => {
1427
- if ("isTransformControls" in object2) {
1428
- object2.detach();
1429
- }
1430
- });
1431
- this.remove(sceneObject);
1432
- }
1433
- PlaceOnFloor(object) {
1434
- if (object.id === void 0) console.warn("ModelRoot.PlaceOnFloor: object.id is undefined");
1435
- const sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
1436
- if (!sceneObject) return;
1437
- sceneObject.PlaceOnFloor();
1438
- }
1439
- };
1440
-
1441
- // src/scene/root/primitiveroot/PrimitiveRoot.ts
1442
- import { Object3D as Object3D9 } from "three";
1443
-
1444
1326
  // src/primitive/Primitive.ts
1445
- import { Box3 as Box32, BoxGeometry, BufferGeometry, Color as Color6, ConeGeometry, CylinderGeometry, Mesh as Mesh3, MeshStandardMaterial as MeshStandardMaterial2, Object3D as Object3D8, Raycaster as Raycaster3, SphereGeometry as SphereGeometry2, Vector3 as Vector33 } from "three";
1327
+ import { Box3 as Box32, BoxGeometry, BufferGeometry, Color as Color4, ConeGeometry, CylinderGeometry, Mesh as Mesh3, MeshStandardMaterial as MeshStandardMaterial2, Object3D as Object3D6, Raycaster as Raycaster3, SphereGeometry as SphereGeometry2, Vector3 as Vector33 } from "three";
1446
1328
  init_VisibilityLayerMask();
1447
- var DIVEPrimitive = class extends Object3D8 {
1329
+ var DIVEPrimitive = class extends Object3D6 {
1448
1330
  constructor() {
1449
1331
  super();
1332
+ this.isDIVEPrimitive = true;
1450
1333
  this.isSelectable = true;
1451
1334
  this.isMoveable = true;
1452
1335
  this.gizmo = null;
@@ -1483,7 +1366,7 @@ var DIVEPrimitive = class extends Object3D8 {
1483
1366
  primitiveMaterial.vertexColors = material.vertexColors;
1484
1367
  }
1485
1368
  if (material.color !== void 0) {
1486
- primitiveMaterial.color = new Color6(material.color);
1369
+ primitiveMaterial.color = new Color4(material.color);
1487
1370
  }
1488
1371
  if (material.map !== void 0) {
1489
1372
  primitiveMaterial.map = material.map;
@@ -1614,142 +1497,105 @@ var DIVEPrimitive = class extends Object3D8 {
1614
1497
  }
1615
1498
  };
1616
1499
 
1617
- // src/scene/root/primitiveroot/PrimitiveRoot.ts
1618
- var DIVEPrimitiveRoot = class extends Object3D9 {
1500
+ // src/group/Group.ts
1501
+ import { Box3 as Box33, BoxGeometry as BoxGeometry2, Mesh as Mesh4, MeshBasicMaterial as MeshBasicMaterial2, Object3D as Object3D7, Vector3 as Vector34 } from "three";
1502
+ var DIVEGroup = class extends Object3D7 {
1619
1503
  constructor() {
1620
1504
  super();
1621
- this.name = "PrimitiveRoot";
1505
+ this.isDIVEGroup = true;
1506
+ this.isSelectable = true;
1507
+ this.isMoveable = true;
1508
+ this.name = "DIVEGroup";
1509
+ this._bb = new Box33();
1510
+ this._boxMesh = new Mesh4(new BoxGeometry2(0, 0, 0), new MeshBasicMaterial2({ color: 16711680, wireframe: true }));
1511
+ this._boxMesh.visible = false;
1512
+ this.add(this._boxMesh);
1622
1513
  }
1623
- GetPrimitive(object) {
1624
- if (object.id === void 0) {
1625
- console.warn("PrimitiveRoot.GetPrimitive: object.id is undefined");
1626
- return void 0;
1627
- }
1628
- return this.children.find((object3D) => object3D.userData.id === object.id);
1514
+ SetPosition(position) {
1515
+ this.position.set(position.x, position.y, position.z);
1629
1516
  }
1630
- UpdatePrimitive(object) {
1631
- if (object.id === void 0) {
1632
- console.warn("PrimitiveRoot.UpdatePrimitive: object.id is undefined");
1633
- return;
1634
- }
1635
- let sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
1636
- if (!sceneObject && object.geometry !== void 0) {
1637
- const primitive = new DIVEPrimitive();
1638
- primitive.SetGeometry(object.geometry);
1639
- sceneObject = primitive;
1640
- sceneObject.userData.id = object.id;
1641
- this.add(sceneObject);
1642
- }
1643
- if (object.position !== void 0) sceneObject.SetPosition(object.position);
1644
- if (object.rotation !== void 0) sceneObject.SetRotation(object.rotation);
1645
- if (object.scale !== void 0) sceneObject.SetScale(object.scale);
1646
- if (object.visible !== void 0) sceneObject.SetVisibility(object.visible);
1647
- if (object.material !== void 0) sceneObject.SetMaterial(object.material);
1517
+ SetRotation(rotation) {
1518
+ this.rotation.setFromVector3(new Vector34(rotation.x, rotation.y, rotation.z));
1648
1519
  }
1649
- DeletePrimitive(object) {
1650
- if (object.id === void 0) {
1651
- console.warn(`PrimitiveRoot.DeletePrimitive: object.id is undefined`);
1652
- return;
1653
- }
1654
- const sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
1655
- if (!sceneObject) {
1656
- console.warn(`PrimitiveRoot.DeletePrimitive: Primitive with id ${object.id} not found`);
1657
- return;
1658
- }
1659
- const findScene = (object2) => {
1660
- if (object2.parent !== null) {
1661
- return findScene(object2.parent);
1662
- }
1663
- ;
1664
- return object2;
1665
- };
1666
- const scene = findScene(sceneObject);
1667
- scene.children.find((object2) => {
1668
- if ("isTransformControls" in object2) {
1669
- object2.detach();
1670
- }
1520
+ SetScale(scale) {
1521
+ this.scale.set(scale.x, scale.y, scale.z);
1522
+ }
1523
+ SetVisibility(visible) {
1524
+ this.traverse((child) => {
1525
+ if (child.uuid === this._boxMesh.uuid) return;
1526
+ child.visible = visible;
1671
1527
  });
1672
- this.remove(sceneObject);
1673
1528
  }
1674
- PlaceOnFloor(object) {
1675
- if (object.id === void 0) console.warn("PrimitiveRoot.PlaceOnFloor: object.id is undefined");
1676
- const sceneObject = this.children.find((object3D) => object3D.userData.id === object.id);
1677
- if (!sceneObject) return;
1678
- sceneObject.PlaceOnFloor();
1529
+ SetBoundingBoxVisibility(visible) {
1530
+ this._boxMesh.visible = visible;
1679
1531
  }
1680
- };
1681
-
1682
- // src/primitive/floor/Floor.ts
1683
- init_VisibilityLayerMask();
1684
- import { Color as Color7, Mesh as Mesh4, MeshStandardMaterial as MeshStandardMaterial3, PlaneGeometry } from "three";
1685
- var DIVEFloor = class extends Mesh4 {
1686
- constructor() {
1687
- super(new PlaneGeometry(1e4, 1e4), new MeshStandardMaterial3({ color: new Color7(150 / 255, 150 / 255, 150 / 255) }));
1688
- this.isFloor = true;
1689
- this.name = "Floor";
1690
- this.layers.mask = PRODUCT_LAYER_MASK;
1691
- this.receiveShadow = true;
1692
- this.rotateX(-Math.PI / 2);
1532
+ attach(object) {
1533
+ super.attach(object);
1534
+ this.recalculatePosition();
1535
+ this.updateBoxMesh();
1536
+ return this;
1693
1537
  }
1694
- SetVisibility(visible) {
1695
- this.visible = visible;
1538
+ remove(object) {
1539
+ super.remove(object);
1540
+ this.recalculatePosition();
1541
+ this.updateBoxMesh();
1542
+ return this;
1696
1543
  }
1697
- SetColor(color) {
1698
- this.material.color = new Color7(color);
1544
+ /**
1545
+ * Recalculates the position of the group based on it's bounding box.
1546
+ * Children's world positions are kept.
1547
+ */
1548
+ recalculatePosition() {
1549
+ var _a;
1550
+ const childrensWorldPositions = this.children.map((child) => child.getWorldPosition(new Vector34()));
1551
+ const bbcenter = this.updateBB();
1552
+ this.position.copy(bbcenter);
1553
+ this.children.forEach((child, i) => {
1554
+ if (child.uuid === this._boxMesh.uuid) return;
1555
+ child.position.copy(this.worldToLocal(childrensWorldPositions[i]));
1556
+ });
1557
+ (_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position });
1699
1558
  }
1700
- };
1701
-
1702
- // src/constant/GridColors.ts
1703
- var GRID_CENTER_LINE_COLOR = "#888888";
1704
- var GRID_SIDE_LINE_COLOR = "#dddddd";
1705
-
1706
- // src/grid/Grid.ts
1707
- init_VisibilityLayerMask();
1708
- import { GridHelper, Object3D as Object3D10 } from "three";
1709
- var DIVEGrid = class extends Object3D10 {
1710
- constructor() {
1711
- super();
1712
- this.name = "Grid";
1713
- const grid = new GridHelper(100, 100, GRID_CENTER_LINE_COLOR, GRID_SIDE_LINE_COLOR);
1714
- grid.material.depthTest = false;
1715
- grid.layers.mask = HELPER_LAYER_MASK;
1716
- this.add(grid);
1559
+ /**
1560
+ * Updates the bounding box of the group.
1561
+ * @returns {Vector3} The new center of the bounding box.
1562
+ */
1563
+ updateBB() {
1564
+ this._bb.makeEmpty();
1565
+ this.children.forEach((child) => {
1566
+ if (child.uuid === this._boxMesh.uuid) return;
1567
+ this._bb.expandByObject(child);
1568
+ });
1569
+ return this._bb.getCenter(new Vector34());
1717
1570
  }
1718
- SetVisibility(visible) {
1719
- this.visible = visible;
1571
+ updateBoxMesh() {
1572
+ this._boxMesh.geometry = new BoxGeometry2(this._bb.max.x - this._bb.min.x, this._bb.max.y - this._bb.min.y, this._bb.max.z - this._bb.min.z);
1573
+ }
1574
+ onMove() {
1575
+ var _a;
1576
+ (_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("UPDATE_OBJECT", { id: this.userData.id, position: this.position, rotation: this.rotation, scale: this.scale });
1577
+ }
1578
+ onSelect() {
1579
+ var _a;
1580
+ (_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("SELECT_OBJECT", { id: this.userData.id });
1581
+ }
1582
+ onDeselect() {
1583
+ var _a;
1584
+ (_a = DIVECommunication.get(this.userData.id)) == null ? void 0 : _a.PerformAction("DESELECT_OBJECT", { id: this.userData.id });
1720
1585
  }
1721
1586
  };
1722
1587
 
1723
1588
  // src/scene/root/Root.ts
1724
- var DIVERoot = class extends Object3D11 {
1725
- get Floor() {
1726
- return this.floor;
1727
- }
1728
- get Grid() {
1729
- return this.grid;
1730
- }
1589
+ var DIVERoot = class extends Object3D8 {
1731
1590
  constructor() {
1732
1591
  super();
1592
+ this.isDIVERoot = true;
1733
1593
  this.name = "Root";
1734
- this.lightRoot = new DIVELightRoot();
1735
- this.add(this.lightRoot);
1736
- this.modelRoot = new DIVEModelRoot();
1737
- this.add(this.modelRoot);
1738
- this.primitiveRoot = new DIVEPrimitiveRoot();
1739
- this.add(this.primitiveRoot);
1740
- this.floor = new DIVEFloor();
1741
- this.add(this.floor);
1742
- this.grid = new DIVEGrid();
1743
- this.add(this.grid);
1594
+ this.loadingManager = new DIVELoadingManager();
1744
1595
  }
1745
1596
  ComputeSceneBB() {
1746
- const bb = new Box33();
1747
- this.modelRoot.traverse((object) => {
1748
- if ("isObject3D" in object) {
1749
- bb.expandByObject(object);
1750
- }
1751
- });
1752
- this.primitiveRoot.traverse((object) => {
1597
+ const bb = new Box34();
1598
+ this.traverse((object) => {
1753
1599
  if ("isObject3D" in object) {
1754
1600
  bb.expandByObject(object);
1755
1601
  }
@@ -1757,20 +1603,7 @@ var DIVERoot = class extends Object3D11 {
1757
1603
  return bb;
1758
1604
  }
1759
1605
  GetSceneObject(object) {
1760
- switch (object.entityType) {
1761
- case "pov": {
1762
- return void 0;
1763
- }
1764
- case "light": {
1765
- return this.lightRoot.GetLight(object);
1766
- }
1767
- case "model": {
1768
- return this.modelRoot.GetModel(object);
1769
- }
1770
- case "primitive": {
1771
- return this.primitiveRoot.GetPrimitive(object);
1772
- }
1773
- }
1606
+ return this.children.find((object3D) => object3D.userData.id === object.id);
1774
1607
  }
1775
1608
  AddSceneObject(object) {
1776
1609
  switch (object.entityType) {
@@ -1778,15 +1611,19 @@ var DIVERoot = class extends Object3D11 {
1778
1611
  break;
1779
1612
  }
1780
1613
  case "light": {
1781
- this.lightRoot.UpdateLight(object);
1614
+ this.updateLight(object);
1782
1615
  break;
1783
1616
  }
1784
1617
  case "model": {
1785
- this.modelRoot.UpdateModel(object);
1618
+ this.updateModel(object);
1786
1619
  break;
1787
1620
  }
1788
1621
  case "primitive": {
1789
- this.primitiveRoot.UpdatePrimitive(object);
1622
+ this.updatePrimitive(object);
1623
+ break;
1624
+ }
1625
+ case "group": {
1626
+ this.updateGroup(object);
1790
1627
  break;
1791
1628
  }
1792
1629
  }
@@ -1797,15 +1634,19 @@ var DIVERoot = class extends Object3D11 {
1797
1634
  break;
1798
1635
  }
1799
1636
  case "light": {
1800
- this.lightRoot.UpdateLight(object);
1637
+ this.updateLight(object);
1801
1638
  break;
1802
1639
  }
1803
1640
  case "model": {
1804
- this.modelRoot.UpdateModel(object);
1641
+ this.updateModel(object);
1805
1642
  break;
1806
1643
  }
1807
1644
  case "primitive": {
1808
- this.primitiveRoot.UpdatePrimitive(object);
1645
+ this.updatePrimitive(object);
1646
+ break;
1647
+ }
1648
+ case "group": {
1649
+ this.updateGroup(object);
1809
1650
  break;
1810
1651
  }
1811
1652
  }
@@ -1816,15 +1657,19 @@ var DIVERoot = class extends Object3D11 {
1816
1657
  break;
1817
1658
  }
1818
1659
  case "light": {
1819
- this.lightRoot.DeleteLight(object);
1660
+ this.deleteLight(object);
1820
1661
  break;
1821
1662
  }
1822
1663
  case "model": {
1823
- this.modelRoot.DeleteModel(object);
1664
+ this.deleteModel(object);
1824
1665
  break;
1825
1666
  }
1826
1667
  case "primitive": {
1827
- this.primitiveRoot.DeletePrimitive(object);
1668
+ this.deletePrimitive(object);
1669
+ break;
1670
+ }
1671
+ case "group": {
1672
+ this.deleteGroup(object);
1828
1673
  break;
1829
1674
  }
1830
1675
  }
@@ -1835,16 +1680,214 @@ var DIVERoot = class extends Object3D11 {
1835
1680
  case "light": {
1836
1681
  break;
1837
1682
  }
1838
- case "model": {
1839
- this.modelRoot.PlaceOnFloor(object);
1840
- break;
1841
- }
1683
+ case "model":
1842
1684
  case "primitive": {
1843
- this.primitiveRoot.PlaceOnFloor(object);
1685
+ this.placeOnFloor(object);
1844
1686
  break;
1845
1687
  }
1846
1688
  }
1847
1689
  }
1690
+ updateLight(light) {
1691
+ let sceneObject = this.GetSceneObject(light);
1692
+ if (!sceneObject) {
1693
+ switch (light.type) {
1694
+ case "scene": {
1695
+ sceneObject = new DIVESceneLight();
1696
+ break;
1697
+ }
1698
+ case "ambient": {
1699
+ sceneObject = new DIVEAmbientLight();
1700
+ break;
1701
+ }
1702
+ case "point": {
1703
+ sceneObject = new DIVEPointLight();
1704
+ break;
1705
+ }
1706
+ default: {
1707
+ console.warn(`Root.updateLight: Unknown light type: ${light.type}`);
1708
+ return;
1709
+ }
1710
+ }
1711
+ sceneObject.userData.id = light.id;
1712
+ this.add(sceneObject);
1713
+ }
1714
+ if (light.name !== void 0 && light.name !== null) sceneObject.name = light.name;
1715
+ if (light.position !== void 0 && light.position !== null) sceneObject.position.set(light.position.x, light.position.y, light.position.z);
1716
+ if (light.intensity !== void 0 && light.intensity !== null) sceneObject.SetIntensity(light.intensity);
1717
+ if (light.enabled !== void 0 && light.enabled !== null) sceneObject.SetEnabled(light.enabled);
1718
+ if (light.color !== void 0 && light.color !== null) sceneObject.SetColor(new Color5(light.color));
1719
+ if (light.visible !== void 0 && light.visible !== null) sceneObject.visible = light.visible;
1720
+ if (light.parent !== void 0) this.setParent(__spreadProps(__spreadValues({}, light), { parent: light.parent }));
1721
+ }
1722
+ updateModel(model) {
1723
+ let sceneObject = this.GetSceneObject(model);
1724
+ if (!sceneObject) {
1725
+ const created = new DIVEModel();
1726
+ sceneObject = created;
1727
+ sceneObject.userData.id = model.id;
1728
+ this.add(sceneObject);
1729
+ }
1730
+ if (model.uri !== void 0) {
1731
+ this.loadingManager.LoadGLTF(model.uri).then((gltf) => {
1732
+ var _a;
1733
+ sceneObject.SetModel(gltf);
1734
+ (_a = DIVECommunication.get(model.id)) == null ? void 0 : _a.PerformAction("MODEL_LOADED", { id: model.id });
1735
+ });
1736
+ }
1737
+ if (model.name !== void 0) sceneObject.name = model.name;
1738
+ if (model.position !== void 0) sceneObject.SetPosition(model.position);
1739
+ if (model.rotation !== void 0) sceneObject.SetRotation(model.rotation);
1740
+ if (model.scale !== void 0) sceneObject.SetScale(model.scale);
1741
+ if (model.visible !== void 0) sceneObject.SetVisibility(model.visible);
1742
+ if (model.material !== void 0) sceneObject.SetMaterial(model.material);
1743
+ if (model.parent !== void 0) this.setParent(__spreadProps(__spreadValues({}, model), { parent: model.parent }));
1744
+ }
1745
+ updatePrimitive(primitive) {
1746
+ let sceneObject = this.GetSceneObject(primitive);
1747
+ if (!sceneObject) {
1748
+ const created = new DIVEPrimitive();
1749
+ sceneObject = created;
1750
+ sceneObject.userData.id = primitive.id;
1751
+ this.add(sceneObject);
1752
+ }
1753
+ if (primitive.name !== void 0) sceneObject.name = primitive.name;
1754
+ if (primitive.geometry !== void 0) sceneObject.SetGeometry(primitive.geometry);
1755
+ if (primitive.position !== void 0) sceneObject.SetPosition(primitive.position);
1756
+ if (primitive.rotation !== void 0) sceneObject.SetRotation(primitive.rotation);
1757
+ if (primitive.scale !== void 0) sceneObject.SetScale(primitive.scale);
1758
+ if (primitive.visible !== void 0) sceneObject.SetVisibility(primitive.visible);
1759
+ if (primitive.material !== void 0) sceneObject.SetMaterial(primitive.material);
1760
+ if (primitive.parent !== void 0) this.setParent(__spreadProps(__spreadValues({}, primitive), { parent: primitive.parent }));
1761
+ }
1762
+ updateGroup(group) {
1763
+ let sceneObject = this.GetSceneObject(group);
1764
+ if (!sceneObject) {
1765
+ const created = new DIVEGroup();
1766
+ sceneObject = created;
1767
+ sceneObject.userData.id = group.id;
1768
+ this.add(sceneObject);
1769
+ }
1770
+ if (group.name !== void 0) sceneObject.name = group.name;
1771
+ if (group.position !== void 0) sceneObject.SetPosition(group.position);
1772
+ if (group.rotation !== void 0) sceneObject.SetRotation(group.rotation);
1773
+ if (group.scale !== void 0) sceneObject.SetScale(group.scale);
1774
+ if (group.visible !== void 0) sceneObject.SetVisibility(group.visible);
1775
+ if (group.bbVisible !== void 0) sceneObject.SetBoundingBoxVisibility(group.bbVisible);
1776
+ if (group.parent !== void 0) this.setParent(__spreadProps(__spreadValues({}, group), { parent: group.parent }));
1777
+ }
1778
+ deleteLight(light) {
1779
+ const sceneObject = this.GetSceneObject(light);
1780
+ if (!sceneObject) {
1781
+ console.warn(`Root.deleteLight: Light with id ${light.id} not found`);
1782
+ return;
1783
+ }
1784
+ this.detachTransformControls(sceneObject);
1785
+ this.remove(sceneObject);
1786
+ }
1787
+ deleteModel(model) {
1788
+ const sceneObject = this.GetSceneObject(model);
1789
+ if (!sceneObject) {
1790
+ console.warn(`Root.deleteModel: Model with id ${model.id} not found`);
1791
+ return;
1792
+ }
1793
+ this.detachTransformControls(sceneObject);
1794
+ this.remove(sceneObject);
1795
+ }
1796
+ deletePrimitive(primitive) {
1797
+ const sceneObject = this.GetSceneObject(primitive);
1798
+ if (!sceneObject) {
1799
+ console.warn(`Root.deletePrimitive: Primitive with id ${primitive.id} not found`);
1800
+ return;
1801
+ }
1802
+ this.detachTransformControls(sceneObject);
1803
+ this.remove(sceneObject);
1804
+ }
1805
+ deleteGroup(group) {
1806
+ const sceneObject = this.GetSceneObject(group);
1807
+ if (!sceneObject) {
1808
+ console.warn(`Root.deleteGroup: Group with id ${group.id} not found`);
1809
+ return;
1810
+ }
1811
+ this.detachTransformControls(sceneObject);
1812
+ for (let i = sceneObject.children.length - 1; i >= 0; i--) {
1813
+ this.attach(sceneObject.children[i]);
1814
+ }
1815
+ sceneObject.parent.remove(sceneObject);
1816
+ }
1817
+ placeOnFloor(object) {
1818
+ const sceneObject = this.GetSceneObject(object);
1819
+ if (!sceneObject) return;
1820
+ sceneObject.PlaceOnFloor();
1821
+ }
1822
+ setParent(object) {
1823
+ const sceneObject = this.GetSceneObject(object);
1824
+ if (!sceneObject) return;
1825
+ if (sceneObject.parent) {
1826
+ sceneObject.parent.remove(sceneObject);
1827
+ }
1828
+ if (object.parent !== null) {
1829
+ const parent = this.GetSceneObject(object.parent);
1830
+ if (!parent) return;
1831
+ parent.attach(sceneObject);
1832
+ } else {
1833
+ this.attach(sceneObject);
1834
+ }
1835
+ }
1836
+ detachTransformControls(object) {
1837
+ this.findScene(object).children.find((object2) => {
1838
+ if ("isTransformControls" in object2) {
1839
+ object2.detach();
1840
+ }
1841
+ });
1842
+ }
1843
+ findScene(object) {
1844
+ if (object.parent !== null) {
1845
+ return this.findScene(object.parent);
1846
+ }
1847
+ ;
1848
+ return object;
1849
+ }
1850
+ };
1851
+
1852
+ // src/constant/GridColors.ts
1853
+ var GRID_CENTER_LINE_COLOR = "#888888";
1854
+ var GRID_SIDE_LINE_COLOR = "#dddddd";
1855
+
1856
+ // src/grid/Grid.ts
1857
+ init_VisibilityLayerMask();
1858
+ import { GridHelper, Object3D as Object3D9 } from "three";
1859
+ var DIVEGrid = class extends Object3D9 {
1860
+ constructor() {
1861
+ super();
1862
+ this.name = "Grid";
1863
+ const grid = new GridHelper(100, 100, GRID_CENTER_LINE_COLOR, GRID_SIDE_LINE_COLOR);
1864
+ grid.material.depthTest = false;
1865
+ grid.layers.mask = HELPER_LAYER_MASK;
1866
+ this.add(grid);
1867
+ }
1868
+ SetVisibility(visible) {
1869
+ this.visible = visible;
1870
+ }
1871
+ };
1872
+
1873
+ // src/primitive/floor/Floor.ts
1874
+ init_VisibilityLayerMask();
1875
+ import { Color as Color6, Mesh as Mesh5, MeshStandardMaterial as MeshStandardMaterial3, PlaneGeometry } from "three";
1876
+ var DIVEFloor = class extends Mesh5 {
1877
+ constructor() {
1878
+ super(new PlaneGeometry(1e4, 1e4), new MeshStandardMaterial3({ color: new Color6(150 / 255, 150 / 255, 150 / 255) }));
1879
+ this.isFloor = true;
1880
+ this.name = "Floor";
1881
+ this.layers.mask = PRODUCT_LAYER_MASK;
1882
+ this.receiveShadow = true;
1883
+ this.rotateX(-Math.PI / 2);
1884
+ }
1885
+ SetVisibility(visible) {
1886
+ this.visible = visible;
1887
+ }
1888
+ SetColor(color) {
1889
+ this.material.color = new Color6(color);
1890
+ }
1848
1891
  };
1849
1892
 
1850
1893
  // src/scene/Scene.ts
@@ -1852,14 +1895,24 @@ var DIVEScene = class extends Scene2 {
1852
1895
  get Root() {
1853
1896
  return this.root;
1854
1897
  }
1898
+ get Floor() {
1899
+ return this.floor;
1900
+ }
1901
+ get Grid() {
1902
+ return this.grid;
1903
+ }
1855
1904
  constructor() {
1856
1905
  super();
1857
- this.background = new Color8(16777215);
1906
+ this.background = new Color7(16777215);
1858
1907
  this.root = new DIVERoot();
1859
1908
  this.add(this.root);
1909
+ this.floor = new DIVEFloor();
1910
+ this.add(this.floor);
1911
+ this.grid = new DIVEGrid();
1912
+ this.add(this.grid);
1860
1913
  }
1861
1914
  SetBackground(color) {
1862
- this.background = new Color8(color);
1915
+ this.background = new Color7(color);
1863
1916
  }
1864
1917
  ComputeSceneBB() {
1865
1918
  return this.Root.ComputeSceneBB();
@@ -1868,7 +1921,7 @@ var DIVEScene = class extends Scene2 {
1868
1921
  return this.Root.GetSceneObject(object);
1869
1922
  }
1870
1923
  AddSceneObject(object) {
1871
- this.Root.UpdateSceneObject(object);
1924
+ this.Root.AddSceneObject(object);
1872
1925
  }
1873
1926
  UpdateSceneObject(object) {
1874
1927
  this.Root.UpdateSceneObject(object);
@@ -1886,7 +1939,7 @@ init_PerspectiveCamera();
1886
1939
 
1887
1940
  // src/controls/OrbitControls.ts
1888
1941
  import { OrbitControls } from "three/examples/jsm/controls/OrbitControls";
1889
- import { MathUtils as MathUtils2, Vector3 as Vector34 } from "three";
1942
+ import { MathUtils as MathUtils2, Vector3 as Vector35 } from "three";
1890
1943
  import { Easing } from "@tweenjs/tween.js";
1891
1944
  var DIVEOrbitControlsDefaultSettings = {
1892
1945
  enableDamping: true,
@@ -1928,8 +1981,8 @@ var _DIVEOrbitControls = class _DIVEOrbitControls extends OrbitControls {
1928
1981
  this.dispose();
1929
1982
  }
1930
1983
  ComputeEncompassingView(bb) {
1931
- const center = bb.getCenter(new Vector34());
1932
- const size = bb.getSize(new Vector34());
1984
+ const center = bb.getCenter(new Vector35());
1985
+ const size = bb.getSize(new Vector35());
1933
1986
  const distance = Math.max(size.x, size.y, size.z) * 1.25;
1934
1987
  const direction = this.object.position.clone().normalize();
1935
1988
  return {
@@ -2097,7 +2150,7 @@ var DIVEAnimationSystem = class {
2097
2150
 
2098
2151
  // src/axiscamera/AxisCamera.ts
2099
2152
  init_VisibilityLayerMask();
2100
- import { AxesHelper, Color as Color9, Matrix4, OrthographicCamera, Vector4 } from "three";
2153
+ import { AxesHelper, Color as Color8, Matrix4, OrthographicCamera, Vector4 } from "three";
2101
2154
  import SpriteText from "three-spritetext";
2102
2155
 
2103
2156
  // src/constant/AxisHelperColors.ts
@@ -2118,9 +2171,9 @@ var DIVEAxisCamera = class extends OrthographicCamera {
2118
2171
  this.axesHelper.material.depthTest = false;
2119
2172
  this.axesHelper.position.set(0, 0, -1);
2120
2173
  this.axesHelper.setColors(
2121
- new Color9(AxesColorRed),
2122
- new Color9(AxesColorGreen),
2123
- new Color9(AxesColorBlue)
2174
+ new Color8(AxesColorRed),
2175
+ new Color8(AxesColorGreen),
2176
+ new Color8(AxesColorBlue)
2124
2177
  );
2125
2178
  const x = new SpriteText("X", 0.2, AxesColorRedLetter);
2126
2179
  const y = new SpriteText("Y", 0.2, AxesColorGreenLetter);
@@ -2221,58 +2274,6 @@ var getObjectDelta = (a, b) => {
2221
2274
  return delta;
2222
2275
  };
2223
2276
 
2224
- // src/math/helper/shift.ts
2225
- function shift(value, exponent) {
2226
- const subvalues = (value + "e").split("e");
2227
- return +(subvalues[0] + "e" + (+subvalues[1] + (exponent || 0)));
2228
- }
2229
-
2230
- // src/math/ceil/ceilExp.ts
2231
- function ceilExp(number, decimals = 0) {
2232
- const n = shift(number, +decimals);
2233
- return shift(Math.ceil(n), -decimals);
2234
- }
2235
-
2236
- // src/math/floor/floorExp.ts
2237
- function floorExp(number, decimals = 0) {
2238
- const n = shift(number, +decimals);
2239
- return shift(Math.floor(n), -decimals);
2240
- }
2241
-
2242
- // src/math/round/roundExp.ts
2243
- function roundExponential(number, decimals = 0) {
2244
- if (number < 0) return -roundExponential(-number, decimals);
2245
- const n = shift(number, +decimals);
2246
- return shift(Math.round(n), -decimals);
2247
- }
2248
-
2249
- // src/math/signedAngleTo/signedAngleTo.ts
2250
- function signedAngleTo(vecA, vecB, planeNormal) {
2251
- return Math.atan2(vecA.clone().cross(vecB).dot(planeNormal), vecB.clone().dot(vecA));
2252
- }
2253
-
2254
- // src/math/toFixed/toFixedExp.ts
2255
- function toFixedExp(number, decimals = 0) {
2256
- const n = shift(number, +decimals);
2257
- return shift(Math.round(n), -decimals).toFixed(decimals);
2258
- }
2259
-
2260
- // src/math/truncate/truncateExp.ts
2261
- function truncateExp(number, decimals = 0) {
2262
- const n = shift(number, +decimals);
2263
- return shift(Math.trunc(n), -decimals);
2264
- }
2265
-
2266
- // src/math/index.ts
2267
- var DIVEMath = {
2268
- ceilExp,
2269
- floorExp,
2270
- roundExp: roundExponential,
2271
- toFixedExp,
2272
- truncateExp,
2273
- signedAngleTo
2274
- };
2275
-
2276
2277
  // src/dive.ts
2277
2278
  import { generateUUID as generateUUID2 } from "three/src/math/MathUtils";
2278
2279
 
@@ -2373,6 +2374,58 @@ var DIVEInfo = class {
2373
2374
  };
2374
2375
  DIVEInfo._supportsWebXR = null;
2375
2376
 
2377
+ // src/math/helper/shift.ts
2378
+ function shift(value, exponent) {
2379
+ const subvalues = (value + "e").split("e");
2380
+ return +(subvalues[0] + "e" + (+subvalues[1] + (exponent || 0)));
2381
+ }
2382
+
2383
+ // src/math/ceil/ceilExp.ts
2384
+ function ceilExp(number, decimals = 0) {
2385
+ const n = shift(number, +decimals);
2386
+ return shift(Math.ceil(n), -decimals);
2387
+ }
2388
+
2389
+ // src/math/floor/floorExp.ts
2390
+ function floorExp(number, decimals = 0) {
2391
+ const n = shift(number, +decimals);
2392
+ return shift(Math.floor(n), -decimals);
2393
+ }
2394
+
2395
+ // src/math/round/roundExp.ts
2396
+ function roundExponential(number, decimals = 0) {
2397
+ if (number < 0) return -roundExponential(-number, decimals);
2398
+ const n = shift(number, +decimals);
2399
+ return shift(Math.round(n), -decimals);
2400
+ }
2401
+
2402
+ // src/math/signedAngleTo/signedAngleTo.ts
2403
+ function signedAngleTo(vecA, vecB, planeNormal) {
2404
+ return Math.atan2(vecA.clone().cross(vecB).dot(planeNormal), vecB.clone().dot(vecA));
2405
+ }
2406
+
2407
+ // src/math/toFixed/toFixedExp.ts
2408
+ function toFixedExp(number, decimals = 0) {
2409
+ const n = shift(number, +decimals);
2410
+ return shift(Math.round(n), -decimals).toFixed(decimals);
2411
+ }
2412
+
2413
+ // src/math/truncate/truncateExp.ts
2414
+ function truncateExp(number, decimals = 0) {
2415
+ const n = shift(number, +decimals);
2416
+ return shift(Math.trunc(n), -decimals);
2417
+ }
2418
+
2419
+ // src/math/index.ts
2420
+ var DIVEMath = {
2421
+ ceilExp,
2422
+ floorExp,
2423
+ roundExp: roundExponential,
2424
+ toFixedExp,
2425
+ truncateExp,
2426
+ signedAngleTo
2427
+ };
2428
+
2376
2429
  // src/dive.ts
2377
2430
  var DIVEDefaultSettings = {
2378
2431
  autoResize: true,