@shopware-ag/dive 2.0.3 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/build/chunks/{AssetCache-DNwNkGms.cjs → AssetCache-B02vAmfm.cjs} +1 -1
- package/build/chunks/{AssetCache-BpdA1GQf.mjs → AssetCache-DP95DtBA.mjs} +1 -1
- package/build/chunks/{AssetLoader-DJKZltSW.mjs → AssetLoader-BOnrkFcl.mjs} +2 -2
- package/build/chunks/{AssetLoader-Ct1Lh-P1.cjs → AssetLoader-C6MLrKu2.cjs} +1 -1
- package/build/chunks/FileTypes-BobMthbh.cjs +29 -0
- package/build/chunks/FileTypes-D5zw1toN.mjs +1884 -0
- package/build/chunks/PerspectiveCamera-8tnOn5YS.mjs +39 -0
- package/build/chunks/PerspectiveCamera-Dp8ElZGj.cjs +1 -0
- package/build/chunks/{SelectTool-DxVRSIoF.mjs → SelectTool-BNZdhIaO.mjs} +2 -2
- package/build/chunks/SelectTool-J55L_APQ.cjs +1 -0
- package/build/{src/components → components}/index.d.ts +1 -0
- package/build/{src/components → components}/model/Model.d.ts +3 -2
- package/build/dive.cjs +1 -1
- package/build/dive.d.ts +1 -1
- package/build/dive.mjs +69 -68
- package/build/engine/AsciiArt.d.ts +1 -0
- package/build/engine/Dive.d.ts +98 -0
- package/build/{src/engine → engine}/camera/PerspectiveCamera.d.ts +1 -0
- package/build/{src/engine → engine}/clock/Clock.d.ts +1 -4
- package/build/{src/engine → engine}/index.d.ts +2 -1
- package/build/{src/engine → engine}/renderer/Renderer.d.ts +12 -5
- package/build/{src/engine → engine}/resize/ResizeManager.d.ts +5 -2
- package/build/engine/scene/Scene.d.ts +41 -0
- package/build/{src/engine → engine}/scene/xrroot/XRRoot.d.ts +2 -2
- package/build/{src/engine → engine}/scene/xrroot/xrlightroot/XRLightRoot.d.ts +2 -2
- package/build/engine/view/View.d.ts +24 -0
- package/build/{src/index.d.ts → index.d.ts} +1 -1
- package/build/plugins/animation/index.cjs +1 -1
- package/build/plugins/animation/index.d.ts +2 -2
- package/build/plugins/animation/index.mjs +11 -11
- package/build/plugins/ar/index.cjs +1 -1
- package/build/plugins/ar/index.d.ts +4 -2
- package/build/plugins/ar/index.mjs +1 -1
- package/build/{src/plugins → plugins}/ar/src/webxr/WebXR.d.ts +2 -2
- package/build/{src/plugins → plugins}/ar/src/webxr/controller/WebXRController.d.ts +2 -2
- package/build/{src/plugins → plugins}/ar/src/webxr/origin/WebXROrigin.d.ts +2 -2
- package/build/{src/plugins → plugins}/ar/src/webxr/raycaster/WebXRRaycaster.d.ts +2 -2
- package/build/{src/plugins → plugins}/ar/src/webxr/raycaster/ar/WebXRRaycasterAR.d.ts +2 -2
- package/build/{src/plugins → plugins}/ar/src/webxr/raycaster/three/WebXRRaycasterTHREE.d.ts +2 -2
- package/build/plugins/assetcache/index.cjs +1 -1
- package/build/plugins/assetcache/index.d.ts +1 -2
- package/build/plugins/assetcache/index.mjs +1 -1
- package/build/plugins/assetconverter/index.d.ts +1 -2
- package/build/plugins/assetexporter/index.d.ts +1 -2
- package/build/plugins/assetloader/index.cjs +1 -1
- package/build/plugins/assetloader/index.d.ts +3 -2
- package/build/plugins/assetloader/index.mjs +1 -1
- package/build/plugins/mediacreator/index.cjs +1 -1
- package/build/plugins/mediacreator/index.d.ts +2 -2
- package/build/plugins/mediacreator/index.mjs +8 -8
- package/build/{src/plugins → plugins}/mediacreator/src/MediaCreator.d.ts +2 -2
- package/build/plugins/orbitcontroller/index.cjs +1 -1
- package/build/plugins/orbitcontroller/index.d.ts +1 -2
- package/build/plugins/orbitcontroller/index.mjs +1 -1
- package/build/plugins/orbitcontroller/src/OrbitController.d.ts +195 -0
- package/build/plugins/orbitcontroller/types/OrbitControllerState.types.d.ts +9 -0
- package/build/plugins/orbitcontroller/types/index.d.ts +1 -0
- package/build/plugins/orientationdisplay/index.cjs +1 -1
- package/build/plugins/orientationdisplay/index.d.ts +2 -2
- package/build/plugins/orientationdisplay/index.mjs +1 -1
- package/build/{src/plugins → plugins}/orientationdisplay/src/OrientationDisplay.d.ts +2 -2
- package/build/plugins/quickview/index.cjs +1 -0
- package/build/plugins/quickview/index.d.ts +2 -0
- package/build/plugins/quickview/index.mjs +22 -0
- package/build/plugins/quickview/src/QuickView.d.ts +14 -0
- package/build/plugins/quickview/types/QuickViewSettings.d.ts +4 -0
- package/build/plugins/quickview/types/index.d.ts +1 -0
- package/build/plugins/state/index.cjs +7 -7
- package/build/plugins/state/index.d.ts +4 -2
- package/build/plugins/state/index.mjs +310 -316
- package/build/{src/plugins → plugins}/state/src/State.d.ts +2 -2
- package/build/{src/plugins → plugins}/state/src/actions/media/generatemedia.d.ts +1 -1
- package/build/{src/plugins → plugins}/state/types/ActionTypes.d.ts +2 -2
- package/build/plugins/systeminfo/index.d.ts +2 -2
- package/build/plugins/toolbox/index.cjs +1 -1
- package/build/plugins/toolbox/index.d.ts +5 -2
- package/build/plugins/toolbox/index.mjs +2 -2
- package/package.json +6 -1
- package/build/chunks/FileTypes-BawiSSTm.mjs +0 -1059
- package/build/chunks/FileTypes-DYdmsV-9.cjs +0 -30
- package/build/chunks/MathUtils-CBW56ZuG.cjs +0 -1
- package/build/chunks/MathUtils-CFGjHuVF.mjs +0 -159
- package/build/chunks/OrbitController-BQ6SV1O_.mjs +0 -1159
- package/build/chunks/OrbitController-CpFQ3A1H.cjs +0 -1
- package/build/chunks/PerspectiveCamera-BByyG5R4.cjs +0 -1
- package/build/chunks/PerspectiveCamera-PMJPzAn3.mjs +0 -34
- package/build/chunks/SelectTool-bi-2zWyT.cjs +0 -1
- package/build/chunks/VisibilityLayerMask-BI7jPKdx.cjs +0 -1
- package/build/chunks/VisibilityLayerMask-CXgt1fJc.mjs +0 -8
- package/build/chunks/package-Cfclzhv-.cjs +0 -1
- package/build/chunks/package-YeeRzGDk.mjs +0 -39
- package/build/src/core/Dive.d.ts +0 -58
- package/build/src/core/index.d.ts +0 -1
- package/build/src/engine/Engine.d.ts +0 -28
- package/build/src/engine/scene/Scene.d.ts +0 -19
- package/build/src/plugins/animation/index.d.ts +0 -2
- package/build/src/plugins/ar/index.d.ts +0 -4
- package/build/src/plugins/assetcache/index.d.ts +0 -1
- package/build/src/plugins/assetconverter/index.d.ts +0 -1
- package/build/src/plugins/assetexporter/index.d.ts +0 -1
- package/build/src/plugins/assetloader/index.d.ts +0 -3
- package/build/src/plugins/mediacreator/index.d.ts +0 -2
- package/build/src/plugins/orbitcontroller/index.d.ts +0 -1
- package/build/src/plugins/orbitcontroller/src/OrbitController.d.ts +0 -45
- package/build/src/plugins/orientationdisplay/index.d.ts +0 -2
- package/build/src/plugins/state/index.d.ts +0 -4
- package/build/src/plugins/systeminfo/index.d.ts +0 -2
- package/build/src/plugins/toolbox/index.d.ts +0 -5
- /package/build/{src/components → components}/boundingbox/BoundingBox.d.ts +0 -0
- /package/build/{src/components → components}/floor/Floor.d.ts +0 -0
- /package/build/{src/components → components}/gizmo/Gizmo.d.ts +0 -0
- /package/build/{src/components → components}/gizmo/handles/AxisHandle.d.ts +0 -0
- /package/build/{src/components → components}/gizmo/handles/RadialHandle.d.ts +0 -0
- /package/build/{src/components → components}/gizmo/handles/ScaleHandle.d.ts +0 -0
- /package/build/{src/components → components}/gizmo/plane/GizmoPlane.d.ts +0 -0
- /package/build/{src/components → components}/gizmo/rotate/RotateGizmo.d.ts +0 -0
- /package/build/{src/components → components}/gizmo/scale/ScaleGizmo.d.ts +0 -0
- /package/build/{src/components → components}/gizmo/translate/TranslateGizmo.d.ts +0 -0
- /package/build/{src/components → components}/grid/Grid.d.ts +0 -0
- /package/build/{src/components → components}/group/Group.d.ts +0 -0
- /package/build/{src/components → components}/light/AmbientLight.d.ts +0 -0
- /package/build/{src/components → components}/light/PointLight.d.ts +0 -0
- /package/build/{src/components → components}/light/SceneLight.d.ts +0 -0
- /package/build/{src/components → components}/light/index.d.ts +0 -0
- /package/build/{src/components → components}/node/Node.d.ts +0 -0
- /package/build/{src/components → components}/primitive/Primitive.d.ts +0 -0
- /package/build/{src/components → components}/root/Root.d.ts +0 -0
- /package/build/{src/constants → constants}/AxisHelperColors.d.ts +0 -0
- /package/build/{src/constants → constants}/GridColors.d.ts +0 -0
- /package/build/{src/constants → constants}/VisibilityLayerMask.d.ts +0 -0
- /package/build/{src/constants → constants}/index.d.ts +0 -0
- /package/build/{src/error → error}/file-content/file-content-error.d.ts +0 -0
- /package/build/{src/error → error}/file-type/file-type-error.d.ts +0 -0
- /package/build/{src/error → error}/index.d.ts +0 -0
- /package/build/{src/error → error}/network/network-error.d.ts +0 -0
- /package/build/{src/error → error}/parse/parse-error.d.ts +0 -0
- /package/build/{src/events → events}/dispatcher/EventDispatcher.d.ts +0 -0
- /package/build/{src/events → events}/index.d.ts +0 -0
- /package/build/{src/helpers → helpers}/applyMixins/applyMixins.d.ts +0 -0
- /package/build/{src/helpers → helpers}/deepClone/deepClone.d.ts +0 -0
- /package/build/{src/helpers → helpers}/findInterface/findInterface.d.ts +0 -0
- /package/build/{src/helpers → helpers}/findSceneRecursive/findSceneRecursive.d.ts +0 -0
- /package/build/{src/helpers → helpers}/getFileTypeFromUri/getFileTypeFromUri.d.ts +0 -0
- /package/build/{src/helpers → helpers}/getObjectDelta/getObjectDelta.d.ts +0 -0
- /package/build/{src/helpers → helpers}/implementsInterface/implementsInterface.d.ts +0 -0
- /package/build/{src/helpers → helpers}/index.d.ts +0 -0
- /package/build/{src/helpers → helpers}/isFileTypeSupported/isFileTypeSupported.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/ceil/ceilExp.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/degToRad/degToRad.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/floor/floorExp.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/helper/shift.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/index.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/radToDeg/radToDeg.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/round/roundExp.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/signedAngleTo/signedAngleTo.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/toFixed/toFixedExp.d.ts +0 -0
- /package/build/{src/helpers → helpers}/math/truncate/truncateExp.d.ts +0 -0
- /package/build/{src/interfaces → interfaces}/Draggable.d.ts +0 -0
- /package/build/{src/interfaces → interfaces}/Hoverable.d.ts +0 -0
- /package/build/{src/interfaces → interfaces}/Movable.d.ts +0 -0
- /package/build/{src/interfaces → interfaces}/Rotatable.d.ts +0 -0
- /package/build/{src/interfaces → interfaces}/Scalable.d.ts +0 -0
- /package/build/{src/interfaces → interfaces}/Selectable.d.ts +0 -0
- /package/build/{src/interfaces → interfaces}/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/animation/src/animator/Animator.d.ts +0 -0
- /package/build/{src/plugins → plugins}/animation/src/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/animation/src/system/AnimationSystem.d.ts +0 -0
- /package/build/{src/plugins → plugins}/animation/src/types/AnimatorParameters.d.ts +0 -0
- /package/build/{src/plugins → plugins}/ar/src/ARSystem.d.ts +0 -0
- /package/build/{src/plugins → plugins}/ar/src/arquicklook/ARQuickLook.d.ts +0 -0
- /package/build/{src/plugins → plugins}/ar/src/error/ar-errors.d.ts +0 -0
- /package/build/{src/plugins → plugins}/ar/src/sceneviewer/SceneViewer.d.ts +0 -0
- /package/build/{src/plugins → plugins}/ar/src/webxr/crosshair/WebXRCrosshair.d.ts +0 -0
- /package/build/{src/plugins → plugins}/ar/src/webxr/overlay/Overlay.d.ts +0 -0
- /package/build/{src/plugins → plugins}/ar/src/webxr/touchscreencontrols/WebXRTouchscreenControls.d.ts +0 -0
- /package/build/{src/plugins → plugins}/assetcache/src/cache/AssetCache.d.ts +0 -0
- /package/build/{src/plugins → plugins}/assetcache/src/chunk/Chunk.d.ts +0 -0
- /package/build/{src/plugins → plugins}/assetcache/src/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/assetconverter/src/AssetConverter.d.ts +0 -0
- /package/build/{src/plugins → plugins}/assetexporter/src/AssetExporter.d.ts +0 -0
- /package/build/{src/plugins → plugins}/assetloader/src/draco/DracoLoader.d.ts +0 -0
- /package/build/{src/plugins → plugins}/assetloader/src/loader/AssetLoader.d.ts +0 -0
- /package/build/{src/plugins → plugins}/mediacreator/types/MediaGenerationById.d.ts +0 -0
- /package/build/{src/plugins → plugins}/mediacreator/types/MediaGenerationByPosition.d.ts +0 -0
- /package/build/{src/plugins → plugins}/mediacreator/types/MediaGenerationResolution.d.ts +0 -0
- /package/build/{src/plugins → plugins}/mediacreator/types/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/orientationdisplay/src/axes/Axes.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/ActionRegistry.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/action.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/ar/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/ar/launchar.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/camera/computeencompassingview.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/camera/getcameratransform.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/camera/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/camera/lockcamera.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/camera/movecamera.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/camera/setcameralayer.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/camera/setcameratransform.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/camera/zoomcamera.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/media/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/addobject.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/deleteobject.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/deselectobject.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/dropit.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/getallobjects.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/getobjects.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/modelloaded.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/placeonfloor.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/selectobject.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/setparent.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/object/updateobject.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/renderer/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/renderer/startrender.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/scene/exportscene.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/scene/getallscenedata.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/scene/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/scene/setbackground.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/scene/updatescene.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/toolbox/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/toolbox/setgizmomode.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/toolbox/setgizmoscalelinked.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/toolbox/setgizmovisible.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/src/actions/toolbox/usetool.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/types/StateExportFileType.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/types/StateSceneData.d.ts +0 -0
- /package/build/{src/plugins → plugins}/state/types/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/systeminfo/src/SystemInfo.d.ts +0 -0
- /package/build/{src/plugins → plugins}/systeminfo/types/index.d.ts +0 -0
- /package/build/{src/plugins → plugins}/toolbox/src/BaseTool.d.ts +0 -0
- /package/build/{src/plugins → plugins}/toolbox/src/Toolbox.d.ts +0 -0
- /package/build/{src/plugins → plugins}/toolbox/src/select/SelectTool.d.ts +0 -0
- /package/build/{src/plugins → plugins}/toolbox/src/transform/TransformTool.d.ts +0 -0
- /package/build/{src/plugins → plugins}/toolbox/types/ToolType.d.ts +0 -0
- /package/build/{src/plugins → plugins}/toolbox/types/index.d.ts +0 -0
- /package/build/{src/types → types}/components/DIVELight.d.ts +0 -0
- /package/build/{src/types → types}/components/DIVESceneObject.d.ts +0 -0
- /package/build/{src/types → types}/components/index.d.ts +0 -0
- /package/build/{src/types → types}/file/FileTypes.d.ts +0 -0
- /package/build/{src/types → types}/file/index.d.ts +0 -0
- /package/build/{src/types → types}/index.d.ts +0 -0
- /package/build/{src/types → types}/schema/BaseEntitySchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/EntitySchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/EntityTypeSchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/GeometrySchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/GeometryTypeSchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/GroupSchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/LightSchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/MaterialSchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/ModelSchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/PovSchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/PrimitiveSchema.d.ts +0 -0
- /package/build/{src/types → types}/schema/index.d.ts +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var R = (e, s, a) => s in e ? L(e, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[s] = a;
|
|
3
|
+
var r = (e, s, a) => R(e, typeof s != "symbol" ? s + "" : s, a);
|
|
4
|
+
import { PerspectiveCamera as n } from "three";
|
|
5
|
+
const c = 1, K = 2, S = 4, i = 8, A = 16, E = {
|
|
6
|
+
fov: 70,
|
|
7
|
+
near: 0.1,
|
|
8
|
+
far: 1e3
|
|
9
|
+
}, t = class t extends n {
|
|
10
|
+
constructor(a = E) {
|
|
11
|
+
super(
|
|
12
|
+
a.fov || E.fov,
|
|
13
|
+
1,
|
|
14
|
+
a.near || E.near,
|
|
15
|
+
a.far || E.far
|
|
16
|
+
);
|
|
17
|
+
r(this, "isDIVEPerspectiveCamera", !0);
|
|
18
|
+
r(this, "onSetCameraLayer", () => {
|
|
19
|
+
});
|
|
20
|
+
this.layers.mask = t.EDITOR_VIEW_LAYER_MASK;
|
|
21
|
+
}
|
|
22
|
+
onResize(a, o) {
|
|
23
|
+
this.aspect = a / o, this.updateProjectionMatrix();
|
|
24
|
+
}
|
|
25
|
+
setCameraLayer(a) {
|
|
26
|
+
this.layers.mask = a === "LIVE" ? t.LIVE_VIEW_LAYER_MASK : t.EDITOR_VIEW_LAYER_MASK, this.onSetCameraLayer(this.layers.mask);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
r(t, "EDITOR_VIEW_LAYER_MASK", c | S | i | A), r(t, "LIVE_VIEW_LAYER_MASK", A);
|
|
30
|
+
let _ = t;
|
|
31
|
+
export {
|
|
32
|
+
K as C,
|
|
33
|
+
_ as D,
|
|
34
|
+
i as H,
|
|
35
|
+
A as P,
|
|
36
|
+
S as U,
|
|
37
|
+
E as a,
|
|
38
|
+
c as b
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var i=(A,t,e)=>t in A?o(A,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):A[t]=e;var a=(A,t,e)=>i(A,typeof t!="symbol"?t+"":t,e);const n=require("three"),L=1,I=2,R=4,S=8,_=16,s={fov:70,near:.1,far:1e3},E=class E extends n.PerspectiveCamera{constructor(e=s){super(e.fov||s.fov,1,e.near||s.near,e.far||s.far);a(this,"isDIVEPerspectiveCamera",!0);a(this,"onSetCameraLayer",()=>{});this.layers.mask=E.EDITOR_VIEW_LAYER_MASK}onResize(e,c){this.aspect=e/c,this.updateProjectionMatrix()}setCameraLayer(e){this.layers.mask=e==="LIVE"?E.LIVE_VIEW_LAYER_MASK:E.EDITOR_VIEW_LAYER_MASK,this.onSetCameraLayer(this.layers.mask)}};a(E,"EDITOR_VIEW_LAYER_MASK",L|R|S|_),a(E,"LIVE_VIEW_LAYER_MASK",_);let r=E;exports.COORDINATE_LAYER_MASK=I;exports.DEFAULT_LAYER_MASK=L;exports.DIVEPerspectiveCamera=r;exports.DIVEPerspectiveCameraDefaultSettings=s;exports.HELPER_LAYER_MASK=S;exports.PRODUCT_LAYER_MASK=_;exports.UI_LAYER_MASK=R;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var jt = Object.defineProperty;
|
|
2
2
|
var Xt = (r, i, t) => i in r ? jt(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
|
|
3
3
|
var c = (r, i, t) => Xt(r, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
-
import { A as lt,
|
|
4
|
+
import { A as lt, g as ht, h as ct } from "./FileTypes-D5zw1toN.mjs";
|
|
5
5
|
import { Object3D as st, Vector3 as a, Quaternion as E, Raycaster as bt, MeshBasicMaterial as St, LineBasicMaterial as Yt, CylinderGeometry as w, BoxGeometry as f, BufferGeometry as dt, Float32BufferAttribute as pt, Mesh as o, OctahedronGeometry as B, Line as I, TorusGeometry as C, SphereGeometry as Qt, Euler as Zt, Matrix4 as vt, PlaneGeometry as Ht, DoubleSide as Ot, Vector2 as tt } from "three";
|
|
6
6
|
import { f as ot, i as et } from "./findInterface-DbJ5qzbc.mjs";
|
|
7
|
-
import { P as Ct, U as kt } from "./
|
|
7
|
+
import { P as Ct, U as kt } from "./PerspectiveCamera-8tnOn5YS.mjs";
|
|
8
8
|
const j = new bt(), u = new a(), T = new a(), d = new E(), ut = {
|
|
9
9
|
X: new a(1, 0, 0),
|
|
10
10
|
Y: new a(0, 1, 0),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var wt=Object.defineProperty;var gt=(r,n,e)=>n in r?wt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[n]=e;var h=(r,n,e)=>gt(r,typeof n!="symbol"?n+"":n,e);const Q=require("./FileTypes-BobMthbh.cjs"),t=require("three"),j=require("./findInterface-C6mrvf_t.cjs"),$=require("./PerspectiveCamera-Dp8ElZGj.cjs"),D=new t.Raycaster,p=new t.Vector3,P=new t.Vector3,c=new t.Quaternion,tt={X:new t.Vector3(1,0,0),Y:new t.Vector3(0,1,0),Z:new t.Vector3(0,0,1)},U={type:"change"},et={type:"mouseDown"},it={type:"mouseUp",mode:null},nt={type:"objectChange"};class bt extends t.Object3D{constructor(n,e){super(),e===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.isTransformControls=!0,this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const o=new xt;this._gizmo=o,this.add(o);const s=new Dt;this._plane=s,this.add(s);const a=this;function i(m,y){let A=y;Object.defineProperty(a,m,{get:function(){return A!==void 0?A:y},set:function(x){A!==x&&(A=x,s[m]=x,o[m]=x,a.dispatchEvent({type:m+"-changed",value:x}),a.dispatchEvent(U))}}),a[m]=y,s[m]=y,o[m]=y}i("camera",n),i("object",void 0),i("enabled",!0),i("axis",null),i("mode","translate"),i("translationSnap",null),i("rotationSnap",null),i("scaleSnap",null),i("space","world"),i("size",1),i("dragging",!1),i("showX",!0),i("showY",!0),i("showZ",!0);const d=new t.Vector3,f=new t.Vector3,E=new t.Quaternion,T=new t.Quaternion,z=new t.Vector3,C=new t.Quaternion,K=new t.Vector3,H=new t.Vector3,M=new t.Vector3,S=0,g=new t.Vector3;i("worldPosition",d),i("worldPositionStart",f),i("worldQuaternion",E),i("worldQuaternionStart",T),i("cameraPosition",z),i("cameraQuaternion",C),i("pointStart",K),i("pointEnd",H),i("rotationAxis",M),i("rotationAngle",S),i("eye",g),this._offset=new t.Vector3,this._startNorm=new t.Vector3,this._endNorm=new t.Vector3,this._cameraScale=new t.Vector3,this._parentPosition=new t.Vector3,this._parentQuaternion=new t.Quaternion,this._parentQuaternionInv=new t.Quaternion,this._parentScale=new t.Vector3,this._worldScaleStart=new t.Vector3,this._worldQuaternionInv=new t.Quaternion,this._worldScale=new t.Vector3,this._positionStart=new t.Vector3,this._quaternionStart=new t.Quaternion,this._scaleStart=new t.Vector3,this._getPointer=Mt.bind(this),this._onPointerDown=vt.bind(this),this._onPointerHover=St.bind(this),this._onPointerMove=Pt.bind(this),this._onPointerUp=Et.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(n){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(n)}pointerHover(n){if(this.object===void 0||this.dragging===!0)return;n!==null&&D.setFromCamera(n,this.camera);const e=N(this._gizmo.picker[this.mode],D);e?this.axis=e.object.name:this.axis=null}pointerDown(n){if(!(this.object===void 0||this.dragging===!0||n!=null&&n.button!==0)&&this.axis!==null){n!==null&&D.setFromCamera(n,this.camera);const e=N(this._plane,D,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,et.mode=this.mode,this.dispatchEvent(et)}}pointerMove(n){const e=this.axis,o=this.mode,s=this.object;let a=this.space;if(o==="scale"?a="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(a="world"),s===void 0||e===null||this.dragging===!1||n!==null&&n.button!==-1)return;n!==null&&D.setFromCamera(n,this.camera);const i=N(this._plane,D,!0);if(i){if(this.pointEnd.copy(i.point).sub(this.worldPositionStart),o==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),a==="local"&&e!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(a==="local"&&(s.position.applyQuaternion(c.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),a==="world"&&(s.parent&&s.position.add(p.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(p.setFromMatrixPosition(s.parent.matrixWorld))));else if(o==="scale"){if(e.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),P.set(d,d,d)}else p.copy(this.pointStart),P.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),P.applyQuaternion(this._worldQuaternionInv),P.divide(p),e.search("X")===-1&&(P.x=1),e.search("Y")===-1&&(P.y=1),e.search("Z")===-1&&(P.z=1);s.scale.copy(this._scaleStart).multiply(P),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(p.setFromMatrixPosition(this.camera.matrixWorld));let f=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(p.copy(this.rotationAxis).cross(this.eye))*d):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(tt[e]),p.copy(tt[e]),a==="local"&&p.applyQuaternion(this.worldQuaternion),p.cross(this.eye),p.length()===0?f=!0:this.rotationAngle=this._offset.dot(p.normalize())*d),(e==="E"||f)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),a==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(c.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(U),this.dispatchEvent(nt)}}pointerUp(n){n!==null&&n.button!==0||(this.dragging&&this.axis!==null&&(it.mode=this.mode,this.dispatchEvent(it)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(n){n.geometry&&n.geometry.dispose(),n.material&&n.material.dispose()})}attach(n){return this.object=n,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(U),this.dispatchEvent(nt),this.pointStart.copy(this.pointEnd))}getRaycaster(){return D}getMode(){return this.mode}setMode(n){this.mode=n}setTranslationSnap(n){this.translationSnap=n}setRotationSnap(n){this.rotationSnap=n}setScaleSnap(n){this.scaleSnap=n}setSize(n){this.size=n}setSpace(n){this.space=n}}function Mt(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const n=this.domElement.getBoundingClientRect();return{x:(r.clientX-n.left)/n.width*2-1,y:-(r.clientY-n.top)/n.height*2+1,button:r.button}}}function St(r){if(this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function vt(r){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function Pt(r){this.enabled&&this.pointerMove(this._getPointer(r))}function Et(r){this.enabled&&(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function N(r,n,e){const o=n.intersectObject(r,!0);for(let s=0;s<o.length;s++)if(o[s].object.visible||e)return o[s];return!1}const q=new t.Euler,l=new t.Vector3(0,1,0),ot=new t.Vector3(0,0,0),st=new t.Matrix4,B=new t.Quaternion,F=new t.Quaternion,b=new t.Vector3,rt=new t.Matrix4,O=new t.Vector3(1,0,0),I=new t.Vector3(0,1,0),Z=new t.Vector3(0,0,1),W=new t.Vector3,X=new t.Vector3,Y=new t.Vector3;class xt extends t.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const n=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=n.clone();o.opacity=.15;const s=e.clone();s.opacity=.5;const a=n.clone();a.color.setHex(16711680);const i=n.clone();i.color.setHex(65280);const d=n.clone();d.color.setHex(255);const f=n.clone();f.color.setHex(16711680),f.opacity=.5;const E=n.clone();E.color.setHex(65280),E.opacity=.5;const T=n.clone();T.color.setHex(255),T.opacity=.5;const z=n.clone();z.opacity=.25;const C=n.clone();C.color.setHex(16776960),C.opacity=.25,n.clone().color.setHex(16776960);const H=n.clone();H.color.setHex(7895160);const M=new t.CylinderGeometry(0,.04,.1,12);M.translate(0,.05,0);const S=new t.BoxGeometry(.08,.08,.08);S.translate(0,.04,0);const g=new t.BufferGeometry;g.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const m=new t.CylinderGeometry(.0075,.0075,.5,3);m.translate(0,.25,0);function y(_,V){const w=new t.TorusGeometry(_,.0075,3,64,V*Math.PI*2);return w.rotateY(Math.PI/2),w.rotateX(Math.PI/2),w}function A(){const _=new t.BufferGeometry;return _.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),_}const x={X:[[new t.Mesh(M,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(M,a),[-.5,0,0],[0,0,Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(M,i),[0,.5,0]],[new t.Mesh(M,i),[0,-.5,0],[Math.PI,0,0]],[new t.Mesh(m,i)]],Z:[[new t.Mesh(M,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(M,d),[0,0,-.5],[-Math.PI/2,0,0]],[new t.Mesh(m,d),null,[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),z.clone()),[0,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T.clone()),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},ht={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),o)]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},ct={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new t.Line(A(),s),null,null,null,"helper"]],X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},dt={XYZE:[[new t.Mesh(y(.5,1),H),null,[0,Math.PI/2,0]]],X:[[new t.Mesh(y(.5,.5),a)]],Y:[[new t.Mesh(y(.5,.5),i),null,[0,0,-Math.PI/2]]],Z:[[new t.Mesh(y(.5,.5),d),null,[0,Math.PI/2,0]]],E:[[new t.Mesh(y(.75,1),C),null,[0,Math.PI/2,0]]]},pt={AXIS:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},mt={XYZE:[[new t.Mesh(new t.SphereGeometry(.25,10,8),o)]],X:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(.75,.1,2,24),o)]]},ut={X:[[new t.Mesh(S,a),[.5,0,0],[0,0,-Math.PI/2]],[new t.Mesh(m,a),[0,0,0],[0,0,-Math.PI/2]],[new t.Mesh(S,a),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(S,i),[0,.5,0]],[new t.Mesh(m,i)],[new t.Mesh(S,i),[0,-.5,0],[0,0,Math.PI]]],Z:[[new t.Mesh(S,d),[0,0,.5],[Math.PI/2,0,0]],[new t.Mesh(m,d),[0,0,0],[Math.PI/2,0,0]],[new t.Mesh(S,d),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),T),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),f),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.15,.15,.01),E),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.1,.1,.1),z.clone())]]},ft={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new t.Mesh(new t.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},_t={X:[[new t.Line(g,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(g,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(g,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function v(_){const V=new t.Object3D;for(const w in _)for(let G=_[w].length;G--;){const u=_[w][G][0].clone(),L=_[w][G][1],R=_[w][G][2],k=_[w][G][3],yt=_[w][G][4];u.name=w,u.tag=yt,L&&u.position.set(L[0],L[1],L[2]),R&&u.rotation.set(R[0],R[1],R[2]),k&&u.scale.set(k[0],k[1],k[2]),u.updateMatrix();const J=u.geometry.clone();J.applyMatrix4(u.matrix),u.geometry=J,u.renderOrder=1/0,u.position.set(0,0,0),u.rotation.set(0,0,0),u.scale.set(1,1,1),V.add(u)}return V}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=v(x)),this.add(this.gizmo.rotate=v(dt)),this.add(this.gizmo.scale=v(ut)),this.add(this.picker.translate=v(ht)),this.add(this.picker.rotate=v(mt)),this.add(this.picker.scale=v(ft)),this.add(this.helper.translate=v(ct)),this.add(this.helper.rotate=v(pt)),this.add(this.helper.scale=v(_t)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(n){const o=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:F;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let a=0;a<s.length;a++){const i=s[a];i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition);let d;if(this.camera.isOrthographicCamera?d=(this.camera.top-this.camera.bottom)/this.camera.zoom:d=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),i.scale.set(1,1,1).multiplyScalar(d*this.size/4),i.tag==="helper"){i.visible=!1,i.name==="AXIS"?(i.visible=!!this.axis,this.axis==="X"&&(c.setFromEuler(q.set(0,0,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Y"&&(c.setFromEuler(q.set(0,0,Math.PI/2)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="Z"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),i.quaternion.copy(o).multiply(c),Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.9&&(i.visible=!1)),this.axis==="XYZE"&&(c.setFromEuler(q.set(0,Math.PI/2,0)),l.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(st.lookAt(ot,l,I)),i.quaternion.multiply(c),i.visible=this.dragging),this.axis==="E"&&(i.visible=!1)):i.name==="START"?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):i.name==="END"?(i.position.copy(this.worldPosition),i.visible=this.dragging):i.name==="DELTA"?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),p.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(p),i.visible=this.dragging):(i.quaternion.copy(o),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=this.axis.search(i.name)!==-1));continue}i.quaternion.copy(o),this.mode==="translate"||this.mode==="scale"?(i.name==="X"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Y"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="Z"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))>.99&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XY"&&Math.abs(l.copy(Z).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="YZ"&&Math.abs(l.copy(O).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),i.name==="XZ"&&Math.abs(l.copy(I).applyQuaternion(o).dot(this.eye))<.2&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1)):this.mode==="rotate"&&(B.copy(o),l.copy(this.eye).applyQuaternion(c.copy(o).invert()),i.name.search("E")!==-1&&i.quaternion.setFromRotationMatrix(st.lookAt(this.eye,ot,I)),i.name==="X"&&(c.setFromAxisAngle(O,Math.atan2(-l.y,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Y"&&(c.setFromAxisAngle(I,Math.atan2(l.x,l.z)),c.multiplyQuaternions(B,c),i.quaternion.copy(c)),i.name==="Z"&&(c.setFromAxisAngle(Z,Math.atan2(l.y,l.x)),c.multiplyQuaternions(B,c),i.quaternion.copy(c))),i.visible=i.visible&&(i.name.indexOf("X")===-1||this.showX),i.visible=i.visible&&(i.name.indexOf("Y")===-1||this.showY),i.visible=i.visible&&(i.name.indexOf("Z")===-1||this.showZ),i.visible=i.visible&&(i.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),i.material._color=i.material._color||i.material.color.clone(),i.material._opacity=i.material._opacity||i.material.opacity,i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled&&this.axis&&(i.name===this.axis||this.axis.split("").some(function(f){return i.name===f}))&&(i.material.color.setHex(16776960),i.material.opacity=1)}super.updateMatrixWorld(n)}}class Dt extends t.Mesh{constructor(){super(new t.PlaneGeometry(1e5,1e5,2,2),new t.MeshBasicMaterial({visible:!1,wireframe:!0,side:t.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(n){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),W.copy(O).applyQuaternion(e==="local"?this.worldQuaternion:F),X.copy(I).applyQuaternion(e==="local"?this.worldQuaternion:F),Y.copy(Z).applyQuaternion(e==="local"?this.worldQuaternion:F),l.copy(X),this.mode){case"translate":case"scale":switch(this.axis){case"X":l.copy(this.eye).cross(W),b.copy(W).cross(l);break;case"Y":l.copy(this.eye).cross(X),b.copy(X).cross(l);break;case"Z":l.copy(this.eye).cross(Y),b.copy(Y).cross(l);break;case"XY":b.copy(Y);break;case"YZ":b.copy(W);break;case"XZ":l.copy(Y),b.copy(X);break;case"XYZ":case"E":b.set(0,0,0);break}break;case"rotate":default:b.set(0,0,0)}b.length()===0?this.quaternion.copy(this.cameraQuaternion):(rt.lookAt(p.set(0,0,0),b,l),this.quaternion.setFromRotationMatrix(rt)),super.updateMatrixWorld(n)}}class at{constructor(n,e){h(this,"POINTER_DRAG_THRESHOLD",.001);h(this,"name");h(this,"_canvas");h(this,"_scene");h(this,"_controller");h(this,"_pointer");h(this,"_pointerPrimaryDown");h(this,"_pointerMiddleDown");h(this,"_pointerSecondaryDown");h(this,"_lastPointerDown");h(this,"_lastPointerUp");h(this,"_raycaster");h(this,"_intersects");h(this,"_hovered");h(this,"_dragging");h(this,"_dragStart");h(this,"_dragCurrent");h(this,"_dragEnd");h(this,"_dragDelta");h(this,"_draggable");h(this,"_dragRaycastOnObjects");this.name="BaseTool",this._canvas=e.domElement,this._scene=n,this._controller=e,this._pointer=new t.Vector2,this._pointerPrimaryDown=!1,this._pointerMiddleDown=!1,this._pointerSecondaryDown=!1,this._lastPointerDown=new t.Vector2,this._lastPointerUp=new t.Vector2,this._raycaster=new t.Raycaster,this._raycaster.layers.mask=$.PRODUCT_LAYER_MASK|$.UI_LAYER_MASK,this._intersects=[],this._hovered=null,this._dragging=!1,this._dragStart=new t.Vector3,this._dragCurrent=new t.Vector3,this._dragEnd=new t.Vector3,this._dragDelta=new t.Vector3,this._draggable=null,this._dragRaycastOnObjects=null}get _pointerAnyDown(){return this._pointerPrimaryDown||this._pointerMiddleDown||this._pointerSecondaryDown}activate(){}deactivate(){}onPointerDown(n){var e;switch(n.button){case 0:{this._pointerPrimaryDown=!0;break}case 1:{this._pointerMiddleDown=!0;break}case 2:{this._pointerSecondaryDown=!0;break}default:console.warn("DIVEBaseTool.onPointerDown: Unknown button: "+n.button)}this._lastPointerDown.copy(this._pointer),this._draggable=j.findInterface((e=this._intersects[0])==null?void 0:e.object,"isDraggable")||null}onDragStart(n){this._draggable&&(this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0)),this._intersects.length!==0&&(this._dragStart.copy(this._intersects[0].point.clone()),this._dragCurrent.copy(this._intersects[0].point.clone()),this._dragEnd.copy(this._dragStart.clone()),this._dragDelta.set(0,0,0),this._draggable&&this._draggable.onDragStart&&(this._draggable.onDragStart({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._dragging=!0,this._controller.enabled=!1)))}onPointerMove(n){var o;this._pointer.x=n.offsetX/this._canvas.clientWidth*2-1,this._pointer.y=-(n.offsetY/this._canvas.clientHeight)*2+1,this._raycaster.setFromCamera(this._pointer,this._controller.object),this._intersects=this.raycast(this._scene.children);const e=j.findInterface((o=this._intersects[0])==null?void 0:o.object,"isHoverable");if(this._intersects[0]&&e){if(!this._hovered){e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}if(this._hovered.uuid!==e.uuid){this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),e.onPointerEnter&&e.onPointerEnter(this._intersects[0]),this._hovered=e;return}e.onPointerOver&&e.onPointerOver(this._intersects[0]),this._hovered=e}else this._hovered&&this._hovered.onPointerLeave&&this._hovered.onPointerLeave(),this._hovered=null;this._pointerAnyDown&&(this._dragging||this.onDragStart(n),this.onDrag(n))}onDrag(n){this._dragRaycastOnObjects!==null&&(this._intersects=this._raycaster.intersectObjects(this._dragRaycastOnObjects,!0));const e=this._intersects[0];e&&(this._dragCurrent.copy(e.point.clone()),this._dragEnd.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone()),this._draggable&&this._draggable.onDrag&&this._draggable.onDrag({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}))}onPointerUp(n){switch(this.pointerWasDragged()||this._dragging?this._draggable&&this.onDragEnd(n):this.onClick(n),n.button){case 0:this._pointerPrimaryDown=!1;break;case 1:this._pointerMiddleDown=!1;break;case 2:this._pointerSecondaryDown=!1;break}this._lastPointerUp.copy(this._pointer)}onClick(n){}onDragEnd(n){const e=this._intersects[0];e&&(this._dragEnd.copy(e.point.clone()),this._dragCurrent.copy(e.point.clone()),this._dragDelta.subVectors(this._dragCurrent.clone(),this._dragStart.clone())),this._draggable&&this._draggable.onDragEnd&&this._draggable.onDragEnd({dragStart:this._dragStart,dragCurrent:this._dragCurrent,dragEnd:this._dragEnd,dragDelta:this._dragDelta}),this._draggable=null,this._dragging=!1,this._dragStart.set(0,0,0),this._dragCurrent.set(0,0,0),this._dragEnd.set(0,0,0),this._dragDelta.set(0,0,0),this._controller.enabled=!0}onWheel(n){}raycast(n){return n!==void 0?this._raycaster.intersectObjects(n,!0).filter(e=>e.object.visible):this._raycaster.intersectObjects(this._scene.children,!0).filter(e=>e.object.visible)}pointerWasDragged(){return this._lastPointerDown.distanceTo(this._pointer)>this.POINTER_DRAG_THRESHOLD}}const It=r=>r.isTransformTool!==void 0;class lt extends at{constructor(e,o){super(e,o);h(this,"isTransformTool",!0);h(this,"_scaleLinked");h(this,"_gizmo");this.name="DIVETransformTool",this._scaleLinked=!1,this._gizmo=this.initGizmo(),this._scene.add(this._gizmo)}activate(){}setGizmoMode(e){this._gizmo.mode=e}setGizmoVisible(e){const o=this._scene.children.includes(this._gizmo);e&&!o?(this._scene.add(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.enableAll()):!e&&o&&(this._scene.remove(this._gizmo),"isTransformControls"in this._gizmo&&this._gizmo.getRaycaster().layers.disableAll())}setGizmoScaleLinked(e){this._scaleLinked=e}initGizmo(){const e=new bt(this._controller.object,this._controller.domElement);return e.mode="translate",e.traverse(o=>{if(!("isMesh"in o))return;const s=o.material;o.name==="X"&&s.color.set(Q.AxesColorRed),o.name==="Y"&&s.color.set(Q.AxesColorGreen),o.name==="Z"&&s.color.set(Q.AxesColorBlue),o.name==="XY"&&s.color.set(Q.AxesColorBlue),o.name==="YZ"&&s.color.set(Q.AxesColorRed),o.name==="XZ"&&s.color.set(Q.AxesColorGreen)}),e.addEventListener("mouseDown",()=>{this._controller.enabled=!1,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveStart&&e.object.onMoveStart()}),e.addEventListener("objectChange",()=>{if(j.implementsInterface(e.object,"isMovable")&&e.object.onMove&&(e.object.onMove(),this._scaleLinked)){const o=e.object.scale,s=(o.x+o.y+o.z)/3;e.object.scale.set(s,s,s)}}),e.addEventListener("mouseUp",()=>{this._controller.enabled=!0,j.implementsInterface(e.object,"isMovable")&&e.object.onMoveEnd&&e.object.onMoveEnd()}),e}}const Tt=r=>r.isSelectTool!==void 0;class At extends lt{constructor(e,o){super(e,o);h(this,"isSelectTool",!0);this.name="SelectTool"}activate(){}select(e){this.attachGizmo(e),e.onSelect&&e.onSelect()}deselect(e){this.detachGizmo(),e.onDeselect&&e.onDeselect()}attachGizmo(e){if("isMovable"in e){const o=e;this._gizmo.attach(o),this.setGizmoVisible(o.visible)}}detachGizmo(){this._gizmo.detach()}onClick(e){super.onClick(e);const o=this._raycaster.intersectObjects(this._scene.root.children,!0).filter(a=>a.object.visible)[0],s=j.findInterface(o==null?void 0:o.object,"isSelectable");if(!o||!s){this._gizmo.object&&this.deselect(this._gizmo.object);return}if(this._gizmo.object){if(this._gizmo.object.uuid===s.uuid)return;this.deselect(this._gizmo.object)}this.select(s)}}exports.DIVEBaseTool=at;exports.DIVESelectTool=At;exports.DIVETransformTool=lt;exports.isSelectTool=Tt;exports.isTransformTool=It;
|
|
@@ -14,10 +14,11 @@ export declare class DIVEModel extends DIVENode {
|
|
|
14
14
|
readonly isDIVEModel: true;
|
|
15
15
|
private _mesh;
|
|
16
16
|
private _material;
|
|
17
|
+
constructor();
|
|
17
18
|
private _assetLoader;
|
|
18
19
|
private _getAssetLoader;
|
|
19
|
-
setFromURL(url: string): Promise<
|
|
20
|
-
setFromGLTF(gltf: Object3D):
|
|
20
|
+
setFromURL(url: string): Promise<this>;
|
|
21
|
+
setFromGLTF(gltf: Object3D): this;
|
|
21
22
|
setMaterial(material: Partial<MaterialSchema>): void;
|
|
22
23
|
placeOnFloor(): void;
|
|
23
24
|
dropIt(): void;
|
package/build/dive.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var R=(r,i,e)=>i in r?b(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var n=(r,i,e)=>R(r,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./chunks/FileTypes-DYdmsV-9.cjs"),u=require("./chunks/VisibilityLayerMask-BI7jPKdx.cjs"),s=require("three"),O=require("./chunks/OrbitController-CpFQ3A1H.cjs"),I=require("./chunks/PerspectiveCamera-BByyG5R4.cjs"),y=require("./chunks/findInterface-C6mrvf_t.cjs"),V=require("./chunks/isFileTypeSupported-CrEqYiv9.cjs"),w=require("./chunks/network-error-CdDXil5g.cjs"),P=require("./chunks/parse-error-Dy_EE4rL.cjs"),A=require("./chunks/PovSchema-Co9FznEz.cjs");class E extends s.Object3D{constructor(e,t,o,h,a){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(a),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const c=new s.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new s.MeshBasicMaterial({color:a,depthTest:!1,depthWrite:!1});const d=new s.Mesh(c,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,this.add(d);const p=new s.TorusGeometry(t,.1,3,48,o),f=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(p,f),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(h)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function _(r,i){const e=(r+"e").split("e");return+(e[0]+"e"+(+e[1]+(i||0)))}function v(r,i=0){const e=_(r,+i);return _(Math.ceil(e),-i)}function H(r,i=0){const e=_(r,+i);return _(Math.floor(e),-i)}function x(r,i=0){if(r<0)return-x(-r,i);const e=_(r,+i);return _(Math.round(e),-i)}function z(r,i,e){return Math.atan2(r.clone().cross(i).dot(e),i.clone().dot(r))}function G(r,i=0){const e=_(r,+i);return _(Math.round(e),-i).toFixed(i)}function C(r,i=0){const e=_(r,+i);return _(Math.trunc(e),-i)}function L(r){return(s.MathUtils.radToDeg(r)+360)%360}function T(r){return s.MathUtils.degToRad(r)}const S={ceilExp:v,floorExp:H,roundExp:x,toFixedExp:G,truncateExp:C,signedAngleTo:z,radToDeg:L,degToRad:T};class Y extends s.Object3D{constructor(e){super();n(this,"children");n(this,"_controller");n(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new E("x",1,Math.PI/2,new s.Vector3(1,0,0),l.AxesColorRed)),this.add(new E("y",1,-Math.PI/2,new s.Vector3(0,1,0),l.AxesColorGreen)),this.add(new E("z",1,Math.PI/2,new s.Vector3(0,0,1),l.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),h=t.dragStart.clone().sub(this.parent.parent.position).normalize(),a=S.signedAngleTo(h,o,e.forwardVector),c=new s.Euler(this._startRot.x+e.forwardVector.x*a,this._startRot.y+e.forwardVector.y*a,this._startRot.z+e.forwardVector.z*a);this.parent.parent.onChange(void 0,c)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class m extends s.Object3D{constructor(e,t,o,h){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const a=new s.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const c=new s.Mesh(a,this._lineMaterial);c.layers.mask=u.UI_LAYER_MASK,c.renderOrder=1/0,c.rotateX(Math.PI/2),c.translateY(t/2),this.add(c);const d=new s.CylinderGeometry(.1,.1,t,3),p=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(d,p),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class j extends s.Object3D{constructor(e){super();n(this,"_controller");n(this,"children");n(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new m("x",1,new s.Vector3(1,0,0),l.AxesColorRed)),this.add(new m("y",1,new s.Vector3(0,1,0),l.AxesColorGreen)),this.add(new m("z",1,new s.Vector3(0,0,1),l.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class D extends s.Object3D{constructor(e,t,o,h,a=.05){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");n(this,"_box");n(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(h),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=a;const c=new s.CylinderGeometry(.01,.01,t-a/2,13);this._lineMaterial=new s.MeshBasicMaterial({color:h,depthTest:!1,depthWrite:!1});const d=new s.Mesh(c,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,d.rotateX(Math.PI/2),d.translateY(t/2-a/4),this.add(d),this._box=new s.Mesh(new s.BoxGeometry(a,a,a),this._lineMaterial),this._box.layers.mask=u.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-a/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const p=new s.CylinderGeometry(.1,.1,t+a/2,3),f=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(p,f),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new s.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class N extends s.Object3D{constructor(e){super();n(this,"isHoverable",!0);n(this,"children");n(this,"_controller");n(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new D("x",1,new s.Vector3(1,0,0),l.AxesColorRed)),this.add(new D("y",1,new s.Vector3(0,1,0),l.AxesColorGreen)),this.add(new D("z",1,new s.Vector3(0,0,1),l.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(h=>{o?h.highlight=h.axis===e&&o:h.highlight=h.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class F extends s.Object3D{constructor(){super();n(this,"_meshX");n(this,"_meshY");n(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new s.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new s.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new s.Mesh(t,o),this._meshX.layers.mask=u.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const h=new s.PlaneGeometry(100,100,2,2),a=e.clone();a.color.set(65280),this._meshY=new s.Mesh(h,a),this._meshY.layers.mask=u.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const c=new s.PlaneGeometry(100,100,2,2),d=e.clone();d.color.set(255),this._meshZ=new s.Mesh(c,d),this._meshZ.layers.mask=u.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class U extends s.Object3D{constructor(e){super();n(this,"_mode");n(this,"_gizmoNode");n(this,"_translateGizmo");n(this,"_rotateGizmo");n(this,"_scaleGizmo");n(this,"_gizmoPlane");n(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new s.Object3D,this.add(this._gizmoNode),this._translateGizmo=new j(e),this._rotateGizmo=new Y(e),this._scaleGizmo=new N(e),this._gizmoPlane=new F,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class K{constructor(){n(this,"isMovable",!0)}}class X{constructor(){n(this,"isSelectable",!0)}}function q(r,i){return i.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const h=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(r.prototype,o,h)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const h=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r.prototype,o,h)})}),r}function g(r,i=new WeakMap){if(r===null||typeof r!="object")return r;if(i.has(r))return i.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r)){const a=[];i.set(r,a);for(let c=0;c<r.length;c++)a[c]=g(r[c],i);return a}if(r instanceof Map){const a=new Map;i.set(r,a);for(const[c,d]of r)a.set(g(c,i),g(d,i));return a}if(r instanceof Set){const a=new Set;i.set(r,a);for(const c of r)a.add(g(c,i));return a}const e=r;if(typeof e.clone=="function"){const a=e.clone();return i.set(r,a),a}const t=Object.create(Object.getPrototypeOf(r));i.set(r,t);const o=Object.getOwnPropertyNames(r);for(const a of o){const c=Object.getOwnPropertyDescriptor(r,a);if(c)if(c.value!==void 0){const d=g(c.value,i);Object.defineProperty(t,a,{...c,value:d})}else Object.defineProperty(t,a,c)}const h=Object.getOwnPropertySymbols(r);for(const a of h){const c=Object.getOwnPropertyDescriptor(r,a);if(c)if(c.value!==void 0){const d=g(c.value,i);Object.defineProperty(t,a,{...c,value:d})}else Object.defineProperty(t,a,c)}return t}const M=(r,i)=>{if(Object.keys(r).length===0&&Object.keys(i).length===0)return{};if(typeof r!="object"||typeof i!="object")return i;let e={};return Object.keys(i).forEach(t=>{if(!Object.keys(r).includes(t)){e={...e,[t]:i[t]};return}if(Array.isArray(i[t])){if(!Array.isArray(r[t])){e={...e,[t]:i[t]};return}const o=r[t],h=i[t];if(o.length===0&&h.length===0){e={...e};return}if(o.length!==h.length){e={...e,[t]:i[t]};return}const a=[];if(h.forEach((c,d)=>{const p=M(o[d],h[d]);Object.keys(p).length&&a.push(h[d])}),Object.keys(a).length){e={...e,[t]:a};return}return}if(typeof i[t]=="object"){if(typeof r[t]!="object"){e={...e,[t]:i[t]};return}const o=M(r[t],i[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}r[t]!==i[t]&&(e={...e,[t]:i[t]})}),e};function B(r){return r.entityType==="group"}function k(r){return r.entityType==="light"}function Z(r){return r.entityType==="primitive"}exports.AxesColorBlue=l.AxesColorBlue;exports.AxesColorBlueLetter=l.AxesColorBlueLetter;exports.AxesColorGreen=l.AxesColorGreen;exports.AxesColorGreenLetter=l.AxesColorGreenLetter;exports.AxesColorRed=l.AxesColorRed;exports.AxesColorRedLetter=l.AxesColorRedLetter;exports.DIVE=l.DIVE;exports.DIVEAmbientLight=l.DIVEAmbientLight;exports.DIVEClock=l.DIVEClock;exports.DIVEDefaultSettings=l.DIVEDefaultSettings;exports.DIVEEngine=l.DIVEEngine;exports.DIVEFloor=l.DIVEFloor;exports.DIVEGrid=l.DIVEGrid;exports.DIVEGroup=l.DIVEGroup;exports.DIVEModel=l.DIVEModel;exports.DIVEPointLight=l.DIVEPointLight;exports.DIVEPrimitive=l.DIVEPrimitive;exports.DIVERenderPipeline=l.DIVERenderPipeline;exports.DIVERenderPipelineDefaultSettings=l.DIVERenderPipelineDefaultSettings;exports.DIVEResizeManager=l.DIVEResizeManager;exports.DIVERoot=l.DIVERoot;exports.DIVEScene=l.DIVEScene;exports.DIVESceneLight=l.DIVESceneLight;exports.EngineDefaultSettings=l.EngineDefaultSettings;exports.FILE_TYPES=l.FILE_TYPES;exports.GRID_CENTER_LINE_COLOR=l.GRID_CENTER_LINE_COLOR;exports.GRID_SIDE_LINE_COLOR=l.GRID_SIDE_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=l.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=l.findSceneRecursive;exports.COORDINATE_LAYER_MASK=u.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=u.DEFAULT_LAYER_MASK;exports.HELPER_LAYER_MASK=u.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=u.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=u.UI_LAYER_MASK;exports.DIVENode=O.DIVENode;exports.DIVEPerspectiveCamera=I.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=I.DIVEPerspectiveCameraDefaultSettings;exports.findInterface=y.findInterface;exports.implementsInterface=y.implementsInterface;exports.getFileTypeFromUri=V.getFileTypeFromUri;exports.isFileTypeSupported=V.isFileTypeSupported;exports.FileContentError=w.FileContentError;exports.NetworkError=w.NetworkError;exports.FileTypeError=P.FileTypeError;exports.ParseError=P.ParseError;exports.isModelSchema=A.isModelSchema;exports.isPovSchema=A.isPovSchema;exports.DIVEGizmo=U;exports.DIVEMath=S;exports.DIVEMovable=K;exports.DIVESelectable=X;exports.applyMixins=q;exports.deepClone=g;exports.getObjectDelta=M;exports.isGroupSchema=B;exports.isLightSchema=k;exports.isPrimitiveSchema=Z;
|
|
1
|
+
"use strict";var S=Object.defineProperty;var b=(r,i,e)=>i in r?S(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var n=(r,i,e)=>b(r,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./chunks/FileTypes-BobMthbh.cjs"),u=require("./chunks/PerspectiveCamera-Dp8ElZGj.cjs"),s=require("three"),I=require("./chunks/findInterface-C6mrvf_t.cjs"),V=require("./chunks/isFileTypeSupported-CrEqYiv9.cjs"),y=require("./chunks/network-error-CdDXil5g.cjs"),w=require("./chunks/parse-error-Dy_EE4rL.cjs"),A=require("./chunks/PovSchema-Co9FznEz.cjs");class E extends s.Object3D{constructor(e,t,o,l,a){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVERadialHandle",this.axis=e,this._color.set(a),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1;const c=new s.TorusGeometry(t,.01,13,48,o);this._lineMaterial=new s.MeshBasicMaterial({color:a,depthTest:!1,depthWrite:!1});const d=new s.Mesh(c,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,this.add(d);const p=new s.TorusGeometry(t,.1,3,48,o),f=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(p,f),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this.add(this._colliderMesh),this.lookAt(l)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}function _(r,i){const e=(r+"e").split("e");return+(e[0]+"e"+(+e[1]+(i||0)))}function R(r,i=0){const e=_(r,+i);return _(Math.ceil(e),-i)}function O(r,i=0){const e=_(r,+i);return _(Math.floor(e),-i)}function P(r,i=0){if(r<0)return-P(-r,i);const e=_(r,+i);return _(Math.round(e),-i)}function v(r,i,e){return Math.atan2(r.clone().cross(i).dot(e),i.clone().dot(r))}function H(r,i=0){const e=_(r,+i);return _(Math.round(e),-i).toFixed(i)}function z(r,i=0){const e=_(r,+i);return _(Math.trunc(e),-i)}function G(r){return(s.MathUtils.radToDeg(r)+360)%360}function C(r){return s.MathUtils.degToRad(r)}const x={ceilExp:R,floorExp:O,roundExp:P,toFixedExp:H,truncateExp:z,signedAngleTo:v,radToDeg:G,degToRad:C};class L extends s.Object3D{constructor(e){super();n(this,"children");n(this,"_controller");n(this,"_startRot");this.name="DIVERotateGizmo",this.children=[],this._startRot=null,this._controller=e,this.add(new E("x",1,Math.PI/2,new s.Vector3(1,0,0),h.AxesColorRed)),this.add(new E("y",1,-Math.PI/2,new s.Vector3(0,1,0),h.AxesColorGreen)),this.add(new E("z",1,Math.PI/2,new s.Vector3(0,0,1),h.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(l=>{o?l.highlight=l.axis===e&&o:l.highlight=l.axis===e&&t})}onHandleHover(e,t){this._startRot||this.parent&&this.parent.parent&&(this.parent.parent.onHover("rotate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startRot=t.rotation.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startRot||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragCurrent.clone().sub(this.parent.parent.position).normalize(),l=t.dragStart.clone().sub(this.parent.parent.position).normalize(),a=x.signedAngleTo(l,o,e.forwardVector),c=new s.Euler(this._startRot.x+e.forwardVector.x*a,this._startRot.y+e.forwardVector.y*a,this._startRot.z+e.forwardVector.z*a);this.parent.parent.onChange(void 0,c)}onHandleDragEnd(e){this._startRot=null,this.handleHighlight(e.axis,!1,!1)}}class m extends s.Object3D{constructor(e,t,o,l){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");this.name="DIVEAxisHandle",this.axis=e,this._color.set(l),this._colorHover=this._color.clone().multiplyScalar(2),this._highlight=!1,this._hovered=!1;const a=new s.CylinderGeometry(.01,.01,t,13);this._lineMaterial=new s.MeshBasicMaterial({color:l,depthTest:!1,depthWrite:!1});const c=new s.Mesh(a,this._lineMaterial);c.layers.mask=u.UI_LAYER_MASK,c.renderOrder=1/0,c.rotateX(Math.PI/2),c.translateY(t/2),this.add(c);const d=new s.CylinderGeometry(.1,.1,t,3),p=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(d,p),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHandleHover(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHandleHover(this,!1)}onDragStart(){this.parent&&this.parent.onHandleDragStart(this)}onDrag(e){this.parent&&this.parent.onHandleDrag(this,e)}onDragEnd(){this.parent&&this.parent.onHandleDragEnd(this)}}class T extends s.Object3D{constructor(e){super();n(this,"_controller");n(this,"children");n(this,"_startPos");this.name="DIVETranslateGizmo",this.children=[],this._startPos=null,this._controller=e,this.add(new m("x",1,new s.Vector3(1,0,0),h.AxesColorRed)),this.add(new m("y",1,new s.Vector3(0,1,0),h.AxesColorGreen)),this.add(new m("z",1,new s.Vector3(0,0,1),h.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}handleHighlight(e,t,o){this.children.forEach(l=>{o?l.highlight=l.axis===e&&o:l.highlight=l.axis===e&&t})}onHandleHover(e,t){this._startPos||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onHandleDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startPos=t.position.clone(),this.handleHighlight(e.axis,!0,!0))}onHandleDrag(e,t){if(!this._startPos||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(this._startPos.clone().add(o))}onHandleDragEnd(e){this._startPos=null,this.handleHighlight(e.axis,!1,!1)}}class D extends s.Object3D{constructor(e,t,o,l,a=.05){super();n(this,"isHoverable",!0);n(this,"isDraggable",!0);n(this,"parent",null);n(this,"axis");n(this,"_color",new s.Color(16711935));n(this,"_colorHover");n(this,"_hovered");n(this,"_highlight");n(this,"_lineMaterial");n(this,"_colliderMesh");n(this,"_box");n(this,"_boxSize");this.name="DIVEScaleHandle",this.axis=e,this._color.set(l),this._colorHover=this._color.clone().multiplyScalar(2),this._hovered=!1,this._highlight=!1,this._boxSize=a;const c=new s.CylinderGeometry(.01,.01,t-a/2,13);this._lineMaterial=new s.MeshBasicMaterial({color:l,depthTest:!1,depthWrite:!1});const d=new s.Mesh(c,this._lineMaterial);d.layers.mask=u.UI_LAYER_MASK,d.renderOrder=1/0,d.rotateX(Math.PI/2),d.translateY(t/2-a/4),this.add(d),this._box=new s.Mesh(new s.BoxGeometry(a,a,a),this._lineMaterial),this._box.layers.mask=u.UI_LAYER_MASK,this._box.renderOrder=1/0,this._box.rotateX(Math.PI/2),this._box.translateY(t-a/2),this._box.rotateZ(o.x*Math.PI/2),this._box.rotateX(o.z*Math.PI/2),this.add(this._box);const p=new s.CylinderGeometry(.1,.1,t+a/2,3),f=new s.MeshBasicMaterial({color:16711935,transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1});this._colliderMesh=new s.Mesh(p,f),this._colliderMesh.visible=!1,this._colliderMesh.layers.mask=u.UI_LAYER_MASK,this._colliderMesh.renderOrder=1/0,this._colliderMesh.rotateX(Math.PI/2),this._colliderMesh.translateY(t/2),this.add(this._colliderMesh),this.rotateX(o.y*-Math.PI/2),this.rotateY(o.x*Math.PI/2)}set debug(e){this._colliderMesh.visible=e}get highlight(){return this._highlight}set highlight(e){this._highlight=e,this._lineMaterial.color=this._highlight||this._hovered?this._colorHover:this._color}get forwardVector(){return new s.Vector3(0,0,1).applyQuaternion(this.quaternion).normalize()}get rightVector(){return new s.Vector3(1,0,0).applyQuaternion(this.quaternion).normalize()}get upVector(){return new s.Vector3(0,1,0).applyQuaternion(this.quaternion).normalize()}reset(){this._lineMaterial.color=this._color}update(e){this._box.scale.copy(new s.Vector3(1,1,1).sub(this.forwardVector).add(e.clone().multiply(this.forwardVector)))}onPointerEnter(){this._hovered=!0,this.parent&&this.parent.onHoverAxis(this,!0)}onPointerLeave(){this._hovered=!1,this.parent&&this.parent.onHoverAxis(this,!1)}onDragStart(){this.parent&&this.parent.onAxisDragStart(this)}onDrag(e){this.parent&&this.parent.onAxisDrag(this,e)}onDragEnd(){this.parent&&this.parent.onAxisDragEnd(this)}}class Y extends s.Object3D{constructor(e){super();n(this,"isHoverable",!0);n(this,"children");n(this,"_controller");n(this,"_startScale");this.name="DIVEScaleGizmo",this.children=[],this._startScale=null,this._controller=e,this.add(new D("x",1,new s.Vector3(1,0,0),h.AxesColorRed)),this.add(new D("y",1,new s.Vector3(0,1,0),h.AxesColorGreen)),this.add(new D("z",1,new s.Vector3(0,0,1),h.AxesColorBlue))}set debug(e){this.children.forEach(t=>{t.debug=e})}reset(){this.children.forEach(e=>{e.reset()})}update(e){this.children.forEach(t=>{t.update(e)})}handleHighlight(e,t,o){this.children.forEach(l=>{o?l.highlight=l.axis===e&&o:l.highlight=l.axis===e&&t})}onHoverAxis(e,t){this._startScale||this.parent&&this.parent.parent&&(this.parent.parent.onHover("translate",e.axis,t),this.handleHighlight(e.axis,t,!1))}onAxisDragStart(e){if(!this.parent||!this.parent.parent)return;const t=this.parent.parent.object;t&&(this._startScale=t.scale.clone(),this.handleHighlight(e.axis,!0,!0))}onAxisDrag(e,t){if(!this._startScale||!this.parent||!this.parent.parent||!("onChange"in this.parent.parent))return;const o=t.dragDelta.clone().projectOnVector(e.forwardVector);this.parent.parent.onChange(void 0,void 0,this._startScale.clone().add(o))}onAxisDragEnd(e){this._startScale=null,this.handleHighlight(e.axis,!1,!1)}}class j extends s.Object3D{constructor(){super();n(this,"_meshX");n(this,"_meshY");n(this,"_meshZ");this.name="DIVEGizmoPlane";const e=new s.MeshBasicMaterial({transparent:!0,opacity:.15,depthTest:!1,depthWrite:!1,side:2}),t=new s.PlaneGeometry(100,100,2,2),o=e.clone();o.color.set(16711680),this._meshX=new s.Mesh(t,o),this._meshX.layers.mask=u.UI_LAYER_MASK,this._meshX.rotateY(Math.PI/2);const l=new s.PlaneGeometry(100,100,2,2),a=e.clone();a.color.set(65280),this._meshY=new s.Mesh(l,a),this._meshY.layers.mask=u.UI_LAYER_MASK,this._meshY.rotateX(-Math.PI/2);const c=new s.PlaneGeometry(100,100,2,2),d=e.clone();d.color.set(255),this._meshZ=new s.Mesh(c,d),this._meshZ.layers.mask=u.UI_LAYER_MASK}get XPlane(){return this._meshX}get YPlane(){return this._meshY}get ZPlane(){return this._meshZ}assemble(e,t){if(this.clear(),e==="translate"||e==="scale")switch(t){case"x":this.add(this._meshY),this.add(this._meshZ);break;case"y":this.add(this._meshX),this.add(this._meshZ);break;case"z":this.add(this._meshX),this.add(this._meshY);break}else if(e==="rotate")switch(t){case"x":this.add(this._meshX);break;case"y":this.add(this._meshY);break;case"z":this.add(this._meshZ);break}}}class N extends s.Object3D{constructor(e){super();n(this,"_mode");n(this,"_gizmoNode");n(this,"_translateGizmo");n(this,"_rotateGizmo");n(this,"_scaleGizmo");n(this,"_gizmoPlane");n(this,"_object");this.name="DIVEGizmo",e.addEventListener("change",()=>{const t=e.getDistance()/2.5;this.scale.set(t,t,t)}),this._mode="translate",this._gizmoNode=new s.Object3D,this.add(this._gizmoNode),this._translateGizmo=new T(e),this._rotateGizmo=new L(e),this._scaleGizmo=new Y(e),this._gizmoPlane=new j,this._gizmoPlane.visible=!1,this._object=null}get mode(){return this._mode}set mode(e){this._mode=e,this.assemble()}set debug(e){this._translateGizmo.debug=e,this._rotateGizmo.debug=e,this._scaleGizmo.debug=e}get gizmoNode(){return this._gizmoNode}get gizmoPlane(){return this._gizmoPlane}get object(){return this._object}attach(e){return this._object=e,this.assemble(),this}detach(){return this._object=null,this.assemble(),this}onHover(e,t,o){o&&this._gizmoPlane.assemble(e,t)}onChange(e,t,o){this.object!==null&&(e&&(this.position.copy(e),this.object.position.copy(e)),t&&this.object.rotation.copy(t),o&&(this.object.scale.copy(o),this._scaleGizmo.update(o)))}assemble(){this._gizmoNode.clear(),this._gizmoPlane.clear(),this._translateGizmo.reset(),this._rotateGizmo.reset(),this._scaleGizmo.reset(),this.object!==null&&(this._mode==="translate"&&this._gizmoNode.add(this._translateGizmo),this._mode==="rotate"&&this._gizmoNode.add(this._rotateGizmo),this._mode==="scale"&&this._gizmoNode.add(this._scaleGizmo),this.add(this._gizmoPlane))}}class F{constructor(){n(this,"isMovable",!0)}}class U{constructor(){n(this,"isSelectable",!0)}}function K(r,i){return i.forEach(e=>{Object.getOwnPropertyNames(e.prototype).forEach(o=>{if(o==="constructor")return;const l=Object.getOwnPropertyDescriptor(e.prototype,o);Object.defineProperty(r.prototype,o,l)});const t=new e;Object.getOwnPropertyNames(t).forEach(o=>{const l=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(r.prototype,o,l)})}),r}function g(r,i=new WeakMap){if(r===null||typeof r!="object")return r;if(i.has(r))return i.get(r);if(r instanceof Date)return new Date(r.getTime());if(r instanceof RegExp)return new RegExp(r.source,r.flags);if(Array.isArray(r)){const a=[];i.set(r,a);for(let c=0;c<r.length;c++)a[c]=g(r[c],i);return a}if(r instanceof Map){const a=new Map;i.set(r,a);for(const[c,d]of r)a.set(g(c,i),g(d,i));return a}if(r instanceof Set){const a=new Set;i.set(r,a);for(const c of r)a.add(g(c,i));return a}const e=r;if(typeof e.clone=="function"){const a=e.clone();return i.set(r,a),a}const t=Object.create(Object.getPrototypeOf(r));i.set(r,t);const o=Object.getOwnPropertyNames(r);for(const a of o){const c=Object.getOwnPropertyDescriptor(r,a);if(c)if(c.value!==void 0){const d=g(c.value,i);Object.defineProperty(t,a,{...c,value:d})}else Object.defineProperty(t,a,c)}const l=Object.getOwnPropertySymbols(r);for(const a of l){const c=Object.getOwnPropertyDescriptor(r,a);if(c)if(c.value!==void 0){const d=g(c.value,i);Object.defineProperty(t,a,{...c,value:d})}else Object.defineProperty(t,a,c)}return t}const M=(r,i)=>{if(Object.keys(r).length===0&&Object.keys(i).length===0)return{};if(typeof r!="object"||typeof i!="object")return i;let e={};return Object.keys(i).forEach(t=>{if(!Object.keys(r).includes(t)){e={...e,[t]:i[t]};return}if(Array.isArray(i[t])){if(!Array.isArray(r[t])){e={...e,[t]:i[t]};return}const o=r[t],l=i[t];if(o.length===0&&l.length===0){e={...e};return}if(o.length!==l.length){e={...e,[t]:i[t]};return}const a=[];if(l.forEach((c,d)=>{const p=M(o[d],l[d]);Object.keys(p).length&&a.push(l[d])}),Object.keys(a).length){e={...e,[t]:a};return}return}if(typeof i[t]=="object"){if(typeof r[t]!="object"){e={...e,[t]:i[t]};return}const o=M(r[t],i[t]);if(Object.keys(o).length){e={...e,[t]:o};return}}r[t]!==i[t]&&(e={...e,[t]:i[t]})}),e};function X(r){return r.entityType==="group"}function B(r){return r.entityType==="light"}function q(r){return r.entityType==="primitive"}exports.AxesColorBlue=h.AxesColorBlue;exports.AxesColorBlueLetter=h.AxesColorBlueLetter;exports.AxesColorGreen=h.AxesColorGreen;exports.AxesColorGreenLetter=h.AxesColorGreenLetter;exports.AxesColorRed=h.AxesColorRed;exports.AxesColorRedLetter=h.AxesColorRedLetter;exports.BoundingBox=h.BoundingBox;exports.DIVE=h.DIVE;exports.DIVEAmbientLight=h.DIVEAmbientLight;exports.DIVEClock=h.DIVEClock;exports.DIVEDefaultSettings=h.DIVEDefaultSettings;exports.DIVEEngine=h.DIVEEngine;exports.DIVEFloor=h.DIVEFloor;exports.DIVEGrid=h.DIVEGrid;exports.DIVEGroup=h.DIVEGroup;exports.DIVEModel=h.DIVEModel;exports.DIVENode=h.DIVENode;exports.DIVEPointLight=h.DIVEPointLight;exports.DIVEPrimitive=h.DIVEPrimitive;exports.DIVERenderPipeline=h.DIVERenderPipeline;exports.DIVERenderer=h.DIVERenderer;exports.DIVERendererDefaultSettings=h.DIVERendererDefaultSettings;exports.DIVEResizeManager=h.DIVEResizeManager;exports.DIVERoot=h.DIVERoot;exports.DIVEScene=h.DIVEScene;exports.DIVESceneDefaultSettings=h.DIVESceneDefaultSettings;exports.DIVESceneLight=h.DIVESceneLight;exports.DIVEView=h.DIVEView;exports.FILE_TYPES=h.FILE_TYPES;exports.GRID_CENTER_LINE_COLOR=h.GRID_CENTER_LINE_COLOR;exports.GRID_SIDE_LINE_COLOR=h.GRID_SIDE_LINE_COLOR;exports.SUPPORTED_FILE_TYPES=h.SUPPORTED_FILE_TYPES;exports.findSceneRecursive=h.findSceneRecursive;exports.COORDINATE_LAYER_MASK=u.COORDINATE_LAYER_MASK;exports.DEFAULT_LAYER_MASK=u.DEFAULT_LAYER_MASK;exports.DIVEPerspectiveCamera=u.DIVEPerspectiveCamera;exports.DIVEPerspectiveCameraDefaultSettings=u.DIVEPerspectiveCameraDefaultSettings;exports.HELPER_LAYER_MASK=u.HELPER_LAYER_MASK;exports.PRODUCT_LAYER_MASK=u.PRODUCT_LAYER_MASK;exports.UI_LAYER_MASK=u.UI_LAYER_MASK;exports.findInterface=I.findInterface;exports.implementsInterface=I.implementsInterface;exports.getFileTypeFromUri=V.getFileTypeFromUri;exports.isFileTypeSupported=V.isFileTypeSupported;exports.FileContentError=y.FileContentError;exports.NetworkError=y.NetworkError;exports.FileTypeError=w.FileTypeError;exports.ParseError=w.ParseError;exports.isModelSchema=A.isModelSchema;exports.isPovSchema=A.isPovSchema;exports.DIVEGizmo=N;exports.DIVEMath=x;exports.DIVEMovable=F;exports.DIVESelectable=U;exports.applyMixins=K;exports.deepClone=g;exports.getObjectDelta=M;exports.isGroupSchema=X;exports.isLightSchema=B;exports.isPrimitiveSchema=q;
|
package/build/dive.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './index'
|
|
2
2
|
export {}
|
package/build/dive.mjs
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
var S = Object.defineProperty;
|
|
2
2
|
var A = (r, s, t) => s in r ? S(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
3
3
|
var i = (r, s, t) => A(r, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
-
import { A as
|
|
5
|
-
import {
|
|
6
|
-
import { U as d } from "./chunks/
|
|
7
|
-
import { C as
|
|
8
|
-
import { Object3D as f, Color as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { F as $t, P as te } from "./chunks/parse-error-DfOPyLWM.mjs";
|
|
15
|
-
import { i as re, a as se } from "./chunks/PovSchema-DWWvr_ED.mjs";
|
|
4
|
+
import { A as I, g as P, h as V } from "./chunks/FileTypes-D5zw1toN.mjs";
|
|
5
|
+
import { t as ot, s as ht, r as lt, F as ct, d as dt, y as pt, j as ut, D as ft, i as _t, v as gt, w as mt, x as Et, f as Dt, B as wt, z as yt, C as Mt, m as xt, l as It, k as Pt, n as Vt, E as Ht, p as bt, o as zt, e as vt, q as Ot, I as St, G as At, u as Gt, S as Rt, H as Tt } from "./chunks/FileTypes-D5zw1toN.mjs";
|
|
6
|
+
import { U as d } from "./chunks/PerspectiveCamera-8tnOn5YS.mjs";
|
|
7
|
+
import { C as jt, b as Ct, D as Lt, a as Nt, H as Xt, P as Ft } from "./chunks/PerspectiveCamera-8tnOn5YS.mjs";
|
|
8
|
+
import { Object3D as f, Color as H, Vector3 as c, TorusGeometry as b, MeshBasicMaterial as g, Mesh as p, MathUtils as v, Euler as G, CylinderGeometry as E, BoxGeometry as R, PlaneGeometry as w } from "three";
|
|
9
|
+
import { f as qt, i as Qt } from "./chunks/findInterface-DbJ5qzbc.mjs";
|
|
10
|
+
import { g as kt, i as Ut } from "./chunks/isFileTypeSupported-BSpswPHU.mjs";
|
|
11
|
+
import { F as Kt, N as Jt } from "./chunks/network-error-BONfHWQq.mjs";
|
|
12
|
+
import { F as te, P as ee } from "./chunks/parse-error-DfOPyLWM.mjs";
|
|
13
|
+
import { i as se, a as ie } from "./chunks/PovSchema-DWWvr_ED.mjs";
|
|
16
14
|
class y extends f {
|
|
17
15
|
constructor(t, e, n, o, a) {
|
|
18
16
|
super();
|
|
@@ -20,14 +18,14 @@ class y extends f {
|
|
|
20
18
|
i(this, "isDraggable", !0);
|
|
21
19
|
i(this, "parent", null);
|
|
22
20
|
i(this, "axis");
|
|
23
|
-
i(this, "_color", new
|
|
21
|
+
i(this, "_color", new H(16711935));
|
|
24
22
|
i(this, "_colorHover");
|
|
25
23
|
i(this, "_hovered");
|
|
26
24
|
i(this, "_highlight");
|
|
27
25
|
i(this, "_lineMaterial");
|
|
28
26
|
i(this, "_colliderMesh");
|
|
29
27
|
this.name = "DIVERadialHandle", this.axis = t, this._color.set(a), this._colorHover = this._color.clone().multiplyScalar(2), this._hovered = !1, this._highlight = !1;
|
|
30
|
-
const h = new
|
|
28
|
+
const h = new b(e, 0.01, 13, 48, n);
|
|
31
29
|
this._lineMaterial = new g({
|
|
32
30
|
color: a,
|
|
33
31
|
depthTest: !1,
|
|
@@ -35,7 +33,7 @@ class y extends f {
|
|
|
35
33
|
});
|
|
36
34
|
const l = new p(h, this._lineMaterial);
|
|
37
35
|
l.layers.mask = d, l.renderOrder = 1 / 0, this.add(l);
|
|
38
|
-
const _ = new
|
|
36
|
+
const _ = new b(e, 0.1, 3, 48, n), D = new g({
|
|
39
37
|
color: 16711935,
|
|
40
38
|
transparent: !0,
|
|
41
39
|
opacity: 0.15,
|
|
@@ -140,7 +138,7 @@ class Z extends f {
|
|
|
140
138
|
1,
|
|
141
139
|
Math.PI / 2,
|
|
142
140
|
new c(1, 0, 0),
|
|
143
|
-
|
|
141
|
+
I
|
|
144
142
|
)
|
|
145
143
|
), this.add(
|
|
146
144
|
new y(
|
|
@@ -148,7 +146,7 @@ class Z extends f {
|
|
|
148
146
|
1,
|
|
149
147
|
-Math.PI / 2,
|
|
150
148
|
new c(0, 1, 0),
|
|
151
|
-
|
|
149
|
+
P
|
|
152
150
|
)
|
|
153
151
|
), this.add(
|
|
154
152
|
new y(
|
|
@@ -156,7 +154,7 @@ class Z extends f {
|
|
|
156
154
|
1,
|
|
157
155
|
Math.PI / 2,
|
|
158
156
|
new c(0, 0, 1),
|
|
159
|
-
|
|
157
|
+
V
|
|
160
158
|
)
|
|
161
159
|
);
|
|
162
160
|
}
|
|
@@ -207,7 +205,7 @@ class M extends f {
|
|
|
207
205
|
i(this, "isDraggable", !0);
|
|
208
206
|
i(this, "parent", null);
|
|
209
207
|
i(this, "axis");
|
|
210
|
-
i(this, "_color", new
|
|
208
|
+
i(this, "_color", new H(16711935));
|
|
211
209
|
i(this, "_colorHover");
|
|
212
210
|
i(this, "_hovered");
|
|
213
211
|
i(this, "_highlight");
|
|
@@ -275,11 +273,11 @@ class q extends f {
|
|
|
275
273
|
i(this, "children");
|
|
276
274
|
i(this, "_startPos");
|
|
277
275
|
this.name = "DIVETranslateGizmo", this.children = [], this._startPos = null, this._controller = t, this.add(
|
|
278
|
-
new M("x", 1, new c(1, 0, 0),
|
|
276
|
+
new M("x", 1, new c(1, 0, 0), I)
|
|
279
277
|
), this.add(
|
|
280
|
-
new M("y", 1, new c(0, 1, 0),
|
|
278
|
+
new M("y", 1, new c(0, 1, 0), P)
|
|
281
279
|
), this.add(
|
|
282
|
-
new M("z", 1, new c(0, 0, 1),
|
|
280
|
+
new M("z", 1, new c(0, 0, 1), V)
|
|
283
281
|
);
|
|
284
282
|
}
|
|
285
283
|
set debug(t) {
|
|
@@ -327,7 +325,7 @@ class x extends f {
|
|
|
327
325
|
i(this, "isDraggable", !0);
|
|
328
326
|
i(this, "parent", null);
|
|
329
327
|
i(this, "axis");
|
|
330
|
-
i(this, "_color", new
|
|
328
|
+
i(this, "_color", new H(16711935));
|
|
331
329
|
i(this, "_colorHover");
|
|
332
330
|
i(this, "_hovered");
|
|
333
331
|
i(this, "_highlight");
|
|
@@ -420,11 +418,11 @@ class Q extends f {
|
|
|
420
418
|
i(this, "_controller");
|
|
421
419
|
i(this, "_startScale");
|
|
422
420
|
this.name = "DIVEScaleGizmo", this.children = [], this._startScale = null, this._controller = t, this.add(
|
|
423
|
-
new x("x", 1, new c(1, 0, 0),
|
|
421
|
+
new x("x", 1, new c(1, 0, 0), I)
|
|
424
422
|
), this.add(
|
|
425
|
-
new x("y", 1, new c(0, 1, 0),
|
|
423
|
+
new x("y", 1, new c(0, 1, 0), P)
|
|
426
424
|
), this.add(
|
|
427
|
-
new x("z", 1, new c(0, 0, 1),
|
|
425
|
+
new x("z", 1, new c(0, 0, 1), V)
|
|
428
426
|
);
|
|
429
427
|
}
|
|
430
428
|
set debug(t) {
|
|
@@ -742,61 +740,64 @@ function it(r) {
|
|
|
742
740
|
return r.entityType === "primitive";
|
|
743
741
|
}
|
|
744
742
|
export {
|
|
745
|
-
|
|
743
|
+
V as AxesColorBlue,
|
|
746
744
|
ot as AxesColorBlueLetter,
|
|
747
|
-
|
|
745
|
+
P as AxesColorGreen,
|
|
748
746
|
ht as AxesColorGreenLetter,
|
|
749
|
-
|
|
747
|
+
I as AxesColorRed,
|
|
750
748
|
lt as AxesColorRedLetter,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
dt as
|
|
755
|
-
pt as
|
|
756
|
-
ut as
|
|
757
|
-
ft as
|
|
758
|
-
_t as
|
|
749
|
+
ct as BoundingBox,
|
|
750
|
+
jt as COORDINATE_LAYER_MASK,
|
|
751
|
+
Ct as DEFAULT_LAYER_MASK,
|
|
752
|
+
dt as DIVE,
|
|
753
|
+
pt as DIVEAmbientLight,
|
|
754
|
+
ut as DIVEClock,
|
|
755
|
+
ft as DIVEDefaultSettings,
|
|
756
|
+
_t as DIVEEngine,
|
|
757
|
+
gt as DIVEFloor,
|
|
759
758
|
J as DIVEGizmo,
|
|
760
|
-
|
|
761
|
-
|
|
759
|
+
mt as DIVEGrid,
|
|
760
|
+
Et as DIVEGroup,
|
|
762
761
|
F as DIVEMath,
|
|
763
|
-
|
|
762
|
+
Dt as DIVEModel,
|
|
764
763
|
$ as DIVEMovable,
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
764
|
+
wt as DIVENode,
|
|
765
|
+
Lt as DIVEPerspectiveCamera,
|
|
766
|
+
Nt as DIVEPerspectiveCameraDefaultSettings,
|
|
767
|
+
yt as DIVEPointLight,
|
|
768
|
+
Mt as DIVEPrimitive,
|
|
769
|
+
xt as DIVERenderPipeline,
|
|
770
|
+
It as DIVERenderer,
|
|
771
|
+
Pt as DIVERendererDefaultSettings,
|
|
772
|
+
Vt as DIVEResizeManager,
|
|
773
|
+
Ht as DIVERoot,
|
|
774
|
+
bt as DIVEScene,
|
|
775
|
+
zt as DIVESceneDefaultSettings,
|
|
776
|
+
vt as DIVESceneLight,
|
|
776
777
|
tt as DIVESelectable,
|
|
777
|
-
|
|
778
|
-
|
|
778
|
+
Ot as DIVEView,
|
|
779
|
+
St as FILE_TYPES,
|
|
779
780
|
Kt as FileContentError,
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
781
|
+
te as FileTypeError,
|
|
782
|
+
At as GRID_CENTER_LINE_COLOR,
|
|
783
|
+
Gt as GRID_SIDE_LINE_COLOR,
|
|
784
|
+
Xt as HELPER_LAYER_MASK,
|
|
785
|
+
Jt as NetworkError,
|
|
786
|
+
Ft as PRODUCT_LAYER_MASK,
|
|
787
|
+
ee as ParseError,
|
|
788
|
+
Rt as SUPPORTED_FILE_TYPES,
|
|
788
789
|
d as UI_LAYER_MASK,
|
|
789
790
|
et as applyMixins,
|
|
790
791
|
m as deepClone,
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
792
|
+
qt as findInterface,
|
|
793
|
+
Tt as findSceneRecursive,
|
|
794
|
+
kt as getFileTypeFromUri,
|
|
794
795
|
z as getObjectDelta,
|
|
795
|
-
|
|
796
|
-
|
|
796
|
+
Qt as implementsInterface,
|
|
797
|
+
Ut as isFileTypeSupported,
|
|
797
798
|
rt as isGroupSchema,
|
|
798
799
|
st as isLightSchema,
|
|
799
|
-
|
|
800
|
-
|
|
800
|
+
se as isModelSchema,
|
|
801
|
+
ie as isPovSchema,
|
|
801
802
|
it as isPrimitiveSchema
|
|
802
803
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DIVE_ASCII_ART = "\n @@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@\n @@@@+-:::::::---------------------==------------------------------=#@@@@\n @@%=::::.......::---------------------------------------------------------+@@\n @@+:::...........::-----------------------------------------------------------#@@\n @@=:::.........::::::-------------------------------------------------------------%@\n @%:::.......:::::::-----------------------------------------------------------------#@\n @*:::.....:::::-----------------------------------------------------------------------*@\n @%::::::.::::---------------------------------------------------------------------------@@\n@@-:::::::::-----------------------------------------------------------------------------=@\n@%::::::::--------------------------------------------------------------------------------%@\n@+::::::::--------------------------------=@@@@@%-----------------------------------------%@\n@=:::::::--------------------------------*@@ @@+---------------------------------------#@\n@+:::::::-------------------------------*@ @*--------------------------------------%@\n@#::::::::-----------------------------=@@ @@=-------------------------------------%@\n@@-::::::::----------------------------@@ @@------------------------------------=@\n @%:::::::::--------------------------*@ @*-----------------------------------@@\n @*:::::::::-------------------------@@ @@----------------------------------%@\n @#::::::::::----------------------%@ @%--------------------------------%@\n @#:::::::::::-------------------=@@ @@=------------------------------%@\n @@-::::::::::::----------------%@ @%----------------------------=@@\n @@#::::::::::::::------------*@ @*--------------------------#@@\n @@+::::::::::::::::--------@@ @@------------------------+@@\n @@*:::::::::::::::::----@@ @@---------------------+@@\n @@@-:::::::::::::::--#@ @#-----------------=%@@\n @@%-::::::::::::-%@ @%-------------=%@@\n @@@@+:::::::#@@ @@*-------*@@@@\n @@@@@@@ @@@@@@\n";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { DIVEClock } from './clock/Clock.ts';
|
|
2
|
+
import { DIVEView } from './view/View.ts';
|
|
3
|
+
import { DIVEScene, DIVESceneSettings } from './scene/Scene.ts';
|
|
4
|
+
import { DIVEPerspectiveCamera, DIVEPerspectiveCameraSettings } from './camera/PerspectiveCamera.ts';
|
|
5
|
+
import { DIVERenderer, DIVERendererSettings } from './renderer/Renderer.ts';
|
|
6
|
+
import { OrbitControllerSettings } from '../plugins/orbitcontroller/index.ts';
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
DIVE: {
|
|
10
|
+
/**
|
|
11
|
+
* All instances of DIVE
|
|
12
|
+
*/
|
|
13
|
+
instances: DIVE[];
|
|
14
|
+
/**
|
|
15
|
+
* Get the first instance of DIVE
|
|
16
|
+
*/
|
|
17
|
+
get instance(): DIVE | undefined;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export type DIVESettings = {
|
|
22
|
+
/**
|
|
23
|
+
* Whether the engine should start automatically after initialization.
|
|
24
|
+
*
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
autoStart: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to display coordinate axes in the scene.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
displayAxes: boolean;
|
|
34
|
+
} & DIVESceneSettings & DIVEPerspectiveCameraSettings & DIVERendererSettings & OrbitControllerSettings;
|
|
35
|
+
export declare const DIVEDefaultSettings: Required<DIVESettings>;
|
|
36
|
+
/**
|
|
37
|
+
* #### DIVE
|
|
38
|
+
* is the main class of the DIVE framework.
|
|
39
|
+
*
|
|
40
|
+
* An instance of this class delivers a complete 3D environment with a perspective camera, orbit controls, a toolbox, and a communication system.
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { DIVE } from "@shopware-ag/dive";
|
|
43
|
+
*
|
|
44
|
+
* const myWrapper = document.getElementById('myWrapper');
|
|
45
|
+
*
|
|
46
|
+
* const dive = new DIVE();
|
|
47
|
+
*
|
|
48
|
+
* myWrapper.appendChild(dive.Canvas);
|
|
49
|
+
*
|
|
50
|
+
* dive.Communication.subscribe('GET_ALL_SCENE_DATA', () => {
|
|
51
|
+
* // do something
|
|
52
|
+
* }));
|
|
53
|
+
*
|
|
54
|
+
* dive.Communication.performAction('GET_ALL_SCENE_DATA', {});
|
|
55
|
+
* ```
|
|
56
|
+
* @module
|
|
57
|
+
*/
|
|
58
|
+
export declare class DIVE {
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated This static method will be removed in a future version. Please use `import { QuickView, QuickViewSettings, QuickViewDefaultSettings } from '@shopware-ag/dive/quickview'` instead.
|
|
61
|
+
*/
|
|
62
|
+
static QuickView(uri: string, settings?: Partial<import('../plugins/quickview/index.ts').QuickViewSettings>): Promise<import('../plugins/quickview/index.ts').QuickView>;
|
|
63
|
+
private _instanceId;
|
|
64
|
+
private _settings;
|
|
65
|
+
private _views;
|
|
66
|
+
private _mainView;
|
|
67
|
+
private _scene;
|
|
68
|
+
private _clock;
|
|
69
|
+
private orientationDisplay;
|
|
70
|
+
constructor(settings?: Partial<DIVESettings>);
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated This property will be removed in a future version. Please use properties on the DIVE instance and mainView directly.
|
|
73
|
+
*/
|
|
74
|
+
get engine(): {
|
|
75
|
+
scene: DIVEScene;
|
|
76
|
+
camera: DIVEPerspectiveCamera;
|
|
77
|
+
renderer: DIVERenderer;
|
|
78
|
+
setCanvas: (canvas: HTMLCanvasElement) => void;
|
|
79
|
+
clock: DIVEClock;
|
|
80
|
+
start: () => void;
|
|
81
|
+
stop: () => void;
|
|
82
|
+
dispose: () => void;
|
|
83
|
+
};
|
|
84
|
+
get views(): DIVEView[];
|
|
85
|
+
get mainView(): DIVEView;
|
|
86
|
+
get canvas(): HTMLCanvasElement;
|
|
87
|
+
get scene(): DIVEScene;
|
|
88
|
+
get clock(): DIVEClock;
|
|
89
|
+
start(): void;
|
|
90
|
+
stop(): void;
|
|
91
|
+
dispose(): Promise<void>;
|
|
92
|
+
createView(camera?: DIVEPerspectiveCamera): DIVEView;
|
|
93
|
+
disposeView(view: DIVEView): void;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated Use `import { DIVE } from '@shopware-ag/dive'` instead.
|
|
97
|
+
*/
|
|
98
|
+
export declare const DIVEEngine: typeof DIVE;
|
|
@@ -14,6 +14,7 @@ export declare const DIVEPerspectiveCameraDefaultSettings: Required<DIVEPerspect
|
|
|
14
14
|
* @module
|
|
15
15
|
*/
|
|
16
16
|
export declare class DIVEPerspectiveCamera extends PerspectiveCamera {
|
|
17
|
+
readonly isDIVEPerspectiveCamera: true;
|
|
17
18
|
static readonly EDITOR_VIEW_LAYER_MASK: number;
|
|
18
19
|
static readonly LIVE_VIEW_LAYER_MASK = 16;
|
|
19
20
|
onSetCameraLayer: (mask: number) => void;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import { DIVERenderPipeline } from '../renderer/Renderer.ts';
|
|
2
1
|
export interface DIVETicker {
|
|
3
2
|
uuid: string;
|
|
4
3
|
tick(deltaTime: number): void;
|
|
5
|
-
dispose?(): void;
|
|
6
4
|
}
|
|
7
5
|
export declare class DIVEClock {
|
|
8
|
-
|
|
6
|
+
readonly isDIVEClock: true;
|
|
9
7
|
private _lastTime;
|
|
10
8
|
private _isRunning;
|
|
11
9
|
private _tickers;
|
|
12
10
|
start(): void;
|
|
13
11
|
stop(): void;
|
|
14
|
-
setRenderer(renderer: DIVERenderPipeline): void;
|
|
15
12
|
addTicker(ticker: DIVETicker): void;
|
|
16
13
|
hasTicker(ticker: DIVETicker): boolean;
|
|
17
14
|
removeTicker(ticker: DIVETicker): void;
|