@shopware-ag/dive 2.0.1-beta.6 → 2.0.1-beta.7
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/chunks/{AssetExporter-ClYQ4gnb.mjs → AssetExporter-QnOue3VT.mjs} +19 -19
- package/build/chunks/{AssetExporter-CAqADFbL.cjs → AssetExporter-TzKB2FHh.cjs} +4 -4
- package/build/chunks/AssetLoader-DCBiLwef.cjs +4 -0
- package/build/chunks/{AssetLoader-BewzFwHi.mjs → AssetLoader-Dqrg0Re8.mjs} +38 -35
- package/build/chunks/FileTypes-Ca8pkRlQ.cjs +30 -0
- package/build/chunks/FileTypes-CpKiTXEY.mjs +1109 -0
- package/build/chunks/MathUtils-CBW56ZuG.cjs +1 -0
- package/build/chunks/MathUtils-CFGjHuVF.mjs +159 -0
- package/build/chunks/OrbitController-D-WNei2f.mjs +940 -0
- package/build/chunks/OrbitController-rMX8EHvJ.cjs +1 -0
- package/build/chunks/PerspectiveCamera-CONx93im.cjs +1 -0
- package/build/chunks/PerspectiveCamera-DUiWJJIj.mjs +38 -0
- package/build/chunks/PovSchema-Co9FznEz.cjs +1 -0
- package/build/chunks/PovSchema-DWWvr_ED.mjs +10 -0
- package/build/chunks/SelectTool-BizqI7_a.cjs +1 -0
- package/build/chunks/{SelectTool-DLXheZay.mjs → SelectTool-DVFL7BtX.mjs} +10 -10
- package/build/chunks/network-error-CHvryg-4.mjs +18 -0
- package/build/chunks/network-error-D_pq8VU6.cjs +1 -0
- package/build/chunks/package-CeZyVg2G.mjs +39 -0
- package/build/chunks/package-D_hIrGNz.cjs +1 -0
- package/build/dive.cjs +1 -30
- package/build/dive.mjs +617 -1089
- package/build/plugins/animation/index.cjs +1 -0
- package/build/plugins/animation/index.d.ts +2 -0
- package/build/plugins/animation/index.mjs +126 -0
- package/build/plugins/ar/index.cjs +1 -0
- package/build/plugins/ar/index.d.ts +2 -0
- package/build/{chunks/ARSystem-D27w7Pck.mjs → plugins/ar/index.mjs} +38 -44
- package/build/plugins/assetconverter/index.d.ts +2 -0
- package/build/plugins/assetexporter/index.cjs +1 -0
- package/build/plugins/assetexporter/index.d.ts +2 -0
- package/build/plugins/assetexporter/index.mjs +4 -0
- package/build/plugins/assetloader/index.cjs +1 -0
- package/build/plugins/assetloader/index.d.ts +2 -0
- package/build/plugins/assetloader/index.mjs +6 -0
- package/build/plugins/axiscamera/index.cjs +1 -0
- package/build/plugins/axiscamera/index.d.ts +2 -0
- package/build/plugins/axiscamera/index.mjs +4 -0
- package/build/plugins/mediacreator/index.cjs +1 -0
- package/build/plugins/mediacreator/index.d.ts +2 -0
- package/build/{chunks/MediaCreator-psLAAyJA.mjs → plugins/mediacreator/index.mjs} +1 -1
- package/build/{modules/controller → plugins/orbitcontroller}/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.d.ts +2 -0
- package/build/plugins/orbitcontroller/index.mjs +5 -0
- package/build/plugins/state/index.cjs +27 -0
- package/build/plugins/state/index.d.ts +2 -0
- package/build/plugins/state/index.mjs +4265 -0
- package/build/plugins/systeminfo/index.cjs +1 -0
- package/build/plugins/systeminfo/index.d.ts +2 -0
- package/build/{modules → plugins}/systeminfo/index.mjs +24 -23
- package/build/plugins/toolbox/index.cjs +1 -0
- package/build/plugins/toolbox/index.d.ts +2 -0
- package/build/{chunks/Toolbox-DKuyL8n5.mjs → plugins/toolbox/index.mjs} +8 -2
- package/build/src/components/gizmo/Gizmo.d.ts +1 -1
- package/build/src/components/gizmo/handles/AxisHandle.d.ts +1 -1
- package/build/src/components/gizmo/handles/RadialHandle.d.ts +1 -1
- package/build/src/components/gizmo/handles/ScaleHandle.d.ts +1 -1
- package/build/src/components/gizmo/rotate/RotateGizmo.d.ts +2 -2
- package/build/src/components/gizmo/scale/ScaleGizmo.d.ts +2 -2
- package/build/src/components/gizmo/translate/TranslateGizmo.d.ts +2 -2
- package/build/src/components/model/Model.d.ts +2 -2
- package/build/src/components/primitive/Primitive.d.ts +3 -3
- package/build/src/components/root/Root.d.ts +5 -7
- package/build/src/core/Dive.d.ts +1 -1
- package/build/src/engine/clock/Clock.d.ts +1 -0
- package/build/src/index.d.ts +2 -1
- package/build/src/interfaces/Draggable.d.ts +1 -1
- package/build/src/plugins/animation/index.d.ts +2 -0
- package/build/src/{modules/animation → plugins/animation/src}/animator/Animator.d.ts +2 -3
- package/build/src/plugins/animation/src/index.d.ts +3 -0
- package/build/src/plugins/animation/src/system/AnimationSystem.d.ts +23 -0
- package/build/src/plugins/ar/index.d.ts +4 -0
- package/build/src/{modules/ar → plugins/ar/src}/ARSystem.d.ts +0 -27
- package/build/src/{modules/ar → plugins/ar/src}/webxr/WebXR.d.ts +2 -2
- package/build/src/{modules/ar → plugins/ar/src}/webxr/controller/WebXRController.d.ts +2 -2
- package/build/src/{modules/ar → plugins/ar/src}/webxr/origin/WebXROrigin.d.ts +1 -1
- package/build/src/{modules/ar → plugins/ar/src}/webxr/raycaster/WebXRRaycaster.d.ts +3 -3
- package/build/src/{modules/ar → plugins/ar/src}/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +1 -1
- package/build/src/{modules/ar → plugins/ar/src}/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +2 -2
- package/build/src/{modules/ar → plugins/ar/src}/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
- package/build/src/plugins/assetconverter/index.d.ts +1 -0
- package/build/src/plugins/assetconverter/src/AssetConverter.d.ts +13 -0
- package/build/src/plugins/assetexporter/index.d.ts +1 -0
- package/build/src/{modules/assetexporter → plugins/assetexporter/src}/AssetExporter.d.ts +1 -18
- package/build/src/plugins/assetloader/index.d.ts +3 -0
- package/build/src/plugins/assetloader/src/loader/AssetLoader.d.ts +8 -0
- package/build/src/plugins/axiscamera/index.d.ts +1 -0
- package/build/src/{modules/axiscamera → plugins/axiscamera/src}/AxisCamera.d.ts +1 -4
- package/build/src/plugins/mediacreator/index.d.ts +1 -0
- package/build/src/plugins/mediacreator/src/MediaCreator.d.ts +15 -0
- package/build/src/plugins/orbitcontroller/index.d.ts +1 -0
- package/build/src/{modules/controller/orbit → plugins/orbitcontroller/src}/OrbitController.d.ts +3 -3
- package/build/src/plugins/state/index.d.ts +4 -0
- package/build/src/{modules/state → plugins/state/src}/State.d.ts +4 -27
- package/build/src/{modules/state → plugins/state/src}/actions/action.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/ar/launchar.d.ts +2 -2
- package/build/src/{modules/state → plugins/state/src}/actions/camera/computeencompassingview.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/camera/getcameratransform.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/camera/lockcamera.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/camera/movecamera.d.ts +3 -3
- package/build/src/{modules/state → plugins/state/src}/actions/camera/setcameralayer.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/camera/setcameratransform.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/camera/zoomcamera.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/media/generatemedia.d.ts +1 -1
- package/build/src/plugins/state/src/actions/object/addobject.d.ts +9 -0
- package/build/src/plugins/state/src/actions/object/deleteobject.d.ts +13 -0
- package/build/src/plugins/state/src/actions/object/deselectobject.d.ts +13 -0
- package/build/src/{modules/state → plugins/state/src}/actions/object/dropit.d.ts +3 -3
- package/build/src/{modules/state → plugins/state/src}/actions/object/getallobjects.d.ts +3 -2
- package/build/src/plugins/state/src/actions/object/getobjects.d.ts +13 -0
- package/build/src/{modules/state → plugins/state/src}/actions/object/modelloaded.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/object/placeonfloor.d.ts +3 -3
- package/build/src/plugins/state/src/actions/object/selectobject.d.ts +13 -0
- package/build/src/plugins/state/src/actions/object/setparent.d.ts +23 -0
- package/build/src/plugins/state/src/actions/object/updateobject.d.ts +13 -0
- package/build/src/{modules/state → plugins/state/src}/actions/renderer/startrender.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/scene/exportscene.d.ts +4 -4
- package/build/src/plugins/state/src/actions/scene/getallscenedata.d.ts +9 -0
- package/build/src/{modules/state → plugins/state/src}/actions/scene/setbackground.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/scene/updatescene.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/toolbox/setgizmomode.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/toolbox/setgizmoscalelinked.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/toolbox/setgizmovisible.d.ts +1 -1
- package/build/src/{modules/state → plugins/state/src}/actions/toolbox/usetool.d.ts +2 -2
- package/build/src/{modules → plugins}/state/types/ActionTypes.d.ts +8 -9
- package/build/src/{types/SceneType.d.ts → plugins/state/types/StateExportFileType.d.ts} +1 -1
- package/build/src/plugins/state/types/StateSceneData.d.ts +19 -0
- package/build/src/plugins/state/types/index.d.ts +1 -0
- package/build/src/plugins/systeminfo/index.d.ts +2 -0
- package/build/src/{modules/systeminfo → plugins/systeminfo/src}/SystemInfo.d.ts +1 -32
- package/build/src/plugins/toolbox/index.d.ts +4 -0
- package/build/src/{modules/toolbox → plugins/toolbox/src}/BaseTool.d.ts +2 -4
- package/build/src/{modules/toolbox → plugins/toolbox/src}/Toolbox.d.ts +2 -11
- package/build/src/{modules/toolbox → plugins/toolbox/src}/select/SelectTool.d.ts +2 -3
- package/build/src/{modules/toolbox → plugins/toolbox/src}/transform/TransformTool.d.ts +2 -3
- package/build/src/types/components/DIVELight.d.ts +4 -0
- package/build/src/types/components/DIVESceneObject.d.ts +6 -0
- package/build/src/types/components/index.d.ts +2 -0
- package/build/src/types/index.d.ts +2 -5
- package/build/src/types/schema/BaseEntitySchema.d.ts +8 -0
- package/build/src/types/schema/EntitySchema.d.ts +11 -0
- package/build/src/types/schema/EntityTypeSchema.d.ts +1 -0
- package/build/src/types/schema/GeometrySchema.d.ts +7 -0
- package/build/src/types/schema/GeometryTypeSchema.d.ts +1 -0
- package/build/src/types/schema/GroupSchema.d.ts +11 -0
- package/build/src/types/schema/LightSchema.d.ts +28 -0
- package/build/src/{modules/state/types/COMMaterial.d.ts → types/schema/MaterialSchema.d.ts} +1 -1
- package/build/src/types/schema/ModelSchema.d.ts +14 -0
- package/build/src/types/schema/PovSchema.d.ts +10 -0
- package/build/src/types/schema/PrimitiveSchema.d.ts +14 -0
- package/build/src/types/schema/index.d.ts +11 -0
- package/package.json +41 -41
- package/build/chunks/ARSystem-_0cLAxyG.cjs +0 -1
- package/build/chunks/AnimationSystem-Bf-xhqRe.mjs +0 -101
- package/build/chunks/AnimationSystem-DFUYMNpj.cjs +0 -1
- package/build/chunks/AssetLoader-Bq-Ekxil.cjs +0 -4
- package/build/chunks/AxisCamera-CUb3g8WX.cjs +0 -1
- package/build/chunks/AxisCamera-lXJLIPLK.mjs +0 -39
- package/build/chunks/AxisHelperColors-BrGqktN5.cjs +0 -1
- package/build/chunks/AxisHelperColors-JLBHYQDi.mjs +0 -9
- package/build/chunks/FileTypes-DuVGjbcR.mjs +0 -36
- package/build/chunks/FileTypes-DzVpDu_p.cjs +0 -1
- package/build/chunks/MediaCreator-CEWeS42n.cjs +0 -1
- package/build/chunks/ModuleRegistry-CBfx1EVd.mjs +0 -13
- package/build/chunks/ModuleRegistry-CDIxOzgZ.cjs +0 -1
- package/build/chunks/OrbitController-B8VkQV1e.cjs +0 -1
- package/build/chunks/OrbitController-CXu1ko6E.mjs +0 -462
- package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +0 -1
- package/build/chunks/PerspectiveCamera-PMJPzAn3.mjs +0 -34
- package/build/chunks/SelectTool-9eiKZXT4.cjs +0 -1
- package/build/chunks/State-BNgqNPrs.mjs +0 -4296
- package/build/chunks/State-Mvu0hG-n.cjs +0 -27
- package/build/chunks/Toolbox-qFN47t2F.cjs +0 -1
- package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +0 -1
- package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +0 -8
- package/build/chunks/index-C_uFFwT2.mjs +0 -5
- package/build/chunks/index-DAwIH9xh.cjs +0 -1
- package/build/chunks/package-CHgGmFCa.cjs +0 -1
- package/build/chunks/package-CIkS9WF6.mjs +0 -39
- package/build/modules/animation/index.cjs +0 -1
- package/build/modules/animation/index.d.ts +0 -2
- package/build/modules/animation/index.mjs +0 -5
- package/build/modules/ar/index.cjs +0 -1
- package/build/modules/ar/index.d.ts +0 -2
- package/build/modules/ar/index.mjs +0 -11
- package/build/modules/assetconverter/index.cjs +0 -1
- package/build/modules/assetconverter/index.d.ts +0 -2
- package/build/modules/assetconverter/index.mjs +0 -4
- package/build/modules/assetexporter/index.cjs +0 -1
- package/build/modules/assetexporter/index.d.ts +0 -2
- package/build/modules/assetexporter/index.mjs +0 -4
- package/build/modules/assetloader/index.cjs +0 -1
- package/build/modules/assetloader/index.d.ts +0 -2
- package/build/modules/assetloader/index.mjs +0 -4
- package/build/modules/axiscamera/index.cjs +0 -1
- package/build/modules/axiscamera/index.d.ts +0 -2
- package/build/modules/axiscamera/index.mjs +0 -4
- package/build/modules/controller/index.d.ts +0 -2
- package/build/modules/controller/index.mjs +0 -5
- package/build/modules/mediacreator/index.cjs +0 -1
- package/build/modules/mediacreator/index.d.ts +0 -2
- package/build/modules/mediacreator/index.mjs +0 -4
- package/build/modules/state/index.cjs +0 -1
- package/build/modules/state/index.d.ts +0 -2
- package/build/modules/state/index.mjs +0 -39
- package/build/modules/systeminfo/index.cjs +0 -1
- package/build/modules/systeminfo/index.d.ts +0 -2
- package/build/modules/toolbox/index.cjs +0 -1
- package/build/modules/toolbox/index.d.ts +0 -2
- package/build/modules/toolbox/index.mjs +0 -10
- package/build/src/modules/ModuleRegistry.d.ts +0 -19
- package/build/src/modules/animation/AnimationSystem.d.ts +0 -36
- package/build/src/modules/animation/index.d.ts +0 -2
- package/build/src/modules/ar/index.d.ts +0 -4
- package/build/src/modules/assetconverter/AssetConverter.d.ts +0 -30
- package/build/src/modules/assetconverter/index.d.ts +0 -1
- package/build/src/modules/assetexporter/index.d.ts +0 -1
- package/build/src/modules/assetloader/AssetLoader.d.ts +0 -29
- package/build/src/modules/assetloader/index.d.ts +0 -1
- package/build/src/modules/axiscamera/index.d.ts +0 -1
- package/build/src/modules/controller/index.d.ts +0 -1
- package/build/src/modules/mediacreator/MediaCreator.d.ts +0 -44
- package/build/src/modules/mediacreator/index.d.ts +0 -1
- package/build/src/modules/state/actions/object/addobject.d.ts +0 -8
- package/build/src/modules/state/actions/object/deleteobject.d.ts +0 -12
- package/build/src/modules/state/actions/object/deselectobject.d.ts +0 -12
- package/build/src/modules/state/actions/object/getobjects.d.ts +0 -12
- package/build/src/modules/state/actions/object/selectobject.d.ts +0 -12
- package/build/src/modules/state/actions/object/setparent.d.ts +0 -22
- package/build/src/modules/state/actions/object/updateobject.d.ts +0 -12
- package/build/src/modules/state/actions/scene/getallscenedata.d.ts +0 -9
- package/build/src/modules/state/index.d.ts +0 -4
- package/build/src/modules/state/types/COMBaseEntity.d.ts +0 -8
- package/build/src/modules/state/types/COMEntity.d.ts +0 -11
- package/build/src/modules/state/types/COMEntityType.d.ts +0 -1
- package/build/src/modules/state/types/COMGeometry.d.ts +0 -7
- package/build/src/modules/state/types/COMGeometryType.d.ts +0 -1
- package/build/src/modules/state/types/COMGroup.d.ts +0 -11
- package/build/src/modules/state/types/COMLight.d.ts +0 -28
- package/build/src/modules/state/types/COMModel.d.ts +0 -14
- package/build/src/modules/state/types/COMPov.d.ts +0 -10
- package/build/src/modules/state/types/COMPrimitive.d.ts +0 -14
- package/build/src/modules/state/types/index.d.ts +0 -11
- package/build/src/modules/systeminfo/index.d.ts +0 -1
- package/build/src/modules/toolbox/index.d.ts +0 -4
- package/build/src/types/SceneData.d.ts +0 -19
- package/build/src/types/SceneObjects.d.ts +0 -9
- package/build/src/types/UUID.d.ts +0 -1
- /package/build/{chunks/AssetConverter-BTAb23e8.cjs → plugins/assetconverter/index.cjs} +0 -0
- /package/build/{chunks/AssetConverter-D-qOTLs1.mjs → plugins/assetconverter/index.mjs} +0 -0
- /package/build/src/{modules/animation → plugins/animation/src}/types/AnimatorParameters.d.ts +0 -0
- /package/build/src/{modules/ar → plugins/ar/src}/arquicklook/ARQuickLook.d.ts +0 -0
- /package/build/src/{modules/ar → plugins/ar/src}/error/ar-errors.d.ts +0 -0
- /package/build/src/{modules/ar → plugins/ar/src}/sceneviewer/SceneViewer.d.ts +0 -0
- /package/build/src/{modules/ar → plugins/ar/src}/webxr/crosshair/WebXRCrosshair.d.ts +0 -0
- /package/build/src/{modules/ar → plugins/ar/src}/webxr/overlay/Overlay.d.ts +0 -0
- /package/build/src/{modules/assetloader → plugins/assetloader/src}/draco/DracoLoader.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/ActionRegistry.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/actions/ar/index.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/actions/camera/index.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/actions/index.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/actions/media/index.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/actions/object/index.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/actions/renderer/index.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/actions/scene/index.d.ts +0 -0
- /package/build/src/{modules/state → plugins/state/src}/actions/toolbox/index.d.ts +0 -0
- /package/build/src/{types/info → plugins/systeminfo/types}/index.d.ts +0 -0
|
@@ -0,0 +1,1109 @@
|
|
|
1
|
+
var F = Object.defineProperty;
|
|
2
|
+
var U = (o, i, e) => i in o ? F(o, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[i] = e;
|
|
3
|
+
var s = (o, i, e) => U(o, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
+
import { O as W, a as x } from "./OrbitController-D-WNei2f.mjs";
|
|
5
|
+
import { OrthographicCamera as H, Vector4 as Y, AxesHelper as J, Color as l, Matrix4 as N, Object3D as g, AmbientLight as $, PointLight as K, SphereGeometry as L, MeshBasicMaterial as Q, FrontSide as S, Mesh as b, HemisphereLight as q, DirectionalLight as X, Vector3 as u, Box3 as k, MeshStandardMaterial as v, Raycaster as V, CylinderGeometry as Z, BufferGeometry as B, BufferAttribute as I, BoxGeometry as w, ConeGeometry as j, LineDashedMaterial as ee, Line as te, PlaneGeometry as ie, GridHelper as se, Scene as re, WebGLRenderer as C, PCFSoftShadowMap as ne, PCFShadowMap as oe, BasicShadowMap as ae, MathUtils as f } from "three";
|
|
6
|
+
import y from "three-spritetext";
|
|
7
|
+
import { C as p, P as _, U as he, H as le, a as de, D as ce } from "./PerspectiveCamera-DUiWJJIj.mjs";
|
|
8
|
+
class ue extends H {
|
|
9
|
+
constructor(e, t, r) {
|
|
10
|
+
super(-1, 1, 1, -1, 0.1, 100);
|
|
11
|
+
s(this, "axesHelper");
|
|
12
|
+
s(this, "_renderer");
|
|
13
|
+
s(this, "_scene");
|
|
14
|
+
s(this, "_camera");
|
|
15
|
+
s(this, "_restoreViewport", new Y());
|
|
16
|
+
this.layers.mask = p, this.axesHelper = new J(0.5), this.axesHelper.layers.mask = p, this.axesHelper.material.depthTest = !1, this.axesHelper.position.set(0, 0, -1), this.axesHelper.setColors(
|
|
17
|
+
new l(Le),
|
|
18
|
+
new l(Se),
|
|
19
|
+
new l(ke)
|
|
20
|
+
);
|
|
21
|
+
const n = new y("X", 0.2, A), a = new y("Y", 0.2, G), h = new y("Z", 0.2, z);
|
|
22
|
+
n.layers.mask = p, a.layers.mask = p, h.layers.mask = p, n.position.set(0.7, 0, 0), a.position.set(0, 0.7, 0), h.position.set(0, 0, 0.7), this.axesHelper.add(n), this.axesHelper.add(a), this.axesHelper.add(h), this.add(this.axesHelper), this._renderer = e, this._scene = t, this._camera = r, this._scene.add(this);
|
|
23
|
+
}
|
|
24
|
+
tick() {
|
|
25
|
+
const e = this._scene.background;
|
|
26
|
+
this._scene.background = null, this._renderer.webglrenderer.getViewport(this._restoreViewport), this._renderer.webglrenderer.setViewport(0, 0, 150, 150), this._renderer.webglrenderer.autoClear = !1, this.setFromCameraMatrix(this._camera.matrix), this._renderer.webglrenderer.render(this._scene, this), this._renderer.webglrenderer.setViewport(this._restoreViewport), this._renderer.webglrenderer.autoClear = !0, this._scene.background = e;
|
|
27
|
+
}
|
|
28
|
+
dispose() {
|
|
29
|
+
this._scene.remove(this);
|
|
30
|
+
}
|
|
31
|
+
setFromCameraMatrix(e) {
|
|
32
|
+
this.axesHelper.rotation.setFromRotationMatrix(
|
|
33
|
+
new N().extractRotation(e).invert()
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
class _e extends g {
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
s(this, "isDIVELight", !0);
|
|
41
|
+
s(this, "isDIVEAmbientLight", !0);
|
|
42
|
+
s(this, "_light");
|
|
43
|
+
this.name = "DIVEAmbientLight", this._light = new $(16777215, 1), this._light.layers.mask = _, this.add(this._light);
|
|
44
|
+
}
|
|
45
|
+
setColor(e) {
|
|
46
|
+
this._light.color = e;
|
|
47
|
+
}
|
|
48
|
+
setIntensity(e) {
|
|
49
|
+
this._light.intensity = e;
|
|
50
|
+
}
|
|
51
|
+
setEnabled(e) {
|
|
52
|
+
this._light.visible = e;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class me extends g {
|
|
56
|
+
constructor() {
|
|
57
|
+
super();
|
|
58
|
+
s(this, "isDIVELight", !0);
|
|
59
|
+
s(this, "isDIVEPointLight", !0);
|
|
60
|
+
s(this, "isMovable", !0);
|
|
61
|
+
s(this, "isSelectable", !0);
|
|
62
|
+
s(this, "gizmo", null);
|
|
63
|
+
s(this, "light");
|
|
64
|
+
s(this, "mesh");
|
|
65
|
+
this.name = "DIVEPointLight", this.light = new K(16777215, 1), this.light.layers.mask = _, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
|
|
66
|
+
const e = 0.1, t = new L(
|
|
67
|
+
e,
|
|
68
|
+
e * 320,
|
|
69
|
+
e * 320
|
|
70
|
+
), r = new Q({
|
|
71
|
+
color: this.light.color,
|
|
72
|
+
transparent: !0,
|
|
73
|
+
opacity: 0.8,
|
|
74
|
+
side: S
|
|
75
|
+
});
|
|
76
|
+
this.mesh = new b(t, r), this.mesh.layers.mask = he, this.add(this.mesh);
|
|
77
|
+
}
|
|
78
|
+
setColor(e) {
|
|
79
|
+
this.light.color = e, this.mesh.material.color = e;
|
|
80
|
+
}
|
|
81
|
+
setIntensity(e) {
|
|
82
|
+
this.light.intensity = e, this.mesh.material.opacity = e > 0.8 ? 0.8 : e * 0.8;
|
|
83
|
+
}
|
|
84
|
+
setEnabled(e) {
|
|
85
|
+
this.light.visible = e;
|
|
86
|
+
}
|
|
87
|
+
onMove() {
|
|
88
|
+
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
89
|
+
var t;
|
|
90
|
+
(t = e.get(this.userData.id)) == null || t.performAction("UPDATE_OBJECT", {
|
|
91
|
+
id: this.userData.id,
|
|
92
|
+
position: this.position
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
onSelect() {
|
|
97
|
+
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
98
|
+
var t;
|
|
99
|
+
(t = e.get(this.userData.id)) == null || t.performAction("SELECT_OBJECT", {
|
|
100
|
+
id: this.userData.id
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
onDeselect() {
|
|
105
|
+
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
106
|
+
var t;
|
|
107
|
+
(t = e.get(this.userData.id)) == null || t.performAction("DESELECT_OBJECT", {
|
|
108
|
+
id: this.userData.id
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
class M extends g {
|
|
114
|
+
constructor() {
|
|
115
|
+
super();
|
|
116
|
+
s(this, "isDIVELight", !0);
|
|
117
|
+
s(this, "isDIVESceneLight", !0);
|
|
118
|
+
s(this, "_hemiLight");
|
|
119
|
+
s(this, "_dirLight");
|
|
120
|
+
this.name = "DIVESceneLight", this._hemiLight = new q(16777215, 16777215, 2), this._hemiLight.layers.mask = _, this._hemiLight.position.set(0, 50, 0), this.add(this._hemiLight), this._dirLight = new X(16777215, 3), this._dirLight.layers.mask = _, this._dirLight.position.set(1, 1.75, 1), this._dirLight.position.multiplyScalar(30), this._dirLight.castShadow = !0, this._dirLight.shadow.mapSize.width = 2048, this._dirLight.shadow.mapSize.height = 2048;
|
|
121
|
+
const e = 5;
|
|
122
|
+
this._dirLight.shadow.camera.left = -5, this._dirLight.shadow.camera.right = e, this._dirLight.shadow.camera.top = e, this._dirLight.shadow.camera.bottom = -5, this._dirLight.shadow.camera.far = 3500, this.add(this._dirLight);
|
|
123
|
+
}
|
|
124
|
+
setColor(e) {
|
|
125
|
+
this._hemiLight.color = e, this._dirLight.color = e;
|
|
126
|
+
}
|
|
127
|
+
setIntensity(e) {
|
|
128
|
+
this._hemiLight.intensity = e * 2, this._dirLight.intensity = e * 3;
|
|
129
|
+
}
|
|
130
|
+
setEnabled(e) {
|
|
131
|
+
this._hemiLight.visible = e, this._dirLight.visible = e;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const E = (o) => o.parent ? E(o.parent) : o;
|
|
135
|
+
class D extends g {
|
|
136
|
+
constructor() {
|
|
137
|
+
super();
|
|
138
|
+
s(this, "isSelectable", !0);
|
|
139
|
+
s(this, "isMovable", !0);
|
|
140
|
+
s(this, "isDIVENode", !0);
|
|
141
|
+
s(this, "gizmo", null);
|
|
142
|
+
s(this, "_positionWorldBuffer");
|
|
143
|
+
s(this, "_boundingBox");
|
|
144
|
+
this.layers.mask = _, this._positionWorldBuffer = new u(), this._boundingBox = new k();
|
|
145
|
+
}
|
|
146
|
+
setPosition(e) {
|
|
147
|
+
if (!this.parent) {
|
|
148
|
+
this.position.set(e.x, e.y, e.z);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const t = new u(e.x, e.y, e.z);
|
|
152
|
+
this.position.copy(this.parent.worldToLocal(t)), "isDIVEGroup" in this.parent && this.parent.updateLineTo(this);
|
|
153
|
+
}
|
|
154
|
+
setRotation(e) {
|
|
155
|
+
this.rotation.set(e.x, e.y, e.z);
|
|
156
|
+
}
|
|
157
|
+
setScale(e) {
|
|
158
|
+
this.scale.set(e.x, e.y, e.z);
|
|
159
|
+
}
|
|
160
|
+
setVisibility(e) {
|
|
161
|
+
this.visible = e;
|
|
162
|
+
}
|
|
163
|
+
setToWorldOrigin() {
|
|
164
|
+
this.position.set(0, 0, 0), import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
165
|
+
var t;
|
|
166
|
+
(t = e.get(this.userData.id)) == null || t.performAction("UPDATE_OBJECT", {
|
|
167
|
+
id: this.userData.id,
|
|
168
|
+
position: this.getWorldPosition(this._positionWorldBuffer),
|
|
169
|
+
rotation: this.rotation,
|
|
170
|
+
scale: this.scale
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
|
|
176
|
+
*/
|
|
177
|
+
onMove() {
|
|
178
|
+
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
179
|
+
var t;
|
|
180
|
+
(t = e.get(this.userData.id)) == null || t.performAction("UPDATE_OBJECT", {
|
|
181
|
+
id: this.userData.id,
|
|
182
|
+
position: this.getWorldPosition(this._positionWorldBuffer),
|
|
183
|
+
rotation: this.rotation,
|
|
184
|
+
scale: this.scale
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
onSelect() {
|
|
189
|
+
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
190
|
+
var t;
|
|
191
|
+
(t = e.get(this.userData.id)) == null || t.performAction("SELECT_OBJECT", {
|
|
192
|
+
id: this.userData.id
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
onDeselect() {
|
|
197
|
+
import("../plugins/state/index.mjs").then(({ State: e }) => {
|
|
198
|
+
var t;
|
|
199
|
+
(t = e.get(this.userData.id)) == null || t.performAction("DESELECT_OBJECT", {
|
|
200
|
+
id: this.userData.id
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
class T extends D {
|
|
206
|
+
constructor() {
|
|
207
|
+
super(...arguments);
|
|
208
|
+
s(this, "isDIVEModel", !0);
|
|
209
|
+
s(this, "_mesh", null);
|
|
210
|
+
s(this, "_material", null);
|
|
211
|
+
s(this, "_assetLoader", null);
|
|
212
|
+
}
|
|
213
|
+
async _getAssetLoader() {
|
|
214
|
+
return this._assetLoader || (this._assetLoader = new (await import("../plugins/assetloader/index.mjs")).AssetLoader()), this._assetLoader;
|
|
215
|
+
}
|
|
216
|
+
async setFromURL(e) {
|
|
217
|
+
const r = await (await this._getAssetLoader()).load(e);
|
|
218
|
+
this.setFromGLTF(r), import("../plugins/state/index.mjs").then(({ State: n }) => {
|
|
219
|
+
var a;
|
|
220
|
+
(a = n.get(this.userData.id)) == null || a.performAction("MODEL_LOADED", {
|
|
221
|
+
id: this.userData.id
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
setFromGLTF(e) {
|
|
226
|
+
this.clear(), this._boundingBox.makeEmpty(), e.traverse((t) => {
|
|
227
|
+
t.castShadow = !0, t.receiveShadow = !0, t.layers.mask = this.layers.mask, this._boundingBox.expandByObject(t), !this._mesh && "isMesh" in t && (this._mesh = t, this._material ? this._mesh.material = this._material : this._material = t.material);
|
|
228
|
+
}), this.add(e);
|
|
229
|
+
}
|
|
230
|
+
setMaterial(e) {
|
|
231
|
+
this._material || (this._material = new v()), e.vertexColors !== void 0 && (this._material.vertexColors = e.vertexColors), e.color !== void 0 && this._material.color.set(e.color), e.map !== void 0 && (this._material.map = e.map), e.normalMap !== void 0 && (this._material.normalMap = e.normalMap), e.roughness !== void 0 && (this._material.roughness = e.roughness), e.roughnessMap !== void 0 && (this._material.roughnessMap = e.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), e.metalness !== void 0 && (this._material.metalness = e.metalness), e.metalnessMap !== void 0 && (this._material.metalnessMap = e.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
|
|
232
|
+
}
|
|
233
|
+
placeOnFloor() {
|
|
234
|
+
var n, a, h, d;
|
|
235
|
+
const e = this.getWorldPosition(this._positionWorldBuffer), t = e.clone();
|
|
236
|
+
(a = (n = this._mesh) == null ? void 0 : n.geometry) == null || a.computeBoundingBox();
|
|
237
|
+
const r = (d = (h = this._mesh) == null ? void 0 : h.geometry) == null ? void 0 : d.boundingBox;
|
|
238
|
+
!r || !this._mesh || (e.y = e.y - this._mesh.localToWorld(r.min.clone()).y, e.y !== t.y && import("../plugins/state/index.mjs").then(({ State: m }) => {
|
|
239
|
+
var c;
|
|
240
|
+
(c = m.get(this.userData.id)) == null || c.performAction("UPDATE_OBJECT", {
|
|
241
|
+
id: this.userData.id,
|
|
242
|
+
position: e,
|
|
243
|
+
rotation: this.rotation,
|
|
244
|
+
scale: this.scale
|
|
245
|
+
});
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
dropIt() {
|
|
249
|
+
if (!this.parent) {
|
|
250
|
+
console.warn(
|
|
251
|
+
"DIVEModel: dropIt() called on a model that is not in the scene.",
|
|
252
|
+
this
|
|
253
|
+
);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const e = this._boundingBox.min.y * this.scale.y, t = this.localToWorld(
|
|
257
|
+
this._boundingBox.getCenter(new u()).multiply(this.scale)
|
|
258
|
+
);
|
|
259
|
+
t.y = e + this.position.y;
|
|
260
|
+
const r = new V(t, new u(0, -1, 0));
|
|
261
|
+
r.layers.mask = _;
|
|
262
|
+
const n = r.intersectObjects(
|
|
263
|
+
E(this).root.children,
|
|
264
|
+
!0
|
|
265
|
+
);
|
|
266
|
+
if (n.length > 0) {
|
|
267
|
+
const a = n[0].object;
|
|
268
|
+
a.geometry.computeBoundingBox();
|
|
269
|
+
const h = a.geometry.boundingBox, d = a.localToWorld(h.max.clone()), m = this.position.clone(), c = this.position.clone().setY(d.y).sub(new u(0, e, 0));
|
|
270
|
+
if (this.position.copy(c), this.position.y === m.y) return;
|
|
271
|
+
this.onMove();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
class ge extends D {
|
|
276
|
+
constructor() {
|
|
277
|
+
super();
|
|
278
|
+
s(this, "isDIVEPrimitive", !0);
|
|
279
|
+
s(this, "_mesh");
|
|
280
|
+
this._mesh = new b(), this._mesh.layers.mask = _, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this._mesh.material = new v(), this.add(this._mesh);
|
|
281
|
+
}
|
|
282
|
+
setGeometry(e) {
|
|
283
|
+
const t = this.assembleGeometry(e);
|
|
284
|
+
t && (this._mesh.geometry = t, this._boundingBox.setFromObject(this._mesh));
|
|
285
|
+
}
|
|
286
|
+
setMaterial(e) {
|
|
287
|
+
const t = this._mesh.material;
|
|
288
|
+
e.vertexColors !== void 0 && (t.vertexColors = e.vertexColors), e.color !== void 0 && (t.color = new l(e.color)), e.map !== void 0 && (t.map = e.map), e.normalMap !== void 0 && (t.normalMap = e.normalMap), e.roughness !== void 0 && (t.roughness = e.roughness), e.roughnessMap !== void 0 && (t.roughnessMap = e.roughnessMap, t.roughnessMap && (t.roughness = 1)), e.metalness !== void 0 && (t.metalness = e.metalness), e.metalnessMap !== void 0 && (t.metalnessMap = e.metalnessMap, t.metalnessMap && (t.metalness = 0)), this._mesh && (this._mesh.material = t);
|
|
289
|
+
}
|
|
290
|
+
placeOnFloor() {
|
|
291
|
+
var n, a, h, d;
|
|
292
|
+
const e = this.getWorldPosition(this._positionWorldBuffer), t = e.clone();
|
|
293
|
+
(a = (n = this._mesh) == null ? void 0 : n.geometry) == null || a.computeBoundingBox();
|
|
294
|
+
const r = (d = (h = this._mesh) == null ? void 0 : h.geometry) == null ? void 0 : d.boundingBox;
|
|
295
|
+
!r || !this._mesh || (e.y = e.y - this._mesh.localToWorld(r.min.clone()).y, e.y !== t.y && import("../plugins/state/index.mjs").then(({ State: m }) => {
|
|
296
|
+
var c;
|
|
297
|
+
(c = m.get(this.userData.id)) == null || c.performAction("UPDATE_OBJECT", {
|
|
298
|
+
id: this.userData.id,
|
|
299
|
+
position: e,
|
|
300
|
+
rotation: this.rotation,
|
|
301
|
+
scale: this.scale
|
|
302
|
+
});
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
dropIt() {
|
|
306
|
+
if (!this.parent) {
|
|
307
|
+
console.warn(
|
|
308
|
+
"DIVEPrimitive: dropIt() called on a model that is not in the scene.",
|
|
309
|
+
this
|
|
310
|
+
);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const e = this._boundingBox.min.y * this.scale.y, t = this.localToWorld(
|
|
314
|
+
this._boundingBox.getCenter(new u()).multiply(this.scale)
|
|
315
|
+
);
|
|
316
|
+
t.y = e + this.position.y;
|
|
317
|
+
const r = new V(t, new u(0, -1, 0));
|
|
318
|
+
r.layers.mask = _;
|
|
319
|
+
const n = r.intersectObjects(
|
|
320
|
+
E(this).root.children,
|
|
321
|
+
!0
|
|
322
|
+
);
|
|
323
|
+
if (n.length > 0) {
|
|
324
|
+
const a = n[0].object;
|
|
325
|
+
a.geometry.computeBoundingBox();
|
|
326
|
+
const h = a.geometry.boundingBox, d = a.localToWorld(h.max.clone()), m = this.position.clone(), c = this.position.clone().setY(d.y).sub(new u(0, e, 0));
|
|
327
|
+
if (this.position.copy(c), this.position.y === m.y) return;
|
|
328
|
+
this.onMove();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
assembleGeometry(e) {
|
|
332
|
+
switch (this._mesh.material.flatShading = !1, e.name.toLowerCase()) {
|
|
333
|
+
case "cylinder":
|
|
334
|
+
return this.createCylinderGeometry(e);
|
|
335
|
+
case "sphere":
|
|
336
|
+
return this.createSphereGeometry(e);
|
|
337
|
+
case "pyramid":
|
|
338
|
+
return this._mesh.material.flatShading = !0, this.createPyramidGeometry(e);
|
|
339
|
+
case "cube":
|
|
340
|
+
case "box":
|
|
341
|
+
return this.createBoxGeometry(e);
|
|
342
|
+
case "cone":
|
|
343
|
+
return this.createConeGeometry(e);
|
|
344
|
+
case "wall":
|
|
345
|
+
return this.createWallGeometry(e);
|
|
346
|
+
case "plane":
|
|
347
|
+
return this.createPlaneGeometry(e);
|
|
348
|
+
default:
|
|
349
|
+
return console.warn(
|
|
350
|
+
"DIVEPrimitive.assembleGeometry: Invalid geometry type:",
|
|
351
|
+
e.name.toLowerCase()
|
|
352
|
+
), null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
createCylinderGeometry(e) {
|
|
356
|
+
const t = new Z(
|
|
357
|
+
e.width / 2,
|
|
358
|
+
e.width / 2,
|
|
359
|
+
e.height,
|
|
360
|
+
64
|
|
361
|
+
);
|
|
362
|
+
return t.translate(0, e.height / 2, 0), t;
|
|
363
|
+
}
|
|
364
|
+
createSphereGeometry(e) {
|
|
365
|
+
return new L(e.width / 2, 256, 256);
|
|
366
|
+
}
|
|
367
|
+
createPyramidGeometry(e) {
|
|
368
|
+
const t = new Float32Array([
|
|
369
|
+
-e.width / 2,
|
|
370
|
+
0,
|
|
371
|
+
-e.depth / 2,
|
|
372
|
+
// 0
|
|
373
|
+
e.width / 2,
|
|
374
|
+
0,
|
|
375
|
+
-e.depth / 2,
|
|
376
|
+
// 1
|
|
377
|
+
e.width / 2,
|
|
378
|
+
0,
|
|
379
|
+
e.depth / 2,
|
|
380
|
+
// 2
|
|
381
|
+
-e.width / 2,
|
|
382
|
+
0,
|
|
383
|
+
e.depth / 2,
|
|
384
|
+
// 3
|
|
385
|
+
0,
|
|
386
|
+
e.height,
|
|
387
|
+
0
|
|
388
|
+
]), r = new Uint16Array([
|
|
389
|
+
0,
|
|
390
|
+
1,
|
|
391
|
+
2,
|
|
392
|
+
0,
|
|
393
|
+
2,
|
|
394
|
+
3,
|
|
395
|
+
0,
|
|
396
|
+
4,
|
|
397
|
+
1,
|
|
398
|
+
1,
|
|
399
|
+
4,
|
|
400
|
+
2,
|
|
401
|
+
2,
|
|
402
|
+
4,
|
|
403
|
+
3,
|
|
404
|
+
3,
|
|
405
|
+
4,
|
|
406
|
+
0
|
|
407
|
+
]), n = new B();
|
|
408
|
+
return n.setAttribute(
|
|
409
|
+
"position",
|
|
410
|
+
new I(t, 3)
|
|
411
|
+
), n.setIndex(new I(r, 1)), n.computeVertexNormals(), n.computeBoundingBox(), n.computeBoundingSphere(), n;
|
|
412
|
+
}
|
|
413
|
+
createBoxGeometry(e) {
|
|
414
|
+
const t = new w(
|
|
415
|
+
e.width,
|
|
416
|
+
e.height,
|
|
417
|
+
e.depth
|
|
418
|
+
);
|
|
419
|
+
return t.translate(0, e.height / 2, 0), t;
|
|
420
|
+
}
|
|
421
|
+
createConeGeometry(e) {
|
|
422
|
+
const t = new j(e.width / 2, e.height, 256);
|
|
423
|
+
return t.translate(0, e.height / 2, 0), t;
|
|
424
|
+
}
|
|
425
|
+
createWallGeometry(e) {
|
|
426
|
+
const t = new w(
|
|
427
|
+
e.width,
|
|
428
|
+
e.height,
|
|
429
|
+
e.depth || 0.05,
|
|
430
|
+
16
|
|
431
|
+
);
|
|
432
|
+
return t.translate(0, e.height / 2, 0), t;
|
|
433
|
+
}
|
|
434
|
+
createPlaneGeometry(e) {
|
|
435
|
+
const t = new w(
|
|
436
|
+
e.width,
|
|
437
|
+
e.height,
|
|
438
|
+
e.depth
|
|
439
|
+
);
|
|
440
|
+
return t.translate(0, e.height / 2, 0), t;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
class pe extends D {
|
|
444
|
+
// lines to children
|
|
445
|
+
constructor() {
|
|
446
|
+
super();
|
|
447
|
+
s(this, "isDIVEGroup", !0);
|
|
448
|
+
s(this, "_members");
|
|
449
|
+
s(this, "_lines");
|
|
450
|
+
this.name = "DIVEGroup", this._members = [], this._lines = [];
|
|
451
|
+
}
|
|
452
|
+
// children objects
|
|
453
|
+
get members() {
|
|
454
|
+
return this._members;
|
|
455
|
+
}
|
|
456
|
+
setPosition(e) {
|
|
457
|
+
super.setPosition(e), this._members.forEach((t) => {
|
|
458
|
+
"isDIVENode" in t && t.onMove();
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
setLinesVisibility(e, t) {
|
|
462
|
+
if (!t) {
|
|
463
|
+
this._lines.forEach((n) => {
|
|
464
|
+
n.visible = e;
|
|
465
|
+
});
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const r = this._members.indexOf(t);
|
|
469
|
+
r !== -1 && (this._lines[r].visible = e);
|
|
470
|
+
}
|
|
471
|
+
attach(e) {
|
|
472
|
+
if (this._members.includes(e))
|
|
473
|
+
return this;
|
|
474
|
+
const t = this.createLine();
|
|
475
|
+
return this.add(t), this._lines.push(t), super.attach(e), this._members.push(e), this._updateLineTo(t, e), this.setLinesVisibility(!0, e), this;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Removes an object from the group.
|
|
479
|
+
* @param object - The object to remove.
|
|
480
|
+
* @returns The group instance.
|
|
481
|
+
*/
|
|
482
|
+
remove(e) {
|
|
483
|
+
const t = this._members.indexOf(e);
|
|
484
|
+
if (t === -1)
|
|
485
|
+
return this;
|
|
486
|
+
const r = this._lines[t];
|
|
487
|
+
return super.remove(r), this._lines.splice(t, 1), super.remove(e), this._members.splice(t, 1), this;
|
|
488
|
+
}
|
|
489
|
+
updateLineTo(e) {
|
|
490
|
+
const t = this._members.indexOf(e);
|
|
491
|
+
t !== -1 && this._updateLineTo(this._lines[t], e);
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Creates a line for visualization.
|
|
495
|
+
*/
|
|
496
|
+
createLine() {
|
|
497
|
+
const e = new B(), t = new ee({
|
|
498
|
+
color: 6710886,
|
|
499
|
+
dashSize: 0.05,
|
|
500
|
+
gapSize: 0.025
|
|
501
|
+
}), r = new te(e, t);
|
|
502
|
+
return r.visible = !1, r;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Updates a line to the object.
|
|
506
|
+
*/
|
|
507
|
+
_updateLineTo(e, t) {
|
|
508
|
+
const r = [
|
|
509
|
+
new u(0, 0, 0),
|
|
510
|
+
t.position.clone()
|
|
511
|
+
];
|
|
512
|
+
e.geometry.setFromPoints(r), e.computeLineDistances();
|
|
513
|
+
}
|
|
514
|
+
// public setBoundingBoxVisibility(visible: boolean): void {
|
|
515
|
+
// this._boxMesh.visible = visible;
|
|
516
|
+
// }
|
|
517
|
+
// /**
|
|
518
|
+
// * Recalculates the position of the group based on it's bounding box.
|
|
519
|
+
// * Children's world positions are kept.
|
|
520
|
+
// */
|
|
521
|
+
// private recalculatePosition(): void {
|
|
522
|
+
// // store all children's world positions
|
|
523
|
+
// const childrensWorldPositions: Vector3[] = this.children.map((child) => child.getWorldPosition(new Vector3()));
|
|
524
|
+
// // calculate new center and set it as the group's position
|
|
525
|
+
// const bbcenter = this.updateBB();
|
|
526
|
+
// this.position.copy(bbcenter);
|
|
527
|
+
// // set childrens's positions so their world positions are kept
|
|
528
|
+
// this.children.forEach((child, i) => {
|
|
529
|
+
// if (child.uuid === this._boxMesh.uuid) return;
|
|
530
|
+
// child.position.copy(this.worldToLocal(childrensWorldPositions[i]));
|
|
531
|
+
// });
|
|
532
|
+
// DIVECommunication.get(this.userData.id)?.performAction('UPDATE_OBJECT', { id: this.userData.id, position: this.position });
|
|
533
|
+
// }
|
|
534
|
+
// /**
|
|
535
|
+
// * Updates the bounding box of the group.
|
|
536
|
+
// * @returns {Vector3} The new center of the bounding box.
|
|
537
|
+
// */
|
|
538
|
+
// private updateBB(): Vector3 {
|
|
539
|
+
// this._boundingBox.makeEmpty();
|
|
540
|
+
// if (this.children.length === 1) {
|
|
541
|
+
// // because we always have the box mesh as 1 child
|
|
542
|
+
// return this.position.clone();
|
|
543
|
+
// }
|
|
544
|
+
// this.children.forEach((child) => {
|
|
545
|
+
// if (child.uuid === this._boxMesh.uuid) return;
|
|
546
|
+
// this._boundingBox.expandByObject(child);
|
|
547
|
+
// });
|
|
548
|
+
// return this._boundingBox.getCenter(new Vector3());
|
|
549
|
+
// }
|
|
550
|
+
// private updateBoxMesh(): void {
|
|
551
|
+
// if (this.children.length === 1) {
|
|
552
|
+
// // because we always have the box mesh as 1 child
|
|
553
|
+
// this._boxMesh.visible = false;
|
|
554
|
+
// return;
|
|
555
|
+
// }
|
|
556
|
+
// this._boxMesh.quaternion.copy(this.quaternion.clone().invert());
|
|
557
|
+
// this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
|
|
558
|
+
// this._boxMesh.geometry = new BoxGeometry(this._boundingBox.max.x - this._boundingBox.min.x, this._boundingBox.max.y - this._boundingBox.min.y, this._boundingBox.max.z - this._boundingBox.min.z);
|
|
559
|
+
// this._boxMesh.visible = true;
|
|
560
|
+
// }
|
|
561
|
+
}
|
|
562
|
+
class we extends b {
|
|
563
|
+
constructor() {
|
|
564
|
+
const e = new ie(1, 1);
|
|
565
|
+
e.scale(1e3, 1e3, 1), e.rotateX(-Math.PI / 2);
|
|
566
|
+
const t = new v({
|
|
567
|
+
color: new l(16777215),
|
|
568
|
+
side: S
|
|
569
|
+
});
|
|
570
|
+
super(e, t);
|
|
571
|
+
s(this, "isDIVEFloor", !0);
|
|
572
|
+
this.name = "Floor", this.layers.mask = _, this.receiveShadow = !0;
|
|
573
|
+
}
|
|
574
|
+
setVisibility(e) {
|
|
575
|
+
this.visible = e;
|
|
576
|
+
}
|
|
577
|
+
setColor(e) {
|
|
578
|
+
this.material.color = new l(e);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
class fe extends g {
|
|
582
|
+
constructor() {
|
|
583
|
+
super();
|
|
584
|
+
s(this, "isDIVERoot", !0);
|
|
585
|
+
s(this, "_floor");
|
|
586
|
+
this.name = "Root", this._floor = new we(), this.add(this._floor);
|
|
587
|
+
}
|
|
588
|
+
get floor() {
|
|
589
|
+
return this._floor;
|
|
590
|
+
}
|
|
591
|
+
computeSceneBB() {
|
|
592
|
+
const e = new k();
|
|
593
|
+
return this.children.forEach((t) => {
|
|
594
|
+
"isDIVEFloor" in t || t.traverse((r) => {
|
|
595
|
+
"isObject3D" in r && e.expandByObject(r);
|
|
596
|
+
});
|
|
597
|
+
}), e;
|
|
598
|
+
}
|
|
599
|
+
getSceneObject(e) {
|
|
600
|
+
let t;
|
|
601
|
+
return this.traverse((r) => {
|
|
602
|
+
t || r.userData.id === e.id && (t = r);
|
|
603
|
+
}), t;
|
|
604
|
+
}
|
|
605
|
+
addSceneObject(e) {
|
|
606
|
+
let t = this.getSceneObject(e);
|
|
607
|
+
if (t)
|
|
608
|
+
return console.warn(
|
|
609
|
+
`DIVERoot.addSceneObject: Scene object with id ${e.id} already exists`
|
|
610
|
+
), t;
|
|
611
|
+
switch (e.entityType) {
|
|
612
|
+
case "pov":
|
|
613
|
+
break;
|
|
614
|
+
case "light": {
|
|
615
|
+
switch (e.type) {
|
|
616
|
+
case "scene": {
|
|
617
|
+
t = new M();
|
|
618
|
+
break;
|
|
619
|
+
}
|
|
620
|
+
case "ambient": {
|
|
621
|
+
t = new _e();
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
case "point": {
|
|
625
|
+
t = new me();
|
|
626
|
+
break;
|
|
627
|
+
}
|
|
628
|
+
default:
|
|
629
|
+
throw new Error(
|
|
630
|
+
`DIVERoot.addSceneObject: Unknown light type: ${e.type}`
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
t.name = e.name, t.userData.id = e.id, this.add(t), this._updateLight(t, e);
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
case "model": {
|
|
637
|
+
t = new T(), t.name = e.name, t.userData.id = e.id, t.userData.uri = e.uri, this.add(t), this._updateModel(t, e);
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
case "primitive": {
|
|
641
|
+
t = new ge(), t.name = e.name, t.userData.id = e.id, this.add(t), this._updatePrimitive(t, e);
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
case "group": {
|
|
645
|
+
t = new pe(), t.name = e.name, t.userData.id = e.id, this.add(t), this._updateGroup(t, e);
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
default:
|
|
649
|
+
throw new Error(
|
|
650
|
+
`DIVERoot.addSceneObject: Unknown entity type: ${e.entityType}`
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
return t;
|
|
654
|
+
}
|
|
655
|
+
updateSceneObject(e) {
|
|
656
|
+
const t = this.getSceneObject(e);
|
|
657
|
+
if (!t) {
|
|
658
|
+
console.warn(
|
|
659
|
+
`DIVERoot.updateSceneObject: Scene object with id ${e.id} does not exist`
|
|
660
|
+
);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
switch (e.entityType) {
|
|
664
|
+
case "pov":
|
|
665
|
+
break;
|
|
666
|
+
case "light": {
|
|
667
|
+
this._updateLight(t, e);
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
case "model": {
|
|
671
|
+
this._updateModel(t, e);
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
case "primitive": {
|
|
675
|
+
this._updatePrimitive(t, e);
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
case "group": {
|
|
679
|
+
this._updateGroup(t, e);
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
default:
|
|
683
|
+
throw new Error(
|
|
684
|
+
`DIVERoot.updateSceneObject: Unknown entity type: ${e.entityType}`
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
deleteSceneObject(e) {
|
|
689
|
+
const t = this.getSceneObject(e);
|
|
690
|
+
if (!t) {
|
|
691
|
+
console.warn(
|
|
692
|
+
`DIVERoot.deleteSceneObject: Object with id ${e.id} not found`
|
|
693
|
+
);
|
|
694
|
+
return;
|
|
695
|
+
}
|
|
696
|
+
switch (e.entityType) {
|
|
697
|
+
case "pov":
|
|
698
|
+
break;
|
|
699
|
+
case "light": {
|
|
700
|
+
this._deleteLight(t);
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
case "model": {
|
|
704
|
+
this._deleteModel(t);
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
case "primitive": {
|
|
708
|
+
this._deletePrimitive(t);
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
case "group": {
|
|
712
|
+
this._deleteGroup(t);
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
default:
|
|
716
|
+
throw new Error(
|
|
717
|
+
`DIVERoot.deleteSceneObject: Unknown entity type: ${e.entityType}`
|
|
718
|
+
);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
_updateLight(e, t) {
|
|
722
|
+
t.name !== void 0 && t.name !== null && (e.name = t.name), t.position !== void 0 && t.position !== null && e.position.set(
|
|
723
|
+
t.position.x,
|
|
724
|
+
t.position.y,
|
|
725
|
+
t.position.z
|
|
726
|
+
), t.intensity !== void 0 && t.intensity !== null && e.setIntensity(t.intensity), t.enabled !== void 0 && t.enabled !== null && e.setEnabled(t.enabled), t.color !== void 0 && t.color !== null && e.setColor(new l(t.color)), t.visible !== void 0 && t.visible !== null && (e.visible = t.visible), t.parentId !== void 0 && this._setParent({ ...t, parentId: t.parentId });
|
|
727
|
+
}
|
|
728
|
+
_updateModel(e, t) {
|
|
729
|
+
t.uri !== void 0 && e.setFromURL(t.uri), t.name !== void 0 && (e.name = t.name), t.position !== void 0 && e.setPosition(t.position), t.rotation !== void 0 && e.setRotation(t.rotation), t.scale !== void 0 && e.setScale(t.scale), t.visible !== void 0 && e.setVisibility(t.visible), t.material !== void 0 && e.setMaterial(t.material), t.parentId !== void 0 && this._setParent({ ...t, parentId: t.parentId });
|
|
730
|
+
}
|
|
731
|
+
_updatePrimitive(e, t) {
|
|
732
|
+
t.name !== void 0 && (e.name = t.name), t.geometry !== void 0 && e.setGeometry(t.geometry), t.position !== void 0 && e.setPosition(t.position), t.rotation !== void 0 && e.setRotation(t.rotation), t.scale !== void 0 && e.setScale(t.scale), t.visible !== void 0 && e.setVisibility(t.visible), t.material !== void 0 && e.setMaterial(t.material), t.parentId !== void 0 && this._setParent({ ...t, parentId: t.parentId });
|
|
733
|
+
}
|
|
734
|
+
_updateGroup(e, t) {
|
|
735
|
+
t.name !== void 0 && (e.name = t.name), t.position !== void 0 && e.setPosition(t.position), t.rotation !== void 0 && e.setRotation(t.rotation), t.scale !== void 0 && e.setScale(t.scale), t.visible !== void 0 && e.setVisibility(t.visible), t.bbVisible !== void 0 && e.setLinesVisibility(t.bbVisible), t.parentId !== void 0 && this._setParent({ ...t, parentId: t.parentId });
|
|
736
|
+
}
|
|
737
|
+
_deleteLight(e) {
|
|
738
|
+
this._detachTransformControls(e), e.parent.remove(e);
|
|
739
|
+
}
|
|
740
|
+
_deleteModel(e) {
|
|
741
|
+
this._detachTransformControls(e), e.parent.remove(e);
|
|
742
|
+
}
|
|
743
|
+
_deletePrimitive(e) {
|
|
744
|
+
this._detachTransformControls(e), e.parent.remove(e);
|
|
745
|
+
}
|
|
746
|
+
_deleteGroup(e) {
|
|
747
|
+
this._detachTransformControls(e);
|
|
748
|
+
for (let t = e.members.length - 1; t >= 0; t--)
|
|
749
|
+
this.attach(e.members[t]);
|
|
750
|
+
e.parent.remove(e);
|
|
751
|
+
}
|
|
752
|
+
_setParent(e) {
|
|
753
|
+
const t = this.getSceneObject(e);
|
|
754
|
+
if (e.parentId !== null) {
|
|
755
|
+
const r = this.getSceneObject({
|
|
756
|
+
id: e.parentId,
|
|
757
|
+
entityType: e.entityType
|
|
758
|
+
});
|
|
759
|
+
if (!r) return;
|
|
760
|
+
r.attach(t);
|
|
761
|
+
} else
|
|
762
|
+
this.attach(t);
|
|
763
|
+
}
|
|
764
|
+
_detachTransformControls(e) {
|
|
765
|
+
this._findScene(e).children.find((t) => {
|
|
766
|
+
"isTransformControls" in t && t.detach();
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
_findScene(e) {
|
|
770
|
+
return e.parent !== null ? this._findScene(e.parent) : e;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
const ye = "#888888", be = "#dddddd";
|
|
774
|
+
class ve extends g {
|
|
775
|
+
constructor() {
|
|
776
|
+
super(), this.name = "Grid";
|
|
777
|
+
const i = new se(
|
|
778
|
+
100,
|
|
779
|
+
100,
|
|
780
|
+
ye,
|
|
781
|
+
be
|
|
782
|
+
);
|
|
783
|
+
i.material.depthTest = !1, i.layers.mask = le, this.add(i);
|
|
784
|
+
}
|
|
785
|
+
setVisibility(i) {
|
|
786
|
+
this.visible = i;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
class Ee extends re {
|
|
790
|
+
constructor() {
|
|
791
|
+
super();
|
|
792
|
+
s(this, "_root");
|
|
793
|
+
s(this, "_grid");
|
|
794
|
+
this.background = new l(16777215), this._root = new fe(), this.add(this._root), this._grid = new ve(), this.add(this._grid);
|
|
795
|
+
}
|
|
796
|
+
get root() {
|
|
797
|
+
return this._root;
|
|
798
|
+
}
|
|
799
|
+
get grid() {
|
|
800
|
+
return this._grid;
|
|
801
|
+
}
|
|
802
|
+
setBackground(e) {
|
|
803
|
+
this.background = new l(e);
|
|
804
|
+
}
|
|
805
|
+
computeSceneBB() {
|
|
806
|
+
return this.root.computeSceneBB();
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
const P = {
|
|
810
|
+
canvas: void 0,
|
|
811
|
+
antialias: !0,
|
|
812
|
+
alpha: !0,
|
|
813
|
+
powerPreference: "high-performance",
|
|
814
|
+
precision: "highp",
|
|
815
|
+
stencil: !1,
|
|
816
|
+
depth: !0,
|
|
817
|
+
logarithmicDepthBuffer: !1,
|
|
818
|
+
shadows: !0,
|
|
819
|
+
shadowQuality: "high"
|
|
820
|
+
};
|
|
821
|
+
class De {
|
|
822
|
+
constructor(i, e, t) {
|
|
823
|
+
s(this, "_webglrenderer");
|
|
824
|
+
s(this, "_settings");
|
|
825
|
+
this._scene = i, this._camera = e, this._settings = {
|
|
826
|
+
...P,
|
|
827
|
+
...t ?? {}
|
|
828
|
+
}, this._webglrenderer = new C(this._settings), this._webglrenderer.shadowMap.enabled = this._settings.shadows, this._webglrenderer.shadowMap.type = this._settings.shadowQuality === "high" ? ne : this._settings.shadowQuality === "medium" ? oe : ae;
|
|
829
|
+
}
|
|
830
|
+
get webglrenderer() {
|
|
831
|
+
return this._webglrenderer;
|
|
832
|
+
}
|
|
833
|
+
setCanvas(i) {
|
|
834
|
+
this._webglrenderer.dispose(), this._settings.canvas = i, this._webglrenderer = new C(this._settings);
|
|
835
|
+
}
|
|
836
|
+
render() {
|
|
837
|
+
this._webglrenderer.render(this._scene, this._camera);
|
|
838
|
+
}
|
|
839
|
+
onResize(i, e) {
|
|
840
|
+
this._webglrenderer.setSize(i, e, !1);
|
|
841
|
+
}
|
|
842
|
+
dispose() {
|
|
843
|
+
this._webglrenderer.dispose();
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
class xe {
|
|
847
|
+
constructor() {
|
|
848
|
+
s(this, "_renderer", null);
|
|
849
|
+
s(this, "_lastTime", 0);
|
|
850
|
+
s(this, "_isRunning", !1);
|
|
851
|
+
s(this, "_tickers", []);
|
|
852
|
+
}
|
|
853
|
+
start() {
|
|
854
|
+
this._isRunning || (this._isRunning = !0, this._lastTime = performance.now(), requestAnimationFrame(this._tick.bind(this)));
|
|
855
|
+
}
|
|
856
|
+
stop() {
|
|
857
|
+
this._isRunning = !1;
|
|
858
|
+
}
|
|
859
|
+
setRenderer(i) {
|
|
860
|
+
this._renderer = i;
|
|
861
|
+
}
|
|
862
|
+
addTicker(i) {
|
|
863
|
+
this._tickers.find((e) => e.uuid === i.uuid) || this._tickers.push(i);
|
|
864
|
+
}
|
|
865
|
+
hasTicker(i) {
|
|
866
|
+
return this._tickers.find((e) => e.uuid === i.uuid) !== void 0;
|
|
867
|
+
}
|
|
868
|
+
removeTicker(i) {
|
|
869
|
+
const e = this._tickers.findIndex((t) => t.uuid === i.uuid);
|
|
870
|
+
e !== -1 && this._tickers.splice(e, 1);
|
|
871
|
+
}
|
|
872
|
+
dispose() {
|
|
873
|
+
this.stop(), this._tickers.forEach((i) => {
|
|
874
|
+
var e;
|
|
875
|
+
return (e = i.dispose) == null ? void 0 : e.call(i);
|
|
876
|
+
}), this._tickers = [], this._isRunning = !1, this._lastTime = 0;
|
|
877
|
+
}
|
|
878
|
+
_tick(i) {
|
|
879
|
+
var t;
|
|
880
|
+
if (!this._isRunning) return;
|
|
881
|
+
const e = (i - this._lastTime) / 1e3;
|
|
882
|
+
this._lastTime = i, this._tickers.forEach((r) => r.tick(e)), (t = this._renderer) == null || t.render(), requestAnimationFrame(this._tick.bind(this));
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
class Ie {
|
|
886
|
+
constructor(i, e) {
|
|
887
|
+
s(this, "_resizeObserver");
|
|
888
|
+
s(this, "_width", 0);
|
|
889
|
+
s(this, "_height", 0);
|
|
890
|
+
this._resizeObserver = new ResizeObserver((t) => {
|
|
891
|
+
for (const r of t) {
|
|
892
|
+
const { width: n, height: a } = r.contentRect;
|
|
893
|
+
n === this._width && a === this._height || (i.onResize(n, a), e.onResize(n, a), this._width = n, this._height = a);
|
|
894
|
+
}
|
|
895
|
+
}), this._observeCanvas(i.webglrenderer.domElement);
|
|
896
|
+
}
|
|
897
|
+
setCanvas(i) {
|
|
898
|
+
this._resizeObserver.disconnect(), this._observeCanvas(i);
|
|
899
|
+
}
|
|
900
|
+
dispose() {
|
|
901
|
+
this._resizeObserver.disconnect();
|
|
902
|
+
}
|
|
903
|
+
_observeCanvas(i) {
|
|
904
|
+
if (i.parentElement)
|
|
905
|
+
this._resizeObserver.observe(i.parentElement);
|
|
906
|
+
else {
|
|
907
|
+
const e = setInterval(() => {
|
|
908
|
+
i.parentElement && (this._resizeObserver.observe(i.parentElement), clearInterval(e));
|
|
909
|
+
}, 16);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
const R = {
|
|
914
|
+
autoStart: !0,
|
|
915
|
+
displayAxes: !1,
|
|
916
|
+
...de,
|
|
917
|
+
...P
|
|
918
|
+
};
|
|
919
|
+
class Ce {
|
|
920
|
+
constructor(i) {
|
|
921
|
+
s(this, "_renderer");
|
|
922
|
+
s(this, "_scene");
|
|
923
|
+
s(this, "_camera");
|
|
924
|
+
s(this, "_resizeManager");
|
|
925
|
+
s(this, "_clock");
|
|
926
|
+
s(this, "_settings");
|
|
927
|
+
this._settings = {
|
|
928
|
+
...R,
|
|
929
|
+
...i ?? {}
|
|
930
|
+
}, this._scene = new Ee(), this._camera = new ce(this._settings), this._renderer = new De(
|
|
931
|
+
this._scene,
|
|
932
|
+
this._camera,
|
|
933
|
+
this._settings
|
|
934
|
+
), this._resizeManager = new Ie(
|
|
935
|
+
this._renderer,
|
|
936
|
+
this._camera
|
|
937
|
+
), this._clock = new xe(), this._clock.setRenderer(this._renderer), this._settings.autoStart && this.start();
|
|
938
|
+
}
|
|
939
|
+
get scene() {
|
|
940
|
+
return this._scene;
|
|
941
|
+
}
|
|
942
|
+
get camera() {
|
|
943
|
+
return this._camera;
|
|
944
|
+
}
|
|
945
|
+
get renderer() {
|
|
946
|
+
return this._renderer;
|
|
947
|
+
}
|
|
948
|
+
setCanvas(i) {
|
|
949
|
+
this._renderer.setCanvas(i), this._resizeManager.setCanvas(i);
|
|
950
|
+
}
|
|
951
|
+
get clock() {
|
|
952
|
+
return this._clock;
|
|
953
|
+
}
|
|
954
|
+
start() {
|
|
955
|
+
this._clock.start();
|
|
956
|
+
}
|
|
957
|
+
stop() {
|
|
958
|
+
this._clock.stop();
|
|
959
|
+
}
|
|
960
|
+
dispose() {
|
|
961
|
+
this._clock.dispose(), this._resizeManager.dispose(), this._renderer.dispose();
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
const A = "#c20017", G = "#00ab26", z = "#0081d4", Le = A, Se = G, ke = z;
|
|
965
|
+
window.DIVE = {
|
|
966
|
+
instances: [],
|
|
967
|
+
get instance() {
|
|
968
|
+
return window.DIVE.instances[0];
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
const Ve = {
|
|
972
|
+
...R,
|
|
973
|
+
...W
|
|
974
|
+
};
|
|
975
|
+
class O {
|
|
976
|
+
constructor(i) {
|
|
977
|
+
// descriptive members
|
|
978
|
+
s(this, "_instanceId", f.generateUUID());
|
|
979
|
+
s(this, "_settings");
|
|
980
|
+
s(this, "_engine");
|
|
981
|
+
s(this, "orbitController");
|
|
982
|
+
s(this, "axisCamera");
|
|
983
|
+
this._settings = {
|
|
984
|
+
...Ve,
|
|
985
|
+
...i ?? {}
|
|
986
|
+
}, this._engine = new Ce(i), this.orbitController = new x(
|
|
987
|
+
this._engine.camera,
|
|
988
|
+
this._engine.renderer.webglrenderer.domElement,
|
|
989
|
+
this._settings
|
|
990
|
+
), this._engine.clock.addTicker(this.orbitController), this._settings.displayAxes ? (this.axisCamera = new ue(
|
|
991
|
+
this._engine.renderer,
|
|
992
|
+
this._engine.scene,
|
|
993
|
+
this._engine.camera
|
|
994
|
+
), this._engine.clock.addTicker(this.axisCamera)) : this.axisCamera = null, import("./package-CeZyVg2G.mjs").then((e) => {
|
|
995
|
+
console.log(
|
|
996
|
+
`DIVE ${e.default.version} initialized successfully!`
|
|
997
|
+
), console.log(`
|
|
998
|
+
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
999
|
+
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
1000
|
+
@@%=::::.......::---------------------------------------------------------+@@
|
|
1001
|
+
@@+:::...........::-----------------------------------------------------------#@@
|
|
1002
|
+
@@=:::.........::::::-------------------------------------------------------------%@
|
|
1003
|
+
@%:::.......:::::::-----------------------------------------------------------------#@
|
|
1004
|
+
@*:::.....:::::-----------------------------------------------------------------------*@
|
|
1005
|
+
@%::::::.::::---------------------------------------------------------------------------@@
|
|
1006
|
+
@@-:::::::::-----------------------------------------------------------------------------=@
|
|
1007
|
+
@%::::::::--------------------------------------------------------------------------------%@
|
|
1008
|
+
@+::::::::--------------------------------=@@@@@%-----------------------------------------%@
|
|
1009
|
+
@=:::::::--------------------------------*@@ @@+---------------------------------------#@
|
|
1010
|
+
@+:::::::-------------------------------*@ @*--------------------------------------%@
|
|
1011
|
+
@#::::::::-----------------------------=@@ @@=-------------------------------------%@
|
|
1012
|
+
@@-::::::::----------------------------@@ @@------------------------------------=@
|
|
1013
|
+
@%:::::::::--------------------------*@ @*-----------------------------------@@
|
|
1014
|
+
@*:::::::::-------------------------@@ @@----------------------------------%@
|
|
1015
|
+
@#::::::::::----------------------%@ @%--------------------------------%@
|
|
1016
|
+
@#:::::::::::-------------------=@@ @@=------------------------------%@
|
|
1017
|
+
@@-::::::::::::----------------%@ @%----------------------------=@@
|
|
1018
|
+
@@#::::::::::::::------------*@ @*--------------------------#@@
|
|
1019
|
+
@@+::::::::::::::::--------@@ @@------------------------+@@
|
|
1020
|
+
@@*:::::::::::::::::----@@ @@---------------------+@@
|
|
1021
|
+
@@@-:::::::::::::::--#@ @#-----------------=%@@
|
|
1022
|
+
@@%-::::::::::::-%@ @%-------------=%@@
|
|
1023
|
+
@@@@+:::::::#@@ @@*-------*@@@@
|
|
1024
|
+
@@@@@@@ @@@@@@
|
|
1025
|
+
|
|
1026
|
+
`);
|
|
1027
|
+
}), window.DIVE.instances.push(this);
|
|
1028
|
+
}
|
|
1029
|
+
// static members
|
|
1030
|
+
static async QuickView(i, e) {
|
|
1031
|
+
const t = new O(e);
|
|
1032
|
+
t.engine.scene.background = new l(16777215), t.engine.scene.grid.setVisibility(!1), t.engine.scene.root.floor.setVisibility(!0), t.engine.camera.position.set(0, 2, 2), t.orbitController.target.set(0, 0.5, 0);
|
|
1033
|
+
const r = new M();
|
|
1034
|
+
r.name = "SceneLight", r.userData.id = f.generateUUID(), r.setEnabled(!0), r.visible = !0, r.setIntensity((e == null ? void 0 : e.lightIntensity) ?? 1), r.setColor(new l(16777215)), t.engine.scene.root.add(r);
|
|
1035
|
+
const n = new T();
|
|
1036
|
+
n.name = "object", n.userData.id = f.generateUUID(), n.userData.uri = i, n.visible = !0, t.engine.scene.root.add(n), await n.setFromURL(i);
|
|
1037
|
+
const a = t.engine.scene.computeSceneBB(), h = t.orbitController.computeEncompassingView(a);
|
|
1038
|
+
return t.engine.camera.position.copy(h.position), t.orbitController.target.copy(h.target), t;
|
|
1039
|
+
}
|
|
1040
|
+
get engine() {
|
|
1041
|
+
return this._engine;
|
|
1042
|
+
}
|
|
1043
|
+
get canvas() {
|
|
1044
|
+
return this._engine.renderer.webglrenderer.domElement;
|
|
1045
|
+
}
|
|
1046
|
+
setCanvas(i) {
|
|
1047
|
+
this._engine.setCanvas(i), this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.orbitController = new x(
|
|
1048
|
+
this._engine.camera,
|
|
1049
|
+
i,
|
|
1050
|
+
this._settings
|
|
1051
|
+
), this._engine.clock.addTicker(this.orbitController);
|
|
1052
|
+
}
|
|
1053
|
+
async dispose() {
|
|
1054
|
+
return new Promise((i) => {
|
|
1055
|
+
this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.axisCamera && (this._engine.clock.removeTicker(this.axisCamera), this.axisCamera.dispose()), window.DIVE.instances = window.DIVE.instances.filter(
|
|
1056
|
+
(e) => e._instanceId !== this._instanceId
|
|
1057
|
+
), i();
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
const Be = {
|
|
1062
|
+
glb: {
|
|
1063
|
+
key: "glb",
|
|
1064
|
+
extension: "glb"
|
|
1065
|
+
},
|
|
1066
|
+
gltf: {
|
|
1067
|
+
key: "gltf",
|
|
1068
|
+
extension: "gltf"
|
|
1069
|
+
},
|
|
1070
|
+
usdz: {
|
|
1071
|
+
key: "usdz",
|
|
1072
|
+
extension: "usdz"
|
|
1073
|
+
}
|
|
1074
|
+
}, Ge = Object.values(Be).map(
|
|
1075
|
+
(o) => o.extension
|
|
1076
|
+
);
|
|
1077
|
+
export {
|
|
1078
|
+
Le as A,
|
|
1079
|
+
ue as D,
|
|
1080
|
+
R as E,
|
|
1081
|
+
Be as F,
|
|
1082
|
+
ye as G,
|
|
1083
|
+
Ge as S,
|
|
1084
|
+
Se as a,
|
|
1085
|
+
ke as b,
|
|
1086
|
+
Ve as c,
|
|
1087
|
+
O as d,
|
|
1088
|
+
A as e,
|
|
1089
|
+
G as f,
|
|
1090
|
+
z as g,
|
|
1091
|
+
be as h,
|
|
1092
|
+
we as i,
|
|
1093
|
+
ve as j,
|
|
1094
|
+
pe as k,
|
|
1095
|
+
_e as l,
|
|
1096
|
+
me as m,
|
|
1097
|
+
M as n,
|
|
1098
|
+
T as o,
|
|
1099
|
+
D as p,
|
|
1100
|
+
ge as q,
|
|
1101
|
+
fe as r,
|
|
1102
|
+
xe as s,
|
|
1103
|
+
P as t,
|
|
1104
|
+
De as u,
|
|
1105
|
+
Ie as v,
|
|
1106
|
+
Ee as w,
|
|
1107
|
+
Ce as x,
|
|
1108
|
+
E as y
|
|
1109
|
+
};
|