@shopware-ag/dive 1.19.1-beta.8 → 2.0.1-beta.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.
- package/build/chunks/FileTypes-BjZ0rrIV.cjs +1 -0
- package/build/chunks/FileTypes-qgYnI0Jg.mjs +30 -0
- package/build/chunks/ModuleRegistry-NyNtjHb2.cjs +1 -0
- package/build/chunks/ModuleRegistry-RSub8W0G.mjs +13 -0
- package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +1 -0
- package/build/chunks/PerspectiveCamera-sm4_81KJ.mjs +34 -0
- package/build/chunks/SelectTool-BRKko7uz.cjs +1 -0
- package/build/chunks/SelectTool-mTRiZYaC.mjs +712 -0
- package/build/chunks/SystemInfo-DPAQG-S5.mjs +139 -0
- package/build/chunks/SystemInfo-oX-NNneO.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +1 -0
- package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +8 -0
- package/build/chunks/findInterface-BEdL2iUQ.cjs +1 -0
- package/build/chunks/findInterface-OrXgmwxj.mjs +18 -0
- package/build/chunks/index-C_uFFwT2.mjs +5 -0
- package/build/chunks/index-DAwIH9xh.cjs +1 -0
- package/build/chunks/package-BFpY3sIj.cjs +1 -0
- package/build/chunks/package-BvoZkrge.mjs +39 -0
- package/build/chunks/parse-error-2f5qpXP5.cjs +6 -0
- package/build/chunks/parse-error-DRBVHL9E.mjs +614 -0
- package/build/dive.cjs +30 -0
- package/build/dive.d.ts +2 -0
- package/build/dive.mjs +1757 -0
- package/build/src/{primitive → components}/floor/Floor.d.ts +1 -1
- package/build/src/{gizmo → components/gizmo}/Gizmo.d.ts +4 -4
- package/build/src/{gizmo → components/gizmo}/handles/AxisHandle.d.ts +4 -4
- package/build/src/{gizmo → components/gizmo}/handles/RadialHandle.d.ts +4 -4
- package/build/src/{gizmo → components/gizmo}/handles/ScaleHandle.d.ts +4 -4
- package/build/src/{gizmo → components/gizmo}/plane/GizmoPlane.d.ts +1 -1
- package/build/src/{gizmo → components/gizmo}/rotate/RotateGizmo.d.ts +4 -4
- package/build/src/{gizmo → components/gizmo}/scale/ScaleGizmo.d.ts +5 -5
- package/build/src/{gizmo → components/gizmo}/translate/TranslateGizmo.d.ts +4 -4
- package/build/src/{group → components/group}/Group.d.ts +8 -3
- package/build/src/components/index.d.ts +9 -0
- package/build/src/{light → components/light}/AmbientLight.d.ts +1 -1
- package/build/src/{light → components/light}/PointLight.d.ts +4 -4
- package/build/src/{light → components/light}/SceneLight.d.ts +1 -1
- package/build/src/components/light/index.d.ts +3 -0
- package/build/src/{model → components/model}/Model.d.ts +2 -2
- package/build/src/{node → components/node}/Node.d.ts +4 -4
- package/build/src/{primitive → components/primitive}/Primitive.d.ts +2 -2
- package/build/src/{engine/scene → components}/root/Root.d.ts +6 -2
- package/build/src/constants/index.d.ts +3 -0
- package/build/src/core/Dive.d.ts +57 -0
- package/build/src/core/index.d.ts +1 -0
- package/build/src/engine/Engine.d.ts +19 -19
- package/build/src/engine/camera/PerspectiveCamera.d.ts +6 -3
- package/build/src/engine/clock/Clock.d.ts +19 -0
- package/build/src/engine/renderer/Renderer.d.ts +29 -57
- package/build/src/engine/resize/ResizeManager.d.ts +11 -0
- package/build/src/engine/scene/Scene.d.ts +6 -15
- package/build/src/engine/scene/xrroot/XRRoot.d.ts +5 -5
- package/build/src/engine/scene/xrroot/xrlightroot/XRLightRoot.d.ts +3 -3
- package/build/src/{helper → helpers}/findSceneRecursive/findSceneRecursive.d.ts +1 -1
- package/build/src/helpers/index.d.ts +8 -0
- package/build/src/{helper → helpers}/isFileTypeSupported/isFileTypeSupported.d.ts +1 -1
- package/build/src/index.d.ts +8 -2
- package/build/src/{interface → interfaces}/Draggable.d.ts +1 -1
- package/build/src/interfaces/index.d.ts +6 -0
- package/build/src/modules/ModuleRegistry.d.ts +19 -0
- package/build/src/modules/animation/AnimationSystem.cjs +1 -0
- package/build/src/modules/animation/AnimationSystem.d.ts +36 -0
- package/build/src/modules/animation/AnimationSystem.mjs +95 -0
- package/build/src/modules/animation/animator/Animator.d.ts +26 -0
- package/build/src/modules/animation/types/AnimatorParameters.d.ts +7 -0
- package/build/src/modules/ar/ARSystem.cjs +1 -2
- package/build/src/modules/ar/ARSystem.d.ts +1 -2
- package/build/src/modules/ar/ARSystem.mjs +2 -3
- package/build/src/modules/ar/arquicklook/ARQuickLook.d.ts +1 -1
- package/build/src/modules/ar/sceneviewer/SceneViewer.d.ts +1 -1
- package/build/src/modules/ar/webxr/WebXR.d.ts +3 -4
- package/build/src/modules/ar/webxr/controller/WebXRController.d.ts +3 -3
- package/build/src/modules/ar/webxr/origin/WebXROrigin.d.ts +2 -2
- package/build/src/modules/ar/webxr/raycaster/WebXRRaycaster.d.ts +4 -4
- package/build/src/modules/ar/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +3 -3
- package/build/src/modules/ar/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +4 -4
- package/build/src/modules/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +1 -1
- package/build/src/modules/asset/converter/AssetConverter.cjs +0 -1
- package/build/src/modules/asset/converter/AssetConverter.d.ts +4 -5
- package/build/src/modules/asset/converter/AssetConverter.mjs +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.cjs +24 -25
- package/build/src/modules/asset/exporter/AssetExporter.d.ts +15 -3
- package/build/src/modules/asset/exporter/AssetExporter.mjs +3 -5
- package/build/src/modules/asset/loader/AssetLoader.cjs +2 -3
- package/build/src/modules/asset/loader/AssetLoader.d.ts +1 -3
- package/build/src/modules/asset/loader/AssetLoader.mjs +96 -101
- package/build/src/modules/axiscamera/AxisCamera.d.ts +21 -0
- package/build/src/modules/controller/orbit/OrbitController.d.ts +30 -0
- package/build/src/modules/mediacreator/MediaCreator.cjs +1 -2
- package/build/src/modules/mediacreator/MediaCreator.d.ts +5 -6
- package/build/src/modules/mediacreator/MediaCreator.mjs +13 -11
- package/build/src/modules/state/ActionRegistry.d.ts +26 -0
- package/build/src/modules/state/State.cjs +27 -0
- package/build/src/modules/state/State.d.ts +58 -0
- package/build/src/modules/state/State.mjs +4271 -0
- package/build/src/modules/state/actions/action.d.ts +36 -0
- package/build/src/modules/state/actions/ar/index.d.ts +1 -0
- package/build/src/modules/state/actions/ar/launchar.d.ts +15 -0
- package/build/src/modules/state/actions/camera/computeencompassingview.d.ts +12 -0
- package/build/src/modules/state/actions/camera/getcameratransform.d.ts +12 -0
- package/build/src/modules/state/actions/camera/index.d.ts +6 -0
- package/build/src/modules/state/actions/camera/lockcamera.d.ts +8 -0
- package/build/src/modules/state/actions/camera/movecamera.d.ts +29 -0
- package/build/src/modules/state/actions/camera/setcameralayer.d.ts +12 -0
- package/build/src/modules/state/actions/camera/setcameratransform.d.ts +15 -0
- package/build/src/modules/state/actions/camera/zoomcamera.d.ts +14 -0
- package/build/src/modules/state/actions/index.d.ts +7 -0
- package/build/src/modules/state/actions/media/generatemedia.d.ts +25 -0
- package/build/src/modules/state/actions/media/index.d.ts +1 -0
- package/build/src/modules/state/actions/object/addobject.d.ts +8 -0
- package/build/src/modules/state/actions/object/deleteobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/deselectobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/dropit.d.ts +12 -0
- package/build/src/modules/state/actions/object/getallobjects.d.ts +8 -0
- package/build/src/modules/state/actions/object/getobjects.d.ts +12 -0
- package/build/src/modules/state/actions/object/index.d.ts +11 -0
- package/build/src/modules/state/actions/object/modelloaded.d.ts +12 -0
- package/build/src/modules/state/actions/object/placeonfloor.d.ts +12 -0
- package/build/src/modules/state/actions/object/selectobject.d.ts +12 -0
- package/build/src/modules/state/actions/object/setparent.d.ts +22 -0
- package/build/src/modules/state/actions/object/updateobject.d.ts +12 -0
- package/build/src/modules/state/actions/renderer/index.d.ts +1 -0
- package/build/src/modules/state/actions/renderer/startrender.d.ts +8 -0
- package/build/src/modules/state/actions/scene/exportscene.d.ts +13 -0
- package/build/src/modules/state/actions/scene/getallscenedata.d.ts +9 -0
- package/build/src/modules/state/actions/scene/index.d.ts +4 -0
- package/build/src/modules/state/actions/scene/setbackground.d.ts +12 -0
- package/build/src/modules/state/actions/scene/updatescene.d.ts +20 -0
- package/build/src/modules/state/actions/toolbox/index.d.ts +4 -0
- package/build/src/modules/state/actions/toolbox/setgizmomode.d.ts +12 -0
- package/build/src/modules/state/actions/toolbox/setgizmoscalelinked.d.ts +8 -0
- package/build/src/modules/state/actions/toolbox/setgizmovisible.d.ts +8 -0
- package/build/src/modules/state/actions/toolbox/usetool.d.ts +13 -0
- package/build/src/modules/state/types/ActionTypes.d.ts +18 -0
- package/build/src/{com → modules/state}/types/COMBaseEntity.d.ts +1 -1
- package/build/src/modules/state/types/COMEntity.d.ts +6 -0
- package/build/src/{com → modules/state}/types/COMGeometry.d.ts +1 -1
- package/build/src/{com → modules/state}/types/COMGroup.d.ts +3 -1
- package/build/src/{com → modules/state}/types/COMLight.d.ts +3 -1
- package/build/src/{com → modules/state}/types/COMModel.d.ts +4 -2
- package/build/src/modules/state/types/COMPov.d.ts +9 -0
- package/build/src/modules/state/types/COMPrimitive.d.ts +13 -0
- package/build/src/modules/state/types/index.d.ts +11 -0
- package/build/src/modules/systeminfo/SystemInfo.cjs +1 -2
- package/build/src/modules/systeminfo/SystemInfo.d.ts +6 -9
- package/build/src/modules/systeminfo/SystemInfo.mjs +3 -113
- package/build/src/{toolbox → modules/toolbox}/BaseTool.d.ts +6 -6
- package/build/src/modules/toolbox/Toolbox.cjs +1 -0
- package/build/src/{toolbox → modules/toolbox}/Toolbox.d.ts +10 -6
- package/build/src/modules/toolbox/Toolbox.mjs +99 -0
- package/build/src/{toolbox → modules/toolbox}/select/SelectTool.d.ts +5 -5
- package/build/src/{toolbox → modules/toolbox}/transform/TransformTool.d.ts +6 -6
- package/build/src/types/SceneData.d.ts +1 -1
- package/build/src/types/SceneObjects.d.ts +6 -6
- package/build/src/types/SceneType.d.ts +1 -1
- package/build/src/types/UUID.d.ts +1 -0
- package/build/src/types/file/index.d.ts +1 -1
- package/build/src/types/index.d.ts +6 -6
- package/package.json +67 -26
- package/build/chunks/PerspectiveCamera-ACx6umAu.mjs +0 -38
- package/build/chunks/PerspectiveCamera-ACx6umAu.mjs.map +0 -1
- package/build/chunks/PerspectiveCamera-BXPNOM71.cjs +0 -2
- package/build/chunks/PerspectiveCamera-BXPNOM71.cjs.map +0 -1
- package/build/chunks/fflate.module-DHdJvhNh.cjs +0 -7
- package/build/chunks/fflate.module-DHdJvhNh.cjs.map +0 -1
- package/build/chunks/fflate.module-DkZg07PZ.mjs +0 -603
- package/build/chunks/fflate.module-DkZg07PZ.mjs.map +0 -1
- package/build/chunks/file-type-error-D6aWGgyc.mjs +0 -15
- package/build/chunks/file-type-error-D6aWGgyc.mjs.map +0 -1
- package/build/chunks/file-type-error-DtvBgs64.cjs +0 -2
- package/build/chunks/file-type-error-DtvBgs64.cjs.map +0 -1
- package/build/chunks/index-C7Wx_9uY.mjs +0 -34
- package/build/chunks/index-C7Wx_9uY.mjs.map +0 -1
- package/build/chunks/index-MNP0K5dt.cjs +0 -2
- package/build/chunks/index-MNP0K5dt.cjs.map +0 -1
- package/build/chunks/network-error-C2ZDC8qS.cjs +0 -2
- package/build/chunks/network-error-C2ZDC8qS.cjs.map +0 -1
- package/build/chunks/network-error-DgecatEk.mjs +0 -27
- package/build/chunks/network-error-DgecatEk.mjs.map +0 -1
- package/build/index.cjs +0 -57
- package/build/index.cjs.map +0 -1
- package/build/index.d.ts +0 -6
- package/build/index.mjs +0 -6809
- package/build/index.mjs.map +0 -1
- package/build/src/animation/AnimationSystem.d.ts +0 -16
- package/build/src/axiscamera/AxisCamera.d.ts +0 -18
- package/build/src/com/Communication.d.ts +0 -74
- package/build/src/com/actions/camera/computeencompassingview.d.ts +0 -9
- package/build/src/com/actions/camera/getcameratransform.d.ts +0 -9
- package/build/src/com/actions/camera/movecamera.d.ts +0 -15
- package/build/src/com/actions/camera/resetcamera.d.ts +0 -7
- package/build/src/com/actions/camera/setcameralayer.d.ts +0 -7
- package/build/src/com/actions/camera/setcameratransform.d.ts +0 -9
- package/build/src/com/actions/camera/zoomcamera.d.ts +0 -8
- package/build/src/com/actions/index.d.ts +0 -60
- package/build/src/com/actions/media/generatemedia.d.ts +0 -14
- package/build/src/com/actions/object/addobject.d.ts +0 -6
- package/build/src/com/actions/object/deleteobject.d.ts +0 -8
- package/build/src/com/actions/object/deselectobject.d.ts +0 -8
- package/build/src/com/actions/object/getallobjects.d.ts +0 -6
- package/build/src/com/actions/object/getobjects.d.ts +0 -8
- package/build/src/com/actions/object/model/dropit.d.ts +0 -7
- package/build/src/com/actions/object/model/modelloaded.d.ts +0 -7
- package/build/src/com/actions/object/model/placeonfloor.d.ts +0 -7
- package/build/src/com/actions/object/selectobject.d.ts +0 -8
- package/build/src/com/actions/object/setparent.d.ts +0 -13
- package/build/src/com/actions/object/updateobject.d.ts +0 -8
- package/build/src/com/actions/renderer/startrender.d.ts +0 -5
- package/build/src/com/actions/scene/exportscene.d.ts +0 -8
- package/build/src/com/actions/scene/getallscenedata.d.ts +0 -6
- package/build/src/com/actions/scene/launchar.d.ts +0 -9
- package/build/src/com/actions/scene/setbackground.d.ts +0 -7
- package/build/src/com/actions/scene/updatescene.d.ts +0 -11
- package/build/src/com/actions/toolbox/select/setgizmomode.d.ts +0 -7
- package/build/src/com/actions/toolbox/transform/setgizmoscalelinked.d.ts +0 -5
- package/build/src/com/actions/toolbox/transform/setgizmovisible.d.ts +0 -5
- package/build/src/com/actions/toolbox/usetool.d.ts +0 -8
- package/build/src/com/types/COMEntity.d.ts +0 -6
- package/build/src/com/types/COMPov.d.ts +0 -7
- package/build/src/com/types/COMPrimitive.d.ts +0 -11
- package/build/src/com/types/index.d.ts +0 -11
- package/build/src/controls/OrbitControls.d.ts +0 -38
- package/build/src/dive.d.ts +0 -49
- package/build/src/error/index.d.ts +0 -4
- package/build/src/helper/index.d.ts +0 -7
- package/build/src/modules/_system/ModuleImporter.d.ts +0 -21
- package/build/src/modules/_system/ModuleRegistry.d.ts +0 -72
- package/build/src/modules/ar/ARSystem.cjs.map +0 -1
- package/build/src/modules/ar/ARSystem.mjs.map +0 -1
- package/build/src/modules/asset/converter/AssetConverter.cjs.map +0 -1
- package/build/src/modules/asset/converter/AssetConverter.mjs.map +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.cjs.map +0 -1
- package/build/src/modules/asset/exporter/AssetExporter.mjs.map +0 -1
- package/build/src/modules/asset/loader/AssetLoader.cjs.map +0 -1
- package/build/src/modules/asset/loader/AssetLoader.mjs.map +0 -1
- package/build/src/modules/index.cjs +0 -2
- package/build/src/modules/index.cjs.map +0 -1
- package/build/src/modules/index.d.ts +0 -10
- package/build/src/modules/index.mjs +0 -109
- package/build/src/modules/index.mjs.map +0 -1
- package/build/src/modules/mediacreator/MediaCreator.cjs.map +0 -1
- package/build/src/modules/mediacreator/MediaCreator.mjs.map +0 -1
- package/build/src/modules/systeminfo/SystemInfo.cjs.map +0 -1
- package/build/src/modules/systeminfo/SystemInfo.mjs.map +0 -1
- /package/build/src/{grid → components/grid}/Grid.d.ts +0 -0
- /package/build/src/{constant → constants}/AxisHelperColors.d.ts +0 -0
- /package/build/src/{constant → constants}/GridColors.d.ts +0 -0
- /package/build/src/{constant → constants}/VisibilityLayerMask.d.ts +0 -0
- /package/build/src/{helper → helpers}/applyMixins/applyMixins.d.ts +0 -0
- /package/build/src/{helper → helpers}/findInterface/findInterface.d.ts +0 -0
- /package/build/src/{helper → helpers}/getFileTypeFromUri/getFileTypeFromUri.d.ts +0 -0
- /package/build/src/{helper → helpers}/getObjectDelta/getObjectDelta.d.ts +0 -0
- /package/build/src/{helper/isInterface → helpers/implementsInterface}/implementsInterface.d.ts +0 -0
- /package/build/src/{math → helpers/math}/ceil/ceilExp.d.ts +0 -0
- /package/build/src/{math → helpers/math}/degToRad/degToRad.d.ts +0 -0
- /package/build/src/{math → helpers/math}/floor/floorExp.d.ts +0 -0
- /package/build/src/{math → helpers/math}/helper/shift.d.ts +0 -0
- /package/build/src/{math → helpers/math}/index.d.ts +0 -0
- /package/build/src/{math → helpers/math}/radToDeg/radToDeg.d.ts +0 -0
- /package/build/src/{math → helpers/math}/round/roundExp.d.ts +0 -0
- /package/build/src/{math → helpers/math}/signedAngleTo/signedAngleTo.d.ts +0 -0
- /package/build/src/{math → helpers/math}/toFixed/toFixedExp.d.ts +0 -0
- /package/build/src/{math → helpers/math}/truncate/truncateExp.d.ts +0 -0
- /package/build/src/{interface → interfaces}/Hoverable.d.ts +0 -0
- /package/build/src/{interface → interfaces}/Movable.d.ts +0 -0
- /package/build/src/{interface → interfaces}/Rotatable.d.ts +0 -0
- /package/build/src/{interface → interfaces}/Scalable.d.ts +0 -0
- /package/build/src/{interface → interfaces}/Selectable.d.ts +0 -0
- /package/build/src/{events → modules/events}/EventExecutor.d.ts +0 -0
- /package/build/src/{com → modules/state}/types/COMEntityType.d.ts +0 -0
- /package/build/src/{com → modules/state}/types/COMGeometryType.d.ts +0 -0
- /package/build/src/{com → modules/state}/types/COMMaterial.d.ts +0 -0
package/build/dive.mjs
ADDED
|
@@ -0,0 +1,1757 @@
|
|
|
1
|
+
var Et = Object.defineProperty;
|
|
2
|
+
var wt = (c, s, t) => s in c ? Et(c, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[s] = t;
|
|
3
|
+
var a = (c, s, t) => wt(c, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { Ray as Dt, Plane as St, MathUtils as C, EventDispatcher as Ot, Vector3 as m, MOUSE as F, TOUCH as U, Spherical as ze, Quaternion as Ne, Vector2 as w, OrthographicCamera as Tt, Vector4 as xt, AxesHelper as Pt, Color as x, Matrix4 as Mt, Object3D as Y, AmbientLight as Lt, PointLight as Ct, SphereGeometry as Ke, MeshBasicMaterial as It, FrontSide as At, Mesh as me, HemisphereLight as vt, DirectionalLight as Rt, Box3 as Ze, MeshStandardMaterial as fe, Raycaster as Xe, CylinderGeometry as kt, BufferGeometry as Je, BufferAttribute as Ge, BoxGeometry as de, ConeGeometry as jt, LineDashedMaterial as Vt, Line as Bt, PlaneGeometry as zt, GridHelper as Nt, Scene as Gt, WebGLRenderer as Fe } from "three";
|
|
5
|
+
import ue from "three-spritetext";
|
|
6
|
+
import { C as J, P, U as Ft, H as Ut } from "./chunks/VisibilityLayerMask-CXgt1fJc.mjs";
|
|
7
|
+
import { A as Yt, a as Ht, b as Wt, c as Kt, d as Zt, e as Xt } from "./chunks/findInterface-OrXgmwxj.mjs";
|
|
8
|
+
import { f as Ni, i as Gi } from "./chunks/findInterface-OrXgmwxj.mjs";
|
|
9
|
+
import { g as E } from "./chunks/ModuleRegistry-RSub8W0G.mjs";
|
|
10
|
+
import { D as Jt, a as qt } from "./chunks/PerspectiveCamera-sm4_81KJ.mjs";
|
|
11
|
+
import { F as Ui, S as Yi, g as Hi, i as Wi } from "./chunks/FileTypes-qgYnI0Jg.mjs";
|
|
12
|
+
import { E as Zi, a as Xi } from "./chunks/index-C_uFFwT2.mjs";
|
|
13
|
+
const Ue = { type: "change" }, pe = { type: "start" }, Ye = { type: "end" }, ie = new Dt(), He = new St(), $t = Math.cos(70 * C.DEG2RAD);
|
|
14
|
+
class Qt extends Ot {
|
|
15
|
+
constructor(s, t) {
|
|
16
|
+
super(), this.object = s, this.domElement = t, this.domElement.style.touchAction = "none", this.enabled = !0, this.target = new m(), this.cursor = new m(), this.minDistance = 0, this.maxDistance = 1 / 0, this.minZoom = 0, this.maxZoom = 1 / 0, this.minTargetRadius = 0, this.maxTargetRadius = 1 / 0, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -1 / 0, this.maxAzimuthAngle = 1 / 0, this.enableDamping = !1, this.dampingFactor = 0.05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = { LEFT: "ArrowLeft", UP: "ArrowUp", RIGHT: "ArrowRight", BOTTOM: "ArrowDown" }, this.mouseButtons = { LEFT: F.ROTATE, MIDDLE: F.DOLLY, RIGHT: F.PAN }, this.touches = { ONE: U.ROTATE, TWO: U.DOLLY_PAN }, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._domElementKeyEvents = null, this.getPolarAngle = function() {
|
|
17
|
+
return l.phi;
|
|
18
|
+
}, this.getAzimuthalAngle = function() {
|
|
19
|
+
return l.theta;
|
|
20
|
+
}, this.getDistance = function() {
|
|
21
|
+
return this.object.position.distanceTo(this.target);
|
|
22
|
+
}, this.listenToKeyEvents = function(i) {
|
|
23
|
+
i.addEventListener("keydown", he), this._domElementKeyEvents = i;
|
|
24
|
+
}, this.stopListenToKeyEvents = function() {
|
|
25
|
+
this._domElementKeyEvents.removeEventListener("keydown", he), this._domElementKeyEvents = null;
|
|
26
|
+
}, this.saveState = function() {
|
|
27
|
+
e.target0.copy(e.target), e.position0.copy(e.object.position), e.zoom0 = e.object.zoom;
|
|
28
|
+
}, this.reset = function() {
|
|
29
|
+
e.target.copy(e.target0), e.object.position.copy(e.position0), e.object.zoom = e.zoom0, e.object.updateProjectionMatrix(), e.dispatchEvent(Ue), e.update(), o = n.NONE;
|
|
30
|
+
}, this.update = function() {
|
|
31
|
+
const i = new m(), r = new Ne().setFromUnitVectors(s.up, new m(0, 1, 0)), d = r.clone().invert(), u = new m(), _ = new Ne(), L = new m(), y = 2 * Math.PI;
|
|
32
|
+
return function(yt = null) {
|
|
33
|
+
const Ve = e.object.position;
|
|
34
|
+
i.copy(Ve).sub(e.target), i.applyQuaternion(r), l.setFromVector3(i), e.autoRotate && o === n.NONE && W(tt(yt)), e.enableDamping ? (l.theta += p.theta * e.dampingFactor, l.phi += p.phi * e.dampingFactor) : (l.theta += p.theta, l.phi += p.phi);
|
|
35
|
+
let S = e.minAzimuthAngle, O = e.maxAzimuthAngle;
|
|
36
|
+
isFinite(S) && isFinite(O) && (S < -Math.PI ? S += y : S > Math.PI && (S -= y), O < -Math.PI ? O += y : O > Math.PI && (O -= y), S <= O ? l.theta = Math.max(S, Math.min(O, l.theta)) : l.theta = l.theta > (S + O) / 2 ? Math.max(S, l.theta) : Math.min(O, l.theta)), l.phi = Math.max(e.minPolarAngle, Math.min(e.maxPolarAngle, l.phi)), l.makeSafe(), e.enableDamping === !0 ? e.target.addScaledVector(b, e.dampingFactor) : e.target.add(b), e.target.sub(e.cursor), e.target.clampLength(e.minTargetRadius, e.maxTargetRadius), e.target.add(e.cursor);
|
|
37
|
+
let Z = !1;
|
|
38
|
+
if (e.zoomToCursor && $ || e.object.isOrthographicCamera)
|
|
39
|
+
l.radius = ce(l.radius);
|
|
40
|
+
else {
|
|
41
|
+
const T = l.radius;
|
|
42
|
+
l.radius = ce(l.radius * f), Z = T != l.radius;
|
|
43
|
+
}
|
|
44
|
+
if (i.setFromSpherical(l), i.applyQuaternion(d), Ve.copy(e.target).add(i), e.object.lookAt(e.target), e.enableDamping === !0 ? (p.theta *= 1 - e.dampingFactor, p.phi *= 1 - e.dampingFactor, b.multiplyScalar(1 - e.dampingFactor)) : (p.set(0, 0, 0), b.set(0, 0, 0)), e.zoomToCursor && $) {
|
|
45
|
+
let T = null;
|
|
46
|
+
if (e.object.isPerspectiveCamera) {
|
|
47
|
+
const X = i.length();
|
|
48
|
+
T = ce(X * f);
|
|
49
|
+
const te = X - T;
|
|
50
|
+
e.object.position.addScaledVector(_e, te), e.object.updateMatrixWorld(), Z = !!te;
|
|
51
|
+
} else if (e.object.isOrthographicCamera) {
|
|
52
|
+
const X = new m(M.x, M.y, 0);
|
|
53
|
+
X.unproject(e.object);
|
|
54
|
+
const te = e.object.zoom;
|
|
55
|
+
e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / f)), e.object.updateProjectionMatrix(), Z = te !== e.object.zoom;
|
|
56
|
+
const Be = new m(M.x, M.y, 0);
|
|
57
|
+
Be.unproject(e.object), e.object.position.sub(Be).add(X), e.object.updateMatrixWorld(), T = i.length();
|
|
58
|
+
} else
|
|
59
|
+
console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), e.zoomToCursor = !1;
|
|
60
|
+
T !== null && (this.screenSpacePanning ? e.target.set(0, 0, -1).transformDirection(e.object.matrix).multiplyScalar(T).add(e.object.position) : (ie.origin.copy(e.object.position), ie.direction.set(0, 0, -1).transformDirection(e.object.matrix), Math.abs(e.object.up.dot(ie.direction)) < $t ? s.lookAt(e.target) : (He.setFromNormalAndCoplanarPoint(e.object.up, e.target), ie.intersectPlane(He, e.target))));
|
|
61
|
+
} else if (e.object.isOrthographicCamera) {
|
|
62
|
+
const T = e.object.zoom;
|
|
63
|
+
e.object.zoom = Math.max(e.minZoom, Math.min(e.maxZoom, e.object.zoom / f)), T !== e.object.zoom && (e.object.updateProjectionMatrix(), Z = !0);
|
|
64
|
+
}
|
|
65
|
+
return f = 1, $ = !1, Z || u.distanceToSquared(e.object.position) > h || 8 * (1 - _.dot(e.object.quaternion)) > h || L.distanceToSquared(e.target) > h ? (e.dispatchEvent(Ue), u.copy(e.object.position), _.copy(e.object.quaternion), L.copy(e.target), !0) : !1;
|
|
66
|
+
};
|
|
67
|
+
}(), this.dispose = function() {
|
|
68
|
+
e.domElement.removeEventListener("contextmenu", ke), e.domElement.removeEventListener("pointerdown", Ce), e.domElement.removeEventListener("pointercancel", K), e.domElement.removeEventListener("wheel", Ie), e.domElement.removeEventListener("pointermove", le), e.domElement.removeEventListener("pointerup", K), e.domElement.getRootNode().removeEventListener("keydown", Ae, { capture: !0 }), e._domElementKeyEvents !== null && (e._domElementKeyEvents.removeEventListener("keydown", he), e._domElementKeyEvents = null);
|
|
69
|
+
};
|
|
70
|
+
const e = this, n = {
|
|
71
|
+
NONE: -1,
|
|
72
|
+
ROTATE: 0,
|
|
73
|
+
DOLLY: 1,
|
|
74
|
+
PAN: 2,
|
|
75
|
+
TOUCH_ROTATE: 3,
|
|
76
|
+
TOUCH_PAN: 4,
|
|
77
|
+
TOUCH_DOLLY_PAN: 5,
|
|
78
|
+
TOUCH_DOLLY_ROTATE: 6
|
|
79
|
+
};
|
|
80
|
+
let o = n.NONE;
|
|
81
|
+
const h = 1e-6, l = new ze(), p = new ze();
|
|
82
|
+
let f = 1;
|
|
83
|
+
const b = new m(), I = new w(), A = new w(), j = new w(), v = new w(), R = new w(), V = new w(), B = new w(), z = new w(), k = new w(), _e = new m(), M = new w();
|
|
84
|
+
let $ = !1;
|
|
85
|
+
const g = [], H = {};
|
|
86
|
+
let oe = !1;
|
|
87
|
+
function tt(i) {
|
|
88
|
+
return i !== null ? 2 * Math.PI / 60 * e.autoRotateSpeed * i : 2 * Math.PI / 60 / 60 * e.autoRotateSpeed;
|
|
89
|
+
}
|
|
90
|
+
function Q(i) {
|
|
91
|
+
const r = Math.abs(i * 0.01);
|
|
92
|
+
return Math.pow(0.95, e.zoomSpeed * r);
|
|
93
|
+
}
|
|
94
|
+
function W(i) {
|
|
95
|
+
p.theta -= i;
|
|
96
|
+
}
|
|
97
|
+
function ee(i) {
|
|
98
|
+
p.phi -= i;
|
|
99
|
+
}
|
|
100
|
+
const ye = function() {
|
|
101
|
+
const i = new m();
|
|
102
|
+
return function(d, u) {
|
|
103
|
+
i.setFromMatrixColumn(u, 0), i.multiplyScalar(-d), b.add(i);
|
|
104
|
+
};
|
|
105
|
+
}(), Ee = function() {
|
|
106
|
+
const i = new m();
|
|
107
|
+
return function(d, u) {
|
|
108
|
+
e.screenSpacePanning === !0 ? i.setFromMatrixColumn(u, 1) : (i.setFromMatrixColumn(u, 0), i.crossVectors(e.object.up, i)), i.multiplyScalar(d), b.add(i);
|
|
109
|
+
};
|
|
110
|
+
}(), N = function() {
|
|
111
|
+
const i = new m();
|
|
112
|
+
return function(d, u) {
|
|
113
|
+
const _ = e.domElement;
|
|
114
|
+
if (e.object.isPerspectiveCamera) {
|
|
115
|
+
const L = e.object.position;
|
|
116
|
+
i.copy(L).sub(e.target);
|
|
117
|
+
let y = i.length();
|
|
118
|
+
y *= Math.tan(e.object.fov / 2 * Math.PI / 180), ye(2 * d * y / _.clientHeight, e.object.matrix), Ee(2 * u * y / _.clientHeight, e.object.matrix);
|
|
119
|
+
} else e.object.isOrthographicCamera ? (ye(d * (e.object.right - e.object.left) / e.object.zoom / _.clientWidth, e.object.matrix), Ee(u * (e.object.top - e.object.bottom) / e.object.zoom / _.clientHeight, e.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), e.enablePan = !1);
|
|
120
|
+
};
|
|
121
|
+
}();
|
|
122
|
+
function re(i) {
|
|
123
|
+
e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? f /= i : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
|
124
|
+
}
|
|
125
|
+
function we(i) {
|
|
126
|
+
e.object.isPerspectiveCamera || e.object.isOrthographicCamera ? f *= i : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), e.enableZoom = !1);
|
|
127
|
+
}
|
|
128
|
+
function ae(i, r) {
|
|
129
|
+
if (!e.zoomToCursor)
|
|
130
|
+
return;
|
|
131
|
+
$ = !0;
|
|
132
|
+
const d = e.domElement.getBoundingClientRect(), u = i - d.left, _ = r - d.top, L = d.width, y = d.height;
|
|
133
|
+
M.x = u / L * 2 - 1, M.y = -(_ / y) * 2 + 1, _e.set(M.x, M.y, 1).unproject(e.object).sub(e.object.position).normalize();
|
|
134
|
+
}
|
|
135
|
+
function ce(i) {
|
|
136
|
+
return Math.max(e.minDistance, Math.min(e.maxDistance, i));
|
|
137
|
+
}
|
|
138
|
+
function De(i) {
|
|
139
|
+
I.set(i.clientX, i.clientY);
|
|
140
|
+
}
|
|
141
|
+
function it(i) {
|
|
142
|
+
ae(i.clientX, i.clientX), B.set(i.clientX, i.clientY);
|
|
143
|
+
}
|
|
144
|
+
function Se(i) {
|
|
145
|
+
v.set(i.clientX, i.clientY);
|
|
146
|
+
}
|
|
147
|
+
function st(i) {
|
|
148
|
+
A.set(i.clientX, i.clientY), j.subVectors(A, I).multiplyScalar(e.rotateSpeed);
|
|
149
|
+
const r = e.domElement;
|
|
150
|
+
W(2 * Math.PI * j.x / r.clientHeight), ee(2 * Math.PI * j.y / r.clientHeight), I.copy(A), e.update();
|
|
151
|
+
}
|
|
152
|
+
function nt(i) {
|
|
153
|
+
z.set(i.clientX, i.clientY), k.subVectors(z, B), k.y > 0 ? re(Q(k.y)) : k.y < 0 && we(Q(k.y)), B.copy(z), e.update();
|
|
154
|
+
}
|
|
155
|
+
function ot(i) {
|
|
156
|
+
R.set(i.clientX, i.clientY), V.subVectors(R, v).multiplyScalar(e.panSpeed), N(V.x, V.y), v.copy(R), e.update();
|
|
157
|
+
}
|
|
158
|
+
function rt(i) {
|
|
159
|
+
ae(i.clientX, i.clientY), i.deltaY < 0 ? we(Q(i.deltaY)) : i.deltaY > 0 && re(Q(i.deltaY)), e.update();
|
|
160
|
+
}
|
|
161
|
+
function at(i) {
|
|
162
|
+
let r = !1;
|
|
163
|
+
switch (i.code) {
|
|
164
|
+
case e.keys.UP:
|
|
165
|
+
i.ctrlKey || i.metaKey || i.shiftKey ? ee(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : N(0, e.keyPanSpeed), r = !0;
|
|
166
|
+
break;
|
|
167
|
+
case e.keys.BOTTOM:
|
|
168
|
+
i.ctrlKey || i.metaKey || i.shiftKey ? ee(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : N(0, -e.keyPanSpeed), r = !0;
|
|
169
|
+
break;
|
|
170
|
+
case e.keys.LEFT:
|
|
171
|
+
i.ctrlKey || i.metaKey || i.shiftKey ? W(2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : N(e.keyPanSpeed, 0), r = !0;
|
|
172
|
+
break;
|
|
173
|
+
case e.keys.RIGHT:
|
|
174
|
+
i.ctrlKey || i.metaKey || i.shiftKey ? W(-2 * Math.PI * e.rotateSpeed / e.domElement.clientHeight) : N(-e.keyPanSpeed, 0), r = !0;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
r && (i.preventDefault(), e.update());
|
|
178
|
+
}
|
|
179
|
+
function Oe(i) {
|
|
180
|
+
if (g.length === 1)
|
|
181
|
+
I.set(i.pageX, i.pageY);
|
|
182
|
+
else {
|
|
183
|
+
const r = G(i), d = 0.5 * (i.pageX + r.x), u = 0.5 * (i.pageY + r.y);
|
|
184
|
+
I.set(d, u);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function Te(i) {
|
|
188
|
+
if (g.length === 1)
|
|
189
|
+
v.set(i.pageX, i.pageY);
|
|
190
|
+
else {
|
|
191
|
+
const r = G(i), d = 0.5 * (i.pageX + r.x), u = 0.5 * (i.pageY + r.y);
|
|
192
|
+
v.set(d, u);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function xe(i) {
|
|
196
|
+
const r = G(i), d = i.pageX - r.x, u = i.pageY - r.y, _ = Math.sqrt(d * d + u * u);
|
|
197
|
+
B.set(0, _);
|
|
198
|
+
}
|
|
199
|
+
function ct(i) {
|
|
200
|
+
e.enableZoom && xe(i), e.enablePan && Te(i);
|
|
201
|
+
}
|
|
202
|
+
function lt(i) {
|
|
203
|
+
e.enableZoom && xe(i), e.enableRotate && Oe(i);
|
|
204
|
+
}
|
|
205
|
+
function Pe(i) {
|
|
206
|
+
if (g.length == 1)
|
|
207
|
+
A.set(i.pageX, i.pageY);
|
|
208
|
+
else {
|
|
209
|
+
const d = G(i), u = 0.5 * (i.pageX + d.x), _ = 0.5 * (i.pageY + d.y);
|
|
210
|
+
A.set(u, _);
|
|
211
|
+
}
|
|
212
|
+
j.subVectors(A, I).multiplyScalar(e.rotateSpeed);
|
|
213
|
+
const r = e.domElement;
|
|
214
|
+
W(2 * Math.PI * j.x / r.clientHeight), ee(2 * Math.PI * j.y / r.clientHeight), I.copy(A);
|
|
215
|
+
}
|
|
216
|
+
function Me(i) {
|
|
217
|
+
if (g.length === 1)
|
|
218
|
+
R.set(i.pageX, i.pageY);
|
|
219
|
+
else {
|
|
220
|
+
const r = G(i), d = 0.5 * (i.pageX + r.x), u = 0.5 * (i.pageY + r.y);
|
|
221
|
+
R.set(d, u);
|
|
222
|
+
}
|
|
223
|
+
V.subVectors(R, v).multiplyScalar(e.panSpeed), N(V.x, V.y), v.copy(R);
|
|
224
|
+
}
|
|
225
|
+
function Le(i) {
|
|
226
|
+
const r = G(i), d = i.pageX - r.x, u = i.pageY - r.y, _ = Math.sqrt(d * d + u * u);
|
|
227
|
+
z.set(0, _), k.set(0, Math.pow(z.y / B.y, e.zoomSpeed)), re(k.y), B.copy(z);
|
|
228
|
+
const L = (i.pageX + r.x) * 0.5, y = (i.pageY + r.y) * 0.5;
|
|
229
|
+
ae(L, y);
|
|
230
|
+
}
|
|
231
|
+
function ht(i) {
|
|
232
|
+
e.enableZoom && Le(i), e.enablePan && Me(i);
|
|
233
|
+
}
|
|
234
|
+
function dt(i) {
|
|
235
|
+
e.enableZoom && Le(i), e.enableRotate && Pe(i);
|
|
236
|
+
}
|
|
237
|
+
function Ce(i) {
|
|
238
|
+
e.enabled !== !1 && (g.length === 0 && (e.domElement.setPointerCapture(i.pointerId), e.domElement.addEventListener("pointermove", le), e.domElement.addEventListener("pointerup", K)), !_t(i) && (gt(i), i.pointerType === "touch" ? Re(i) : ut(i)));
|
|
239
|
+
}
|
|
240
|
+
function le(i) {
|
|
241
|
+
e.enabled !== !1 && (i.pointerType === "touch" ? ft(i) : pt(i));
|
|
242
|
+
}
|
|
243
|
+
function K(i) {
|
|
244
|
+
switch (bt(i), g.length) {
|
|
245
|
+
case 0:
|
|
246
|
+
e.domElement.releasePointerCapture(i.pointerId), e.domElement.removeEventListener("pointermove", le), e.domElement.removeEventListener("pointerup", K), e.dispatchEvent(Ye), o = n.NONE;
|
|
247
|
+
break;
|
|
248
|
+
case 1:
|
|
249
|
+
const r = g[0], d = H[r];
|
|
250
|
+
Re({ pointerId: r, pageX: d.x, pageY: d.y });
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
function ut(i) {
|
|
255
|
+
let r;
|
|
256
|
+
switch (i.button) {
|
|
257
|
+
case 0:
|
|
258
|
+
r = e.mouseButtons.LEFT;
|
|
259
|
+
break;
|
|
260
|
+
case 1:
|
|
261
|
+
r = e.mouseButtons.MIDDLE;
|
|
262
|
+
break;
|
|
263
|
+
case 2:
|
|
264
|
+
r = e.mouseButtons.RIGHT;
|
|
265
|
+
break;
|
|
266
|
+
default:
|
|
267
|
+
r = -1;
|
|
268
|
+
}
|
|
269
|
+
switch (r) {
|
|
270
|
+
case F.DOLLY:
|
|
271
|
+
if (e.enableZoom === !1) return;
|
|
272
|
+
it(i), o = n.DOLLY;
|
|
273
|
+
break;
|
|
274
|
+
case F.ROTATE:
|
|
275
|
+
if (i.ctrlKey || i.metaKey || i.shiftKey) {
|
|
276
|
+
if (e.enablePan === !1) return;
|
|
277
|
+
Se(i), o = n.PAN;
|
|
278
|
+
} else {
|
|
279
|
+
if (e.enableRotate === !1) return;
|
|
280
|
+
De(i), o = n.ROTATE;
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
case F.PAN:
|
|
284
|
+
if (i.ctrlKey || i.metaKey || i.shiftKey) {
|
|
285
|
+
if (e.enableRotate === !1) return;
|
|
286
|
+
De(i), o = n.ROTATE;
|
|
287
|
+
} else {
|
|
288
|
+
if (e.enablePan === !1) return;
|
|
289
|
+
Se(i), o = n.PAN;
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
default:
|
|
293
|
+
o = n.NONE;
|
|
294
|
+
}
|
|
295
|
+
o !== n.NONE && e.dispatchEvent(pe);
|
|
296
|
+
}
|
|
297
|
+
function pt(i) {
|
|
298
|
+
switch (o) {
|
|
299
|
+
case n.ROTATE:
|
|
300
|
+
if (e.enableRotate === !1) return;
|
|
301
|
+
st(i);
|
|
302
|
+
break;
|
|
303
|
+
case n.DOLLY:
|
|
304
|
+
if (e.enableZoom === !1) return;
|
|
305
|
+
nt(i);
|
|
306
|
+
break;
|
|
307
|
+
case n.PAN:
|
|
308
|
+
if (e.enablePan === !1) return;
|
|
309
|
+
ot(i);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function Ie(i) {
|
|
314
|
+
e.enabled === !1 || e.enableZoom === !1 || o !== n.NONE || (i.preventDefault(), e.dispatchEvent(pe), rt(mt(i)), e.dispatchEvent(Ye));
|
|
315
|
+
}
|
|
316
|
+
function mt(i) {
|
|
317
|
+
const r = i.deltaMode, d = {
|
|
318
|
+
clientX: i.clientX,
|
|
319
|
+
clientY: i.clientY,
|
|
320
|
+
deltaY: i.deltaY
|
|
321
|
+
};
|
|
322
|
+
switch (r) {
|
|
323
|
+
case 1:
|
|
324
|
+
d.deltaY *= 16;
|
|
325
|
+
break;
|
|
326
|
+
case 2:
|
|
327
|
+
d.deltaY *= 100;
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
return i.ctrlKey && !oe && (d.deltaY *= 10), d;
|
|
331
|
+
}
|
|
332
|
+
function Ae(i) {
|
|
333
|
+
i.key === "Control" && (oe = !0, e.domElement.getRootNode().addEventListener("keyup", ve, { passive: !0, capture: !0 }));
|
|
334
|
+
}
|
|
335
|
+
function ve(i) {
|
|
336
|
+
i.key === "Control" && (oe = !1, e.domElement.getRootNode().removeEventListener("keyup", ve, { passive: !0, capture: !0 }));
|
|
337
|
+
}
|
|
338
|
+
function he(i) {
|
|
339
|
+
e.enabled === !1 || e.enablePan === !1 || at(i);
|
|
340
|
+
}
|
|
341
|
+
function Re(i) {
|
|
342
|
+
switch (je(i), g.length) {
|
|
343
|
+
case 1:
|
|
344
|
+
switch (e.touches.ONE) {
|
|
345
|
+
case U.ROTATE:
|
|
346
|
+
if (e.enableRotate === !1) return;
|
|
347
|
+
Oe(i), o = n.TOUCH_ROTATE;
|
|
348
|
+
break;
|
|
349
|
+
case U.PAN:
|
|
350
|
+
if (e.enablePan === !1) return;
|
|
351
|
+
Te(i), o = n.TOUCH_PAN;
|
|
352
|
+
break;
|
|
353
|
+
default:
|
|
354
|
+
o = n.NONE;
|
|
355
|
+
}
|
|
356
|
+
break;
|
|
357
|
+
case 2:
|
|
358
|
+
switch (e.touches.TWO) {
|
|
359
|
+
case U.DOLLY_PAN:
|
|
360
|
+
if (e.enableZoom === !1 && e.enablePan === !1) return;
|
|
361
|
+
ct(i), o = n.TOUCH_DOLLY_PAN;
|
|
362
|
+
break;
|
|
363
|
+
case U.DOLLY_ROTATE:
|
|
364
|
+
if (e.enableZoom === !1 && e.enableRotate === !1) return;
|
|
365
|
+
lt(i), o = n.TOUCH_DOLLY_ROTATE;
|
|
366
|
+
break;
|
|
367
|
+
default:
|
|
368
|
+
o = n.NONE;
|
|
369
|
+
}
|
|
370
|
+
break;
|
|
371
|
+
default:
|
|
372
|
+
o = n.NONE;
|
|
373
|
+
}
|
|
374
|
+
o !== n.NONE && e.dispatchEvent(pe);
|
|
375
|
+
}
|
|
376
|
+
function ft(i) {
|
|
377
|
+
switch (je(i), o) {
|
|
378
|
+
case n.TOUCH_ROTATE:
|
|
379
|
+
if (e.enableRotate === !1) return;
|
|
380
|
+
Pe(i), e.update();
|
|
381
|
+
break;
|
|
382
|
+
case n.TOUCH_PAN:
|
|
383
|
+
if (e.enablePan === !1) return;
|
|
384
|
+
Me(i), e.update();
|
|
385
|
+
break;
|
|
386
|
+
case n.TOUCH_DOLLY_PAN:
|
|
387
|
+
if (e.enableZoom === !1 && e.enablePan === !1) return;
|
|
388
|
+
ht(i), e.update();
|
|
389
|
+
break;
|
|
390
|
+
case n.TOUCH_DOLLY_ROTATE:
|
|
391
|
+
if (e.enableZoom === !1 && e.enableRotate === !1) return;
|
|
392
|
+
dt(i), e.update();
|
|
393
|
+
break;
|
|
394
|
+
default:
|
|
395
|
+
o = n.NONE;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
function ke(i) {
|
|
399
|
+
e.enabled !== !1 && i.preventDefault();
|
|
400
|
+
}
|
|
401
|
+
function gt(i) {
|
|
402
|
+
g.push(i.pointerId);
|
|
403
|
+
}
|
|
404
|
+
function bt(i) {
|
|
405
|
+
delete H[i.pointerId];
|
|
406
|
+
for (let r = 0; r < g.length; r++)
|
|
407
|
+
if (g[r] == i.pointerId) {
|
|
408
|
+
g.splice(r, 1);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function _t(i) {
|
|
413
|
+
for (let r = 0; r < g.length; r++)
|
|
414
|
+
if (g[r] == i.pointerId) return !0;
|
|
415
|
+
return !1;
|
|
416
|
+
}
|
|
417
|
+
function je(i) {
|
|
418
|
+
let r = H[i.pointerId];
|
|
419
|
+
r === void 0 && (r = new w(), H[i.pointerId] = r), r.set(i.pageX, i.pageY);
|
|
420
|
+
}
|
|
421
|
+
function G(i) {
|
|
422
|
+
const r = i.pointerId === g[0] ? g[1] : g[0];
|
|
423
|
+
return H[r];
|
|
424
|
+
}
|
|
425
|
+
e.domElement.addEventListener("contextmenu", ke), e.domElement.addEventListener("pointerdown", Ce), e.domElement.addEventListener("pointercancel", K), e.domElement.addEventListener("wheel", Ie, { passive: !1 }), e.domElement.getRootNode().addEventListener("keydown", Ae, { passive: !0, capture: !0 }), this.update();
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const se = {
|
|
429
|
+
enableDamping: !0,
|
|
430
|
+
dampingFactor: 0.05
|
|
431
|
+
}, q = class q extends Qt {
|
|
432
|
+
constructor(t, e, n = se) {
|
|
433
|
+
super(t, e);
|
|
434
|
+
a(this, "uuid", C.generateUUID());
|
|
435
|
+
a(this, "object");
|
|
436
|
+
this.domElement = e, this.domElement = e, this.object = t, this.enableDamping = n.enableDamping ?? se.enableDamping, this.dampingFactor = n.dampingFactor ?? se.dampingFactor, this.object.position.set(0, 2, 2), this.target.copy({ x: 0, y: 0.5, z: 0 }), this.update();
|
|
437
|
+
}
|
|
438
|
+
tick() {
|
|
439
|
+
this.enabled && this.update();
|
|
440
|
+
}
|
|
441
|
+
computeEncompassingView(t) {
|
|
442
|
+
const e = t.getCenter(new m()), n = t.getSize(new m()), o = Math.max(n.x, n.y, n.z) * 1.25;
|
|
443
|
+
return {
|
|
444
|
+
position: this.object.position.clone().normalize().clone().multiplyScalar(o),
|
|
445
|
+
target: e.clone()
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
zoomIn(t) {
|
|
449
|
+
const e = t || q.DEFAULT_ZOOM_FACTOR, { minDistance: n, maxDistance: o } = this;
|
|
450
|
+
this.minDistance = this.maxDistance = C.clamp(
|
|
451
|
+
this.getDistance() - e,
|
|
452
|
+
n + e,
|
|
453
|
+
o - e
|
|
454
|
+
), this.update(), this.minDistance = n, this.maxDistance = o;
|
|
455
|
+
}
|
|
456
|
+
zoomOut(t) {
|
|
457
|
+
const e = t || q.DEFAULT_ZOOM_FACTOR, { minDistance: n, maxDistance: o } = this;
|
|
458
|
+
this.minDistance = this.maxDistance = C.clamp(
|
|
459
|
+
this.getDistance() + e,
|
|
460
|
+
n + e,
|
|
461
|
+
o - e
|
|
462
|
+
), this.update(), this.minDistance = n, this.maxDistance = o;
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
a(q, "DEFAULT_ZOOM_FACTOR", 1);
|
|
466
|
+
let ne = q;
|
|
467
|
+
class ei extends Tt {
|
|
468
|
+
constructor(t, e, n) {
|
|
469
|
+
super(-1, 1, 1, -1, 0.1, 100);
|
|
470
|
+
a(this, "axesHelper");
|
|
471
|
+
a(this, "_renderer");
|
|
472
|
+
a(this, "_scene");
|
|
473
|
+
a(this, "_camera");
|
|
474
|
+
a(this, "_restoreViewport", new xt());
|
|
475
|
+
this.layers.mask = J, this.axesHelper = new Pt(0.5), this.axesHelper.layers.mask = J, this.axesHelper.material.depthTest = !1, this.axesHelper.position.set(0, 0, -1), this.axesHelper.setColors(
|
|
476
|
+
new x(Yt),
|
|
477
|
+
new x(Ht),
|
|
478
|
+
new x(Wt)
|
|
479
|
+
);
|
|
480
|
+
const o = new ue("X", 0.2, Kt), h = new ue("Y", 0.2, Zt), l = new ue("Z", 0.2, Xt);
|
|
481
|
+
o.layers.mask = J, h.layers.mask = J, l.layers.mask = J, o.position.set(0.7, 0, 0), h.position.set(0, 0.7, 0), l.position.set(0, 0, 0.7), this.axesHelper.add(o), this.axesHelper.add(h), this.axesHelper.add(l), this.add(this.axesHelper), this._renderer = t, this._scene = e, this._camera = n, this._scene.add(this);
|
|
482
|
+
}
|
|
483
|
+
tick() {
|
|
484
|
+
const t = this._scene.background;
|
|
485
|
+
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 = t;
|
|
486
|
+
}
|
|
487
|
+
Dispose() {
|
|
488
|
+
this._scene.remove(this);
|
|
489
|
+
}
|
|
490
|
+
SetFromCameraMatrix(t) {
|
|
491
|
+
this.axesHelper.rotation.setFromRotationMatrix(
|
|
492
|
+
new Mt().extractRotation(t).invert()
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
class ti extends Y {
|
|
497
|
+
constructor() {
|
|
498
|
+
super();
|
|
499
|
+
a(this, "isDIVELight", !0);
|
|
500
|
+
a(this, "isDIVEAmbientLight", !0);
|
|
501
|
+
a(this, "_light");
|
|
502
|
+
this.name = "DIVEAmbientLight", this._light = new Lt(16777215, 1), this._light.layers.mask = P, this.add(this._light);
|
|
503
|
+
}
|
|
504
|
+
SetColor(t) {
|
|
505
|
+
this._light.color = t;
|
|
506
|
+
}
|
|
507
|
+
SetIntensity(t) {
|
|
508
|
+
this._light.intensity = t;
|
|
509
|
+
}
|
|
510
|
+
SetEnabled(t) {
|
|
511
|
+
this._light.visible = t;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
class ii extends Y {
|
|
515
|
+
constructor() {
|
|
516
|
+
super();
|
|
517
|
+
a(this, "isDIVELight", !0);
|
|
518
|
+
a(this, "isDIVEPointLight", !0);
|
|
519
|
+
a(this, "isMovable", !0);
|
|
520
|
+
a(this, "isSelectable", !0);
|
|
521
|
+
a(this, "gizmo", null);
|
|
522
|
+
a(this, "light");
|
|
523
|
+
a(this, "mesh");
|
|
524
|
+
this.name = "DIVEPointLight", this.light = new Ct(16777215, 1), this.light.layers.mask = P, this.light.castShadow = !0, this.light.shadow.mapSize.width = 512, this.light.shadow.mapSize.height = 512, this.add(this.light);
|
|
525
|
+
const t = 0.1, e = new Ke(
|
|
526
|
+
t,
|
|
527
|
+
t * 320,
|
|
528
|
+
t * 320
|
|
529
|
+
), n = new It({
|
|
530
|
+
color: this.light.color,
|
|
531
|
+
transparent: !0,
|
|
532
|
+
opacity: 0.8,
|
|
533
|
+
side: At
|
|
534
|
+
});
|
|
535
|
+
this.mesh = new me(e, n), this.mesh.layers.mask = Ft, this.add(this.mesh);
|
|
536
|
+
}
|
|
537
|
+
SetColor(t) {
|
|
538
|
+
this.light.color = t, this.mesh.material.color = t;
|
|
539
|
+
}
|
|
540
|
+
SetIntensity(t) {
|
|
541
|
+
this.light.intensity = t, this.mesh.material.opacity = t > 0.8 ? 0.8 : t * 0.8;
|
|
542
|
+
}
|
|
543
|
+
SetEnabled(t) {
|
|
544
|
+
this.light.visible = t;
|
|
545
|
+
}
|
|
546
|
+
onMove() {
|
|
547
|
+
E("State").then((t) => {
|
|
548
|
+
var e;
|
|
549
|
+
(e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
|
|
550
|
+
id: this.userData.id,
|
|
551
|
+
position: this.position
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
onSelect() {
|
|
556
|
+
E("State").then((t) => {
|
|
557
|
+
var e;
|
|
558
|
+
(e = t.get(this.userData.id)) == null || e.performAction("SELECT_OBJECT", {
|
|
559
|
+
id: this.userData.id
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
onDeselect() {
|
|
564
|
+
E("State").then((t) => {
|
|
565
|
+
var e;
|
|
566
|
+
(e = t.get(this.userData.id)) == null || e.performAction("DESELECT_OBJECT", {
|
|
567
|
+
id: this.userData.id
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
class si extends Y {
|
|
573
|
+
constructor() {
|
|
574
|
+
super();
|
|
575
|
+
a(this, "isDIVELight", !0);
|
|
576
|
+
a(this, "isDIVESceneLight", !0);
|
|
577
|
+
a(this, "_hemiLight");
|
|
578
|
+
a(this, "_dirLight");
|
|
579
|
+
this.name = "DIVESceneLight", this._hemiLight = new vt(16777215, 16777215, 2), this._hemiLight.layers.mask = P, this._hemiLight.position.set(0, 50, 0), this.add(this._hemiLight), this._dirLight = new Rt(16777215, 3), this._dirLight.layers.mask = P, 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;
|
|
580
|
+
const t = 5;
|
|
581
|
+
this._dirLight.shadow.camera.left = -5, this._dirLight.shadow.camera.right = t, this._dirLight.shadow.camera.top = t, this._dirLight.shadow.camera.bottom = -5, this._dirLight.shadow.camera.far = 3500, this.add(this._dirLight);
|
|
582
|
+
}
|
|
583
|
+
SetColor(t) {
|
|
584
|
+
this._hemiLight.color = t, this._dirLight.color = t;
|
|
585
|
+
}
|
|
586
|
+
SetIntensity(t) {
|
|
587
|
+
this._hemiLight.intensity = t * 2, this._dirLight.intensity = t * 3;
|
|
588
|
+
}
|
|
589
|
+
SetEnabled(t) {
|
|
590
|
+
this._hemiLight.visible = t, this._dirLight.visible = t;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
const ge = (c) => c.parent ? ge(c.parent) : c;
|
|
594
|
+
class ni {
|
|
595
|
+
constructor() {
|
|
596
|
+
a(this, "isMovable", !0);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
class oi {
|
|
600
|
+
constructor() {
|
|
601
|
+
a(this, "isSelectable", !0);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function ri(c, s) {
|
|
605
|
+
return s.forEach((t) => {
|
|
606
|
+
Object.getOwnPropertyNames(t.prototype).forEach((e) => {
|
|
607
|
+
Object.defineProperty(
|
|
608
|
+
c.prototype,
|
|
609
|
+
e,
|
|
610
|
+
Object.getOwnPropertyDescriptor(t.prototype, e)
|
|
611
|
+
);
|
|
612
|
+
});
|
|
613
|
+
}), c;
|
|
614
|
+
}
|
|
615
|
+
class be extends ri(Y, [
|
|
616
|
+
oi,
|
|
617
|
+
ni
|
|
618
|
+
]) {
|
|
619
|
+
constructor() {
|
|
620
|
+
super();
|
|
621
|
+
a(this, "isDIVENode", !0);
|
|
622
|
+
a(this, "gizmo", null);
|
|
623
|
+
a(this, "_positionWorldBuffer");
|
|
624
|
+
a(this, "_boundingBox");
|
|
625
|
+
this.layers.mask = P, this._positionWorldBuffer = new m(), this._boundingBox = new Ze();
|
|
626
|
+
}
|
|
627
|
+
SetPosition(t) {
|
|
628
|
+
if (!this.parent) {
|
|
629
|
+
this.position.set(t.x, t.y, t.z);
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
const e = new m(t.x, t.y, t.z);
|
|
633
|
+
this.position.copy(this.parent.worldToLocal(e)), "isDIVEGroup" in this.parent && this.parent.UpdateLineTo(this);
|
|
634
|
+
}
|
|
635
|
+
SetRotation(t) {
|
|
636
|
+
this.rotation.set(t.x, t.y, t.z);
|
|
637
|
+
}
|
|
638
|
+
SetScale(t) {
|
|
639
|
+
this.scale.set(t.x, t.y, t.z);
|
|
640
|
+
}
|
|
641
|
+
SetVisibility(t) {
|
|
642
|
+
this.visible = t;
|
|
643
|
+
}
|
|
644
|
+
SetToWorldOrigin() {
|
|
645
|
+
this.position.set(0, 0, 0), E("State").then((t) => {
|
|
646
|
+
var e;
|
|
647
|
+
(e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
|
|
648
|
+
id: this.userData.id,
|
|
649
|
+
position: this.getWorldPosition(this._positionWorldBuffer),
|
|
650
|
+
rotation: this.rotation,
|
|
651
|
+
scale: this.scale
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Can be called when the object is moved from a foreign object (gizmo, parent, etc.) to update the object's position.
|
|
657
|
+
*/
|
|
658
|
+
onMove() {
|
|
659
|
+
E("State").then((t) => {
|
|
660
|
+
var e;
|
|
661
|
+
(e = t.get(this.userData.id)) == null || e.performAction("UPDATE_OBJECT", {
|
|
662
|
+
id: this.userData.id,
|
|
663
|
+
position: this.getWorldPosition(this._positionWorldBuffer),
|
|
664
|
+
rotation: this.rotation,
|
|
665
|
+
scale: this.scale
|
|
666
|
+
});
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
onSelect() {
|
|
670
|
+
E("State").then((t) => {
|
|
671
|
+
var e;
|
|
672
|
+
(e = t.get(this.userData.id)) == null || e.performAction("SELECT_OBJECT", {
|
|
673
|
+
id: this.userData.id
|
|
674
|
+
});
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
onDeselect() {
|
|
678
|
+
E("State").then((t) => {
|
|
679
|
+
var e;
|
|
680
|
+
(e = t.get(this.userData.id)) == null || e.performAction("DESELECT_OBJECT", {
|
|
681
|
+
id: this.userData.id
|
|
682
|
+
});
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
class ai extends be {
|
|
687
|
+
constructor() {
|
|
688
|
+
super(...arguments);
|
|
689
|
+
a(this, "isDIVEModel", !0);
|
|
690
|
+
a(this, "_mesh", null);
|
|
691
|
+
a(this, "_material", null);
|
|
692
|
+
}
|
|
693
|
+
SetModel(t) {
|
|
694
|
+
this.clear(), this._boundingBox.makeEmpty(), t.traverse((e) => {
|
|
695
|
+
e.castShadow = !0, e.receiveShadow = !0, e.layers.mask = this.layers.mask, this._boundingBox.expandByObject(e), !this._mesh && "isMesh" in e && (this._mesh = e, this._material ? this._mesh.material = this._material : this._material = e.material);
|
|
696
|
+
}), this.add(t);
|
|
697
|
+
}
|
|
698
|
+
SetMaterial(t) {
|
|
699
|
+
this._material || (this._material = new fe()), t.vertexColors !== void 0 && (this._material.vertexColors = t.vertexColors), t.color !== void 0 && this._material.color.set(t.color), t.map !== void 0 && (this._material.map = t.map), t.normalMap !== void 0 && (this._material.normalMap = t.normalMap), t.roughness !== void 0 && (this._material.roughness = t.roughness), t.roughnessMap !== void 0 && (this._material.roughnessMap = t.roughnessMap, this._material.roughnessMap && (this._material.roughness = 1)), t.metalness !== void 0 && (this._material.metalness = t.metalness), t.metalnessMap !== void 0 && (this._material.metalnessMap = t.metalnessMap, this._material.metalnessMap && (this._material.metalness = 1)), this._mesh && (this._mesh.material = this._material);
|
|
700
|
+
}
|
|
701
|
+
PlaceOnFloor() {
|
|
702
|
+
var o, h, l, p;
|
|
703
|
+
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
|
|
704
|
+
(h = (o = this._mesh) == null ? void 0 : o.geometry) == null || h.computeBoundingBox();
|
|
705
|
+
const n = (p = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : p.boundingBox;
|
|
706
|
+
!n || !this._mesh || (t.y = t.y - this._mesh.localToWorld(n.min.clone()).y, t.y !== e.y && E("State").then((f) => {
|
|
707
|
+
var b;
|
|
708
|
+
(b = f.get(this.userData.id)) == null || b.performAction("UPDATE_OBJECT", {
|
|
709
|
+
id: this.userData.id,
|
|
710
|
+
position: t,
|
|
711
|
+
rotation: this.rotation,
|
|
712
|
+
scale: this.scale
|
|
713
|
+
});
|
|
714
|
+
}));
|
|
715
|
+
}
|
|
716
|
+
DropIt() {
|
|
717
|
+
if (!this.parent) {
|
|
718
|
+
console.warn(
|
|
719
|
+
"DIVEModel: DropIt() called on a model that is not in the scene.",
|
|
720
|
+
this
|
|
721
|
+
);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
const t = this._boundingBox.min.y * this.scale.y, e = this.localToWorld(
|
|
725
|
+
this._boundingBox.getCenter(new m()).multiply(this.scale)
|
|
726
|
+
);
|
|
727
|
+
e.y = t + this.position.y;
|
|
728
|
+
const n = new Xe(e, new m(0, -1, 0));
|
|
729
|
+
n.layers.mask = P;
|
|
730
|
+
const o = n.intersectObjects(
|
|
731
|
+
ge(this).Root.children,
|
|
732
|
+
!0
|
|
733
|
+
);
|
|
734
|
+
if (o.length > 0) {
|
|
735
|
+
const h = o[0].object;
|
|
736
|
+
h.geometry.computeBoundingBox();
|
|
737
|
+
const l = h.geometry.boundingBox, p = h.localToWorld(l.max.clone()), f = this.position.clone(), b = this.position.clone().setY(p.y).sub(new m(0, t, 0));
|
|
738
|
+
if (this.position.copy(b), this.position.y === f.y) return;
|
|
739
|
+
this.onMove();
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
class ci extends be {
|
|
744
|
+
constructor() {
|
|
745
|
+
super();
|
|
746
|
+
a(this, "isDIVEPrimitive", !0);
|
|
747
|
+
a(this, "_mesh");
|
|
748
|
+
this._mesh = new me(), this._mesh.layers.mask = P, this._mesh.castShadow = !0, this._mesh.receiveShadow = !0, this._mesh.material = new fe(), this.add(this._mesh);
|
|
749
|
+
}
|
|
750
|
+
SetGeometry(t) {
|
|
751
|
+
const e = this.assembleGeometry(t);
|
|
752
|
+
e && (this._mesh.geometry = e, this._boundingBox.setFromObject(this._mesh));
|
|
753
|
+
}
|
|
754
|
+
SetMaterial(t) {
|
|
755
|
+
const e = this._mesh.material;
|
|
756
|
+
t.vertexColors !== void 0 && (e.vertexColors = t.vertexColors), t.color !== void 0 && (e.color = new x(t.color)), t.map !== void 0 && (e.map = t.map), t.normalMap !== void 0 && (e.normalMap = t.normalMap), t.roughness !== void 0 && (e.roughness = t.roughness), t.roughnessMap !== void 0 && (e.roughnessMap = t.roughnessMap, e.roughnessMap && (e.roughness = 1)), t.metalness !== void 0 && (e.metalness = t.metalness), t.metalnessMap !== void 0 && (e.metalnessMap = t.metalnessMap, e.metalnessMap && (e.metalness = 0)), this._mesh && (this._mesh.material = e);
|
|
757
|
+
}
|
|
758
|
+
PlaceOnFloor() {
|
|
759
|
+
var o, h, l, p;
|
|
760
|
+
const t = this.getWorldPosition(this._positionWorldBuffer), e = t.clone();
|
|
761
|
+
(h = (o = this._mesh) == null ? void 0 : o.geometry) == null || h.computeBoundingBox();
|
|
762
|
+
const n = (p = (l = this._mesh) == null ? void 0 : l.geometry) == null ? void 0 : p.boundingBox;
|
|
763
|
+
!n || !this._mesh || (t.y = t.y - this._mesh.localToWorld(n.min.clone()).y, t.y !== e.y && E("State").then((f) => {
|
|
764
|
+
var b;
|
|
765
|
+
(b = f.get(this.userData.id)) == null || b.performAction("UPDATE_OBJECT", {
|
|
766
|
+
id: this.userData.id,
|
|
767
|
+
position: t,
|
|
768
|
+
rotation: this.rotation,
|
|
769
|
+
scale: this.scale
|
|
770
|
+
});
|
|
771
|
+
}));
|
|
772
|
+
}
|
|
773
|
+
DropIt() {
|
|
774
|
+
if (!this.parent) {
|
|
775
|
+
console.warn(
|
|
776
|
+
"DIVEPrimitive: DropIt() called on a model that is not in the scene.",
|
|
777
|
+
this
|
|
778
|
+
);
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
const t = this._boundingBox.min.y * this.scale.y, e = this.localToWorld(
|
|
782
|
+
this._boundingBox.getCenter(new m()).multiply(this.scale)
|
|
783
|
+
);
|
|
784
|
+
e.y = t + this.position.y;
|
|
785
|
+
const n = new Xe(e, new m(0, -1, 0));
|
|
786
|
+
n.layers.mask = P;
|
|
787
|
+
const o = n.intersectObjects(
|
|
788
|
+
ge(this).Root.children,
|
|
789
|
+
!0
|
|
790
|
+
);
|
|
791
|
+
if (o.length > 0) {
|
|
792
|
+
const h = o[0].object;
|
|
793
|
+
h.geometry.computeBoundingBox();
|
|
794
|
+
const l = h.geometry.boundingBox, p = h.localToWorld(l.max.clone()), f = this.position.clone(), b = this.position.clone().setY(p.y).sub(new m(0, t, 0));
|
|
795
|
+
if (this.position.copy(b), this.position.y === f.y) return;
|
|
796
|
+
this.onMove();
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
assembleGeometry(t) {
|
|
800
|
+
switch (this._mesh.material.flatShading = !1, t.name.toLowerCase()) {
|
|
801
|
+
case "cylinder":
|
|
802
|
+
return this.createCylinderGeometry(t);
|
|
803
|
+
case "sphere":
|
|
804
|
+
return this.createSphereGeometry(t);
|
|
805
|
+
case "pyramid":
|
|
806
|
+
return this._mesh.material.flatShading = !0, this.createPyramidGeometry(t);
|
|
807
|
+
case "cube":
|
|
808
|
+
case "box":
|
|
809
|
+
return this.createBoxGeometry(t);
|
|
810
|
+
case "cone":
|
|
811
|
+
return this.createConeGeometry(t);
|
|
812
|
+
case "wall":
|
|
813
|
+
return this.createWallGeometry(t);
|
|
814
|
+
case "plane":
|
|
815
|
+
return this.createPlaneGeometry(t);
|
|
816
|
+
default:
|
|
817
|
+
return console.warn(
|
|
818
|
+
"DIVEPrimitive.assembleGeometry: Invalid geometry type:",
|
|
819
|
+
t.name.toLowerCase()
|
|
820
|
+
), null;
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
createCylinderGeometry(t) {
|
|
824
|
+
const e = new kt(
|
|
825
|
+
t.width / 2,
|
|
826
|
+
t.width / 2,
|
|
827
|
+
t.height,
|
|
828
|
+
64
|
|
829
|
+
);
|
|
830
|
+
return e.translate(0, t.height / 2, 0), e;
|
|
831
|
+
}
|
|
832
|
+
createSphereGeometry(t) {
|
|
833
|
+
return new Ke(t.width / 2, 256, 256);
|
|
834
|
+
}
|
|
835
|
+
createPyramidGeometry(t) {
|
|
836
|
+
const e = new Float32Array([
|
|
837
|
+
-t.width / 2,
|
|
838
|
+
0,
|
|
839
|
+
-t.depth / 2,
|
|
840
|
+
// 0
|
|
841
|
+
t.width / 2,
|
|
842
|
+
0,
|
|
843
|
+
-t.depth / 2,
|
|
844
|
+
// 1
|
|
845
|
+
t.width / 2,
|
|
846
|
+
0,
|
|
847
|
+
t.depth / 2,
|
|
848
|
+
// 2
|
|
849
|
+
-t.width / 2,
|
|
850
|
+
0,
|
|
851
|
+
t.depth / 2,
|
|
852
|
+
// 3
|
|
853
|
+
0,
|
|
854
|
+
t.height,
|
|
855
|
+
0
|
|
856
|
+
]), n = new Uint16Array([
|
|
857
|
+
0,
|
|
858
|
+
1,
|
|
859
|
+
2,
|
|
860
|
+
0,
|
|
861
|
+
2,
|
|
862
|
+
3,
|
|
863
|
+
0,
|
|
864
|
+
4,
|
|
865
|
+
1,
|
|
866
|
+
1,
|
|
867
|
+
4,
|
|
868
|
+
2,
|
|
869
|
+
2,
|
|
870
|
+
4,
|
|
871
|
+
3,
|
|
872
|
+
3,
|
|
873
|
+
4,
|
|
874
|
+
0
|
|
875
|
+
]), o = new Je();
|
|
876
|
+
return o.setAttribute(
|
|
877
|
+
"position",
|
|
878
|
+
new Ge(e, 3)
|
|
879
|
+
), o.setIndex(new Ge(n, 1)), o.computeVertexNormals(), o.computeBoundingBox(), o.computeBoundingSphere(), o;
|
|
880
|
+
}
|
|
881
|
+
createBoxGeometry(t) {
|
|
882
|
+
const e = new de(
|
|
883
|
+
t.width,
|
|
884
|
+
t.height,
|
|
885
|
+
t.depth
|
|
886
|
+
);
|
|
887
|
+
return e.translate(0, t.height / 2, 0), e;
|
|
888
|
+
}
|
|
889
|
+
createConeGeometry(t) {
|
|
890
|
+
const e = new jt(t.width / 2, t.height, 256);
|
|
891
|
+
return e.translate(0, t.height / 2, 0), e;
|
|
892
|
+
}
|
|
893
|
+
createWallGeometry(t) {
|
|
894
|
+
const e = new de(
|
|
895
|
+
t.width,
|
|
896
|
+
t.height,
|
|
897
|
+
t.depth || 0.05,
|
|
898
|
+
16
|
|
899
|
+
);
|
|
900
|
+
return e.translate(0, t.height / 2, 0), e;
|
|
901
|
+
}
|
|
902
|
+
createPlaneGeometry(t) {
|
|
903
|
+
const e = new de(
|
|
904
|
+
t.width,
|
|
905
|
+
t.height,
|
|
906
|
+
t.depth
|
|
907
|
+
);
|
|
908
|
+
return e.translate(0, t.height / 2, 0), e;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
class li extends be {
|
|
912
|
+
// lines to children
|
|
913
|
+
constructor() {
|
|
914
|
+
super();
|
|
915
|
+
a(this, "isDIVEGroup", !0);
|
|
916
|
+
a(this, "_members");
|
|
917
|
+
a(this, "_lines");
|
|
918
|
+
this.name = "DIVEGroup", this._members = [], this._lines = [];
|
|
919
|
+
}
|
|
920
|
+
// children objects
|
|
921
|
+
get members() {
|
|
922
|
+
return this._members;
|
|
923
|
+
}
|
|
924
|
+
SetPosition(t) {
|
|
925
|
+
super.SetPosition(t), this._members.forEach((e) => {
|
|
926
|
+
"isDIVENode" in e && e.onMove();
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
SetLinesVisibility(t, e) {
|
|
930
|
+
if (!e) {
|
|
931
|
+
this._lines.forEach((o) => {
|
|
932
|
+
o.visible = t;
|
|
933
|
+
});
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
const n = this._members.indexOf(e);
|
|
937
|
+
n !== -1 && (this._lines[n].visible = t);
|
|
938
|
+
}
|
|
939
|
+
attach(t) {
|
|
940
|
+
if (this._members.includes(t))
|
|
941
|
+
return this;
|
|
942
|
+
const e = this.createLine();
|
|
943
|
+
return this.add(e), this._lines.push(e), super.attach(t), this._members.push(t), this.updateLineTo(e, t), this.SetLinesVisibility(!0, t), this;
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Removes an object from the group.
|
|
947
|
+
* @param object - The object to remove.
|
|
948
|
+
* @returns The group instance.
|
|
949
|
+
*/
|
|
950
|
+
remove(t) {
|
|
951
|
+
const e = this._members.indexOf(t);
|
|
952
|
+
if (e === -1)
|
|
953
|
+
return this;
|
|
954
|
+
const n = this._lines[e];
|
|
955
|
+
return super.remove(n), this._lines.splice(e, 1), super.remove(t), this._members.splice(e, 1), this;
|
|
956
|
+
}
|
|
957
|
+
UpdateLineTo(t) {
|
|
958
|
+
const e = this._members.indexOf(t);
|
|
959
|
+
e !== -1 && this.updateLineTo(this._lines[e], t);
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Creates a line for visualization.
|
|
963
|
+
*/
|
|
964
|
+
createLine() {
|
|
965
|
+
const t = new Je(), e = new Vt({
|
|
966
|
+
color: 6710886,
|
|
967
|
+
dashSize: 0.05,
|
|
968
|
+
gapSize: 0.025
|
|
969
|
+
}), n = new Bt(t, e);
|
|
970
|
+
return n.visible = !1, n;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Updates a line to the object.
|
|
974
|
+
*/
|
|
975
|
+
updateLineTo(t, e) {
|
|
976
|
+
const n = [
|
|
977
|
+
new m(0, 0, 0),
|
|
978
|
+
e.position.clone()
|
|
979
|
+
];
|
|
980
|
+
t.geometry.setFromPoints(n), t.computeLineDistances();
|
|
981
|
+
}
|
|
982
|
+
// public SetBoundingBoxVisibility(visible: boolean): void {
|
|
983
|
+
// this._boxMesh.visible = visible;
|
|
984
|
+
// }
|
|
985
|
+
// /**
|
|
986
|
+
// * Recalculates the position of the group based on it's bounding box.
|
|
987
|
+
// * Children's world positions are kept.
|
|
988
|
+
// */
|
|
989
|
+
// private recalculatePosition(): void {
|
|
990
|
+
// // store all children's world positions
|
|
991
|
+
// const childrensWorldPositions: Vector3[] = this.children.map((child) => child.getWorldPosition(new Vector3()));
|
|
992
|
+
// // calculate new center and set it as the group's position
|
|
993
|
+
// const bbcenter = this.updateBB();
|
|
994
|
+
// this.position.copy(bbcenter);
|
|
995
|
+
// // set childrens's positions so their world positions are kept
|
|
996
|
+
// this.children.forEach((child, i) => {
|
|
997
|
+
// if (child.uuid === this._boxMesh.uuid) return;
|
|
998
|
+
// child.position.copy(this.worldToLocal(childrensWorldPositions[i]));
|
|
999
|
+
// });
|
|
1000
|
+
// DIVECommunication.get(this.userData.id)?.performAction('UPDATE_OBJECT', { id: this.userData.id, position: this.position });
|
|
1001
|
+
// }
|
|
1002
|
+
// /**
|
|
1003
|
+
// * Updates the bounding box of the group.
|
|
1004
|
+
// * @returns {Vector3} The new center of the bounding box.
|
|
1005
|
+
// */
|
|
1006
|
+
// private updateBB(): Vector3 {
|
|
1007
|
+
// this._boundingBox.makeEmpty();
|
|
1008
|
+
// if (this.children.length === 1) {
|
|
1009
|
+
// // because we always have the box mesh as 1 child
|
|
1010
|
+
// return this.position.clone();
|
|
1011
|
+
// }
|
|
1012
|
+
// this.children.forEach((child) => {
|
|
1013
|
+
// if (child.uuid === this._boxMesh.uuid) return;
|
|
1014
|
+
// this._boundingBox.expandByObject(child);
|
|
1015
|
+
// });
|
|
1016
|
+
// return this._boundingBox.getCenter(new Vector3());
|
|
1017
|
+
// }
|
|
1018
|
+
// private updateBoxMesh(): void {
|
|
1019
|
+
// if (this.children.length === 1) {
|
|
1020
|
+
// // because we always have the box mesh as 1 child
|
|
1021
|
+
// this._boxMesh.visible = false;
|
|
1022
|
+
// return;
|
|
1023
|
+
// }
|
|
1024
|
+
// this._boxMesh.quaternion.copy(this.quaternion.clone().invert());
|
|
1025
|
+
// this._boxMesh.scale.set(1 / this.scale.x, 1 / this.scale.y, 1 / this.scale.z);
|
|
1026
|
+
// 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);
|
|
1027
|
+
// this._boxMesh.visible = true;
|
|
1028
|
+
// }
|
|
1029
|
+
}
|
|
1030
|
+
class hi extends me {
|
|
1031
|
+
constructor() {
|
|
1032
|
+
super(
|
|
1033
|
+
new zt(1e4, 1e4),
|
|
1034
|
+
new fe({
|
|
1035
|
+
color: new x(150 / 255, 150 / 255, 150 / 255)
|
|
1036
|
+
})
|
|
1037
|
+
);
|
|
1038
|
+
a(this, "isDIVEFloor", !0);
|
|
1039
|
+
this.name = "Floor", this.layers.mask = P, this.receiveShadow = !0, this.rotateX(-Math.PI / 2);
|
|
1040
|
+
}
|
|
1041
|
+
SetVisibility(t) {
|
|
1042
|
+
this.visible = t;
|
|
1043
|
+
}
|
|
1044
|
+
SetColor(t) {
|
|
1045
|
+
this.material.color = new x(t);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
class di extends Y {
|
|
1049
|
+
constructor() {
|
|
1050
|
+
super();
|
|
1051
|
+
a(this, "isDIVERoot", !0);
|
|
1052
|
+
a(this, "_floor");
|
|
1053
|
+
a(this, "_assetLoader", null);
|
|
1054
|
+
this.name = "Root", this._floor = new hi(), this.add(this._floor);
|
|
1055
|
+
}
|
|
1056
|
+
get floor() {
|
|
1057
|
+
return this._floor;
|
|
1058
|
+
}
|
|
1059
|
+
async _getAssetLoader() {
|
|
1060
|
+
return this._assetLoader || (this._assetLoader = new (await E("AssetLoader"))()), this._assetLoader;
|
|
1061
|
+
}
|
|
1062
|
+
ComputeSceneBB() {
|
|
1063
|
+
const t = new Ze();
|
|
1064
|
+
return this.children.forEach((e) => {
|
|
1065
|
+
"isDIVEFloor" in e || e.traverse((n) => {
|
|
1066
|
+
"isObject3D" in n && t.expandByObject(n);
|
|
1067
|
+
});
|
|
1068
|
+
}), t;
|
|
1069
|
+
}
|
|
1070
|
+
GetSceneObject(t) {
|
|
1071
|
+
let e;
|
|
1072
|
+
return this.traverse((n) => {
|
|
1073
|
+
e || n.userData.id === t.id && (e = n);
|
|
1074
|
+
}), e;
|
|
1075
|
+
}
|
|
1076
|
+
AddSceneObject(t) {
|
|
1077
|
+
switch (t.entityType) {
|
|
1078
|
+
case "pov":
|
|
1079
|
+
break;
|
|
1080
|
+
case "light": {
|
|
1081
|
+
this.updateLight(t);
|
|
1082
|
+
break;
|
|
1083
|
+
}
|
|
1084
|
+
case "model": {
|
|
1085
|
+
this.updateModel(t);
|
|
1086
|
+
break;
|
|
1087
|
+
}
|
|
1088
|
+
case "primitive": {
|
|
1089
|
+
this.updatePrimitive(t);
|
|
1090
|
+
break;
|
|
1091
|
+
}
|
|
1092
|
+
case "group": {
|
|
1093
|
+
this.updateGroup(t);
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
default:
|
|
1097
|
+
console.warn(
|
|
1098
|
+
`DIVERoot.AddSceneObject: Unknown entity type: ${t.entityType}`
|
|
1099
|
+
);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
UpdateSceneObject(t) {
|
|
1103
|
+
switch (t.entityType) {
|
|
1104
|
+
case "pov":
|
|
1105
|
+
break;
|
|
1106
|
+
case "light": {
|
|
1107
|
+
this.updateLight(t);
|
|
1108
|
+
break;
|
|
1109
|
+
}
|
|
1110
|
+
case "model": {
|
|
1111
|
+
this.updateModel(t);
|
|
1112
|
+
break;
|
|
1113
|
+
}
|
|
1114
|
+
case "primitive": {
|
|
1115
|
+
this.updatePrimitive(t);
|
|
1116
|
+
break;
|
|
1117
|
+
}
|
|
1118
|
+
case "group": {
|
|
1119
|
+
this.updateGroup(t);
|
|
1120
|
+
break;
|
|
1121
|
+
}
|
|
1122
|
+
default:
|
|
1123
|
+
console.warn(
|
|
1124
|
+
`DIVERoot.UpdateSceneObject: Unknown entity type: ${t.entityType}`
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
DeleteSceneObject(t) {
|
|
1129
|
+
switch (t.entityType) {
|
|
1130
|
+
case "pov":
|
|
1131
|
+
break;
|
|
1132
|
+
case "light": {
|
|
1133
|
+
this.deleteLight(t);
|
|
1134
|
+
break;
|
|
1135
|
+
}
|
|
1136
|
+
case "model": {
|
|
1137
|
+
this.deleteModel(t);
|
|
1138
|
+
break;
|
|
1139
|
+
}
|
|
1140
|
+
case "primitive": {
|
|
1141
|
+
this.deletePrimitive(t);
|
|
1142
|
+
break;
|
|
1143
|
+
}
|
|
1144
|
+
case "group": {
|
|
1145
|
+
this.deleteGroup(t);
|
|
1146
|
+
break;
|
|
1147
|
+
}
|
|
1148
|
+
default:
|
|
1149
|
+
console.warn(
|
|
1150
|
+
`DIVERoot.DeleteSceneObject: Unknown entity type: ${t.entityType}`
|
|
1151
|
+
);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
PlaceOnFloor(t) {
|
|
1155
|
+
switch (t.entityType) {
|
|
1156
|
+
case "pov":
|
|
1157
|
+
case "light":
|
|
1158
|
+
break;
|
|
1159
|
+
case "model":
|
|
1160
|
+
case "primitive": {
|
|
1161
|
+
this.placeOnFloor(t);
|
|
1162
|
+
break;
|
|
1163
|
+
}
|
|
1164
|
+
default:
|
|
1165
|
+
console.warn(
|
|
1166
|
+
`DIVERoot.PlaceOnFloor: Unknown entity type: ${t.entityType}`
|
|
1167
|
+
);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
updateLight(t) {
|
|
1171
|
+
let e = this.GetSceneObject(t);
|
|
1172
|
+
if (!e) {
|
|
1173
|
+
switch (t.type) {
|
|
1174
|
+
case "scene": {
|
|
1175
|
+
e = new si();
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
case "ambient": {
|
|
1179
|
+
e = new ti();
|
|
1180
|
+
break;
|
|
1181
|
+
}
|
|
1182
|
+
case "point": {
|
|
1183
|
+
e = new ii();
|
|
1184
|
+
break;
|
|
1185
|
+
}
|
|
1186
|
+
default: {
|
|
1187
|
+
console.warn(
|
|
1188
|
+
`DIVERoot.updateLight: Unknown light type: ${t.type}`
|
|
1189
|
+
);
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
e.userData.id = t.id, this.add(e);
|
|
1194
|
+
}
|
|
1195
|
+
t.name !== void 0 && t.name !== null && (e.name = t.name), t.position !== void 0 && t.position !== null && e.position.set(
|
|
1196
|
+
t.position.x,
|
|
1197
|
+
t.position.y,
|
|
1198
|
+
t.position.z
|
|
1199
|
+
), t.intensity !== void 0 && t.intensity !== null && e.SetIntensity(
|
|
1200
|
+
t.intensity
|
|
1201
|
+
), t.enabled !== void 0 && t.enabled !== null && e.SetEnabled(
|
|
1202
|
+
t.enabled
|
|
1203
|
+
), t.color !== void 0 && t.color !== null && e.SetColor(
|
|
1204
|
+
new x(t.color)
|
|
1205
|
+
), t.visible !== void 0 && t.visible !== null && (e.visible = t.visible), t.parentId !== void 0 && this.setParent({ ...t, parentId: t.parentId });
|
|
1206
|
+
}
|
|
1207
|
+
updateModel(t) {
|
|
1208
|
+
let e = this.GetSceneObject(t);
|
|
1209
|
+
e || (e = new ai(), e.userData.id = t.id, e.userData.uri = t.uri, this.add(e)), t.uri !== void 0 && this._getAssetLoader().then((n) => n.load(t.uri)).then((n) => {
|
|
1210
|
+
e.SetModel(n), E("State").then((o) => {
|
|
1211
|
+
var h;
|
|
1212
|
+
(h = o.get(t.id)) == null || h.performAction("MODEL_LOADED", {
|
|
1213
|
+
id: t.id
|
|
1214
|
+
});
|
|
1215
|
+
});
|
|
1216
|
+
}), 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 });
|
|
1217
|
+
}
|
|
1218
|
+
updatePrimitive(t) {
|
|
1219
|
+
let e = this.GetSceneObject(t);
|
|
1220
|
+
e || (e = new ci(), e.userData.id = t.id, this.add(e)), 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 });
|
|
1221
|
+
}
|
|
1222
|
+
updateGroup(t) {
|
|
1223
|
+
let e = this.GetSceneObject(t);
|
|
1224
|
+
e || (e = new li(), e.userData.id = t.id, this.add(e)), 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 });
|
|
1225
|
+
}
|
|
1226
|
+
deleteLight(t) {
|
|
1227
|
+
const e = this.GetSceneObject(t);
|
|
1228
|
+
if (!e) {
|
|
1229
|
+
console.warn(
|
|
1230
|
+
`DIVERoot.deleteLight: Light with id ${t.id} not found`
|
|
1231
|
+
);
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
this.detachTransformControls(e), e.parent.remove(e);
|
|
1235
|
+
}
|
|
1236
|
+
deleteModel(t) {
|
|
1237
|
+
const e = this.GetSceneObject(t);
|
|
1238
|
+
if (!e) {
|
|
1239
|
+
console.warn(
|
|
1240
|
+
`DIVERoot.deleteModel: Model with id ${t.id} not found`
|
|
1241
|
+
);
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
this.detachTransformControls(e), e.parent.remove(e);
|
|
1245
|
+
}
|
|
1246
|
+
deletePrimitive(t) {
|
|
1247
|
+
const e = this.GetSceneObject(t);
|
|
1248
|
+
if (!e) {
|
|
1249
|
+
console.warn(
|
|
1250
|
+
`DIVERoot.deletePrimitive: Primitive with id ${t.id} not found`
|
|
1251
|
+
);
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
this.detachTransformControls(e), e.parent.remove(e);
|
|
1255
|
+
}
|
|
1256
|
+
deleteGroup(t) {
|
|
1257
|
+
const e = this.GetSceneObject(t);
|
|
1258
|
+
if (!e) {
|
|
1259
|
+
console.warn(
|
|
1260
|
+
`DIVERoot.deleteGroup: Group with id ${t.id} not found`
|
|
1261
|
+
);
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
this.detachTransformControls(e);
|
|
1265
|
+
for (let n = e.members.length - 1; n >= 0; n--)
|
|
1266
|
+
this.attach(e.members[n]);
|
|
1267
|
+
e.parent.remove(e);
|
|
1268
|
+
}
|
|
1269
|
+
placeOnFloor(t) {
|
|
1270
|
+
const e = this.GetSceneObject(t);
|
|
1271
|
+
e && e.PlaceOnFloor();
|
|
1272
|
+
}
|
|
1273
|
+
setParent(t) {
|
|
1274
|
+
const e = this.GetSceneObject(t);
|
|
1275
|
+
if (t.parentId !== null) {
|
|
1276
|
+
const n = this.GetSceneObject({
|
|
1277
|
+
id: t.parentId
|
|
1278
|
+
});
|
|
1279
|
+
if (!n) return;
|
|
1280
|
+
n.attach(e);
|
|
1281
|
+
} else
|
|
1282
|
+
this.attach(e);
|
|
1283
|
+
}
|
|
1284
|
+
detachTransformControls(t) {
|
|
1285
|
+
this.findScene(t).children.find((e) => {
|
|
1286
|
+
"isTransformControls" in e && e.detach();
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
findScene(t) {
|
|
1290
|
+
return t.parent !== null ? this.findScene(t.parent) : t;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
const ui = "#888888", pi = "#dddddd";
|
|
1294
|
+
class mi extends Y {
|
|
1295
|
+
constructor() {
|
|
1296
|
+
super(), this.name = "Grid";
|
|
1297
|
+
const s = new Nt(
|
|
1298
|
+
100,
|
|
1299
|
+
100,
|
|
1300
|
+
ui,
|
|
1301
|
+
pi
|
|
1302
|
+
);
|
|
1303
|
+
s.material.depthTest = !1, s.layers.mask = Ut, this.add(s);
|
|
1304
|
+
}
|
|
1305
|
+
SetVisibility(s) {
|
|
1306
|
+
this.visible = s;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
class fi extends Gt {
|
|
1310
|
+
constructor() {
|
|
1311
|
+
super();
|
|
1312
|
+
a(this, "_root");
|
|
1313
|
+
a(this, "_grid");
|
|
1314
|
+
this.background = new x(16777215), this._root = new di(), this.add(this._root), this._grid = new mi(), this.add(this._grid);
|
|
1315
|
+
}
|
|
1316
|
+
get Root() {
|
|
1317
|
+
return this._root;
|
|
1318
|
+
}
|
|
1319
|
+
get Grid() {
|
|
1320
|
+
return this._grid;
|
|
1321
|
+
}
|
|
1322
|
+
SetBackground(t) {
|
|
1323
|
+
this.background = new x(t);
|
|
1324
|
+
}
|
|
1325
|
+
ComputeSceneBB() {
|
|
1326
|
+
return this.Root.ComputeSceneBB();
|
|
1327
|
+
}
|
|
1328
|
+
GetSceneObject(t) {
|
|
1329
|
+
return this.Root.GetSceneObject(t);
|
|
1330
|
+
}
|
|
1331
|
+
AddSceneObject(t) {
|
|
1332
|
+
this.Root.AddSceneObject(t);
|
|
1333
|
+
}
|
|
1334
|
+
UpdateSceneObject(t) {
|
|
1335
|
+
this.Root.UpdateSceneObject(t);
|
|
1336
|
+
}
|
|
1337
|
+
DeleteSceneObject(t) {
|
|
1338
|
+
this.Root.DeleteSceneObject(t);
|
|
1339
|
+
}
|
|
1340
|
+
PlaceOnFloor(t) {
|
|
1341
|
+
this.Root.PlaceOnFloor(t);
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
const qe = {
|
|
1345
|
+
canvas: void 0,
|
|
1346
|
+
antialias: !0,
|
|
1347
|
+
alpha: !0,
|
|
1348
|
+
powerPreference: "high-performance",
|
|
1349
|
+
precision: "highp",
|
|
1350
|
+
stencil: !1,
|
|
1351
|
+
depth: !0,
|
|
1352
|
+
logarithmicDepthBuffer: !1
|
|
1353
|
+
};
|
|
1354
|
+
class gi {
|
|
1355
|
+
constructor(s, t, e) {
|
|
1356
|
+
a(this, "_webglrenderer");
|
|
1357
|
+
a(this, "_settings");
|
|
1358
|
+
this._scene = s, this._camera = t, this._settings = {
|
|
1359
|
+
...qe,
|
|
1360
|
+
...e ?? {}
|
|
1361
|
+
}, this._webglrenderer = new Fe({
|
|
1362
|
+
canvas: this._settings.canvas,
|
|
1363
|
+
antialias: this._settings.antialias,
|
|
1364
|
+
alpha: this._settings.alpha,
|
|
1365
|
+
powerPreference: this._settings.powerPreference,
|
|
1366
|
+
precision: this._settings.precision,
|
|
1367
|
+
stencil: this._settings.stencil,
|
|
1368
|
+
depth: this._settings.depth,
|
|
1369
|
+
logarithmicDepthBuffer: this._settings.logarithmicDepthBuffer
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
get webglrenderer() {
|
|
1373
|
+
return this._webglrenderer;
|
|
1374
|
+
}
|
|
1375
|
+
setCanvas(s) {
|
|
1376
|
+
this._webglrenderer.dispose(), this._settings.canvas = s, this._webglrenderer = new Fe(this._settings);
|
|
1377
|
+
}
|
|
1378
|
+
render() {
|
|
1379
|
+
this._webglrenderer.render(this._scene, this._camera);
|
|
1380
|
+
}
|
|
1381
|
+
onResize(s, t) {
|
|
1382
|
+
this._webglrenderer.setSize(s, t, !1);
|
|
1383
|
+
}
|
|
1384
|
+
dispose() {
|
|
1385
|
+
this._webglrenderer.dispose();
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
class bi {
|
|
1389
|
+
constructor() {
|
|
1390
|
+
a(this, "_renderer", null);
|
|
1391
|
+
a(this, "_lastTime", 0);
|
|
1392
|
+
a(this, "_isRunning", !1);
|
|
1393
|
+
a(this, "_tickers", []);
|
|
1394
|
+
}
|
|
1395
|
+
start() {
|
|
1396
|
+
this._isRunning || (this._isRunning = !0, this._lastTime = performance.now(), requestAnimationFrame(this._tick.bind(this)));
|
|
1397
|
+
}
|
|
1398
|
+
stop() {
|
|
1399
|
+
this._isRunning = !1;
|
|
1400
|
+
}
|
|
1401
|
+
setRenderer(s) {
|
|
1402
|
+
this._renderer = s;
|
|
1403
|
+
}
|
|
1404
|
+
addTicker(s) {
|
|
1405
|
+
this._tickers.find((t) => t.uuid === s.uuid) || this._tickers.push(s);
|
|
1406
|
+
}
|
|
1407
|
+
removeTicker(s) {
|
|
1408
|
+
const t = this._tickers.findIndex((e) => e.uuid === s.uuid);
|
|
1409
|
+
t !== -1 && this._tickers.splice(t, 1);
|
|
1410
|
+
}
|
|
1411
|
+
dispose() {
|
|
1412
|
+
this.stop(), this._tickers.forEach((s) => {
|
|
1413
|
+
var t;
|
|
1414
|
+
return (t = s.dispose) == null ? void 0 : t.call(s);
|
|
1415
|
+
}), this._tickers = [], this._isRunning = !1, this._lastTime = 0;
|
|
1416
|
+
}
|
|
1417
|
+
_tick(s) {
|
|
1418
|
+
var e;
|
|
1419
|
+
if (!this._isRunning) return;
|
|
1420
|
+
const t = (s - this._lastTime) / 1e3;
|
|
1421
|
+
this._lastTime = s, this._tickers.forEach((n) => n.tick(t)), (e = this._renderer) == null || e.render(), requestAnimationFrame(this._tick.bind(this));
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
class _i {
|
|
1425
|
+
constructor(s, t) {
|
|
1426
|
+
a(this, "_resizeObserver");
|
|
1427
|
+
a(this, "_width", 0);
|
|
1428
|
+
a(this, "_height", 0);
|
|
1429
|
+
this._resizeObserver = new ResizeObserver((e) => {
|
|
1430
|
+
for (const n of e) {
|
|
1431
|
+
const { width: o, height: h } = n.contentRect;
|
|
1432
|
+
o === this._width && h === this._height || (s.onResize(o, h), t.onResize(o, h), this._width = o, this._height = h);
|
|
1433
|
+
}
|
|
1434
|
+
}), this._observeCanvas(s.webglrenderer.domElement);
|
|
1435
|
+
}
|
|
1436
|
+
setCanvas(s) {
|
|
1437
|
+
this._resizeObserver.disconnect(), this._observeCanvas(s);
|
|
1438
|
+
}
|
|
1439
|
+
dispose() {
|
|
1440
|
+
this._resizeObserver.disconnect();
|
|
1441
|
+
}
|
|
1442
|
+
_observeCanvas(s) {
|
|
1443
|
+
if (s.parentElement)
|
|
1444
|
+
this._resizeObserver.observe(s.parentElement);
|
|
1445
|
+
else {
|
|
1446
|
+
const t = setInterval(() => {
|
|
1447
|
+
s.parentElement && (this._resizeObserver.observe(s.parentElement), clearInterval(t));
|
|
1448
|
+
}, 16);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
const $e = {
|
|
1453
|
+
autoStart: !0,
|
|
1454
|
+
displayAxes: !1,
|
|
1455
|
+
perspectiveCamera: Jt,
|
|
1456
|
+
renderer: qe
|
|
1457
|
+
};
|
|
1458
|
+
class yi {
|
|
1459
|
+
constructor(s) {
|
|
1460
|
+
a(this, "_renderer");
|
|
1461
|
+
a(this, "_scene");
|
|
1462
|
+
a(this, "_camera");
|
|
1463
|
+
a(this, "_resizeManager");
|
|
1464
|
+
a(this, "_clock");
|
|
1465
|
+
a(this, "_settings");
|
|
1466
|
+
this._settings = {
|
|
1467
|
+
...$e,
|
|
1468
|
+
...s ?? {}
|
|
1469
|
+
}, this._scene = new fi(), this._camera = new qt(
|
|
1470
|
+
this._settings.perspectiveCamera
|
|
1471
|
+
), this._renderer = new gi(
|
|
1472
|
+
this._scene,
|
|
1473
|
+
this._camera,
|
|
1474
|
+
this._settings.renderer
|
|
1475
|
+
), this._resizeManager = new _i(
|
|
1476
|
+
this._renderer,
|
|
1477
|
+
this._camera
|
|
1478
|
+
), this._clock = new bi(), this._clock.setRenderer(this._renderer), this._settings.autoStart && this.start();
|
|
1479
|
+
}
|
|
1480
|
+
get scene() {
|
|
1481
|
+
return this._scene;
|
|
1482
|
+
}
|
|
1483
|
+
get camera() {
|
|
1484
|
+
return this._camera;
|
|
1485
|
+
}
|
|
1486
|
+
get renderer() {
|
|
1487
|
+
return this._renderer;
|
|
1488
|
+
}
|
|
1489
|
+
setCanvas(s) {
|
|
1490
|
+
this._renderer.setCanvas(s), this._resizeManager.setCanvas(s);
|
|
1491
|
+
}
|
|
1492
|
+
get clock() {
|
|
1493
|
+
return this._clock;
|
|
1494
|
+
}
|
|
1495
|
+
start() {
|
|
1496
|
+
this._clock.start();
|
|
1497
|
+
}
|
|
1498
|
+
stop() {
|
|
1499
|
+
this._clock.stop();
|
|
1500
|
+
}
|
|
1501
|
+
dispose() {
|
|
1502
|
+
this._clock.dispose(), this._resizeManager.dispose(), this._renderer.dispose();
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
window.DIVE = {
|
|
1506
|
+
instances: [],
|
|
1507
|
+
get instance() {
|
|
1508
|
+
return window.DIVE.instances[0];
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
const Ei = {
|
|
1512
|
+
...$e,
|
|
1513
|
+
orbitController: se
|
|
1514
|
+
};
|
|
1515
|
+
class Qe {
|
|
1516
|
+
constructor(s) {
|
|
1517
|
+
// descriptive members
|
|
1518
|
+
a(this, "_settings");
|
|
1519
|
+
a(this, "_engine");
|
|
1520
|
+
a(this, "orbitController");
|
|
1521
|
+
a(this, "axisCamera");
|
|
1522
|
+
this._settings = {
|
|
1523
|
+
...Ei,
|
|
1524
|
+
...s ?? {}
|
|
1525
|
+
}, this._engine = new yi(s), this.orbitController = new ne(
|
|
1526
|
+
this._engine.camera,
|
|
1527
|
+
this._engine.renderer.webglrenderer.domElement,
|
|
1528
|
+
this._settings.orbitController
|
|
1529
|
+
), this._engine.clock.addTicker(this.orbitController), this._settings.displayAxes ? (this.axisCamera = new ei(
|
|
1530
|
+
this._engine.renderer,
|
|
1531
|
+
this._engine.scene,
|
|
1532
|
+
this._engine.camera
|
|
1533
|
+
), this._engine.clock.addTicker(this.axisCamera)) : this.axisCamera = null, import("./chunks/package-BvoZkrge.mjs").then((t) => {
|
|
1534
|
+
console.log(
|
|
1535
|
+
`DIVE ${t.default.version} initialized successfully!`
|
|
1536
|
+
), console.log(`
|
|
1537
|
+
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
1538
|
+
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
1539
|
+
@@%=::::.......::---------------------------------------------------------+@@
|
|
1540
|
+
@@+:::...........::-----------------------------------------------------------#@@
|
|
1541
|
+
@@=:::.........::::::-------------------------------------------------------------%@
|
|
1542
|
+
@%:::.......:::::::-----------------------------------------------------------------#@
|
|
1543
|
+
@*:::.....:::::-----------------------------------------------------------------------*@
|
|
1544
|
+
@%::::::.::::---------------------------------------------------------------------------@@
|
|
1545
|
+
@@-:::::::::-----------------------------------------------------------------------------=@
|
|
1546
|
+
@%::::::::--------------------------------------------------------------------------------%@
|
|
1547
|
+
@+::::::::--------------------------------=@@@@@%-----------------------------------------%@
|
|
1548
|
+
@=:::::::--------------------------------*@@ @@+---------------------------------------#@
|
|
1549
|
+
@+:::::::-------------------------------*@ @*--------------------------------------%@
|
|
1550
|
+
@#::::::::-----------------------------=@@ @@=-------------------------------------%@
|
|
1551
|
+
@@-::::::::----------------------------@@ @@------------------------------------=@
|
|
1552
|
+
@%:::::::::--------------------------*@ @*-----------------------------------@@
|
|
1553
|
+
@*:::::::::-------------------------@@ @@----------------------------------%@
|
|
1554
|
+
@#::::::::::----------------------%@ @%--------------------------------%@
|
|
1555
|
+
@#:::::::::::-------------------=@@ @@=------------------------------%@
|
|
1556
|
+
@@-::::::::::::----------------%@ @%----------------------------=@@
|
|
1557
|
+
@@#::::::::::::::------------*@ @*--------------------------#@@
|
|
1558
|
+
@@+::::::::::::::::--------@@ @@------------------------+@@
|
|
1559
|
+
@@*:::::::::::::::::----@@ @@---------------------+@@
|
|
1560
|
+
@@@-:::::::::::::::--#@ @#-----------------=%@@
|
|
1561
|
+
@@%-::::::::::::-%@ @%-------------=%@@
|
|
1562
|
+
@@@@+:::::::#@@ @@*-------*@@@@
|
|
1563
|
+
@@@@@@@ @@@@@@
|
|
1564
|
+
|
|
1565
|
+
`);
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
// static members
|
|
1569
|
+
static async QuickView(s, t) {
|
|
1570
|
+
const e = new Qe(t);
|
|
1571
|
+
window.DIVE.instances.push(e);
|
|
1572
|
+
const n = new (await E("State"))(
|
|
1573
|
+
e._engine,
|
|
1574
|
+
e.orbitController
|
|
1575
|
+
);
|
|
1576
|
+
n.performAction("UPDATE_SCENE", {
|
|
1577
|
+
backgroundColor: 16777215,
|
|
1578
|
+
gridEnabled: !1,
|
|
1579
|
+
floorEnabled: !0,
|
|
1580
|
+
floorColor: 16777215
|
|
1581
|
+
}), n.performAction("SET_CAMERA_TRANSFORM", {
|
|
1582
|
+
position: { x: 0, y: 2, z: 2 },
|
|
1583
|
+
target: { x: 0, y: 0.5, z: 0 }
|
|
1584
|
+
});
|
|
1585
|
+
const o = C.generateUUID();
|
|
1586
|
+
n.performAction("ADD_OBJECT", {
|
|
1587
|
+
entityType: "light",
|
|
1588
|
+
type: "scene",
|
|
1589
|
+
name: "light",
|
|
1590
|
+
id: o,
|
|
1591
|
+
enabled: !0,
|
|
1592
|
+
visible: !0,
|
|
1593
|
+
intensity: (t == null ? void 0 : t.lightIntensity) ?? 1,
|
|
1594
|
+
color: 16777215
|
|
1595
|
+
});
|
|
1596
|
+
const h = C.generateUUID();
|
|
1597
|
+
return new Promise((l) => {
|
|
1598
|
+
n.subscribe("MODEL_LOADED", (p) => {
|
|
1599
|
+
if (p.id !== h) return;
|
|
1600
|
+
const f = n.performAction(
|
|
1601
|
+
"COMPUTE_ENCOMPASSING_VIEW"
|
|
1602
|
+
);
|
|
1603
|
+
n.performAction("SET_CAMERA_TRANSFORM", {
|
|
1604
|
+
position: f.position,
|
|
1605
|
+
target: f.target
|
|
1606
|
+
}), l(e);
|
|
1607
|
+
}), n.performAction("ADD_OBJECT", {
|
|
1608
|
+
entityType: "model",
|
|
1609
|
+
name: "object",
|
|
1610
|
+
id: h,
|
|
1611
|
+
position: { x: 0, y: 0, z: 0 },
|
|
1612
|
+
rotation: { x: 0, y: 0, z: 0 },
|
|
1613
|
+
scale: { x: 1, y: 1, z: 1 },
|
|
1614
|
+
uri: s,
|
|
1615
|
+
visible: !0,
|
|
1616
|
+
loaded: !1
|
|
1617
|
+
});
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
get engine() {
|
|
1621
|
+
return this._engine;
|
|
1622
|
+
}
|
|
1623
|
+
get canvas() {
|
|
1624
|
+
return this._engine.renderer.webglrenderer.domElement;
|
|
1625
|
+
}
|
|
1626
|
+
setCanvas(s) {
|
|
1627
|
+
this._engine.setCanvas(s), this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.orbitController = new ne(
|
|
1628
|
+
this._engine.camera,
|
|
1629
|
+
s,
|
|
1630
|
+
this._settings.orbitController
|
|
1631
|
+
), this._engine.clock.addTicker(this.orbitController);
|
|
1632
|
+
}
|
|
1633
|
+
async Dispose() {
|
|
1634
|
+
return new Promise((s) => {
|
|
1635
|
+
this._engine.clock.removeTicker(this.orbitController), this.orbitController.dispose(), this.axisCamera && (this._engine.clock.removeTicker(this.axisCamera), this.axisCamera.Dispose()), s();
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
const We = (c, s) => {
|
|
1640
|
+
if (Object.keys(c).length === 0 && Object.keys(s).length === 0)
|
|
1641
|
+
return {};
|
|
1642
|
+
if (typeof c != "object" || typeof s != "object")
|
|
1643
|
+
return s;
|
|
1644
|
+
let t = {};
|
|
1645
|
+
return Object.keys(s).forEach((e) => {
|
|
1646
|
+
if (!Object.keys(c).includes(e)) {
|
|
1647
|
+
t = { ...t, [e]: s[e] };
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
if (Array.isArray(s[e])) {
|
|
1651
|
+
if (!Array.isArray(c[e])) {
|
|
1652
|
+
t = { ...t, [e]: s[e] };
|
|
1653
|
+
return;
|
|
1654
|
+
}
|
|
1655
|
+
const n = c[e], o = s[e];
|
|
1656
|
+
if (n.length === 0 && o.length === 0) {
|
|
1657
|
+
t = { ...t };
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
if (n.length !== o.length) {
|
|
1661
|
+
t = { ...t, [e]: s[e] };
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
const h = [];
|
|
1665
|
+
if (o.forEach((l, p) => {
|
|
1666
|
+
const f = We(
|
|
1667
|
+
n[p],
|
|
1668
|
+
o[p]
|
|
1669
|
+
);
|
|
1670
|
+
Object.keys(f).length && h.push(o[p]);
|
|
1671
|
+
}), Object.keys(h).length) {
|
|
1672
|
+
t = { ...t, [e]: h };
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
if (typeof s[e] == "object") {
|
|
1678
|
+
if (typeof c[e] != "object") {
|
|
1679
|
+
t = { ...t, [e]: s[e] };
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
const n = We(
|
|
1683
|
+
c[e],
|
|
1684
|
+
s[e]
|
|
1685
|
+
);
|
|
1686
|
+
if (Object.keys(n).length) {
|
|
1687
|
+
t = { ...t, [e]: n };
|
|
1688
|
+
return;
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
c[e] !== s[e] && (t = { ...t, [e]: s[e] });
|
|
1692
|
+
}), t;
|
|
1693
|
+
};
|
|
1694
|
+
function D(c, s) {
|
|
1695
|
+
const t = (c + "e").split("e");
|
|
1696
|
+
return +(t[0] + "e" + (+t[1] + (s || 0)));
|
|
1697
|
+
}
|
|
1698
|
+
function wi(c, s = 0) {
|
|
1699
|
+
const t = D(c, +s);
|
|
1700
|
+
return D(Math.ceil(t), -s);
|
|
1701
|
+
}
|
|
1702
|
+
function Di(c, s = 0) {
|
|
1703
|
+
const t = D(c, +s);
|
|
1704
|
+
return D(Math.floor(t), -s);
|
|
1705
|
+
}
|
|
1706
|
+
function et(c, s = 0) {
|
|
1707
|
+
if (c < 0) return -et(-c, s);
|
|
1708
|
+
const t = D(c, +s);
|
|
1709
|
+
return D(Math.round(t), -s);
|
|
1710
|
+
}
|
|
1711
|
+
function Si(c, s, t) {
|
|
1712
|
+
return Math.atan2(
|
|
1713
|
+
c.clone().cross(s).dot(t),
|
|
1714
|
+
s.clone().dot(c)
|
|
1715
|
+
);
|
|
1716
|
+
}
|
|
1717
|
+
function Oi(c, s = 0) {
|
|
1718
|
+
const t = D(c, +s);
|
|
1719
|
+
return D(Math.round(t), -s).toFixed(s);
|
|
1720
|
+
}
|
|
1721
|
+
function Ti(c, s = 0) {
|
|
1722
|
+
const t = D(c, +s);
|
|
1723
|
+
return D(Math.trunc(t), -s);
|
|
1724
|
+
}
|
|
1725
|
+
function xi(c) {
|
|
1726
|
+
return (C.radToDeg(c) + 360) % 360;
|
|
1727
|
+
}
|
|
1728
|
+
function Pi(c) {
|
|
1729
|
+
return C.degToRad(c);
|
|
1730
|
+
}
|
|
1731
|
+
const Vi = {
|
|
1732
|
+
ceilExp: wi,
|
|
1733
|
+
floorExp: Di,
|
|
1734
|
+
roundExp: et,
|
|
1735
|
+
toFixedExp: Oi,
|
|
1736
|
+
truncateExp: Ti,
|
|
1737
|
+
signedAngleTo: Si,
|
|
1738
|
+
radToDeg: xi,
|
|
1739
|
+
degToRad: Pi
|
|
1740
|
+
};
|
|
1741
|
+
export {
|
|
1742
|
+
Qe as DIVE,
|
|
1743
|
+
Ei as DIVEDefaultSettings,
|
|
1744
|
+
Vi as DIVEMath,
|
|
1745
|
+
Zi as ESystem,
|
|
1746
|
+
Xi as EWebXRUnsupportedReason,
|
|
1747
|
+
Ui as FILE_TYPES,
|
|
1748
|
+
Yi as SUPPORTED_FILE_TYPES,
|
|
1749
|
+
ri as applyMixins,
|
|
1750
|
+
Ni as findInterface,
|
|
1751
|
+
ge as findSceneRecursive,
|
|
1752
|
+
Hi as getFileTypeFromUri,
|
|
1753
|
+
E as getModule,
|
|
1754
|
+
We as getObjectDelta,
|
|
1755
|
+
Gi as implementsInterface,
|
|
1756
|
+
Wi as isFileTypeSupported
|
|
1757
|
+
};
|