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