@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
@@ -1,1919 +0,0 @@
1
- var ve = Object.defineProperty;
2
- var Ge = (d, t, e) => t in d ? ve(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e;
3
- var J = (d, t, e) => Ge(d, typeof t != "symbol" ? t + "" : t, e);
4
- import { TrianglesDrawMode as Be, TriangleFanDrawMode as ne, TriangleStripDrawMode as Se, Loader as we, LoaderUtils as V, FileLoader as W, MeshPhysicalMaterial as C, Vector2 as z, Color as G, LinearSRGBColorSpace as O, SRGBColorSpace as P, SpotLight as Ue, PointLight as je, DirectionalLight as Ke, Matrix4 as q, Vector3 as B, Quaternion as _e, InstancedMesh as Ve, InstancedBufferAttribute as Xe, Object3D as ie, TextureLoader as ye, ImageBitmapLoader as We, BufferAttribute as v, InterleavedBuffer as ze, InterleavedBufferAttribute as qe, LinearMipmapLinearFilter as Le, NearestMipmapLinearFilter as Ye, LinearMipmapNearestFilter as Qe, NearestMipmapNearestFilter as Je, LinearFilter as Me, NearestFilter as Ze, RepeatWrapping as Y, MirroredRepeatWrapping as be, ClampToEdgeWrapping as Ne, PointsMaterial as $e, Material as Z, LineBasicMaterial as et, MeshStandardMaterial as Ie, DoubleSide as tt, MeshBasicMaterial as K, PropertyBinding as nt, BufferGeometry as Ce, SkinnedMesh as st, Mesh as Oe, LineSegments as rt, Line as it, LineLoop as ot, Points as at, Group as X, PerspectiveCamera as ct, MathUtils as ut, OrthographicCamera as lt, Skeleton as ft, AnimationClip as dt, Bone as ht, InterpolateDiscrete as pt, InterpolateLinear as Fe, Texture as ce, VectorKeyframeTrack as ue, NumberKeyframeTrack as le, QuaternionKeyframeTrack as fe, ColorManagement as de, FrontSide as mt, Interpolant as gt, Box3 as At, Sphere as Tt, NoColorSpace as k } from "three";
5
- import { u as xt, a as he, F as pe, P as me } from "../../../../chunks/parse-error-DRBVHL9E.mjs";
6
- import { g as Rt, i as Et, S as St } from "../../../../chunks/FileTypes-qgYnI0Jg.mjs";
7
- function ge(d, t) {
8
- if (t === Be)
9
- return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), d;
10
- if (t === ne || t === Se) {
11
- let e = d.getIndex();
12
- if (e === null) {
13
- const s = [], a = d.getAttribute("position");
14
- if (a !== void 0) {
15
- for (let o = 0; o < a.count; o++)
16
- s.push(o);
17
- d.setIndex(s), e = d.getIndex();
18
- } else
19
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), d;
20
- }
21
- const i = e.count - 2, n = [];
22
- if (t === ne)
23
- for (let s = 1; s <= i; s++)
24
- n.push(e.getX(0)), n.push(e.getX(s)), n.push(e.getX(s + 1));
25
- else
26
- for (let s = 0; s < i; s++)
27
- s % 2 === 0 ? (n.push(e.getX(s)), n.push(e.getX(s + 1)), n.push(e.getX(s + 2))) : (n.push(e.getX(s + 2)), n.push(e.getX(s + 1)), n.push(e.getX(s)));
28
- n.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
29
- const r = d.clone();
30
- return r.setIndex(n), r.clearGroups(), r;
31
- } else
32
- return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), d;
33
- }
34
- class wt extends we {
35
- constructor(t) {
36
- super(t), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register(function(e) {
37
- return new bt(e);
38
- }), this.register(function(e) {
39
- return new Ht(e);
40
- }), this.register(function(e) {
41
- return new vt(e);
42
- }), this.register(function(e) {
43
- return new Gt(e);
44
- }), this.register(function(e) {
45
- return new It(e);
46
- }), this.register(function(e) {
47
- return new Ct(e);
48
- }), this.register(function(e) {
49
- return new Ot(e);
50
- }), this.register(function(e) {
51
- return new Ft(e);
52
- }), this.register(function(e) {
53
- return new Mt(e);
54
- }), this.register(function(e) {
55
- return new Dt(e);
56
- }), this.register(function(e) {
57
- return new Nt(e);
58
- }), this.register(function(e) {
59
- return new kt(e);
60
- }), this.register(function(e) {
61
- return new Pt(e);
62
- }), this.register(function(e) {
63
- return new yt(e);
64
- }), this.register(function(e) {
65
- return new Bt(e);
66
- }), this.register(function(e) {
67
- return new Ut(e);
68
- });
69
- }
70
- load(t, e, i, n) {
71
- const r = this;
72
- let s;
73
- if (this.resourcePath !== "")
74
- s = this.resourcePath;
75
- else if (this.path !== "") {
76
- const c = V.extractUrlBase(t);
77
- s = V.resolveURL(c, this.path);
78
- } else
79
- s = V.extractUrlBase(t);
80
- this.manager.itemStart(t);
81
- const a = function(c) {
82
- n ? n(c) : console.error(c), r.manager.itemError(t), r.manager.itemEnd(t);
83
- }, o = new W(this.manager);
84
- o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(t, function(c) {
85
- try {
86
- r.parse(c, s, function(l) {
87
- e(l), r.manager.itemEnd(t);
88
- }, a);
89
- } catch (l) {
90
- a(l);
91
- }
92
- }, i, a);
93
- }
94
- setDRACOLoader(t) {
95
- return this.dracoLoader = t, this;
96
- }
97
- setDDSLoader() {
98
- throw new Error(
99
- 'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
100
- );
101
- }
102
- setKTX2Loader(t) {
103
- return this.ktx2Loader = t, this;
104
- }
105
- setMeshoptDecoder(t) {
106
- return this.meshoptDecoder = t, this;
107
- }
108
- register(t) {
109
- return this.pluginCallbacks.indexOf(t) === -1 && this.pluginCallbacks.push(t), this;
110
- }
111
- unregister(t) {
112
- return this.pluginCallbacks.indexOf(t) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t), 1), this;
113
- }
114
- parse(t, e, i, n) {
115
- let r;
116
- const s = {}, a = {}, o = new TextDecoder();
117
- if (typeof t == "string")
118
- r = JSON.parse(t);
119
- else if (t instanceof ArrayBuffer)
120
- if (o.decode(new Uint8Array(t, 0, 4)) === De) {
121
- try {
122
- s[w.KHR_BINARY_GLTF] = new jt(t);
123
- } catch (u) {
124
- n && n(u);
125
- return;
126
- }
127
- r = JSON.parse(s[w.KHR_BINARY_GLTF].content);
128
- } else
129
- r = JSON.parse(o.decode(t));
130
- else
131
- r = t;
132
- if (r.asset === void 0 || r.asset.version[0] < 2) {
133
- n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
134
- return;
135
- }
136
- const c = new tn(r, {
137
- path: e || this.resourcePath || "",
138
- crossOrigin: this.crossOrigin,
139
- requestHeader: this.requestHeader,
140
- manager: this.manager,
141
- ktx2Loader: this.ktx2Loader,
142
- meshoptDecoder: this.meshoptDecoder
143
- });
144
- c.fileLoader.setRequestHeader(this.requestHeader);
145
- for (let l = 0; l < this.pluginCallbacks.length; l++) {
146
- const u = this.pluginCallbacks[l](c);
147
- u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, s[u.name] = !0;
148
- }
149
- if (r.extensionsUsed)
150
- for (let l = 0; l < r.extensionsUsed.length; ++l) {
151
- const u = r.extensionsUsed[l], p = r.extensionsRequired || [];
152
- switch (u) {
153
- case w.KHR_MATERIALS_UNLIT:
154
- s[u] = new Lt();
155
- break;
156
- case w.KHR_DRACO_MESH_COMPRESSION:
157
- s[u] = new Kt(r, this.dracoLoader);
158
- break;
159
- case w.KHR_TEXTURE_TRANSFORM:
160
- s[u] = new Vt();
161
- break;
162
- case w.KHR_MESH_QUANTIZATION:
163
- s[u] = new Xt();
164
- break;
165
- default:
166
- p.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
167
- }
168
- }
169
- c.setExtensions(s), c.setPlugins(a), c.parse(i, n);
170
- }
171
- parseAsync(t, e) {
172
- const i = this;
173
- return new Promise(function(n, r) {
174
- i.parse(t, e, n, r);
175
- });
176
- }
177
- }
178
- function _t() {
179
- let d = {};
180
- return {
181
- get: function(t) {
182
- return d[t];
183
- },
184
- add: function(t, e) {
185
- d[t] = e;
186
- },
187
- remove: function(t) {
188
- delete d[t];
189
- },
190
- removeAll: function() {
191
- d = {};
192
- }
193
- };
194
- }
195
- const w = {
196
- KHR_BINARY_GLTF: "KHR_binary_glTF",
197
- KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
198
- KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
199
- KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
200
- KHR_MATERIALS_IOR: "KHR_materials_ior",
201
- KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
202
- KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
203
- KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
204
- KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
205
- KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
206
- KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
207
- KHR_MATERIALS_VOLUME: "KHR_materials_volume",
208
- KHR_TEXTURE_BASISU: "KHR_texture_basisu",
209
- KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
210
- KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
211
- KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
212
- EXT_MATERIALS_BUMP: "EXT_materials_bump",
213
- EXT_TEXTURE_WEBP: "EXT_texture_webp",
214
- EXT_TEXTURE_AVIF: "EXT_texture_avif",
215
- EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
216
- EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
217
- };
218
- class yt {
219
- constructor(t) {
220
- this.parser = t, this.name = w.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
221
- }
222
- _markDefs() {
223
- const t = this.parser, e = this.parser.json.nodes || [];
224
- for (let i = 0, n = e.length; i < n; i++) {
225
- const r = e[i];
226
- r.extensions && r.extensions[this.name] && r.extensions[this.name].light !== void 0 && t._addNodeRef(this.cache, r.extensions[this.name].light);
227
- }
228
- }
229
- _loadLight(t) {
230
- const e = this.parser, i = "light:" + t;
231
- let n = e.cache.get(i);
232
- if (n) return n;
233
- const r = e.json, o = ((r.extensions && r.extensions[this.name] || {}).lights || [])[t];
234
- let c;
235
- const l = new G(16777215);
236
- o.color !== void 0 && l.setRGB(o.color[0], o.color[1], o.color[2], O);
237
- const u = o.range !== void 0 ? o.range : 0;
238
- switch (o.type) {
239
- case "directional":
240
- c = new Ke(l), c.target.position.set(0, 0, -1), c.add(c.target);
241
- break;
242
- case "point":
243
- c = new je(l), c.distance = u;
244
- break;
245
- case "spot":
246
- c = new Ue(l), c.distance = u, o.spot = o.spot || {}, o.spot.innerConeAngle = o.spot.innerConeAngle !== void 0 ? o.spot.innerConeAngle : 0, o.spot.outerConeAngle = o.spot.outerConeAngle !== void 0 ? o.spot.outerConeAngle : Math.PI / 4, c.angle = o.spot.outerConeAngle, c.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
247
- break;
248
- default:
249
- throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
250
- }
251
- return c.position.set(0, 0, 0), c.decay = 2, D(c, o), o.intensity !== void 0 && (c.intensity = o.intensity), c.name = e.createUniqueName(o.name || "light_" + t), n = Promise.resolve(c), e.cache.add(i, n), n;
252
- }
253
- getDependency(t, e) {
254
- if (t === "light")
255
- return this._loadLight(e);
256
- }
257
- createNodeAttachment(t) {
258
- const e = this, i = this.parser, r = i.json.nodes[t], a = (r.extensions && r.extensions[this.name] || {}).light;
259
- return a === void 0 ? null : this._loadLight(a).then(function(o) {
260
- return i._getNodeRef(e.cache, a, o);
261
- });
262
- }
263
- }
264
- class Lt {
265
- constructor() {
266
- this.name = w.KHR_MATERIALS_UNLIT;
267
- }
268
- getMaterialType() {
269
- return K;
270
- }
271
- extendParams(t, e, i) {
272
- const n = [];
273
- t.color = new G(1, 1, 1), t.opacity = 1;
274
- const r = e.pbrMetallicRoughness;
275
- if (r) {
276
- if (Array.isArray(r.baseColorFactor)) {
277
- const s = r.baseColorFactor;
278
- t.color.setRGB(s[0], s[1], s[2], O), t.opacity = s[3];
279
- }
280
- r.baseColorTexture !== void 0 && n.push(i.assignTexture(t, "map", r.baseColorTexture, P));
281
- }
282
- return Promise.all(n);
283
- }
284
- }
285
- class Mt {
286
- constructor(t) {
287
- this.parser = t, this.name = w.KHR_MATERIALS_EMISSIVE_STRENGTH;
288
- }
289
- extendMaterialParams(t, e) {
290
- const n = this.parser.json.materials[t];
291
- if (!n.extensions || !n.extensions[this.name])
292
- return Promise.resolve();
293
- const r = n.extensions[this.name].emissiveStrength;
294
- return r !== void 0 && (e.emissiveIntensity = r), Promise.resolve();
295
- }
296
- }
297
- class bt {
298
- constructor(t) {
299
- this.parser = t, this.name = w.KHR_MATERIALS_CLEARCOAT;
300
- }
301
- getMaterialType(t) {
302
- const i = this.parser.json.materials[t];
303
- return !i.extensions || !i.extensions[this.name] ? null : C;
304
- }
305
- extendMaterialParams(t, e) {
306
- const i = this.parser, n = i.json.materials[t];
307
- if (!n.extensions || !n.extensions[this.name])
308
- return Promise.resolve();
309
- const r = [], s = n.extensions[this.name];
310
- if (s.clearcoatFactor !== void 0 && (e.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && r.push(i.assignTexture(e, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && r.push(i.assignTexture(e, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (r.push(i.assignTexture(e, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
311
- const a = s.clearcoatNormalTexture.scale;
312
- e.clearcoatNormalScale = new z(a, a);
313
- }
314
- return Promise.all(r);
315
- }
316
- }
317
- class Nt {
318
- constructor(t) {
319
- this.parser = t, this.name = w.KHR_MATERIALS_IRIDESCENCE;
320
- }
321
- getMaterialType(t) {
322
- const i = this.parser.json.materials[t];
323
- return !i.extensions || !i.extensions[this.name] ? null : C;
324
- }
325
- extendMaterialParams(t, e) {
326
- const i = this.parser, n = i.json.materials[t];
327
- if (!n.extensions || !n.extensions[this.name])
328
- return Promise.resolve();
329
- const r = [], s = n.extensions[this.name];
330
- return s.iridescenceFactor !== void 0 && (e.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && r.push(i.assignTexture(e, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (e.iridescenceIOR = s.iridescenceIor), e.iridescenceThicknessRange === void 0 && (e.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (e.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (e.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && r.push(i.assignTexture(e, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(r);
331
- }
332
- }
333
- class It {
334
- constructor(t) {
335
- this.parser = t, this.name = w.KHR_MATERIALS_SHEEN;
336
- }
337
- getMaterialType(t) {
338
- const i = this.parser.json.materials[t];
339
- return !i.extensions || !i.extensions[this.name] ? null : C;
340
- }
341
- extendMaterialParams(t, e) {
342
- const i = this.parser, n = i.json.materials[t];
343
- if (!n.extensions || !n.extensions[this.name])
344
- return Promise.resolve();
345
- const r = [];
346
- e.sheenColor = new G(0, 0, 0), e.sheenRoughness = 0, e.sheen = 1;
347
- const s = n.extensions[this.name];
348
- if (s.sheenColorFactor !== void 0) {
349
- const a = s.sheenColorFactor;
350
- e.sheenColor.setRGB(a[0], a[1], a[2], O);
351
- }
352
- return s.sheenRoughnessFactor !== void 0 && (e.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && r.push(i.assignTexture(e, "sheenColorMap", s.sheenColorTexture, P)), s.sheenRoughnessTexture !== void 0 && r.push(i.assignTexture(e, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(r);
353
- }
354
- }
355
- class Ct {
356
- constructor(t) {
357
- this.parser = t, this.name = w.KHR_MATERIALS_TRANSMISSION;
358
- }
359
- getMaterialType(t) {
360
- const i = this.parser.json.materials[t];
361
- return !i.extensions || !i.extensions[this.name] ? null : C;
362
- }
363
- extendMaterialParams(t, e) {
364
- const i = this.parser, n = i.json.materials[t];
365
- if (!n.extensions || !n.extensions[this.name])
366
- return Promise.resolve();
367
- const r = [], s = n.extensions[this.name];
368
- return s.transmissionFactor !== void 0 && (e.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && r.push(i.assignTexture(e, "transmissionMap", s.transmissionTexture)), Promise.all(r);
369
- }
370
- }
371
- class Ot {
372
- constructor(t) {
373
- this.parser = t, this.name = w.KHR_MATERIALS_VOLUME;
374
- }
375
- getMaterialType(t) {
376
- const i = this.parser.json.materials[t];
377
- return !i.extensions || !i.extensions[this.name] ? null : C;
378
- }
379
- extendMaterialParams(t, e) {
380
- const i = this.parser, n = i.json.materials[t];
381
- if (!n.extensions || !n.extensions[this.name])
382
- return Promise.resolve();
383
- const r = [], s = n.extensions[this.name];
384
- e.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && r.push(i.assignTexture(e, "thicknessMap", s.thicknessTexture)), e.attenuationDistance = s.attenuationDistance || 1 / 0;
385
- const a = s.attenuationColor || [1, 1, 1];
386
- return e.attenuationColor = new G().setRGB(a[0], a[1], a[2], O), Promise.all(r);
387
- }
388
- }
389
- class Ft {
390
- constructor(t) {
391
- this.parser = t, this.name = w.KHR_MATERIALS_IOR;
392
- }
393
- getMaterialType(t) {
394
- const i = this.parser.json.materials[t];
395
- return !i.extensions || !i.extensions[this.name] ? null : C;
396
- }
397
- extendMaterialParams(t, e) {
398
- const n = this.parser.json.materials[t];
399
- if (!n.extensions || !n.extensions[this.name])
400
- return Promise.resolve();
401
- const r = n.extensions[this.name];
402
- return e.ior = r.ior !== void 0 ? r.ior : 1.5, Promise.resolve();
403
- }
404
- }
405
- class Dt {
406
- constructor(t) {
407
- this.parser = t, this.name = w.KHR_MATERIALS_SPECULAR;
408
- }
409
- getMaterialType(t) {
410
- const i = this.parser.json.materials[t];
411
- return !i.extensions || !i.extensions[this.name] ? null : C;
412
- }
413
- extendMaterialParams(t, e) {
414
- const i = this.parser, n = i.json.materials[t];
415
- if (!n.extensions || !n.extensions[this.name])
416
- return Promise.resolve();
417
- const r = [], s = n.extensions[this.name];
418
- e.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && r.push(i.assignTexture(e, "specularIntensityMap", s.specularTexture));
419
- const a = s.specularColorFactor || [1, 1, 1];
420
- return e.specularColor = new G().setRGB(a[0], a[1], a[2], O), s.specularColorTexture !== void 0 && r.push(i.assignTexture(e, "specularColorMap", s.specularColorTexture, P)), Promise.all(r);
421
- }
422
- }
423
- class Pt {
424
- constructor(t) {
425
- this.parser = t, this.name = w.EXT_MATERIALS_BUMP;
426
- }
427
- getMaterialType(t) {
428
- const i = this.parser.json.materials[t];
429
- return !i.extensions || !i.extensions[this.name] ? null : C;
430
- }
431
- extendMaterialParams(t, e) {
432
- const i = this.parser, n = i.json.materials[t];
433
- if (!n.extensions || !n.extensions[this.name])
434
- return Promise.resolve();
435
- const r = [], s = n.extensions[this.name];
436
- return e.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && r.push(i.assignTexture(e, "bumpMap", s.bumpTexture)), Promise.all(r);
437
- }
438
- }
439
- class kt {
440
- constructor(t) {
441
- this.parser = t, this.name = w.KHR_MATERIALS_ANISOTROPY;
442
- }
443
- getMaterialType(t) {
444
- const i = this.parser.json.materials[t];
445
- return !i.extensions || !i.extensions[this.name] ? null : C;
446
- }
447
- extendMaterialParams(t, e) {
448
- const i = this.parser, n = i.json.materials[t];
449
- if (!n.extensions || !n.extensions[this.name])
450
- return Promise.resolve();
451
- const r = [], s = n.extensions[this.name];
452
- return s.anisotropyStrength !== void 0 && (e.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (e.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && r.push(i.assignTexture(e, "anisotropyMap", s.anisotropyTexture)), Promise.all(r);
453
- }
454
- }
455
- class Ht {
456
- constructor(t) {
457
- this.parser = t, this.name = w.KHR_TEXTURE_BASISU;
458
- }
459
- loadTexture(t) {
460
- const e = this.parser, i = e.json, n = i.textures[t];
461
- if (!n.extensions || !n.extensions[this.name])
462
- return null;
463
- const r = n.extensions[this.name], s = e.options.ktx2Loader;
464
- if (!s) {
465
- if (i.extensionsRequired && i.extensionsRequired.indexOf(this.name) >= 0)
466
- throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
467
- return null;
468
- }
469
- return e.loadTextureImage(t, r.source, s);
470
- }
471
- }
472
- class vt {
473
- constructor(t) {
474
- this.parser = t, this.name = w.EXT_TEXTURE_WEBP, this.isSupported = null;
475
- }
476
- loadTexture(t) {
477
- const e = this.name, i = this.parser, n = i.json, r = n.textures[t];
478
- if (!r.extensions || !r.extensions[e])
479
- return null;
480
- const s = r.extensions[e], a = n.images[s.source];
481
- let o = i.textureLoader;
482
- if (a.uri) {
483
- const c = i.options.manager.getHandler(a.uri);
484
- c !== null && (o = c);
485
- }
486
- return this.detectSupport().then(function(c) {
487
- if (c) return i.loadTextureImage(t, s.source, o);
488
- if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
489
- throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
490
- return i.loadTexture(t);
491
- });
492
- }
493
- detectSupport() {
494
- return this.isSupported || (this.isSupported = new Promise(function(t) {
495
- const e = new Image();
496
- e.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", e.onload = e.onerror = function() {
497
- t(e.height === 1);
498
- };
499
- })), this.isSupported;
500
- }
501
- }
502
- class Gt {
503
- constructor(t) {
504
- this.parser = t, this.name = w.EXT_TEXTURE_AVIF, this.isSupported = null;
505
- }
506
- loadTexture(t) {
507
- const e = this.name, i = this.parser, n = i.json, r = n.textures[t];
508
- if (!r.extensions || !r.extensions[e])
509
- return null;
510
- const s = r.extensions[e], a = n.images[s.source];
511
- let o = i.textureLoader;
512
- if (a.uri) {
513
- const c = i.options.manager.getHandler(a.uri);
514
- c !== null && (o = c);
515
- }
516
- return this.detectSupport().then(function(c) {
517
- if (c) return i.loadTextureImage(t, s.source, o);
518
- if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
519
- throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
520
- return i.loadTexture(t);
521
- });
522
- }
523
- detectSupport() {
524
- return this.isSupported || (this.isSupported = new Promise(function(t) {
525
- const e = new Image();
526
- e.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", e.onload = e.onerror = function() {
527
- t(e.height === 1);
528
- };
529
- })), this.isSupported;
530
- }
531
- }
532
- class Bt {
533
- constructor(t) {
534
- this.name = w.EXT_MESHOPT_COMPRESSION, this.parser = t;
535
- }
536
- loadBufferView(t) {
537
- const e = this.parser.json, i = e.bufferViews[t];
538
- if (i.extensions && i.extensions[this.name]) {
539
- const n = i.extensions[this.name], r = this.parser.getDependency("buffer", n.buffer), s = this.parser.options.meshoptDecoder;
540
- if (!s || !s.supported) {
541
- if (e.extensionsRequired && e.extensionsRequired.indexOf(this.name) >= 0)
542
- throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
543
- return null;
544
- }
545
- return r.then(function(a) {
546
- const o = n.byteOffset || 0, c = n.byteLength || 0, l = n.count, u = n.byteStride, p = new Uint8Array(a, o, c);
547
- return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(l, u, p, n.mode, n.filter).then(function(A) {
548
- return A.buffer;
549
- }) : s.ready.then(function() {
550
- const A = new ArrayBuffer(l * u);
551
- return s.decodeGltfBuffer(new Uint8Array(A), l, u, p, n.mode, n.filter), A;
552
- });
553
- });
554
- } else
555
- return null;
556
- }
557
- }
558
- class Ut {
559
- constructor(t) {
560
- this.name = w.EXT_MESH_GPU_INSTANCING, this.parser = t;
561
- }
562
- createNodeMesh(t) {
563
- const e = this.parser.json, i = e.nodes[t];
564
- if (!i.extensions || !i.extensions[this.name] || i.mesh === void 0)
565
- return null;
566
- const n = e.meshes[i.mesh];
567
- for (const c of n.primitives)
568
- if (c.mode !== I.TRIANGLES && c.mode !== I.TRIANGLE_STRIP && c.mode !== I.TRIANGLE_FAN && c.mode !== void 0)
569
- return null;
570
- const s = i.extensions[this.name].attributes, a = [], o = {};
571
- for (const c in s)
572
- a.push(this.parser.getDependency("accessor", s[c]).then((l) => (o[c] = l, o[c])));
573
- return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(t)), Promise.all(a).then((c) => {
574
- const l = c.pop(), u = l.isGroup ? l.children : [l], p = c[0].count, A = [];
575
- for (const x of u) {
576
- const _ = new q(), T = new B(), R = new _e(), y = new B(1, 1, 1), L = new Ve(x.geometry, x.material, p);
577
- for (let S = 0; S < p; S++)
578
- o.TRANSLATION && T.fromBufferAttribute(o.TRANSLATION, S), o.ROTATION && R.fromBufferAttribute(o.ROTATION, S), o.SCALE && y.fromBufferAttribute(o.SCALE, S), L.setMatrixAt(S, _.compose(T, R, y));
579
- for (const S in o)
580
- if (S === "_COLOR_0") {
581
- const b = o[S];
582
- L.instanceColor = new Xe(b.array, b.itemSize, b.normalized);
583
- } else S !== "TRANSLATION" && S !== "ROTATION" && S !== "SCALE" && x.geometry.setAttribute(S, o[S]);
584
- ie.prototype.copy.call(L, x), this.parser.assignFinalMaterial(L), A.push(L);
585
- }
586
- return l.isGroup ? (l.clear(), l.add(...A), l) : A[0];
587
- }));
588
- }
589
- }
590
- const De = "glTF", j = 12, Ae = { JSON: 1313821514, BIN: 5130562 };
591
- class jt {
592
- constructor(t) {
593
- this.name = w.KHR_BINARY_GLTF, this.content = null, this.body = null;
594
- const e = new DataView(t, 0, j), i = new TextDecoder();
595
- if (this.header = {
596
- magic: i.decode(new Uint8Array(t.slice(0, 4))),
597
- version: e.getUint32(4, !0),
598
- length: e.getUint32(8, !0)
599
- }, this.header.magic !== De)
600
- throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
601
- if (this.header.version < 2)
602
- throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
603
- const n = this.header.length - j, r = new DataView(t, j);
604
- let s = 0;
605
- for (; s < n; ) {
606
- const a = r.getUint32(s, !0);
607
- s += 4;
608
- const o = r.getUint32(s, !0);
609
- if (s += 4, o === Ae.JSON) {
610
- const c = new Uint8Array(t, j + s, a);
611
- this.content = i.decode(c);
612
- } else if (o === Ae.BIN) {
613
- const c = j + s;
614
- this.body = t.slice(c, c + a);
615
- }
616
- s += a;
617
- }
618
- if (this.content === null)
619
- throw new Error("THREE.GLTFLoader: JSON content not found.");
620
- }
621
- }
622
- class Kt {
623
- constructor(t, e) {
624
- if (!e)
625
- throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
626
- this.name = w.KHR_DRACO_MESH_COMPRESSION, this.json = t, this.dracoLoader = e, this.dracoLoader.preload();
627
- }
628
- decodePrimitive(t, e) {
629
- const i = this.json, n = this.dracoLoader, r = t.extensions[this.name].bufferView, s = t.extensions[this.name].attributes, a = {}, o = {}, c = {};
630
- for (const l in s) {
631
- const u = se[l] || l.toLowerCase();
632
- a[u] = s[l];
633
- }
634
- for (const l in t.attributes) {
635
- const u = se[l] || l.toLowerCase();
636
- if (s[l] !== void 0) {
637
- const p = i.accessors[t.attributes[l]], A = U[p.componentType];
638
- c[u] = A.name, o[u] = p.normalized === !0;
639
- }
640
- }
641
- return e.getDependency("bufferView", r).then(function(l) {
642
- return new Promise(function(u, p) {
643
- n.decodeDracoFile(l, function(A) {
644
- for (const x in A.attributes) {
645
- const _ = A.attributes[x], T = o[x];
646
- T !== void 0 && (_.normalized = T);
647
- }
648
- u(A);
649
- }, a, c, O, p);
650
- });
651
- });
652
- }
653
- }
654
- class Vt {
655
- constructor() {
656
- this.name = w.KHR_TEXTURE_TRANSFORM;
657
- }
658
- extendTexture(t, e) {
659
- return (e.texCoord === void 0 || e.texCoord === t.channel) && e.offset === void 0 && e.rotation === void 0 && e.scale === void 0 || (t = t.clone(), e.texCoord !== void 0 && (t.channel = e.texCoord), e.offset !== void 0 && t.offset.fromArray(e.offset), e.rotation !== void 0 && (t.rotation = e.rotation), e.scale !== void 0 && t.repeat.fromArray(e.scale), t.needsUpdate = !0), t;
660
- }
661
- }
662
- class Xt {
663
- constructor() {
664
- this.name = w.KHR_MESH_QUANTIZATION;
665
- }
666
- }
667
- class Pe extends gt {
668
- constructor(t, e, i, n) {
669
- super(t, e, i, n);
670
- }
671
- copySampleValue_(t) {
672
- const e = this.resultBuffer, i = this.sampleValues, n = this.valueSize, r = t * n * 3 + n;
673
- for (let s = 0; s !== n; s++)
674
- e[s] = i[r + s];
675
- return e;
676
- }
677
- interpolate_(t, e, i, n) {
678
- const r = this.resultBuffer, s = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, l = n - e, u = (i - e) / l, p = u * u, A = p * u, x = t * c, _ = x - c, T = -2 * A + 3 * p, R = A - p, y = 1 - T, L = R - p + u;
679
- for (let S = 0; S !== a; S++) {
680
- const b = s[_ + S + a], N = s[_ + S + o] * l, M = s[x + S + a], f = s[x + S] * l;
681
- r[S] = y * b + L * N + T * M + R * f;
682
- }
683
- return r;
684
- }
685
- }
686
- const Wt = new _e();
687
- class zt extends Pe {
688
- interpolate_(t, e, i, n) {
689
- const r = super.interpolate_(t, e, i, n);
690
- return Wt.fromArray(r).normalize().toArray(r), r;
691
- }
692
- }
693
- const I = {
694
- POINTS: 0,
695
- LINES: 1,
696
- LINE_LOOP: 2,
697
- LINE_STRIP: 3,
698
- TRIANGLES: 4,
699
- TRIANGLE_STRIP: 5,
700
- TRIANGLE_FAN: 6
701
- }, U = {
702
- 5120: Int8Array,
703
- 5121: Uint8Array,
704
- 5122: Int16Array,
705
- 5123: Uint16Array,
706
- 5125: Uint32Array,
707
- 5126: Float32Array
708
- }, Te = {
709
- 9728: Ze,
710
- 9729: Me,
711
- 9984: Je,
712
- 9985: Qe,
713
- 9986: Ye,
714
- 9987: Le
715
- }, xe = {
716
- 33071: Ne,
717
- 33648: be,
718
- 10497: Y
719
- }, $ = {
720
- SCALAR: 1,
721
- VEC2: 2,
722
- VEC3: 3,
723
- VEC4: 4,
724
- MAT2: 4,
725
- MAT3: 9,
726
- MAT4: 16
727
- }, se = {
728
- POSITION: "position",
729
- NORMAL: "normal",
730
- TANGENT: "tangent",
731
- TEXCOORD_0: "uv",
732
- TEXCOORD_1: "uv1",
733
- TEXCOORD_2: "uv2",
734
- TEXCOORD_3: "uv3",
735
- COLOR_0: "color",
736
- WEIGHTS_0: "skinWeight",
737
- JOINTS_0: "skinIndex"
738
- }, F = {
739
- scale: "scale",
740
- translation: "position",
741
- rotation: "quaternion",
742
- weights: "morphTargetInfluences"
743
- }, qt = {
744
- CUBICSPLINE: void 0,
745
- // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
746
- // keyframe track will be initialized with a default interpolation type, then modified.
747
- LINEAR: Fe,
748
- STEP: pt
749
- }, ee = {
750
- OPAQUE: "OPAQUE",
751
- MASK: "MASK",
752
- BLEND: "BLEND"
753
- };
754
- function Yt(d) {
755
- return d.DefaultMaterial === void 0 && (d.DefaultMaterial = new Ie({
756
- color: 16777215,
757
- emissive: 0,
758
- metalness: 1,
759
- roughness: 1,
760
- transparent: !1,
761
- depthTest: !0,
762
- side: mt
763
- })), d.DefaultMaterial;
764
- }
765
- function H(d, t, e) {
766
- for (const i in e.extensions)
767
- d[i] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[i] = e.extensions[i]);
768
- }
769
- function D(d, t) {
770
- t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(d.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
771
- }
772
- function Qt(d, t, e) {
773
- let i = !1, n = !1, r = !1;
774
- for (let c = 0, l = t.length; c < l; c++) {
775
- const u = t[c];
776
- if (u.POSITION !== void 0 && (i = !0), u.NORMAL !== void 0 && (n = !0), u.COLOR_0 !== void 0 && (r = !0), i && n && r) break;
777
- }
778
- if (!i && !n && !r) return Promise.resolve(d);
779
- const s = [], a = [], o = [];
780
- for (let c = 0, l = t.length; c < l; c++) {
781
- const u = t[c];
782
- if (i) {
783
- const p = u.POSITION !== void 0 ? e.getDependency("accessor", u.POSITION) : d.attributes.position;
784
- s.push(p);
785
- }
786
- if (n) {
787
- const p = u.NORMAL !== void 0 ? e.getDependency("accessor", u.NORMAL) : d.attributes.normal;
788
- a.push(p);
789
- }
790
- if (r) {
791
- const p = u.COLOR_0 !== void 0 ? e.getDependency("accessor", u.COLOR_0) : d.attributes.color;
792
- o.push(p);
793
- }
794
- }
795
- return Promise.all([
796
- Promise.all(s),
797
- Promise.all(a),
798
- Promise.all(o)
799
- ]).then(function(c) {
800
- const l = c[0], u = c[1], p = c[2];
801
- return i && (d.morphAttributes.position = l), n && (d.morphAttributes.normal = u), r && (d.morphAttributes.color = p), d.morphTargetsRelative = !0, d;
802
- });
803
- }
804
- function Jt(d, t) {
805
- if (d.updateMorphTargets(), t.weights !== void 0)
806
- for (let e = 0, i = t.weights.length; e < i; e++)
807
- d.morphTargetInfluences[e] = t.weights[e];
808
- if (t.extras && Array.isArray(t.extras.targetNames)) {
809
- const e = t.extras.targetNames;
810
- if (d.morphTargetInfluences.length === e.length) {
811
- d.morphTargetDictionary = {};
812
- for (let i = 0, n = e.length; i < n; i++)
813
- d.morphTargetDictionary[e[i]] = i;
814
- } else
815
- console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
816
- }
817
- }
818
- function Zt(d) {
819
- let t;
820
- const e = d.extensions && d.extensions[w.KHR_DRACO_MESH_COMPRESSION];
821
- if (e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + te(e.attributes) : t = d.indices + ":" + te(d.attributes) + ":" + d.mode, d.targets !== void 0)
822
- for (let i = 0, n = d.targets.length; i < n; i++)
823
- t += ":" + te(d.targets[i]);
824
- return t;
825
- }
826
- function te(d) {
827
- let t = "";
828
- const e = Object.keys(d).sort();
829
- for (let i = 0, n = e.length; i < n; i++)
830
- t += e[i] + ":" + d[e[i]] + ";";
831
- return t;
832
- }
833
- function re(d) {
834
- switch (d) {
835
- case Int8Array:
836
- return 1 / 127;
837
- case Uint8Array:
838
- return 1 / 255;
839
- case Int16Array:
840
- return 1 / 32767;
841
- case Uint16Array:
842
- return 1 / 65535;
843
- default:
844
- throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
845
- }
846
- }
847
- function $t(d) {
848
- return d.search(/\.jpe?g($|\?)/i) > 0 || d.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : d.search(/\.webp($|\?)/i) > 0 || d.search(/^data\:image\/webp/) === 0 ? "image/webp" : "image/png";
849
- }
850
- const en = new q();
851
- class tn {
852
- constructor(t = {}, e = {}) {
853
- this.json = t, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new _t(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
854
- let i = !1, n = !1, r = -1;
855
- typeof navigator < "u" && (i = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === !0, n = navigator.userAgent.indexOf("Firefox") > -1, r = n ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1), typeof createImageBitmap > "u" || i || n && r < 98 ? this.textureLoader = new ye(this.options.manager) : this.textureLoader = new We(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new W(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
856
- }
857
- setExtensions(t) {
858
- this.extensions = t;
859
- }
860
- setPlugins(t) {
861
- this.plugins = t;
862
- }
863
- parse(t, e) {
864
- const i = this, n = this.json, r = this.extensions;
865
- this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(s) {
866
- return s._markDefs && s._markDefs();
867
- }), Promise.all(this._invokeAll(function(s) {
868
- return s.beforeRoot && s.beforeRoot();
869
- })).then(function() {
870
- return Promise.all([
871
- i.getDependencies("scene"),
872
- i.getDependencies("animation"),
873
- i.getDependencies("camera")
874
- ]);
875
- }).then(function(s) {
876
- const a = {
877
- scene: s[0][n.scene || 0],
878
- scenes: s[0],
879
- animations: s[1],
880
- cameras: s[2],
881
- asset: n.asset,
882
- parser: i,
883
- userData: {}
884
- };
885
- return H(r, a, n), D(a, n), Promise.all(i._invokeAll(function(o) {
886
- return o.afterRoot && o.afterRoot(a);
887
- })).then(function() {
888
- for (const o of a.scenes)
889
- o.updateMatrixWorld();
890
- t(a);
891
- });
892
- }).catch(e);
893
- }
894
- /**
895
- * Marks the special nodes/meshes in json for efficient parse.
896
- */
897
- _markDefs() {
898
- const t = this.json.nodes || [], e = this.json.skins || [], i = this.json.meshes || [];
899
- for (let n = 0, r = e.length; n < r; n++) {
900
- const s = e[n].joints;
901
- for (let a = 0, o = s.length; a < o; a++)
902
- t[s[a]].isBone = !0;
903
- }
904
- for (let n = 0, r = t.length; n < r; n++) {
905
- const s = t[n];
906
- s.mesh !== void 0 && (this._addNodeRef(this.meshCache, s.mesh), s.skin !== void 0 && (i[s.mesh].isSkinnedMesh = !0)), s.camera !== void 0 && this._addNodeRef(this.cameraCache, s.camera);
907
- }
908
- }
909
- /**
910
- * Counts references to shared node / Object3D resources. These resources
911
- * can be reused, or "instantiated", at multiple nodes in the scene
912
- * hierarchy. Mesh, Camera, and Light instances are instantiated and must
913
- * be marked. Non-scenegraph resources (like Materials, Geometries, and
914
- * Textures) can be reused directly and are not marked here.
915
- *
916
- * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
917
- */
918
- _addNodeRef(t, e) {
919
- e !== void 0 && (t.refs[e] === void 0 && (t.refs[e] = t.uses[e] = 0), t.refs[e]++);
920
- }
921
- /** Returns a reference to a shared resource, cloning it if necessary. */
922
- _getNodeRef(t, e, i) {
923
- if (t.refs[e] <= 1) return i;
924
- const n = i.clone(), r = (s, a) => {
925
- const o = this.associations.get(s);
926
- o != null && this.associations.set(a, o);
927
- for (const [c, l] of s.children.entries())
928
- r(l, a.children[c]);
929
- };
930
- return r(i, n), n.name += "_instance_" + t.uses[e]++, n;
931
- }
932
- _invokeOne(t) {
933
- const e = Object.values(this.plugins);
934
- e.push(this);
935
- for (let i = 0; i < e.length; i++) {
936
- const n = t(e[i]);
937
- if (n) return n;
938
- }
939
- return null;
940
- }
941
- _invokeAll(t) {
942
- const e = Object.values(this.plugins);
943
- e.unshift(this);
944
- const i = [];
945
- for (let n = 0; n < e.length; n++) {
946
- const r = t(e[n]);
947
- r && i.push(r);
948
- }
949
- return i;
950
- }
951
- /**
952
- * Requests the specified dependency asynchronously, with caching.
953
- * @param {string} type
954
- * @param {number} index
955
- * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
956
- */
957
- getDependency(t, e) {
958
- const i = t + ":" + e;
959
- let n = this.cache.get(i);
960
- if (!n) {
961
- switch (t) {
962
- case "scene":
963
- n = this.loadScene(e);
964
- break;
965
- case "node":
966
- n = this._invokeOne(function(r) {
967
- return r.loadNode && r.loadNode(e);
968
- });
969
- break;
970
- case "mesh":
971
- n = this._invokeOne(function(r) {
972
- return r.loadMesh && r.loadMesh(e);
973
- });
974
- break;
975
- case "accessor":
976
- n = this.loadAccessor(e);
977
- break;
978
- case "bufferView":
979
- n = this._invokeOne(function(r) {
980
- return r.loadBufferView && r.loadBufferView(e);
981
- });
982
- break;
983
- case "buffer":
984
- n = this.loadBuffer(e);
985
- break;
986
- case "material":
987
- n = this._invokeOne(function(r) {
988
- return r.loadMaterial && r.loadMaterial(e);
989
- });
990
- break;
991
- case "texture":
992
- n = this._invokeOne(function(r) {
993
- return r.loadTexture && r.loadTexture(e);
994
- });
995
- break;
996
- case "skin":
997
- n = this.loadSkin(e);
998
- break;
999
- case "animation":
1000
- n = this._invokeOne(function(r) {
1001
- return r.loadAnimation && r.loadAnimation(e);
1002
- });
1003
- break;
1004
- case "camera":
1005
- n = this.loadCamera(e);
1006
- break;
1007
- default:
1008
- if (n = this._invokeOne(function(r) {
1009
- return r != this && r.getDependency && r.getDependency(t, e);
1010
- }), !n)
1011
- throw new Error("Unknown type: " + t);
1012
- break;
1013
- }
1014
- this.cache.add(i, n);
1015
- }
1016
- return n;
1017
- }
1018
- /**
1019
- * Requests all dependencies of the specified type asynchronously, with caching.
1020
- * @param {string} type
1021
- * @return {Promise<Array<Object>>}
1022
- */
1023
- getDependencies(t) {
1024
- let e = this.cache.get(t);
1025
- if (!e) {
1026
- const i = this, n = this.json[t + (t === "mesh" ? "es" : "s")] || [];
1027
- e = Promise.all(n.map(function(r, s) {
1028
- return i.getDependency(t, s);
1029
- })), this.cache.add(t, e);
1030
- }
1031
- return e;
1032
- }
1033
- /**
1034
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1035
- * @param {number} bufferIndex
1036
- * @return {Promise<ArrayBuffer>}
1037
- */
1038
- loadBuffer(t) {
1039
- const e = this.json.buffers[t], i = this.fileLoader;
1040
- if (e.type && e.type !== "arraybuffer")
1041
- throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
1042
- if (e.uri === void 0 && t === 0)
1043
- return Promise.resolve(this.extensions[w.KHR_BINARY_GLTF].body);
1044
- const n = this.options;
1045
- return new Promise(function(r, s) {
1046
- i.load(V.resolveURL(e.uri, n.path), r, void 0, function() {
1047
- s(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'));
1048
- });
1049
- });
1050
- }
1051
- /**
1052
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1053
- * @param {number} bufferViewIndex
1054
- * @return {Promise<ArrayBuffer>}
1055
- */
1056
- loadBufferView(t) {
1057
- const e = this.json.bufferViews[t];
1058
- return this.getDependency("buffer", e.buffer).then(function(i) {
1059
- const n = e.byteLength || 0, r = e.byteOffset || 0;
1060
- return i.slice(r, r + n);
1061
- });
1062
- }
1063
- /**
1064
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1065
- * @param {number} accessorIndex
1066
- * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1067
- */
1068
- loadAccessor(t) {
1069
- const e = this, i = this.json, n = this.json.accessors[t];
1070
- if (n.bufferView === void 0 && n.sparse === void 0) {
1071
- const s = $[n.type], a = U[n.componentType], o = n.normalized === !0, c = new a(n.count * s);
1072
- return Promise.resolve(new v(c, s, o));
1073
- }
1074
- const r = [];
1075
- return n.bufferView !== void 0 ? r.push(this.getDependency("bufferView", n.bufferView)) : r.push(null), n.sparse !== void 0 && (r.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(r).then(function(s) {
1076
- const a = s[0], o = $[n.type], c = U[n.componentType], l = c.BYTES_PER_ELEMENT, u = l * o, p = n.byteOffset || 0, A = n.bufferView !== void 0 ? i.bufferViews[n.bufferView].byteStride : void 0, x = n.normalized === !0;
1077
- let _, T;
1078
- if (A && A !== u) {
1079
- const R = Math.floor(p / A), y = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + R + ":" + n.count;
1080
- let L = e.cache.get(y);
1081
- L || (_ = new c(a, R * A, n.count * A / l), L = new ze(_, A / l), e.cache.add(y, L)), T = new qe(L, o, p % A / l, x);
1082
- } else
1083
- a === null ? _ = new c(n.count * o) : _ = new c(a, p, n.count * o), T = new v(_, o, x);
1084
- if (n.sparse !== void 0) {
1085
- const R = $.SCALAR, y = U[n.sparse.indices.componentType], L = n.sparse.indices.byteOffset || 0, S = n.sparse.values.byteOffset || 0, b = new y(s[1], L, n.sparse.count * R), N = new c(s[2], S, n.sparse.count * o);
1086
- a !== null && (T = new v(T.array.slice(), T.itemSize, T.normalized));
1087
- for (let M = 0, f = b.length; M < f; M++) {
1088
- const h = b[M];
1089
- if (T.setX(h, N[M * o]), o >= 2 && T.setY(h, N[M * o + 1]), o >= 3 && T.setZ(h, N[M * o + 2]), o >= 4 && T.setW(h, N[M * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1090
- }
1091
- }
1092
- return T;
1093
- });
1094
- }
1095
- /**
1096
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1097
- * @param {number} textureIndex
1098
- * @return {Promise<THREE.Texture|null>}
1099
- */
1100
- loadTexture(t) {
1101
- const e = this.json, i = this.options, r = e.textures[t].source, s = e.images[r];
1102
- let a = this.textureLoader;
1103
- if (s.uri) {
1104
- const o = i.manager.getHandler(s.uri);
1105
- o !== null && (a = o);
1106
- }
1107
- return this.loadTextureImage(t, r, a);
1108
- }
1109
- loadTextureImage(t, e, i) {
1110
- const n = this, r = this.json, s = r.textures[t], a = r.images[e], o = (a.uri || a.bufferView) + ":" + s.sampler;
1111
- if (this.textureCache[o])
1112
- return this.textureCache[o];
1113
- const c = this.loadImageSource(e, i).then(function(l) {
1114
- l.flipY = !1, l.name = s.name || a.name || "", l.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (l.name = a.uri);
1115
- const p = (r.samplers || {})[s.sampler] || {};
1116
- return l.magFilter = Te[p.magFilter] || Me, l.minFilter = Te[p.minFilter] || Le, l.wrapS = xe[p.wrapS] || Y, l.wrapT = xe[p.wrapT] || Y, n.associations.set(l, { textures: t }), l;
1117
- }).catch(function() {
1118
- return null;
1119
- });
1120
- return this.textureCache[o] = c, c;
1121
- }
1122
- loadImageSource(t, e) {
1123
- const i = this, n = this.json, r = this.options;
1124
- if (this.sourceCache[t] !== void 0)
1125
- return this.sourceCache[t].then((u) => u.clone());
1126
- const s = n.images[t], a = self.URL || self.webkitURL;
1127
- let o = s.uri || "", c = !1;
1128
- if (s.bufferView !== void 0)
1129
- o = i.getDependency("bufferView", s.bufferView).then(function(u) {
1130
- c = !0;
1131
- const p = new Blob([u], { type: s.mimeType });
1132
- return o = a.createObjectURL(p), o;
1133
- });
1134
- else if (s.uri === void 0)
1135
- throw new Error("THREE.GLTFLoader: Image " + t + " is missing URI and bufferView");
1136
- const l = Promise.resolve(o).then(function(u) {
1137
- return new Promise(function(p, A) {
1138
- let x = p;
1139
- e.isImageBitmapLoader === !0 && (x = function(_) {
1140
- const T = new ce(_);
1141
- T.needsUpdate = !0, p(T);
1142
- }), e.load(V.resolveURL(u, r.path), x, void 0, A);
1143
- });
1144
- }).then(function(u) {
1145
- return c === !0 && a.revokeObjectURL(o), u.userData.mimeType = s.mimeType || $t(s.uri), u;
1146
- }).catch(function(u) {
1147
- throw console.error("THREE.GLTFLoader: Couldn't load texture", o), u;
1148
- });
1149
- return this.sourceCache[t] = l, l;
1150
- }
1151
- /**
1152
- * Asynchronously assigns a texture to the given material parameters.
1153
- * @param {Object} materialParams
1154
- * @param {string} mapName
1155
- * @param {Object} mapDef
1156
- * @return {Promise<Texture>}
1157
- */
1158
- assignTexture(t, e, i, n) {
1159
- const r = this;
1160
- return this.getDependency("texture", i.index).then(function(s) {
1161
- if (!s) return null;
1162
- if (i.texCoord !== void 0 && i.texCoord > 0 && (s = s.clone(), s.channel = i.texCoord), r.extensions[w.KHR_TEXTURE_TRANSFORM]) {
1163
- const a = i.extensions !== void 0 ? i.extensions[w.KHR_TEXTURE_TRANSFORM] : void 0;
1164
- if (a) {
1165
- const o = r.associations.get(s);
1166
- s = r.extensions[w.KHR_TEXTURE_TRANSFORM].extendTexture(s, a), r.associations.set(s, o);
1167
- }
1168
- }
1169
- return n !== void 0 && (s.colorSpace = n), t[e] = s, s;
1170
- });
1171
- }
1172
- /**
1173
- * Assigns final material to a Mesh, Line, or Points instance. The instance
1174
- * already has a material (generated from the glTF material options alone)
1175
- * but reuse of the same glTF material may require multiple threejs materials
1176
- * to accommodate different primitive types, defines, etc. New materials will
1177
- * be created if necessary, and reused from a cache.
1178
- * @param {Object3D} mesh Mesh, Line, or Points instance.
1179
- */
1180
- assignFinalMaterial(t) {
1181
- const e = t.geometry;
1182
- let i = t.material;
1183
- const n = e.attributes.tangent === void 0, r = e.attributes.color !== void 0, s = e.attributes.normal === void 0;
1184
- if (t.isPoints) {
1185
- const a = "PointsMaterial:" + i.uuid;
1186
- let o = this.cache.get(a);
1187
- o || (o = new $e(), Z.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, o.sizeAttenuation = !1, this.cache.add(a, o)), i = o;
1188
- } else if (t.isLine) {
1189
- const a = "LineBasicMaterial:" + i.uuid;
1190
- let o = this.cache.get(a);
1191
- o || (o = new et(), Z.prototype.copy.call(o, i), o.color.copy(i.color), o.map = i.map, this.cache.add(a, o)), i = o;
1192
- }
1193
- if (n || r || s) {
1194
- let a = "ClonedMaterial:" + i.uuid + ":";
1195
- n && (a += "derivative-tangents:"), r && (a += "vertex-colors:"), s && (a += "flat-shading:");
1196
- let o = this.cache.get(a);
1197
- o || (o = i.clone(), r && (o.vertexColors = !0), s && (o.flatShading = !0), n && (o.normalScale && (o.normalScale.y *= -1), o.clearcoatNormalScale && (o.clearcoatNormalScale.y *= -1)), this.cache.add(a, o), this.associations.set(o, this.associations.get(i))), i = o;
1198
- }
1199
- t.material = i;
1200
- }
1201
- getMaterialType() {
1202
- return Ie;
1203
- }
1204
- /**
1205
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1206
- * @param {number} materialIndex
1207
- * @return {Promise<Material>}
1208
- */
1209
- loadMaterial(t) {
1210
- const e = this, i = this.json, n = this.extensions, r = i.materials[t];
1211
- let s;
1212
- const a = {}, o = r.extensions || {}, c = [];
1213
- if (o[w.KHR_MATERIALS_UNLIT]) {
1214
- const u = n[w.KHR_MATERIALS_UNLIT];
1215
- s = u.getMaterialType(), c.push(u.extendParams(a, r, e));
1216
- } else {
1217
- const u = r.pbrMetallicRoughness || {};
1218
- if (a.color = new G(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
1219
- const p = u.baseColorFactor;
1220
- a.color.setRGB(p[0], p[1], p[2], O), a.opacity = p[3];
1221
- }
1222
- u.baseColorTexture !== void 0 && c.push(e.assignTexture(a, "map", u.baseColorTexture, P)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (c.push(e.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), c.push(e.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), s = this._invokeOne(function(p) {
1223
- return p.getMaterialType && p.getMaterialType(t);
1224
- }), c.push(Promise.all(this._invokeAll(function(p) {
1225
- return p.extendMaterialParams && p.extendMaterialParams(t, a);
1226
- })));
1227
- }
1228
- r.doubleSided === !0 && (a.side = tt);
1229
- const l = r.alphaMode || ee.OPAQUE;
1230
- if (l === ee.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, l === ee.MASK && (a.alphaTest = r.alphaCutoff !== void 0 ? r.alphaCutoff : 0.5)), r.normalTexture !== void 0 && s !== K && (c.push(e.assignTexture(a, "normalMap", r.normalTexture)), a.normalScale = new z(1, 1), r.normalTexture.scale !== void 0)) {
1231
- const u = r.normalTexture.scale;
1232
- a.normalScale.set(u, u);
1233
- }
1234
- if (r.occlusionTexture !== void 0 && s !== K && (c.push(e.assignTexture(a, "aoMap", r.occlusionTexture)), r.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = r.occlusionTexture.strength)), r.emissiveFactor !== void 0 && s !== K) {
1235
- const u = r.emissiveFactor;
1236
- a.emissive = new G().setRGB(u[0], u[1], u[2], O);
1237
- }
1238
- return r.emissiveTexture !== void 0 && s !== K && c.push(e.assignTexture(a, "emissiveMap", r.emissiveTexture, P)), Promise.all(c).then(function() {
1239
- const u = new s(a);
1240
- return r.name && (u.name = r.name), D(u, r), e.associations.set(u, { materials: t }), r.extensions && H(n, u, r), u;
1241
- });
1242
- }
1243
- /** When Object3D instances are targeted by animation, they need unique names. */
1244
- createUniqueName(t) {
1245
- const e = nt.sanitizeNodeName(t || "");
1246
- return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
1247
- }
1248
- /**
1249
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
1250
- *
1251
- * Creates BufferGeometries from primitives.
1252
- *
1253
- * @param {Array<GLTF.Primitive>} primitives
1254
- * @return {Promise<Array<BufferGeometry>>}
1255
- */
1256
- loadGeometries(t) {
1257
- const e = this, i = this.extensions, n = this.primitiveCache;
1258
- function r(a) {
1259
- return i[w.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, e).then(function(o) {
1260
- return Re(o, a, e);
1261
- });
1262
- }
1263
- const s = [];
1264
- for (let a = 0, o = t.length; a < o; a++) {
1265
- const c = t[a], l = Zt(c), u = n[l];
1266
- if (u)
1267
- s.push(u.promise);
1268
- else {
1269
- let p;
1270
- c.extensions && c.extensions[w.KHR_DRACO_MESH_COMPRESSION] ? p = r(c) : p = Re(new Ce(), c, e), n[l] = { primitive: c, promise: p }, s.push(p);
1271
- }
1272
- }
1273
- return Promise.all(s);
1274
- }
1275
- /**
1276
- * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
1277
- * @param {number} meshIndex
1278
- * @return {Promise<Group|Mesh|SkinnedMesh>}
1279
- */
1280
- loadMesh(t) {
1281
- const e = this, i = this.json, n = this.extensions, r = i.meshes[t], s = r.primitives, a = [];
1282
- for (let o = 0, c = s.length; o < c; o++) {
1283
- const l = s[o].material === void 0 ? Yt(this.cache) : this.getDependency("material", s[o].material);
1284
- a.push(l);
1285
- }
1286
- return a.push(e.loadGeometries(s)), Promise.all(a).then(function(o) {
1287
- const c = o.slice(0, o.length - 1), l = o[o.length - 1], u = [];
1288
- for (let A = 0, x = l.length; A < x; A++) {
1289
- const _ = l[A], T = s[A];
1290
- let R;
1291
- const y = c[A];
1292
- if (T.mode === I.TRIANGLES || T.mode === I.TRIANGLE_STRIP || T.mode === I.TRIANGLE_FAN || T.mode === void 0)
1293
- R = r.isSkinnedMesh === !0 ? new st(_, y) : new Oe(_, y), R.isSkinnedMesh === !0 && R.normalizeSkinWeights(), T.mode === I.TRIANGLE_STRIP ? R.geometry = ge(R.geometry, Se) : T.mode === I.TRIANGLE_FAN && (R.geometry = ge(R.geometry, ne));
1294
- else if (T.mode === I.LINES)
1295
- R = new rt(_, y);
1296
- else if (T.mode === I.LINE_STRIP)
1297
- R = new it(_, y);
1298
- else if (T.mode === I.LINE_LOOP)
1299
- R = new ot(_, y);
1300
- else if (T.mode === I.POINTS)
1301
- R = new at(_, y);
1302
- else
1303
- throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + T.mode);
1304
- Object.keys(R.geometry.morphAttributes).length > 0 && Jt(R, r), R.name = e.createUniqueName(r.name || "mesh_" + t), D(R, r), T.extensions && H(n, R, T), e.assignFinalMaterial(R), u.push(R);
1305
- }
1306
- for (let A = 0, x = u.length; A < x; A++)
1307
- e.associations.set(u[A], {
1308
- meshes: t,
1309
- primitives: A
1310
- });
1311
- if (u.length === 1)
1312
- return r.extensions && H(n, u[0], r), u[0];
1313
- const p = new X();
1314
- r.extensions && H(n, p, r), e.associations.set(p, { meshes: t });
1315
- for (let A = 0, x = u.length; A < x; A++)
1316
- p.add(u[A]);
1317
- return p;
1318
- });
1319
- }
1320
- /**
1321
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
1322
- * @param {number} cameraIndex
1323
- * @return {Promise<THREE.Camera>}
1324
- */
1325
- loadCamera(t) {
1326
- let e;
1327
- const i = this.json.cameras[t], n = i[i.type];
1328
- if (!n) {
1329
- console.warn("THREE.GLTFLoader: Missing camera parameters.");
1330
- return;
1331
- }
1332
- return i.type === "perspective" ? e = new ct(ut.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : i.type === "orthographic" && (e = new lt(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), i.name && (e.name = this.createUniqueName(i.name)), D(e, i), Promise.resolve(e);
1333
- }
1334
- /**
1335
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
1336
- * @param {number} skinIndex
1337
- * @return {Promise<Skeleton>}
1338
- */
1339
- loadSkin(t) {
1340
- const e = this.json.skins[t], i = [];
1341
- for (let n = 0, r = e.joints.length; n < r; n++)
1342
- i.push(this._loadNodeShallow(e.joints[n]));
1343
- return e.inverseBindMatrices !== void 0 ? i.push(this.getDependency("accessor", e.inverseBindMatrices)) : i.push(null), Promise.all(i).then(function(n) {
1344
- const r = n.pop(), s = n, a = [], o = [];
1345
- for (let c = 0, l = s.length; c < l; c++) {
1346
- const u = s[c];
1347
- if (u) {
1348
- a.push(u);
1349
- const p = new q();
1350
- r !== null && p.fromArray(r.array, c * 16), o.push(p);
1351
- } else
1352
- console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[c]);
1353
- }
1354
- return new ft(a, o);
1355
- });
1356
- }
1357
- /**
1358
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
1359
- * @param {number} animationIndex
1360
- * @return {Promise<AnimationClip>}
1361
- */
1362
- loadAnimation(t) {
1363
- const e = this.json, i = this, n = e.animations[t], r = n.name ? n.name : "animation_" + t, s = [], a = [], o = [], c = [], l = [];
1364
- for (let u = 0, p = n.channels.length; u < p; u++) {
1365
- const A = n.channels[u], x = n.samplers[A.sampler], _ = A.target, T = _.node, R = n.parameters !== void 0 ? n.parameters[x.input] : x.input, y = n.parameters !== void 0 ? n.parameters[x.output] : x.output;
1366
- _.node !== void 0 && (s.push(this.getDependency("node", T)), a.push(this.getDependency("accessor", R)), o.push(this.getDependency("accessor", y)), c.push(x), l.push(_));
1367
- }
1368
- return Promise.all([
1369
- Promise.all(s),
1370
- Promise.all(a),
1371
- Promise.all(o),
1372
- Promise.all(c),
1373
- Promise.all(l)
1374
- ]).then(function(u) {
1375
- const p = u[0], A = u[1], x = u[2], _ = u[3], T = u[4], R = [];
1376
- for (let y = 0, L = p.length; y < L; y++) {
1377
- const S = p[y], b = A[y], N = x[y], M = _[y], f = T[y];
1378
- if (S === void 0) continue;
1379
- S.updateMatrix && S.updateMatrix();
1380
- const h = i._createAnimationTracks(S, b, N, M, f);
1381
- if (h)
1382
- for (let m = 0; m < h.length; m++)
1383
- R.push(h[m]);
1384
- }
1385
- return new dt(r, void 0, R);
1386
- });
1387
- }
1388
- createNodeMesh(t) {
1389
- const e = this.json, i = this, n = e.nodes[t];
1390
- return n.mesh === void 0 ? null : i.getDependency("mesh", n.mesh).then(function(r) {
1391
- const s = i._getNodeRef(i.meshCache, n.mesh, r);
1392
- return n.weights !== void 0 && s.traverse(function(a) {
1393
- if (a.isMesh)
1394
- for (let o = 0, c = n.weights.length; o < c; o++)
1395
- a.morphTargetInfluences[o] = n.weights[o];
1396
- }), s;
1397
- });
1398
- }
1399
- /**
1400
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
1401
- * @param {number} nodeIndex
1402
- * @return {Promise<Object3D>}
1403
- */
1404
- loadNode(t) {
1405
- const e = this.json, i = this, n = e.nodes[t], r = i._loadNodeShallow(t), s = [], a = n.children || [];
1406
- for (let c = 0, l = a.length; c < l; c++)
1407
- s.push(i.getDependency("node", a[c]));
1408
- const o = n.skin === void 0 ? Promise.resolve(null) : i.getDependency("skin", n.skin);
1409
- return Promise.all([
1410
- r,
1411
- Promise.all(s),
1412
- o
1413
- ]).then(function(c) {
1414
- const l = c[0], u = c[1], p = c[2];
1415
- p !== null && l.traverse(function(A) {
1416
- A.isSkinnedMesh && A.bind(p, en);
1417
- });
1418
- for (let A = 0, x = u.length; A < x; A++)
1419
- l.add(u[A]);
1420
- return l;
1421
- });
1422
- }
1423
- // ._loadNodeShallow() parses a single node.
1424
- // skin and child nodes are created and added in .loadNode() (no '_' prefix).
1425
- _loadNodeShallow(t) {
1426
- const e = this.json, i = this.extensions, n = this;
1427
- if (this.nodeCache[t] !== void 0)
1428
- return this.nodeCache[t];
1429
- const r = e.nodes[t], s = r.name ? n.createUniqueName(r.name) : "", a = [], o = n._invokeOne(function(c) {
1430
- return c.createNodeMesh && c.createNodeMesh(t);
1431
- });
1432
- return o && a.push(o), r.camera !== void 0 && a.push(n.getDependency("camera", r.camera).then(function(c) {
1433
- return n._getNodeRef(n.cameraCache, r.camera, c);
1434
- })), n._invokeAll(function(c) {
1435
- return c.createNodeAttachment && c.createNodeAttachment(t);
1436
- }).forEach(function(c) {
1437
- a.push(c);
1438
- }), this.nodeCache[t] = Promise.all(a).then(function(c) {
1439
- let l;
1440
- if (r.isBone === !0 ? l = new ht() : c.length > 1 ? l = new X() : c.length === 1 ? l = c[0] : l = new ie(), l !== c[0])
1441
- for (let u = 0, p = c.length; u < p; u++)
1442
- l.add(c[u]);
1443
- if (r.name && (l.userData.name = r.name, l.name = s), D(l, r), r.extensions && H(i, l, r), r.matrix !== void 0) {
1444
- const u = new q();
1445
- u.fromArray(r.matrix), l.applyMatrix4(u);
1446
- } else
1447
- r.translation !== void 0 && l.position.fromArray(r.translation), r.rotation !== void 0 && l.quaternion.fromArray(r.rotation), r.scale !== void 0 && l.scale.fromArray(r.scale);
1448
- return n.associations.has(l) || n.associations.set(l, {}), n.associations.get(l).nodes = t, l;
1449
- }), this.nodeCache[t];
1450
- }
1451
- /**
1452
- * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
1453
- * @param {number} sceneIndex
1454
- * @return {Promise<Group>}
1455
- */
1456
- loadScene(t) {
1457
- const e = this.extensions, i = this.json.scenes[t], n = this, r = new X();
1458
- i.name && (r.name = n.createUniqueName(i.name)), D(r, i), i.extensions && H(e, r, i);
1459
- const s = i.nodes || [], a = [];
1460
- for (let o = 0, c = s.length; o < c; o++)
1461
- a.push(n.getDependency("node", s[o]));
1462
- return Promise.all(a).then(function(o) {
1463
- for (let l = 0, u = o.length; l < u; l++)
1464
- r.add(o[l]);
1465
- const c = (l) => {
1466
- const u = /* @__PURE__ */ new Map();
1467
- for (const [p, A] of n.associations)
1468
- (p instanceof Z || p instanceof ce) && u.set(p, A);
1469
- return l.traverse((p) => {
1470
- const A = n.associations.get(p);
1471
- A != null && u.set(p, A);
1472
- }), u;
1473
- };
1474
- return n.associations = c(r), r;
1475
- });
1476
- }
1477
- _createAnimationTracks(t, e, i, n, r) {
1478
- const s = [], a = t.name ? t.name : t.uuid, o = [];
1479
- F[r.path] === F.weights ? t.traverse(function(p) {
1480
- p.morphTargetInfluences && o.push(p.name ? p.name : p.uuid);
1481
- }) : o.push(a);
1482
- let c;
1483
- switch (F[r.path]) {
1484
- case F.weights:
1485
- c = le;
1486
- break;
1487
- case F.rotation:
1488
- c = fe;
1489
- break;
1490
- case F.position:
1491
- case F.scale:
1492
- c = ue;
1493
- break;
1494
- default:
1495
- switch (i.itemSize) {
1496
- case 1:
1497
- c = le;
1498
- break;
1499
- case 2:
1500
- case 3:
1501
- default:
1502
- c = ue;
1503
- break;
1504
- }
1505
- break;
1506
- }
1507
- const l = n.interpolation !== void 0 ? qt[n.interpolation] : Fe, u = this._getArrayFromAccessor(i);
1508
- for (let p = 0, A = o.length; p < A; p++) {
1509
- const x = new c(
1510
- o[p] + "." + F[r.path],
1511
- e.array,
1512
- u,
1513
- l
1514
- );
1515
- n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(x), s.push(x);
1516
- }
1517
- return s;
1518
- }
1519
- _getArrayFromAccessor(t) {
1520
- let e = t.array;
1521
- if (t.normalized) {
1522
- const i = re(e.constructor), n = new Float32Array(e.length);
1523
- for (let r = 0, s = e.length; r < s; r++)
1524
- n[r] = e[r] * i;
1525
- e = n;
1526
- }
1527
- return e;
1528
- }
1529
- _createCubicSplineTrackInterpolant(t) {
1530
- t.createInterpolant = function(i) {
1531
- const n = this instanceof fe ? zt : Pe;
1532
- return new n(this.times, this.values, this.getValueSize() / 3, i);
1533
- }, t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
1534
- }
1535
- }
1536
- function nn(d, t, e) {
1537
- const i = t.attributes, n = new At();
1538
- if (i.POSITION !== void 0) {
1539
- const a = e.json.accessors[i.POSITION], o = a.min, c = a.max;
1540
- if (o !== void 0 && c !== void 0) {
1541
- if (n.set(
1542
- new B(o[0], o[1], o[2]),
1543
- new B(c[0], c[1], c[2])
1544
- ), a.normalized) {
1545
- const l = re(U[a.componentType]);
1546
- n.min.multiplyScalar(l), n.max.multiplyScalar(l);
1547
- }
1548
- } else {
1549
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1550
- return;
1551
- }
1552
- } else
1553
- return;
1554
- const r = t.targets;
1555
- if (r !== void 0) {
1556
- const a = new B(), o = new B();
1557
- for (let c = 0, l = r.length; c < l; c++) {
1558
- const u = r[c];
1559
- if (u.POSITION !== void 0) {
1560
- const p = e.json.accessors[u.POSITION], A = p.min, x = p.max;
1561
- if (A !== void 0 && x !== void 0) {
1562
- if (o.setX(Math.max(Math.abs(A[0]), Math.abs(x[0]))), o.setY(Math.max(Math.abs(A[1]), Math.abs(x[1]))), o.setZ(Math.max(Math.abs(A[2]), Math.abs(x[2]))), p.normalized) {
1563
- const _ = re(U[p.componentType]);
1564
- o.multiplyScalar(_);
1565
- }
1566
- a.max(o);
1567
- } else
1568
- console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
1569
- }
1570
- }
1571
- n.expandByVector(a);
1572
- }
1573
- d.boundingBox = n;
1574
- const s = new Tt();
1575
- n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, d.boundingSphere = s;
1576
- }
1577
- function Re(d, t, e) {
1578
- const i = t.attributes, n = [];
1579
- function r(s, a) {
1580
- return e.getDependency("accessor", s).then(function(o) {
1581
- d.setAttribute(a, o);
1582
- });
1583
- }
1584
- for (const s in i) {
1585
- const a = se[s] || s.toLowerCase();
1586
- a in d.attributes || n.push(r(i[s], a));
1587
- }
1588
- if (t.indices !== void 0 && !d.index) {
1589
- const s = e.getDependency("accessor", t.indices).then(function(a) {
1590
- d.setIndex(a);
1591
- });
1592
- n.push(s);
1593
- }
1594
- return de.workingColorSpace !== O && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${de.workingColorSpace}" not supported.`), D(d, t), nn(d, t, e), Promise.all(n).then(function() {
1595
- return t.targets !== void 0 ? Qt(d, t.targets, e) : d;
1596
- });
1597
- }
1598
- class sn {
1599
- parse(t) {
1600
- const e = {}, i = t.split(`
1601
- `);
1602
- let n = null, r = e;
1603
- const s = [e];
1604
- for (const a of i)
1605
- if (a.includes("=")) {
1606
- const o = a.split("="), c = o[0].trim(), l = o[1].trim();
1607
- if (l.endsWith("{")) {
1608
- const u = {};
1609
- s.push(u), r[c] = u, r = u;
1610
- } else
1611
- r[c] = l;
1612
- } else if (a.endsWith("{")) {
1613
- const o = r[n] || {};
1614
- s.push(o), r[n] = o, r = o;
1615
- } else if (a.endsWith("}")) {
1616
- if (s.pop(), s.length === 0) continue;
1617
- r = s[s.length - 1];
1618
- } else if (a.endsWith("(")) {
1619
- const o = {};
1620
- s.push(o), n = a.split("(")[0].trim() || n, r[n] = o, r = o;
1621
- } else a.endsWith(")") ? (s.pop(), r = s[s.length - 1]) : n = a.trim();
1622
- return e;
1623
- }
1624
- }
1625
- class rn extends we {
1626
- constructor(t) {
1627
- super(t);
1628
- }
1629
- load(t, e, i, n) {
1630
- const r = this, s = new W(r.manager);
1631
- s.setPath(r.path), s.setResponseType("arraybuffer"), s.setRequestHeader(r.requestHeader), s.setWithCredentials(r.withCredentials), s.load(t, function(a) {
1632
- try {
1633
- e(r.parse(a));
1634
- } catch (o) {
1635
- n ? n(o) : console.error(o), r.manager.itemError(t);
1636
- }
1637
- }, i, n);
1638
- }
1639
- parse(t) {
1640
- const e = new sn();
1641
- function i(f) {
1642
- const h = {};
1643
- new W().setResponseType("arraybuffer");
1644
- for (const g in f) {
1645
- if (g.endsWith("png")) {
1646
- const E = new Blob([f[g]], { type: { type: "image/png" } });
1647
- h[g] = URL.createObjectURL(E);
1648
- }
1649
- if (g.endsWith("usd") || g.endsWith("usda")) {
1650
- if (n(f[g])) {
1651
- console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1652
- continue;
1653
- }
1654
- const E = he(f[g]);
1655
- h[g] = e.parse(E);
1656
- }
1657
- }
1658
- return h;
1659
- }
1660
- function n(f) {
1661
- const h = f.slice(0, 7), m = new Uint8Array([80, 88, 82, 45, 85, 83, 68, 67]);
1662
- return h.every((g, E) => g === m[E]);
1663
- }
1664
- function r(f) {
1665
- if (f.length < 1) return;
1666
- const h = Object.keys(f)[0];
1667
- let m = !1;
1668
- if (h.endsWith("usda")) return f[h];
1669
- if (h.endsWith("usdc"))
1670
- m = !0;
1671
- else if (h.endsWith("usd"))
1672
- if (n(f[h]))
1673
- m = !0;
1674
- else
1675
- return f[h];
1676
- m && console.warn("THREE.USDZLoader: Crate files (.usdc or binary .usd) are not supported.");
1677
- }
1678
- const s = xt(new Uint8Array(t)), a = i(s), o = r(s);
1679
- if (o === void 0)
1680
- return console.warn("THREE.USDZLoader: No usda file found."), new X();
1681
- const c = he(o), l = e.parse(c);
1682
- function u(f) {
1683
- if (f) {
1684
- if ("prepend references" in f) {
1685
- const m = f["prepend references"].split("@"), g = m[1].replace(/^.\//, ""), E = m[2].replace(/^<\//, "").replace(/>$/, "");
1686
- return p(a[g], E);
1687
- }
1688
- return p(f);
1689
- }
1690
- }
1691
- function p(f, h) {
1692
- if (f) {
1693
- if (h !== void 0) {
1694
- const m = `def Mesh "${h}"`;
1695
- if (m in f)
1696
- return f[m];
1697
- }
1698
- for (const m in f) {
1699
- const g = f[m];
1700
- if (m.startsWith("def Mesh"))
1701
- return "point3f[] points" in f && (g["point3f[] points"] = f["point3f[] points"]), "texCoord2f[] primvars:st" in f && (g["texCoord2f[] primvars:st"] = f["texCoord2f[] primvars:st"]), "int[] primvars:st:indices" in f && (g["int[] primvars:st:indices"] = f["int[] primvars:st:indices"]), g;
1702
- if (typeof g == "object") {
1703
- const E = p(g);
1704
- if (E) return E;
1705
- }
1706
- }
1707
- }
1708
- }
1709
- function A(f) {
1710
- if (!f) return;
1711
- let h = new Ce();
1712
- if ("int[] faceVertexIndices" in f) {
1713
- const m = JSON.parse(f["int[] faceVertexIndices"]);
1714
- h.setIndex(m);
1715
- }
1716
- if ("point3f[] points" in f) {
1717
- const m = JSON.parse(f["point3f[] points"].replace(/[()]*/g, "")), g = new v(new Float32Array(m), 3);
1718
- h.setAttribute("position", g);
1719
- }
1720
- if ("normal3f[] normals" in f) {
1721
- const m = JSON.parse(f["normal3f[] normals"].replace(/[()]*/g, "")), g = new v(new Float32Array(m), 3);
1722
- h.setAttribute("normal", g);
1723
- } else
1724
- h.computeVertexNormals();
1725
- if ("float2[] primvars:st" in f && (f["texCoord2f[] primvars:st"] = f["float2[] primvars:st"]), "texCoord2f[] primvars:st" in f) {
1726
- const m = JSON.parse(f["texCoord2f[] primvars:st"].replace(/[()]*/g, "")), g = new v(new Float32Array(m), 2);
1727
- if ("int[] primvars:st:indices" in f) {
1728
- h = h.toNonIndexed();
1729
- const E = JSON.parse(f["int[] primvars:st:indices"]);
1730
- h.setAttribute("uv", x(g, E));
1731
- } else
1732
- h.setAttribute("uv", g);
1733
- }
1734
- return h;
1735
- }
1736
- function x(f, h) {
1737
- const m = f.array, g = f.itemSize, E = new m.constructor(h.length * g);
1738
- let oe = 0, ke = 0;
1739
- for (let Q = 0, He = h.length; Q < He; Q++) {
1740
- oe = h[Q] * g;
1741
- for (let ae = 0; ae < g; ae++)
1742
- E[ke++] = m[oe++];
1743
- }
1744
- return new v(E, g);
1745
- }
1746
- function _(f) {
1747
- if (f) {
1748
- if ("rel material:binding" in f) {
1749
- const g = f["rel material:binding"].replace(/^<\//, "").replace(/>$/, "").split("/");
1750
- return T(l, ` "${g[1]}"`);
1751
- }
1752
- return T(f);
1753
- }
1754
- }
1755
- function T(f, h = "") {
1756
- for (const m in f) {
1757
- const g = f[m];
1758
- if (m.startsWith("def Material" + h))
1759
- return g;
1760
- if (typeof g == "object") {
1761
- const E = T(g, h);
1762
- if (E) return E;
1763
- }
1764
- }
1765
- }
1766
- function R(f, h) {
1767
- h["float inputs:rotation"] && (f.rotation = parseFloat(h["float inputs:rotation"])), h["float2 inputs:scale"] && (f.repeat = new z().fromArray(JSON.parse("[" + h["float2 inputs:scale"].replace(/[()]*/g, "") + "]"))), h["float2 inputs:translation"] && (f.offset = new z().fromArray(JSON.parse("[" + h["float2 inputs:translation"].replace(/[()]*/g, "") + "]")));
1768
- }
1769
- function y(f) {
1770
- const h = new C();
1771
- if (f !== void 0) {
1772
- if ('def Shader "PreviewSurface"' in f) {
1773
- const m = f['def Shader "PreviewSurface"'];
1774
- if ("color3f inputs:diffuseColor.connect" in m) {
1775
- const g = m["color3f inputs:diffuseColor.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1776
- h.map = S(E), h.map.colorSpace = P, 'def Shader "Transform2d_diffuse"' in f && R(h.map, f['def Shader "Transform2d_diffuse"']);
1777
- } else if ("color3f inputs:diffuseColor" in m) {
1778
- const g = m["color3f inputs:diffuseColor"].replace(/[()]*/g, "");
1779
- h.color.fromArray(JSON.parse("[" + g + "]"));
1780
- }
1781
- if ("color3f inputs:emissiveColor.connect" in m) {
1782
- const g = m["color3f inputs:emissiveColor.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1783
- h.emissiveMap = S(E), h.emissiveMap.colorSpace = P, h.emissive.set(16777215), 'def Shader "Transform2d_emissive"' in f && R(h.emissiveMap, f['def Shader "Transform2d_emissive"']);
1784
- } else if ("color3f inputs:emissiveColor" in m) {
1785
- const g = m["color3f inputs:emissiveColor"].replace(/[()]*/g, "");
1786
- h.emissive.fromArray(JSON.parse("[" + g + "]"));
1787
- }
1788
- if ("normal3f inputs:normal.connect" in m) {
1789
- const g = m["normal3f inputs:normal.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1790
- h.normalMap = S(E), h.normalMap.colorSpace = k, 'def Shader "Transform2d_normal"' in f && R(h.normalMap, f['def Shader "Transform2d_normal"']);
1791
- }
1792
- if ("float inputs:roughness.connect" in m) {
1793
- const g = m["float inputs:roughness.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1794
- h.roughness = 1, h.roughnessMap = S(E), h.roughnessMap.colorSpace = k, 'def Shader "Transform2d_roughness"' in f && R(h.roughnessMap, f['def Shader "Transform2d_roughness"']);
1795
- } else "float inputs:roughness" in m && (h.roughness = parseFloat(m["float inputs:roughness"]));
1796
- if ("float inputs:metallic.connect" in m) {
1797
- const g = m["float inputs:metallic.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1798
- h.metalness = 1, h.metalnessMap = S(E), h.metalnessMap.colorSpace = k, 'def Shader "Transform2d_metallic"' in f && R(h.metalnessMap, f['def Shader "Transform2d_metallic"']);
1799
- } else "float inputs:metallic" in m && (h.metalness = parseFloat(m["float inputs:metallic"]));
1800
- if ("float inputs:clearcoat.connect" in m) {
1801
- const g = m["float inputs:clearcoat.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1802
- h.clearcoat = 1, h.clearcoatMap = S(E), h.clearcoatMap.colorSpace = k, 'def Shader "Transform2d_clearcoat"' in f && R(h.clearcoatMap, f['def Shader "Transform2d_clearcoat"']);
1803
- } else "float inputs:clearcoat" in m && (h.clearcoat = parseFloat(m["float inputs:clearcoat"]));
1804
- if ("float inputs:clearcoatRoughness.connect" in m) {
1805
- const g = m["float inputs:clearcoatRoughness.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1806
- h.clearcoatRoughness = 1, h.clearcoatRoughnessMap = S(E), h.clearcoatRoughnessMap.colorSpace = k, 'def Shader "Transform2d_clearcoatRoughness"' in f && R(h.clearcoatRoughnessMap, f['def Shader "Transform2d_clearcoatRoughness"']);
1807
- } else "float inputs:clearcoatRoughness" in m && (h.clearcoatRoughness = parseFloat(m["float inputs:clearcoatRoughness"]));
1808
- if ("float inputs:ior" in m && (h.ior = parseFloat(m["float inputs:ior"])), "float inputs:occlusion.connect" in m) {
1809
- const g = m["float inputs:occlusion.connect"], E = L(l, /(\w+).output/.exec(g)[1]);
1810
- h.aoMap = S(E), h.aoMap.colorSpace = k, 'def Shader "Transform2d_occlusion"' in f && R(h.aoMap, f['def Shader "Transform2d_occlusion"']);
1811
- }
1812
- }
1813
- if ('def Shader "diffuseColor_texture"' in f) {
1814
- const m = f['def Shader "diffuseColor_texture"'];
1815
- h.map = S(m), h.map.colorSpace = P;
1816
- }
1817
- if ('def Shader "normal_texture"' in f) {
1818
- const m = f['def Shader "normal_texture"'];
1819
- h.normalMap = S(m), h.normalMap.colorSpace = k;
1820
- }
1821
- }
1822
- return h;
1823
- }
1824
- function L(f, h) {
1825
- for (const m in f) {
1826
- const g = f[m];
1827
- if (m.startsWith(`def Shader "${h}"`))
1828
- return g;
1829
- if (typeof g == "object") {
1830
- const E = L(g, h);
1831
- if (E) return E;
1832
- }
1833
- }
1834
- }
1835
- function S(f) {
1836
- if ("asset inputs:file" in f) {
1837
- const h = f["asset inputs:file"].replace(/@*/g, ""), g = new ye().load(a[h]), E = {
1838
- '"clamp"': Ne,
1839
- '"mirror"': be,
1840
- '"repeat"': Y
1841
- };
1842
- return "token inputs:wrapS" in f && (g.wrapS = E[f["token inputs:wrapS"]]), "token inputs:wrapT" in f && (g.wrapT = E[f["token inputs:wrapT"]]), g;
1843
- }
1844
- return null;
1845
- }
1846
- function b(f) {
1847
- const h = A(u(f)), m = y(_(f)), g = h ? new Oe(h, m) : new ie();
1848
- if ("matrix4d xformOp:transform" in f) {
1849
- const E = JSON.parse("[" + f["matrix4d xformOp:transform"].replace(/[()]*/g, "") + "]");
1850
- g.matrix.fromArray(E), g.matrix.decompose(g.position, g.quaternion, g.scale);
1851
- }
1852
- return g;
1853
- }
1854
- function N(f, h) {
1855
- for (const m in f)
1856
- if (m.startsWith("def Scope"))
1857
- N(f[m], h);
1858
- else if (m.startsWith("def Xform")) {
1859
- const g = b(f[m]);
1860
- /def Xform "(\w+)"/.test(m) && (g.name = /def Xform "(\w+)"/.exec(m)[1]), h.add(g), N(f[m], g);
1861
- }
1862
- }
1863
- const M = new X();
1864
- return N(l, M), M;
1865
- }
1866
- }
1867
- class Ee extends Error {
1868
- constructor(t, e, i) {
1869
- super(e), this.url = t, this.cause = i, this.name = "NetworkError";
1870
- }
1871
- }
1872
- class ln {
1873
- constructor() {
1874
- J(this, "_gltfLoader");
1875
- J(this, "_usdzLoader");
1876
- this._gltfLoader = new wt(), this._usdzLoader = new rn();
1877
- }
1878
- async _loadFile(t) {
1879
- const e = await fetch(t);
1880
- if (!e.ok)
1881
- throw new Ee(t, `Failed to fetch file from ${t}`);
1882
- try {
1883
- return await e.arrayBuffer();
1884
- } catch {
1885
- throw new Ee(t, `Failed to fetch file from ${t}`);
1886
- }
1887
- }
1888
- async load(t) {
1889
- const e = Rt(t);
1890
- if (e.length === 0)
1891
- throw new pe("No file extension found in URI", "");
1892
- if (!Et(e))
1893
- throw new pe(
1894
- `Unsupported file type: ${e}. Supported types: ${St.join(", ")}`,
1895
- e
1896
- );
1897
- const i = await this._loadFile(t);
1898
- try {
1899
- switch (e) {
1900
- case "glb":
1901
- case "gltf":
1902
- return (await this._gltfLoader.parseAsync(
1903
- i,
1904
- ""
1905
- )).scene;
1906
- case "usdz":
1907
- return await this._usdzLoader.parse(i);
1908
- }
1909
- } catch (n) {
1910
- throw n instanceof Error ? new me(
1911
- `Failed to parse ${e} file: ${n.message}`,
1912
- n
1913
- ) : new me(`Failed to parse ${e} file`);
1914
- }
1915
- }
1916
- }
1917
- export {
1918
- ln as AssetLoader
1919
- };