@shopware-ag/dive 2.0.1-beta.0 → 2.0.1-beta.10

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