three-stdlib 2.22.7 → 2.22.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1065) hide show
  1. package/dist/_polyfill/CompressedArrayTexture.js +12 -0
  2. package/dist/_polyfill/CompressedArrayTexture.mjs +12 -0
  3. package/dist/_polyfill/Data3DTexture.js +17 -0
  4. package/dist/_polyfill/Data3DTexture.mjs +17 -0
  5. package/dist/animation/AnimationClipCreator.d.ts +12 -0
  6. package/dist/animation/AnimationClipCreator.js +57 -0
  7. package/dist/animation/AnimationClipCreator.mjs +57 -0
  8. package/dist/animation/CCDIKSolver.d.ts +25 -0
  9. package/dist/animation/CCDIKSolver.js +224 -0
  10. package/dist/animation/CCDIKSolver.mjs +224 -0
  11. package/dist/animation/MMDAnimationHelper.d.ts +93 -0
  12. package/dist/animation/MMDAnimationHelper.js +590 -0
  13. package/dist/animation/MMDAnimationHelper.mjs +590 -0
  14. package/dist/animation/MMDPhysics.d.ts +114 -0
  15. package/dist/animation/MMDPhysics.js +819 -0
  16. package/dist/animation/MMDPhysics.mjs +819 -0
  17. package/dist/cameras/CinematicCamera.d.ts +34 -0
  18. package/dist/cameras/CinematicCamera.js +131 -0
  19. package/dist/cameras/CinematicCamera.mjs +131 -0
  20. package/dist/controls/ArcballControls.d.ts +374 -0
  21. package/dist/controls/ArcballControls.js +2039 -0
  22. package/dist/controls/ArcballControls.mjs +2039 -0
  23. package/dist/controls/DeviceOrientationControls.d.ts +27 -0
  24. package/dist/controls/DeviceOrientationControls.js +84 -0
  25. package/dist/controls/DeviceOrientationControls.mjs +84 -0
  26. package/dist/controls/DragControls.d.ts +34 -0
  27. package/dist/controls/DragControls.js +182 -0
  28. package/dist/controls/DragControls.mjs +182 -0
  29. package/dist/controls/FirstPersonControls.d.ts +48 -0
  30. package/dist/controls/FirstPersonControls.js +229 -0
  31. package/dist/controls/FirstPersonControls.mjs +229 -0
  32. package/dist/controls/FlyControls.d.ts +32 -0
  33. package/dist/controls/FlyControls.js +248 -0
  34. package/dist/controls/FlyControls.mjs +248 -0
  35. package/dist/controls/OrbitControls.d.ts +63 -0
  36. package/dist/controls/OrbitControls.js +781 -0
  37. package/dist/controls/OrbitControls.mjs +781 -0
  38. package/dist/controls/PointerLockControls.d.ts +24 -0
  39. package/dist/controls/PointerLockControls.js +103 -0
  40. package/dist/controls/PointerLockControls.mjs +103 -0
  41. package/dist/controls/TrackballControls.d.ts +95 -0
  42. package/dist/controls/TrackballControls.js +502 -0
  43. package/dist/controls/TrackballControls.mjs +502 -0
  44. package/dist/controls/TransformControls.d.ts +151 -0
  45. package/dist/controls/TransformControls.js +1089 -0
  46. package/dist/controls/TransformControls.mjs +1089 -0
  47. package/dist/controls/experimental/CameraControls.d.ts +212 -0
  48. package/dist/controls/experimental/CameraControls.js +736 -0
  49. package/dist/controls/experimental/CameraControls.mjs +736 -0
  50. package/dist/csm/CSM.d.ts +61 -0
  51. package/dist/csm/CSM.js +244 -0
  52. package/dist/csm/CSM.mjs +244 -0
  53. package/dist/csm/CSMFrustum.d.ts +19 -0
  54. package/dist/csm/CSMFrustum.js +75 -0
  55. package/dist/csm/CSMFrustum.mjs +75 -0
  56. package/dist/csm/CSMHelper.d.ts +26 -0
  57. package/dist/csm/CSMHelper.js +114 -0
  58. package/dist/csm/CSMHelper.mjs +114 -0
  59. package/dist/csm/CSMShader.d.ts +4 -0
  60. package/dist/csm/CSMShader.js +257 -0
  61. package/dist/csm/CSMShader.mjs +257 -0
  62. package/dist/curves/CurveExtras.d.ts +68 -0
  63. package/dist/curves/CurveExtras.js +224 -0
  64. package/dist/curves/CurveExtras.mjs +224 -0
  65. package/dist/curves/NURBSCurve.d.ts +11 -0
  66. package/dist/curves/NURBSCurve.js +35 -0
  67. package/dist/curves/NURBSCurve.mjs +35 -0
  68. package/dist/curves/NURBSSurface.d.ts +13 -0
  69. package/dist/curves/NURBSSurface.js +28 -0
  70. package/dist/curves/NURBSSurface.mjs +28 -0
  71. package/dist/curves/NURBSUtils.d.ts +22 -0
  72. package/dist/curves/NURBSUtils.js +226 -0
  73. package/dist/curves/NURBSUtils.mjs +226 -0
  74. package/dist/custom.d.ts +5 -0
  75. package/dist/deprecated/Geometry.d.ts +342 -0
  76. package/dist/deprecated/Geometry.js +971 -0
  77. package/dist/deprecated/Geometry.mjs +971 -0
  78. package/dist/effects/AnaglyphEffect.d.ts +11 -0
  79. package/dist/effects/AnaglyphEffect.js +121 -0
  80. package/dist/effects/AnaglyphEffect.mjs +121 -0
  81. package/dist/effects/AsciiEffect.d.ts +18 -0
  82. package/dist/effects/AsciiEffect.js +173 -0
  83. package/dist/effects/AsciiEffect.mjs +173 -0
  84. package/dist/effects/OutlineEffect.d.ts +28 -0
  85. package/dist/effects/OutlineEffect.js +298 -0
  86. package/dist/effects/OutlineEffect.mjs +298 -0
  87. package/dist/effects/ParallaxBarrierEffect.d.ts +8 -0
  88. package/dist/effects/ParallaxBarrierEffect.js +64 -0
  89. package/dist/effects/ParallaxBarrierEffect.mjs +64 -0
  90. package/dist/effects/PeppersGhostEffect.d.ts +10 -0
  91. package/dist/effects/PeppersGhostEffect.js +85 -0
  92. package/dist/effects/PeppersGhostEffect.mjs +85 -0
  93. package/dist/effects/StereoEffect.d.ts +9 -0
  94. package/dist/effects/StereoEffect.js +32 -0
  95. package/dist/effects/StereoEffect.mjs +32 -0
  96. package/dist/environments/RoomEnvironment.d.ts +5 -0
  97. package/dist/environments/RoomEnvironment.js +95 -0
  98. package/dist/environments/RoomEnvironment.mjs +78 -0
  99. package/dist/exporters/ColladaExporter.d.ts +50 -0
  100. package/dist/exporters/ColladaExporter.js +331 -0
  101. package/dist/exporters/ColladaExporter.mjs +331 -0
  102. package/dist/exporters/DRACOExporter.d.ts +23 -0
  103. package/dist/exporters/DRACOExporter.js +141 -0
  104. package/dist/exporters/DRACOExporter.mjs +141 -0
  105. package/dist/exporters/GLTFExporter.d.ts +446 -0
  106. package/dist/exporters/GLTFExporter.js +1575 -0
  107. package/dist/exporters/GLTFExporter.mjs +1575 -0
  108. package/dist/exporters/MMDExporter.d.ts +12 -0
  109. package/dist/exporters/MMDExporter.js +131 -0
  110. package/dist/exporters/MMDExporter.mjs +131 -0
  111. package/dist/exporters/OBJExporter.d.ts +18 -0
  112. package/dist/exporters/OBJExporter.js +181 -0
  113. package/dist/exporters/OBJExporter.mjs +181 -0
  114. package/dist/exporters/PLYExporter.d.ts +23 -0
  115. package/dist/exporters/PLYExporter.js +280 -0
  116. package/dist/exporters/PLYExporter.mjs +280 -0
  117. package/dist/exporters/STLExporter.d.ts +31 -0
  118. package/dist/exporters/STLExporter.js +146 -0
  119. package/dist/exporters/STLExporter.mjs +146 -0
  120. package/dist/exporters/USDZExporter.d.ts +27 -0
  121. package/dist/exporters/USDZExporter.js +340 -0
  122. package/dist/exporters/USDZExporter.mjs +340 -0
  123. package/dist/geometries/BoxLineGeometry.d.ts +12 -0
  124. package/dist/geometries/BoxLineGeometry.js +45 -0
  125. package/dist/geometries/BoxLineGeometry.mjs +45 -0
  126. package/dist/geometries/ConvexGeometry.d.ts +5 -0
  127. package/dist/geometries/ConvexGeometry.js +29 -0
  128. package/dist/geometries/ConvexGeometry.mjs +29 -0
  129. package/dist/geometries/DecalGeometry.d.ts +10 -0
  130. package/dist/geometries/DecalGeometry.js +184 -0
  131. package/dist/geometries/DecalGeometry.mjs +184 -0
  132. package/dist/geometries/LightningStrike.d.ts +108 -0
  133. package/dist/geometries/LightningStrike.js +548 -0
  134. package/dist/geometries/LightningStrike.mjs +548 -0
  135. package/dist/geometries/ParametricGeometries.d.ts +26 -0
  136. package/dist/geometries/ParametricGeometries.js +129 -0
  137. package/dist/geometries/ParametricGeometries.mjs +129 -0
  138. package/dist/geometries/ParametricGeometry.d.ts +18 -0
  139. package/dist/geometries/ParametricGeometry.js +63 -0
  140. package/dist/geometries/ParametricGeometry.mjs +63 -0
  141. package/dist/geometries/RoundedBoxGeometry.d.ts +5 -0
  142. package/dist/geometries/RoundedBoxGeometry.js +91 -0
  143. package/dist/geometries/RoundedBoxGeometry.mjs +91 -0
  144. package/dist/geometries/TeapotGeometry.d.ts +13 -0
  145. package/dist/geometries/TeapotGeometry.js +1563 -0
  146. package/dist/geometries/TeapotGeometry.mjs +1563 -0
  147. package/dist/geometries/TextGeometry.d.ts +18 -0
  148. package/dist/geometries/TextGeometry.js +27 -0
  149. package/dist/geometries/TextGeometry.mjs +27 -0
  150. package/dist/helpers/LightProbeHelper.d.ts +10 -0
  151. package/dist/helpers/LightProbeHelper.js +73 -0
  152. package/dist/helpers/LightProbeHelper.mjs +73 -0
  153. package/dist/helpers/PositionalAudioHelper.d.ts +13 -0
  154. package/dist/helpers/PositionalAudioHelper.js +68 -0
  155. package/dist/helpers/PositionalAudioHelper.mjs +68 -0
  156. package/dist/helpers/RectAreaLightHelper.d.ts +10 -0
  157. package/dist/helpers/RectAreaLightHelper.js +44 -0
  158. package/dist/helpers/RectAreaLightHelper.mjs +44 -0
  159. package/dist/helpers/VertexNormalsHelper.d.ts +10 -0
  160. package/dist/helpers/VertexNormalsHelper.js +54 -0
  161. package/dist/helpers/VertexNormalsHelper.mjs +54 -0
  162. package/dist/helpers/VertexTangentsHelper.d.ts +10 -0
  163. package/dist/helpers/VertexTangentsHelper.js +45 -0
  164. package/dist/helpers/VertexTangentsHelper.mjs +45 -0
  165. package/dist/index.d.ts +325 -0
  166. package/dist/index.js +978 -0
  167. package/dist/index.mjs +978 -0
  168. package/dist/interactive/HTMLMesh.d.ts +6 -0
  169. package/dist/interactive/HTMLMesh.js +325 -0
  170. package/dist/interactive/HTMLMesh.mjs +325 -0
  171. package/dist/interactive/InteractiveGroup.d.ts +5 -0
  172. package/dist/interactive/InteractiveGroup.js +68 -0
  173. package/dist/interactive/InteractiveGroup.mjs +68 -0
  174. package/dist/interactive/SelectionBox.d.ts +15 -0
  175. package/dist/interactive/SelectionBox.js +137 -0
  176. package/dist/interactive/SelectionBox.mjs +137 -0
  177. package/dist/interactive/SelectionHelper.d.ts +17 -0
  178. package/dist/interactive/SelectionHelper.js +54 -0
  179. package/dist/interactive/SelectionHelper.mjs +54 -0
  180. package/dist/libs/MeshoptDecoder.d.ts +12 -0
  181. package/dist/libs/MeshoptDecoder.js +221 -0
  182. package/dist/libs/MeshoptDecoder.mjs +221 -0
  183. package/dist/libs/MotionControllers.d.ts +175 -0
  184. package/dist/libs/MotionControllers.js +325 -0
  185. package/dist/libs/MotionControllers.mjs +325 -0
  186. package/dist/lights/LightProbeGenerator.d.ts +6 -0
  187. package/dist/lights/LightProbeGenerator.js +145 -0
  188. package/dist/lights/LightProbeGenerator.mjs +145 -0
  189. package/dist/lights/RectAreaLightUniformsLib.d.ts +3 -0
  190. package/dist/lights/RectAreaLightUniformsLib.js +32842 -0
  191. package/dist/lights/RectAreaLightUniformsLib.mjs +32842 -0
  192. package/dist/lines/Line2.d.ts +11 -0
  193. package/dist/lines/Line2.js +13 -0
  194. package/dist/lines/Line2.mjs +13 -0
  195. package/dist/lines/LineGeometry.d.ts +10 -0
  196. package/dist/lines/LineGeometry.js +44 -0
  197. package/dist/lines/LineGeometry.mjs +44 -0
  198. package/dist/lines/LineMaterial.d.ts +31 -0
  199. package/dist/lines/LineMaterial.js +547 -0
  200. package/dist/lines/LineMaterial.mjs +547 -0
  201. package/dist/lines/LineSegments2.d.ts +14 -0
  202. package/dist/lines/LineSegments2.js +203 -0
  203. package/dist/lines/LineSegments2.mjs +203 -0
  204. package/dist/lines/LineSegmentsGeometry.d.ts +16 -0
  205. package/dist/lines/LineSegmentsGeometry.js +124 -0
  206. package/dist/lines/LineSegmentsGeometry.mjs +124 -0
  207. package/dist/lines/Wireframe.d.ts +11 -0
  208. package/dist/lines/Wireframe.js +32 -0
  209. package/dist/lines/Wireframe.mjs +32 -0
  210. package/dist/lines/WireframeGeometry2.d.ts +8 -0
  211. package/dist/lines/WireframeGeometry2.js +13 -0
  212. package/dist/lines/WireframeGeometry2.mjs +13 -0
  213. package/dist/loaders/3DMLoader.d.ts +17 -0
  214. package/dist/loaders/3DMLoader.js +803 -0
  215. package/dist/loaders/3DMLoader.mjs +803 -0
  216. package/dist/loaders/3MFLoader.d.ts +16 -0
  217. package/dist/loaders/3MFLoader.js +854 -0
  218. package/dist/loaders/3MFLoader.mjs +854 -0
  219. package/dist/loaders/AMFLoader.d.ts +14 -0
  220. package/dist/loaders/AMFLoader.js +284 -0
  221. package/dist/loaders/AMFLoader.mjs +284 -0
  222. package/dist/loaders/AssimpLoader.js +1396 -0
  223. package/dist/loaders/AssimpLoader.mjs +1396 -0
  224. package/dist/loaders/BVHLoader.d.ts +21 -0
  225. package/dist/loaders/BVHLoader.js +207 -0
  226. package/dist/loaders/BVHLoader.mjs +207 -0
  227. package/dist/loaders/BasisTextureLoader.d.ts +32 -0
  228. package/dist/loaders/BasisTextureLoader.js +480 -0
  229. package/dist/loaders/BasisTextureLoader.mjs +480 -0
  230. package/dist/loaders/ColladaLoader.d.ts +20 -0
  231. package/dist/loaders/ColladaLoader.js +2405 -0
  232. package/dist/loaders/ColladaLoader.mjs +2405 -0
  233. package/dist/loaders/DDSLoader.d.ts +16 -0
  234. package/dist/loaders/DDSLoader.js +148 -0
  235. package/dist/loaders/DDSLoader.mjs +148 -0
  236. package/dist/loaders/DRACOLoader.d.ts +18 -0
  237. package/dist/loaders/DRACOLoader.js +341 -0
  238. package/dist/loaders/DRACOLoader.mjs +341 -0
  239. package/dist/loaders/EXRLoader.d.ts +18 -0
  240. package/dist/loaders/EXRLoader.js +1354 -0
  241. package/dist/loaders/EXRLoader.mjs +1354 -0
  242. package/dist/loaders/FBXLoader.d.ts +14 -0
  243. package/dist/loaders/FBXLoader.js +2457 -0
  244. package/dist/loaders/FBXLoader.mjs +2457 -0
  245. package/dist/loaders/FontLoader.d.ts +36 -0
  246. package/dist/loaders/FontLoader.js +120 -0
  247. package/dist/loaders/FontLoader.mjs +120 -0
  248. package/dist/loaders/GCodeLoader.d.ts +15 -0
  249. package/dist/loaders/GCodeLoader.js +141 -0
  250. package/dist/loaders/GCodeLoader.mjs +141 -0
  251. package/dist/loaders/GLTFLoader.d.ts +153 -0
  252. package/dist/loaders/GLTFLoader.js +2459 -0
  253. package/dist/loaders/GLTFLoader.mjs +2459 -0
  254. package/dist/loaders/HDRCubeTextureLoader.d.ts +18 -0
  255. package/dist/loaders/HDRCubeTextureLoader.js +75 -0
  256. package/dist/loaders/HDRCubeTextureLoader.mjs +75 -0
  257. package/dist/loaders/KMZLoader.d.ts +16 -0
  258. package/dist/loaders/KMZLoader.js +75 -0
  259. package/dist/loaders/KMZLoader.mjs +75 -0
  260. package/dist/loaders/KTX2Loader.d.ts +16 -0
  261. package/dist/loaders/KTX2Loader.js +461 -0
  262. package/dist/loaders/KTX2Loader.mjs +461 -0
  263. package/dist/loaders/KTXLoader.d.ts +16 -0
  264. package/dist/loaders/KTXLoader.js +93 -0
  265. package/dist/loaders/KTXLoader.mjs +93 -0
  266. package/dist/loaders/LDrawLoader.d.ts +26 -0
  267. package/dist/loaders/LDrawLoader.js +1424 -0
  268. package/dist/loaders/LDrawLoader.mjs +1424 -0
  269. package/dist/loaders/LUT3dlLoader.d.ts +20 -0
  270. package/dist/loaders/LUT3dlLoader.js +103 -0
  271. package/dist/loaders/LUT3dlLoader.mjs +103 -0
  272. package/dist/loaders/LUTCubeLoader.d.ts +23 -0
  273. package/dist/loaders/LUTCubeLoader.js +107 -0
  274. package/dist/loaders/LUTCubeLoader.mjs +107 -0
  275. package/dist/loaders/LWOLoader.d.ts +26 -0
  276. package/dist/loaders/LWOLoader.js +645 -0
  277. package/dist/loaders/LWOLoader.mjs +645 -0
  278. package/dist/loaders/LottieLoader.d.ts +15 -0
  279. package/dist/loaders/LottieLoader.js +47 -0
  280. package/dist/loaders/LottieLoader.mjs +47 -0
  281. package/dist/loaders/MD2Loader.d.ts +14 -0
  282. package/dist/loaders/MD2Loader.js +359 -0
  283. package/dist/loaders/MD2Loader.mjs +359 -0
  284. package/dist/loaders/MDDLoader.d.ts +19 -0
  285. package/dist/loaders/MDDLoader.js +58 -0
  286. package/dist/loaders/MDDLoader.mjs +58 -0
  287. package/dist/loaders/MMDLoader.d.ts +63 -0
  288. package/dist/loaders/MMDLoader.js +1121 -0
  289. package/dist/loaders/MMDLoader.mjs +1121 -0
  290. package/dist/loaders/MTLLoader.d.ts +100 -0
  291. package/dist/loaders/MTLLoader.js +304 -0
  292. package/dist/loaders/MTLLoader.mjs +304 -0
  293. package/dist/loaders/NRRDLoader.d.ts +21 -0
  294. package/dist/loaders/NRRDLoader.js +401 -0
  295. package/dist/loaders/NRRDLoader.mjs +401 -0
  296. package/dist/loaders/NodeMaterialLoader.js +146 -0
  297. package/dist/loaders/NodeMaterialLoader.mjs +146 -0
  298. package/dist/loaders/OBJLoader.d.ts +17 -0
  299. package/dist/loaders/OBJLoader.js +487 -0
  300. package/dist/loaders/OBJLoader.mjs +487 -0
  301. package/dist/loaders/PCDLoader.d.ts +15 -0
  302. package/dist/loaders/PCDLoader.js +248 -0
  303. package/dist/loaders/PCDLoader.mjs +248 -0
  304. package/dist/loaders/PDBLoader.d.ts +22 -0
  305. package/dist/loaders/PDBLoader.js +247 -0
  306. package/dist/loaders/PDBLoader.mjs +247 -0
  307. package/dist/loaders/PLYLoader.d.ts +16 -0
  308. package/dist/loaders/PLYLoader.js +317 -0
  309. package/dist/loaders/PLYLoader.mjs +317 -0
  310. package/dist/loaders/PRWMLoader.d.ts +16 -0
  311. package/dist/loaders/PRWMLoader.js +160 -0
  312. package/dist/loaders/PRWMLoader.mjs +160 -0
  313. package/dist/loaders/PVRLoader.d.ts +16 -0
  314. package/dist/loaders/PVRLoader.js +131 -0
  315. package/dist/loaders/PVRLoader.mjs +131 -0
  316. package/dist/loaders/RGBELoader.d.ts +20 -0
  317. package/dist/loaders/RGBELoader.js +252 -0
  318. package/dist/loaders/RGBELoader.mjs +252 -0
  319. package/dist/loaders/RGBMLoader.d.ts +32 -0
  320. package/dist/loaders/RGBMLoader.js +998 -0
  321. package/dist/loaders/RGBMLoader.mjs +998 -0
  322. package/dist/loaders/STLLoader.d.ts +14 -0
  323. package/dist/loaders/STLLoader.js +190 -0
  324. package/dist/loaders/STLLoader.mjs +190 -0
  325. package/dist/loaders/SVGLoader.d.ts +63 -0
  326. package/dist/loaders/SVGLoader.js +1712 -0
  327. package/dist/loaders/SVGLoader.mjs +1712 -0
  328. package/dist/loaders/TDSLoader.d.ts +42 -0
  329. package/dist/loaders/TDSLoader.js +650 -0
  330. package/dist/loaders/TDSLoader.mjs +650 -0
  331. package/dist/loaders/TGALoader.d.ts +14 -0
  332. package/dist/loaders/TGALoader.js +285 -0
  333. package/dist/loaders/TGALoader.mjs +285 -0
  334. package/dist/loaders/TTFLoader.d.ts +15 -0
  335. package/dist/loaders/TTFLoader.js +131 -0
  336. package/dist/loaders/TTFLoader.mjs +131 -0
  337. package/dist/loaders/TiltLoader.d.ts +14 -0
  338. package/dist/loaders/TiltLoader.js +373 -0
  339. package/dist/loaders/TiltLoader.mjs +373 -0
  340. package/dist/loaders/VOXLoader.d.ts +28 -0
  341. package/dist/loaders/VOXLoader.js +432 -0
  342. package/dist/loaders/VOXLoader.mjs +432 -0
  343. package/dist/loaders/VRMLLoader.d.ts +14 -0
  344. package/dist/loaders/VRMLLoader.js +2105 -0
  345. package/dist/loaders/VRMLLoader.mjs +2105 -0
  346. package/dist/loaders/VRMLoader.js +38 -0
  347. package/dist/loaders/VRMLoader.mjs +38 -0
  348. package/dist/loaders/VTKLoader.d.ts +14 -0
  349. package/dist/loaders/VTKLoader.js +648 -0
  350. package/dist/loaders/VTKLoader.mjs +648 -0
  351. package/dist/loaders/XLoader.js +1258 -0
  352. package/dist/loaders/XLoader.mjs +1258 -0
  353. package/dist/loaders/XYZLoader.d.ts +14 -0
  354. package/dist/loaders/XYZLoader.js +60 -0
  355. package/dist/loaders/XYZLoader.mjs +60 -0
  356. package/dist/loaders/lwo/IFFParser.js +749 -0
  357. package/dist/loaders/lwo/IFFParser.mjs +749 -0
  358. package/dist/loaders/lwo/LWO2Parser.js +327 -0
  359. package/dist/loaders/lwo/LWO2Parser.mjs +327 -0
  360. package/dist/loaders/lwo/LWO3Parser.js +298 -0
  361. package/dist/loaders/lwo/LWO3Parser.mjs +298 -0
  362. package/dist/math/Capsule.d.ts +27 -0
  363. package/dist/math/Capsule.js +100 -0
  364. package/dist/math/Capsule.mjs +100 -0
  365. package/dist/math/ColorConverter.d.ts +21 -0
  366. package/dist/math/ColorConverter.js +52 -0
  367. package/dist/math/ColorConverter.mjs +52 -0
  368. package/dist/math/ConvexHull.d.ts +89 -0
  369. package/dist/math/ConvexHull.js +597 -0
  370. package/dist/math/ConvexHull.mjs +597 -0
  371. package/dist/math/ImprovedNoise.d.ts +4 -0
  372. package/dist/math/ImprovedNoise.js +302 -0
  373. package/dist/math/ImprovedNoise.mjs +302 -0
  374. package/dist/math/Lut.d.ts +27 -0
  375. package/dist/math/Lut.js +135 -0
  376. package/dist/math/Lut.mjs +135 -0
  377. package/dist/math/MeshSurfaceSampler.d.ts +15 -0
  378. package/dist/math/MeshSurfaceSampler.js +107 -0
  379. package/dist/math/MeshSurfaceSampler.mjs +107 -0
  380. package/dist/math/OBB.d.ts +24 -0
  381. package/dist/math/OBB.js +262 -0
  382. package/dist/math/OBB.mjs +262 -0
  383. package/dist/math/Octree.d.ts +24 -0
  384. package/dist/math/Octree.js +278 -0
  385. package/dist/math/Octree.mjs +278 -0
  386. package/dist/math/SimplexNoise.d.ts +21 -0
  387. package/dist/math/SimplexNoise.js +440 -0
  388. package/dist/math/SimplexNoise.mjs +440 -0
  389. package/dist/misc/ConvexObjectBreaker.d.ts +25 -0
  390. package/dist/misc/ConvexObjectBreaker.js +298 -0
  391. package/dist/misc/ConvexObjectBreaker.mjs +298 -0
  392. package/dist/misc/GPUComputationRenderer.d.ts +52 -0
  393. package/dist/misc/GPUComputationRenderer.js +171 -0
  394. package/dist/misc/GPUComputationRenderer.mjs +171 -0
  395. package/dist/misc/Gyroscope.d.ts +5 -0
  396. package/dist/misc/Gyroscope.js +35 -0
  397. package/dist/misc/Gyroscope.mjs +35 -0
  398. package/dist/misc/MD2Character.d.ts +33 -0
  399. package/dist/misc/MD2Character.js +165 -0
  400. package/dist/misc/MD2Character.mjs +165 -0
  401. package/dist/misc/MD2CharacterComplex.d.ts +47 -0
  402. package/dist/misc/MD2CharacterComplex.js +331 -0
  403. package/dist/misc/MD2CharacterComplex.mjs +331 -0
  404. package/dist/misc/MorphAnimMesh.d.ts +13 -0
  405. package/dist/misc/MorphAnimMesh.js +40 -0
  406. package/dist/misc/MorphAnimMesh.mjs +40 -0
  407. package/dist/misc/MorphBlendMesh.d.ts +21 -0
  408. package/dist/misc/MorphBlendMesh.js +179 -0
  409. package/dist/misc/MorphBlendMesh.mjs +179 -0
  410. package/dist/misc/ProgressiveLightmap.d.ts +61 -0
  411. package/dist/misc/ProgressiveLightmap.js +186 -0
  412. package/dist/misc/ProgressiveLightmap.mjs +186 -0
  413. package/dist/misc/RollerCoaster.d.ts +21 -0
  414. package/dist/misc/RollerCoaster.js +346 -0
  415. package/dist/misc/RollerCoaster.mjs +346 -0
  416. package/dist/misc/Timer.d.ts +27 -0
  417. package/dist/misc/Timer.js +101 -0
  418. package/dist/misc/Timer.mjs +101 -0
  419. package/dist/misc/TubePainter.d.ts +10 -0
  420. package/dist/misc/TubePainter.js +123 -0
  421. package/dist/misc/TubePainter.mjs +123 -0
  422. package/dist/misc/Volume.d.ts +37 -0
  423. package/dist/misc/Volume.js +302 -0
  424. package/dist/misc/Volume.mjs +302 -0
  425. package/dist/misc/VolumeSlice.d.ts +28 -0
  426. package/dist/misc/VolumeSlice.js +115 -0
  427. package/dist/misc/VolumeSlice.mjs +115 -0
  428. package/dist/misc/WebGL.d.ts +5 -0
  429. package/dist/misc/WebGL.js +74 -0
  430. package/dist/misc/WebGL.mjs +74 -0
  431. package/dist/modifiers/CurveModifier.d.ts +91 -0
  432. package/dist/modifiers/CurveModifier.js +232 -0
  433. package/dist/modifiers/CurveModifier.mjs +232 -0
  434. package/dist/modifiers/EdgeSplitModifier.d.ts +19 -0
  435. package/dist/modifiers/EdgeSplitModifier.js +167 -0
  436. package/dist/modifiers/EdgeSplitModifier.mjs +168 -0
  437. package/dist/modifiers/SimplifyModifier.d.ts +19 -0
  438. package/dist/modifiers/SimplifyModifier.js +300 -0
  439. package/dist/modifiers/SimplifyModifier.mjs +300 -0
  440. package/dist/modifiers/TessellateModifier.d.ts +11 -0
  441. package/dist/modifiers/TessellateModifier.js +214 -0
  442. package/dist/modifiers/TessellateModifier.mjs +214 -0
  443. package/dist/nodes/Nodes.js +347 -0
  444. package/dist/nodes/Nodes.mjs +347 -0
  445. package/dist/nodes/ShaderNode.js +408 -0
  446. package/dist/nodes/ShaderNode.mjs +408 -0
  447. package/dist/nodes/accessors/BufferNode.js +14 -0
  448. package/dist/nodes/accessors/BufferNode.mjs +15 -0
  449. package/dist/nodes/accessors/CameraNode.js +43 -0
  450. package/dist/nodes/accessors/CameraNode.mjs +44 -0
  451. package/dist/nodes/accessors/CubeTextureNode.js +41 -0
  452. package/dist/nodes/accessors/CubeTextureNode.mjs +42 -0
  453. package/dist/nodes/accessors/MaterialNode.js +70 -0
  454. package/dist/nodes/accessors/MaterialNode.mjs +71 -0
  455. package/dist/nodes/accessors/MaterialReferenceNode.js +13 -0
  456. package/dist/nodes/accessors/MaterialReferenceNode.mjs +14 -0
  457. package/dist/nodes/accessors/ModelNode.js +8 -0
  458. package/dist/nodes/accessors/ModelNode.mjs +9 -0
  459. package/dist/nodes/accessors/ModelViewProjectionNode.js +23 -0
  460. package/dist/nodes/accessors/ModelViewProjectionNode.mjs +24 -0
  461. package/dist/nodes/accessors/NormalNode.js +61 -0
  462. package/dist/nodes/accessors/NormalNode.mjs +62 -0
  463. package/dist/nodes/accessors/Object3DNode.js +75 -0
  464. package/dist/nodes/accessors/Object3DNode.mjs +76 -0
  465. package/dist/nodes/accessors/PointUVNode.js +12 -0
  466. package/dist/nodes/accessors/PointUVNode.mjs +13 -0
  467. package/dist/nodes/accessors/PositionNode.js +64 -0
  468. package/dist/nodes/accessors/PositionNode.mjs +65 -0
  469. package/dist/nodes/accessors/ReferenceNode.js +36 -0
  470. package/dist/nodes/accessors/ReferenceNode.mjs +37 -0
  471. package/dist/nodes/accessors/ReflectNode.js +42 -0
  472. package/dist/nodes/accessors/ReflectNode.mjs +43 -0
  473. package/dist/nodes/accessors/SkinningNode.js +57 -0
  474. package/dist/nodes/accessors/SkinningNode.mjs +58 -0
  475. package/dist/nodes/accessors/TextureNode.js +53 -0
  476. package/dist/nodes/accessors/TextureNode.mjs +54 -0
  477. package/dist/nodes/accessors/UVNode.js +22 -0
  478. package/dist/nodes/accessors/UVNode.mjs +23 -0
  479. package/dist/nodes/core/ArrayUniformNode.js +13 -0
  480. package/dist/nodes/core/ArrayUniformNode.mjs +14 -0
  481. package/dist/nodes/core/AttributeNode.js +29 -0
  482. package/dist/nodes/core/AttributeNode.mjs +30 -0
  483. package/dist/nodes/core/BypassNode.js +21 -0
  484. package/dist/nodes/core/BypassNode.mjs +22 -0
  485. package/dist/nodes/core/CodeNode.js +27 -0
  486. package/dist/nodes/core/CodeNode.mjs +28 -0
  487. package/dist/nodes/core/ConstNode.js +13 -0
  488. package/dist/nodes/core/ConstNode.mjs +14 -0
  489. package/dist/nodes/core/ContextNode.js +21 -0
  490. package/dist/nodes/core/ContextNode.mjs +22 -0
  491. package/dist/nodes/core/ExpressionNode.js +18 -0
  492. package/dist/nodes/core/ExpressionNode.mjs +19 -0
  493. package/dist/nodes/core/FunctionCallNode.js +36 -0
  494. package/dist/nodes/core/FunctionCallNode.mjs +37 -0
  495. package/dist/nodes/core/FunctionNode.js +55 -0
  496. package/dist/nodes/core/FunctionNode.mjs +56 -0
  497. package/dist/nodes/core/InputNode.js +37 -0
  498. package/dist/nodes/core/InputNode.mjs +38 -0
  499. package/dist/nodes/core/Node.js +138 -0
  500. package/dist/nodes/core/Node.mjs +139 -0
  501. package/dist/nodes/core/NodeAttribute.js +9 -0
  502. package/dist/nodes/core/NodeAttribute.mjs +10 -0
  503. package/dist/nodes/core/NodeBuilder.js +402 -0
  504. package/dist/nodes/core/NodeBuilder.mjs +402 -0
  505. package/dist/nodes/core/NodeCode.js +10 -0
  506. package/dist/nodes/core/NodeCode.mjs +11 -0
  507. package/dist/nodes/core/NodeFrame.js +34 -0
  508. package/dist/nodes/core/NodeFrame.mjs +35 -0
  509. package/dist/nodes/core/NodeFunctionInput.js +12 -0
  510. package/dist/nodes/core/NodeFunctionInput.mjs +13 -0
  511. package/dist/nodes/core/NodeKeywords.js +43 -0
  512. package/dist/nodes/core/NodeKeywords.mjs +44 -0
  513. package/dist/nodes/core/NodeUniform.js +17 -0
  514. package/dist/nodes/core/NodeUniform.mjs +18 -0
  515. package/dist/nodes/core/NodeUtils.js +57 -0
  516. package/dist/nodes/core/NodeUtils.mjs +57 -0
  517. package/dist/nodes/core/NodeVar.js +9 -0
  518. package/dist/nodes/core/NodeVar.mjs +10 -0
  519. package/dist/nodes/core/NodeVary.js +9 -0
  520. package/dist/nodes/core/NodeVary.mjs +10 -0
  521. package/dist/nodes/core/PropertyNode.js +20 -0
  522. package/dist/nodes/core/PropertyNode.mjs +21 -0
  523. package/dist/nodes/core/TempNode.js +24 -0
  524. package/dist/nodes/core/TempNode.mjs +25 -0
  525. package/dist/nodes/core/UniformNode.js +22 -0
  526. package/dist/nodes/core/UniformNode.mjs +23 -0
  527. package/dist/nodes/core/VarNode.js +30 -0
  528. package/dist/nodes/core/VarNode.mjs +31 -0
  529. package/dist/nodes/core/VaryNode.js +29 -0
  530. package/dist/nodes/core/VaryNode.mjs +30 -0
  531. package/dist/nodes/core/constants.js +24 -0
  532. package/dist/nodes/core/constants.mjs +24 -0
  533. package/dist/nodes/display/ColorSpaceNode.js +62 -0
  534. package/dist/nodes/display/ColorSpaceNode.mjs +62 -0
  535. package/dist/nodes/display/NormalMapNode.js +53 -0
  536. package/dist/nodes/display/NormalMapNode.mjs +54 -0
  537. package/dist/nodes/fog/FogNode.js +14 -0
  538. package/dist/nodes/fog/FogNode.mjs +15 -0
  539. package/dist/nodes/fog/FogRangeNode.js +16 -0
  540. package/dist/nodes/fog/FogRangeNode.mjs +17 -0
  541. package/dist/nodes/functions/BSDFs.js +64 -0
  542. package/dist/nodes/functions/BSDFs.mjs +64 -0
  543. package/dist/nodes/lights/LightContextNode.js +34 -0
  544. package/dist/nodes/lights/LightContextNode.mjs +35 -0
  545. package/dist/nodes/lights/LightNode.js +57 -0
  546. package/dist/nodes/lights/LightNode.mjs +58 -0
  547. package/dist/nodes/lights/LightsNode.js +58 -0
  548. package/dist/nodes/lights/LightsNode.mjs +59 -0
  549. package/dist/nodes/loaders/NodeLoader.js +195 -0
  550. package/dist/nodes/loaders/NodeLoader.mjs +196 -0
  551. package/dist/nodes/loaders/NodeMaterialLoader.js +23 -0
  552. package/dist/nodes/loaders/NodeMaterialLoader.mjs +24 -0
  553. package/dist/nodes/loaders/NodeObjectLoader.js +39 -0
  554. package/dist/nodes/loaders/NodeObjectLoader.mjs +40 -0
  555. package/dist/nodes/materials/LineBasicNodeMaterial.js +26 -0
  556. package/dist/nodes/materials/LineBasicNodeMaterial.mjs +27 -0
  557. package/dist/nodes/materials/Materials.js +24 -0
  558. package/dist/nodes/materials/Materials.mjs +24 -0
  559. package/dist/nodes/materials/MeshBasicNodeMaterial.js +27 -0
  560. package/dist/nodes/materials/MeshBasicNodeMaterial.mjs +28 -0
  561. package/dist/nodes/materials/MeshStandardNodeMaterial.js +40 -0
  562. package/dist/nodes/materials/MeshStandardNodeMaterial.mjs +41 -0
  563. package/dist/nodes/materials/NodeMaterial.js +63 -0
  564. package/dist/nodes/materials/NodeMaterial.mjs +64 -0
  565. package/dist/nodes/materials/PointsNodeMaterial.js +29 -0
  566. package/dist/nodes/materials/PointsNodeMaterial.mjs +30 -0
  567. package/dist/nodes/math/CondNode.js +40 -0
  568. package/dist/nodes/math/CondNode.mjs +41 -0
  569. package/dist/nodes/math/MathNode.js +165 -0
  570. package/dist/nodes/math/MathNode.mjs +166 -0
  571. package/dist/nodes/math/OperatorNode.js +102 -0
  572. package/dist/nodes/math/OperatorNode.mjs +103 -0
  573. package/dist/nodes/procedural/CheckerNode.js +20 -0
  574. package/dist/nodes/procedural/CheckerNode.mjs +21 -0
  575. package/dist/nodes/utils/ArrayElementNode.js +18 -0
  576. package/dist/nodes/utils/ArrayElementNode.mjs +19 -0
  577. package/dist/nodes/utils/ConvertNode.js +24 -0
  578. package/dist/nodes/utils/ConvertNode.mjs +25 -0
  579. package/dist/nodes/utils/JoinNode.js +25 -0
  580. package/dist/nodes/utils/JoinNode.mjs +26 -0
  581. package/dist/nodes/utils/MatcapUVNode.js +15 -0
  582. package/dist/nodes/utils/MatcapUVNode.mjs +16 -0
  583. package/dist/nodes/utils/OscNode.js +49 -0
  584. package/dist/nodes/utils/OscNode.mjs +50 -0
  585. package/dist/nodes/utils/SplitNode.js +44 -0
  586. package/dist/nodes/utils/SplitNode.mjs +45 -0
  587. package/dist/nodes/utils/SpriteSheetUVNode.js +39 -0
  588. package/dist/nodes/utils/SpriteSheetUVNode.mjs +40 -0
  589. package/dist/nodes/utils/TimerNode.js +43 -0
  590. package/dist/nodes/utils/TimerNode.mjs +44 -0
  591. package/dist/objects/GroundProjectedEnv.d.ts +12 -0
  592. package/dist/objects/GroundProjectedEnv.js +134 -0
  593. package/dist/objects/GroundProjectedEnv.mjs +134 -0
  594. package/dist/objects/Lensflare.d.ts +17 -0
  595. package/dist/objects/Lensflare.js +280 -0
  596. package/dist/objects/Lensflare.mjs +280 -0
  597. package/dist/objects/LightningStorm.d.ts +32 -0
  598. package/dist/objects/LightningStorm.js +110 -0
  599. package/dist/objects/LightningStorm.mjs +110 -0
  600. package/dist/objects/MarchingCubes.d.ts +75 -0
  601. package/dist/objects/MarchingCubes.js +457 -0
  602. package/dist/objects/MarchingCubes.mjs +457 -0
  603. package/dist/objects/Reflector.d.ts +19 -0
  604. package/dist/objects/Reflector.js +175 -0
  605. package/dist/objects/Reflector.mjs +175 -0
  606. package/dist/objects/ReflectorForSSRPass.d.ts +48 -0
  607. package/dist/objects/ReflectorForSSRPass.js +256 -0
  608. package/dist/objects/ReflectorForSSRPass.mjs +256 -0
  609. package/dist/objects/ReflectorRTT.js +10 -0
  610. package/dist/objects/ReflectorRTT.mjs +10 -0
  611. package/dist/objects/Refractor.d.ts +19 -0
  612. package/dist/objects/Refractor.js +188 -0
  613. package/dist/objects/Refractor.mjs +188 -0
  614. package/dist/objects/ShadowMesh.d.ts +7 -0
  615. package/dist/objects/ShadowMesh.js +41 -0
  616. package/dist/objects/ShadowMesh.mjs +41 -0
  617. package/dist/objects/Sky.d.ts +43 -0
  618. package/dist/objects/Sky.js +156 -0
  619. package/dist/objects/Sky.mjs +156 -0
  620. package/dist/objects/Water.d.ts +22 -0
  621. package/dist/objects/Water.js +241 -0
  622. package/dist/objects/Water.mjs +241 -0
  623. package/dist/objects/Water2.d.ts +22 -0
  624. package/dist/objects/Water2.js +258 -0
  625. package/dist/objects/Water2.mjs +258 -0
  626. package/dist/offscreen/jank.js +26 -0
  627. package/dist/offscreen/jank.mjs +27 -0
  628. package/dist/offscreen/offscreen.js +8 -0
  629. package/dist/offscreen/offscreen.mjs +7 -0
  630. package/dist/offscreen/scene.js +68 -0
  631. package/dist/offscreen/scene.mjs +52 -0
  632. package/dist/physics/AmmoPhysics.d.ts +7 -0
  633. package/dist/physics/AmmoPhysics.js +166 -0
  634. package/dist/physics/AmmoPhysics.mjs +166 -0
  635. package/dist/postprocessing/AdaptiveToneMappingPass.d.ts +29 -0
  636. package/dist/postprocessing/AdaptiveToneMappingPass.js +225 -0
  637. package/dist/postprocessing/AdaptiveToneMappingPass.mjs +225 -0
  638. package/dist/postprocessing/AfterimagePass.d.ts +15 -0
  639. package/dist/postprocessing/AfterimagePass.js +68 -0
  640. package/dist/postprocessing/AfterimagePass.mjs +68 -0
  641. package/dist/postprocessing/BloomPass.d.ts +16 -0
  642. package/dist/postprocessing/BloomPass.js +109 -0
  643. package/dist/postprocessing/BloomPass.mjs +109 -0
  644. package/dist/postprocessing/BokehPass.d.ts +26 -0
  645. package/dist/postprocessing/BokehPass.js +90 -0
  646. package/dist/postprocessing/BokehPass.mjs +90 -0
  647. package/dist/postprocessing/ClearPass.d.ts +10 -0
  648. package/dist/postprocessing/ClearPass.js +36 -0
  649. package/dist/postprocessing/ClearPass.mjs +36 -0
  650. package/dist/postprocessing/CubeTexturePass.d.ts +14 -0
  651. package/dist/postprocessing/CubeTexturePass.js +49 -0
  652. package/dist/postprocessing/CubeTexturePass.mjs +49 -0
  653. package/dist/postprocessing/DotScreenPass.d.ts +10 -0
  654. package/dist/postprocessing/DotScreenPass.js +49 -0
  655. package/dist/postprocessing/DotScreenPass.mjs +49 -0
  656. package/dist/postprocessing/EffectComposer.d.ts +27 -0
  657. package/dist/postprocessing/EffectComposer.js +156 -0
  658. package/dist/postprocessing/EffectComposer.mjs +156 -0
  659. package/dist/postprocessing/FilmPass.d.ts +10 -0
  660. package/dist/postprocessing/FilmPass.js +51 -0
  661. package/dist/postprocessing/FilmPass.mjs +51 -0
  662. package/dist/postprocessing/GlitchPass.d.ts +15 -0
  663. package/dist/postprocessing/GlitchPass.js +84 -0
  664. package/dist/postprocessing/GlitchPass.mjs +84 -0
  665. package/dist/postprocessing/HalftonePass.d.ts +26 -0
  666. package/dist/postprocessing/HalftonePass.js +53 -0
  667. package/dist/postprocessing/HalftonePass.mjs +53 -0
  668. package/dist/postprocessing/LUTPass.d.ts +13 -0
  669. package/dist/postprocessing/LUTPass.js +142 -0
  670. package/dist/postprocessing/LUTPass.mjs +142 -0
  671. package/dist/postprocessing/MaskPass.d.ts +14 -0
  672. package/dist/postprocessing/MaskPass.js +69 -0
  673. package/dist/postprocessing/MaskPass.mjs +69 -0
  674. package/dist/postprocessing/OutlinePass.d.ts +53 -0
  675. package/dist/postprocessing/OutlinePass.js +479 -0
  676. package/dist/postprocessing/OutlinePass.mjs +479 -0
  677. package/dist/postprocessing/Pass.d.ts +20 -0
  678. package/dist/postprocessing/Pass.js +48 -0
  679. package/dist/postprocessing/Pass.mjs +48 -0
  680. package/dist/postprocessing/RenderPass.d.ts +14 -0
  681. package/dist/postprocessing/RenderPass.js +59 -0
  682. package/dist/postprocessing/RenderPass.mjs +59 -0
  683. package/dist/postprocessing/RenderPixelatedPass.js +199 -0
  684. package/dist/postprocessing/RenderPixelatedPass.mjs +199 -0
  685. package/dist/postprocessing/SAOPass.d.ts +79 -0
  686. package/dist/postprocessing/SAOPass.js +282 -0
  687. package/dist/postprocessing/SAOPass.mjs +282 -0
  688. package/dist/postprocessing/SMAAPass.d.ts +21 -0
  689. package/dist/postprocessing/SMAAPass.js +112 -0
  690. package/dist/postprocessing/SMAAPass.mjs +112 -0
  691. package/dist/postprocessing/SSAARenderPass.d.ts +17 -0
  692. package/dist/postprocessing/SSAARenderPass.js +171 -0
  693. package/dist/postprocessing/SSAARenderPass.mjs +171 -0
  694. package/dist/postprocessing/SSAOPass.d.ts +71 -0
  695. package/dist/postprocessing/SSAOPass.js +265 -0
  696. package/dist/postprocessing/SSAOPass.mjs +265 -0
  697. package/dist/postprocessing/SSRPass.d.ts +124 -0
  698. package/dist/postprocessing/SSRPass.js +438 -0
  699. package/dist/postprocessing/SSRPass.mjs +438 -0
  700. package/dist/postprocessing/SavePass.d.ts +12 -0
  701. package/dist/postprocessing/SavePass.js +37 -0
  702. package/dist/postprocessing/SavePass.mjs +37 -0
  703. package/dist/postprocessing/ShaderPass.d.ts +13 -0
  704. package/dist/postprocessing/ShaderPass.js +49 -0
  705. package/dist/postprocessing/ShaderPass.mjs +49 -0
  706. package/dist/postprocessing/TAARenderPass.d.ts +8 -0
  707. package/dist/postprocessing/TAARenderPass.js +89 -0
  708. package/dist/postprocessing/TAARenderPass.mjs +89 -0
  709. package/dist/postprocessing/TexturePass.d.ts +12 -0
  710. package/dist/postprocessing/TexturePass.js +39 -0
  711. package/dist/postprocessing/TexturePass.mjs +39 -0
  712. package/dist/postprocessing/UnrealBloomPass.d.ts +31 -0
  713. package/dist/postprocessing/UnrealBloomPass.js +220 -0
  714. package/dist/postprocessing/UnrealBloomPass.mjs +220 -0
  715. package/dist/postprocessing/WaterPass.d.ts +30 -0
  716. package/dist/postprocessing/WaterPass.js +72 -0
  717. package/dist/postprocessing/WaterPass.mjs +72 -0
  718. package/dist/renderers/CSS2DRenderer.d.ts +22 -0
  719. package/dist/renderers/CSS2DRenderer.js +121 -0
  720. package/dist/renderers/CSS2DRenderer.mjs +121 -0
  721. package/dist/renderers/CSS3DRenderer.d.ts +26 -0
  722. package/dist/renderers/CSS3DRenderer.js +133 -0
  723. package/dist/renderers/CSS3DRenderer.mjs +133 -0
  724. package/dist/renderers/Projector.d.ts +60 -0
  725. package/dist/renderers/Projector.js +511 -0
  726. package/dist/renderers/Projector.mjs +511 -0
  727. package/dist/renderers/SVGRenderer.d.ts +25 -0
  728. package/dist/renderers/SVGRenderer.js +306 -0
  729. package/dist/renderers/SVGRenderer.mjs +306 -0
  730. package/dist/renderers/nodes/accessors/CameraNode.js +62 -0
  731. package/dist/renderers/nodes/accessors/CameraNode.mjs +63 -0
  732. package/dist/renderers/nodes/accessors/ModelNode.js +60 -0
  733. package/dist/renderers/nodes/accessors/ModelNode.mjs +61 -0
  734. package/dist/renderers/nodes/accessors/ModelViewProjectionNode.js +20 -0
  735. package/dist/renderers/nodes/accessors/ModelViewProjectionNode.mjs +21 -0
  736. package/dist/renderers/nodes/accessors/NormalNode.js +60 -0
  737. package/dist/renderers/nodes/accessors/NormalNode.mjs +61 -0
  738. package/dist/renderers/nodes/accessors/PositionNode.js +29 -0
  739. package/dist/renderers/nodes/accessors/PositionNode.mjs +30 -0
  740. package/dist/renderers/nodes/accessors/UVNode.js +12 -0
  741. package/dist/renderers/nodes/accessors/UVNode.mjs +13 -0
  742. package/dist/renderers/nodes/core/AttributeNode.js +34 -0
  743. package/dist/renderers/nodes/core/AttributeNode.mjs +35 -0
  744. package/dist/renderers/nodes/core/InputNode.js +30 -0
  745. package/dist/renderers/nodes/core/InputNode.mjs +31 -0
  746. package/dist/renderers/nodes/core/Node.js +33 -0
  747. package/dist/renderers/nodes/core/Node.mjs +34 -0
  748. package/dist/renderers/nodes/core/NodeAttribute.js +9 -0
  749. package/dist/renderers/nodes/core/NodeAttribute.mjs +10 -0
  750. package/dist/renderers/nodes/core/NodeBuilder.js +248 -0
  751. package/dist/renderers/nodes/core/NodeBuilder.mjs +249 -0
  752. package/dist/renderers/nodes/core/NodeFrame.js +34 -0
  753. package/dist/renderers/nodes/core/NodeFrame.mjs +35 -0
  754. package/dist/renderers/nodes/core/NodeSlot.js +9 -0
  755. package/dist/renderers/nodes/core/NodeSlot.mjs +10 -0
  756. package/dist/renderers/nodes/core/NodeUniform.js +17 -0
  757. package/dist/renderers/nodes/core/NodeUniform.mjs +18 -0
  758. package/dist/renderers/nodes/core/NodeVary.js +10 -0
  759. package/dist/renderers/nodes/core/NodeVary.mjs +11 -0
  760. package/dist/renderers/nodes/core/VaryNode.js +21 -0
  761. package/dist/renderers/nodes/core/VaryNode.mjs +22 -0
  762. package/dist/renderers/nodes/core/constants.js +22 -0
  763. package/dist/renderers/nodes/core/constants.mjs +22 -0
  764. package/dist/renderers/nodes/inputs/ColorNode.js +10 -0
  765. package/dist/renderers/nodes/inputs/ColorNode.mjs +11 -0
  766. package/dist/renderers/nodes/inputs/FloatNode.js +10 -0
  767. package/dist/renderers/nodes/inputs/FloatNode.mjs +11 -0
  768. package/dist/renderers/nodes/inputs/Matrix3Node.js +11 -0
  769. package/dist/renderers/nodes/inputs/Matrix3Node.mjs +12 -0
  770. package/dist/renderers/nodes/inputs/Matrix4Node.js +11 -0
  771. package/dist/renderers/nodes/inputs/Matrix4Node.mjs +12 -0
  772. package/dist/renderers/nodes/inputs/TextureNode.js +19 -0
  773. package/dist/renderers/nodes/inputs/TextureNode.mjs +20 -0
  774. package/dist/renderers/nodes/inputs/Vector2Node.js +10 -0
  775. package/dist/renderers/nodes/inputs/Vector2Node.mjs +11 -0
  776. package/dist/renderers/nodes/inputs/Vector3Node.js +11 -0
  777. package/dist/renderers/nodes/inputs/Vector3Node.mjs +12 -0
  778. package/dist/renderers/nodes/inputs/Vector4Node.js +11 -0
  779. package/dist/renderers/nodes/inputs/Vector4Node.mjs +12 -0
  780. package/dist/renderers/nodes/math/MathNode.js +54 -0
  781. package/dist/renderers/nodes/math/MathNode.mjs +55 -0
  782. package/dist/renderers/nodes/math/OperatorNode.js +41 -0
  783. package/dist/renderers/nodes/math/OperatorNode.mjs +42 -0
  784. package/dist/renderers/nodes/utils/SwitchNode.js +19 -0
  785. package/dist/renderers/nodes/utils/SwitchNode.mjs +20 -0
  786. package/dist/renderers/nodes/utils/TimerNode.js +13 -0
  787. package/dist/renderers/nodes/utils/TimerNode.mjs +14 -0
  788. package/dist/renderers/webgpu/WebGPU.js +23 -0
  789. package/dist/renderers/webgpu/WebGPU.mjs +24 -0
  790. package/dist/renderers/webgpu/WebGPUAttributes.js +68 -0
  791. package/dist/renderers/webgpu/WebGPUAttributes.mjs +69 -0
  792. package/dist/renderers/webgpu/WebGPUBackground.js +60 -0
  793. package/dist/renderers/webgpu/WebGPUBackground.mjs +61 -0
  794. package/dist/renderers/webgpu/WebGPUBinding.js +13 -0
  795. package/dist/renderers/webgpu/WebGPUBinding.mjs +14 -0
  796. package/dist/renderers/webgpu/WebGPUBindings.js +154 -0
  797. package/dist/renderers/webgpu/WebGPUBindings.mjs +155 -0
  798. package/dist/renderers/webgpu/WebGPUComputePipelines.js +43 -0
  799. package/dist/renderers/webgpu/WebGPUComputePipelines.mjs +44 -0
  800. package/dist/renderers/webgpu/WebGPUGeometries.js +40 -0
  801. package/dist/renderers/webgpu/WebGPUGeometries.mjs +41 -0
  802. package/dist/renderers/webgpu/WebGPUInfo.js +45 -0
  803. package/dist/renderers/webgpu/WebGPUInfo.mjs +46 -0
  804. package/dist/renderers/webgpu/WebGPUObjects.js +24 -0
  805. package/dist/renderers/webgpu/WebGPUObjects.mjs +25 -0
  806. package/dist/renderers/webgpu/WebGPUProperties.js +21 -0
  807. package/dist/renderers/webgpu/WebGPUProperties.mjs +22 -0
  808. package/dist/renderers/webgpu/WebGPURenderLists.js +118 -0
  809. package/dist/renderers/webgpu/WebGPURenderLists.mjs +119 -0
  810. package/dist/renderers/webgpu/WebGPURenderPipelines.js +545 -0
  811. package/dist/renderers/webgpu/WebGPURenderPipelines.mjs +546 -0
  812. package/dist/renderers/webgpu/WebGPURenderer.js +596 -0
  813. package/dist/renderers/webgpu/WebGPURenderer.mjs +575 -0
  814. package/dist/renderers/webgpu/WebGPUSampledTexture.js +40 -0
  815. package/dist/renderers/webgpu/WebGPUSampledTexture.mjs +40 -0
  816. package/dist/renderers/webgpu/WebGPUSampler.js +14 -0
  817. package/dist/renderers/webgpu/WebGPUSampler.mjs +15 -0
  818. package/dist/renderers/webgpu/WebGPUStorageBuffer.js +14 -0
  819. package/dist/renderers/webgpu/WebGPUStorageBuffer.mjs +15 -0
  820. package/dist/renderers/webgpu/WebGPUTextureRenderer.js +22 -0
  821. package/dist/renderers/webgpu/WebGPUTextureRenderer.mjs +23 -0
  822. package/dist/renderers/webgpu/WebGPUTextureUtils.js +97 -0
  823. package/dist/renderers/webgpu/WebGPUTextureUtils.mjs +98 -0
  824. package/dist/renderers/webgpu/WebGPUTextures.js +483 -0
  825. package/dist/renderers/webgpu/WebGPUTextures.mjs +484 -0
  826. package/dist/renderers/webgpu/WebGPUUniform.js +81 -0
  827. package/dist/renderers/webgpu/WebGPUUniform.mjs +81 -0
  828. package/dist/renderers/webgpu/WebGPUUniformsGroup.js +175 -0
  829. package/dist/renderers/webgpu/WebGPUUniformsGroup.mjs +176 -0
  830. package/dist/renderers/webgpu/constants.js +241 -0
  831. package/dist/renderers/webgpu/constants.mjs +241 -0
  832. package/dist/renderers/webgpu/nodes/ShaderLib.js +41 -0
  833. package/dist/renderers/webgpu/nodes/ShaderLib.mjs +42 -0
  834. package/dist/renderers/webgpu/nodes/WebGPUNodeBuilder.js +164 -0
  835. package/dist/renderers/webgpu/nodes/WebGPUNodeBuilder.mjs +165 -0
  836. package/dist/renderers/webgpu/nodes/WebGPUNodeUniform.js +73 -0
  837. package/dist/renderers/webgpu/nodes/WebGPUNodeUniform.mjs +73 -0
  838. package/dist/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +14 -0
  839. package/dist/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.mjs +15 -0
  840. package/dist/renderers/webgpu/nodes/WebGPUNodes.js +39 -0
  841. package/dist/renderers/webgpu/nodes/WebGPUNodes.mjs +40 -0
  842. package/dist/shaders/ACESFilmicToneMappingShader.d.ts +16 -0
  843. package/dist/shaders/ACESFilmicToneMappingShader.js +55 -0
  844. package/dist/shaders/ACESFilmicToneMappingShader.mjs +55 -0
  845. package/dist/shaders/AfterimageShader.d.ts +15 -0
  846. package/dist/shaders/AfterimageShader.js +32 -0
  847. package/dist/shaders/AfterimageShader.mjs +32 -0
  848. package/dist/shaders/BasicShader.d.ts +8 -0
  849. package/dist/shaders/BasicShader.js +12 -0
  850. package/dist/shaders/BasicShader.mjs +12 -0
  851. package/dist/shaders/BleachBypassShader.d.ts +14 -0
  852. package/dist/shaders/BleachBypassShader.js +35 -0
  853. package/dist/shaders/BleachBypassShader.mjs +35 -0
  854. package/dist/shaders/BlendShader.d.ts +21 -0
  855. package/dist/shaders/BlendShader.js +30 -0
  856. package/dist/shaders/BlendShader.mjs +30 -0
  857. package/dist/shaders/BokehShader.d.ts +24 -0
  858. package/dist/shaders/BokehShader.js +109 -0
  859. package/dist/shaders/BokehShader.mjs +109 -0
  860. package/dist/shaders/BokehShader2.d.ts +50 -0
  861. package/dist/shaders/BokehShader2.js +269 -0
  862. package/dist/shaders/BokehShader2.mjs +269 -0
  863. package/dist/shaders/BrightnessContrastShader.d.ts +21 -0
  864. package/dist/shaders/BrightnessContrastShader.js +32 -0
  865. package/dist/shaders/BrightnessContrastShader.mjs +32 -0
  866. package/dist/shaders/ColorCorrectionShader.d.ts +22 -0
  867. package/dist/shaders/ColorCorrectionShader.js +30 -0
  868. package/dist/shaders/ColorCorrectionShader.mjs +30 -0
  869. package/dist/shaders/ColorifyShader.d.ts +16 -0
  870. package/dist/shaders/ColorifyShader.js +28 -0
  871. package/dist/shaders/ColorifyShader.mjs +28 -0
  872. package/dist/shaders/ConvolutionShader.d.ts +21 -0
  873. package/dist/shaders/ConvolutionShader.js +55 -0
  874. package/dist/shaders/ConvolutionShader.mjs +55 -0
  875. package/dist/shaders/CopyShader.d.ts +12 -0
  876. package/dist/shaders/CopyShader.js +25 -0
  877. package/dist/shaders/CopyShader.mjs +25 -0
  878. package/dist/shaders/DOFMipMapShader.d.ts +23 -0
  879. package/dist/shaders/DOFMipMapShader.js +32 -0
  880. package/dist/shaders/DOFMipMapShader.mjs +32 -0
  881. package/dist/shaders/DepthLimitedBlurShader.d.ts +28 -0
  882. package/dist/shaders/DepthLimitedBlurShader.js +114 -0
  883. package/dist/shaders/DepthLimitedBlurShader.mjs +114 -0
  884. package/dist/shaders/DigitalGlitch.d.ts +39 -0
  885. package/dist/shaders/DigitalGlitch.js +85 -0
  886. package/dist/shaders/DigitalGlitch.mjs +85 -0
  887. package/dist/shaders/DotScreenShader.d.ts +27 -0
  888. package/dist/shaders/DotScreenShader.js +39 -0
  889. package/dist/shaders/DotScreenShader.mjs +39 -0
  890. package/dist/shaders/FXAAShader.d.ts +19 -0
  891. package/dist/shaders/FXAAShader.js +1098 -0
  892. package/dist/shaders/FXAAShader.mjs +1098 -0
  893. package/dist/shaders/FilmShader.d.ts +43 -0
  894. package/dist/shaders/FilmShader.js +53 -0
  895. package/dist/shaders/FilmShader.mjs +53 -0
  896. package/dist/shaders/FocusShader.d.ts +26 -0
  897. package/dist/shaders/FocusShader.js +55 -0
  898. package/dist/shaders/FocusShader.mjs +55 -0
  899. package/dist/shaders/FreiChenShader.d.ts +19 -0
  900. package/dist/shaders/FreiChenShader.js +64 -0
  901. package/dist/shaders/FreiChenShader.mjs +64 -0
  902. package/dist/shaders/FresnelShader.d.ts +24 -0
  903. package/dist/shaders/FresnelShader.js +47 -0
  904. package/dist/shaders/FresnelShader.mjs +47 -0
  905. package/dist/shaders/GammaCorrectionShader.d.ts +12 -0
  906. package/dist/shaders/GammaCorrectionShader.js +23 -0
  907. package/dist/shaders/GammaCorrectionShader.mjs +23 -0
  908. package/dist/shaders/GodRaysShader.d.ts +97 -0
  909. package/dist/shaders/GodRaysShader.js +183 -0
  910. package/dist/shaders/GodRaysShader.mjs +183 -0
  911. package/dist/shaders/HalftoneShader.d.ts +51 -0
  912. package/dist/shaders/HalftoneShader.js +228 -0
  913. package/dist/shaders/HalftoneShader.mjs +228 -0
  914. package/dist/shaders/HorizontalBlurShader.d.ts +18 -0
  915. package/dist/shaders/HorizontalBlurShader.js +49 -0
  916. package/dist/shaders/HorizontalBlurShader.mjs +49 -0
  917. package/dist/shaders/HorizontalTiltShiftShader.d.ts +23 -0
  918. package/dist/shaders/HorizontalTiltShiftShader.js +37 -0
  919. package/dist/shaders/HorizontalTiltShiftShader.mjs +37 -0
  920. package/dist/shaders/HueSaturationShader.d.ts +21 -0
  921. package/dist/shaders/HueSaturationShader.js +43 -0
  922. package/dist/shaders/HueSaturationShader.mjs +43 -0
  923. package/dist/shaders/KaleidoShader.d.ts +24 -0
  924. package/dist/shaders/KaleidoShader.js +34 -0
  925. package/dist/shaders/KaleidoShader.mjs +34 -0
  926. package/dist/shaders/LuminosityHighPassShader.d.ts +27 -0
  927. package/dist/shaders/LuminosityHighPassShader.js +37 -0
  928. package/dist/shaders/LuminosityHighPassShader.mjs +37 -0
  929. package/dist/shaders/LuminosityShader.d.ts +13 -0
  930. package/dist/shaders/LuminosityShader.js +25 -0
  931. package/dist/shaders/LuminosityShader.mjs +25 -0
  932. package/dist/shaders/MirrorShader.d.ts +18 -0
  933. package/dist/shaders/MirrorShader.js +35 -0
  934. package/dist/shaders/MirrorShader.mjs +35 -0
  935. package/dist/shaders/NormalMapShader.d.ts +23 -0
  936. package/dist/shaders/NormalMapShader.js +31 -0
  937. package/dist/shaders/NormalMapShader.mjs +31 -0
  938. package/dist/shaders/ParallaxShader.d.ts +28 -0
  939. package/dist/shaders/ParallaxShader.js +133 -0
  940. package/dist/shaders/ParallaxShader.mjs +133 -0
  941. package/dist/shaders/PixelShader.d.ts +18 -0
  942. package/dist/shaders/PixelShader.js +28 -0
  943. package/dist/shaders/PixelShader.mjs +28 -0
  944. package/dist/shaders/RGBShiftShader.d.ts +24 -0
  945. package/dist/shaders/RGBShiftShader.js +30 -0
  946. package/dist/shaders/RGBShiftShader.mjs +30 -0
  947. package/dist/shaders/SAOShader.d.ts +25 -0
  948. package/dist/shaders/SAOShader.js +144 -0
  949. package/dist/shaders/SAOShader.mjs +144 -0
  950. package/dist/shaders/SMAAShader.d.ts +60 -0
  951. package/dist/shaders/SMAAShader.js +358 -0
  952. package/dist/shaders/SMAAShader.mjs +358 -0
  953. package/dist/shaders/SSAOShader.d.ts +86 -0
  954. package/dist/shaders/SSAOShader.js +182 -0
  955. package/dist/shaders/SSAOShader.mjs +182 -0
  956. package/dist/shaders/SSRShader.d.ts +94 -0
  957. package/dist/shaders/SSRShader.js +342 -0
  958. package/dist/shaders/SSRShader.mjs +342 -0
  959. package/dist/shaders/SepiaShader.d.ts +17 -0
  960. package/dist/shaders/SepiaShader.js +29 -0
  961. package/dist/shaders/SepiaShader.mjs +29 -0
  962. package/dist/shaders/SobelOperatorShader.d.ts +19 -0
  963. package/dist/shaders/SobelOperatorShader.js +54 -0
  964. package/dist/shaders/SobelOperatorShader.mjs +54 -0
  965. package/dist/shaders/SubsurfaceScatteringShader.d.ts +5 -0
  966. package/dist/shaders/SubsurfaceScatteringShader.js +59 -0
  967. package/dist/shaders/SubsurfaceScatteringShader.mjs +59 -0
  968. package/dist/shaders/TechnicolorShader.d.ts +15 -0
  969. package/dist/shaders/TechnicolorShader.js +24 -0
  970. package/dist/shaders/TechnicolorShader.mjs +24 -0
  971. package/dist/shaders/ToneMapShader.d.ts +27 -0
  972. package/dist/shaders/ToneMapShader.js +51 -0
  973. package/dist/shaders/ToneMapShader.mjs +51 -0
  974. package/dist/shaders/ToonShader.d.ts +108 -0
  975. package/dist/shaders/ToonShader.js +188 -0
  976. package/dist/shaders/ToonShader.mjs +188 -0
  977. package/dist/shaders/TriangleBlurShader.d.ts +22 -0
  978. package/dist/shaders/TriangleBlurShader.js +37 -0
  979. package/dist/shaders/TriangleBlurShader.mjs +37 -0
  980. package/dist/shaders/UnpackDepthRGBAShader.d.ts +16 -0
  981. package/dist/shaders/UnpackDepthRGBAShader.js +26 -0
  982. package/dist/shaders/UnpackDepthRGBAShader.mjs +26 -0
  983. package/dist/shaders/VerticalBlurShader.d.ts +18 -0
  984. package/dist/shaders/VerticalBlurShader.js +50 -0
  985. package/dist/shaders/VerticalBlurShader.mjs +50 -0
  986. package/dist/shaders/VerticalTiltShiftShader.d.ts +23 -0
  987. package/dist/shaders/VerticalTiltShiftShader.js +37 -0
  988. package/dist/shaders/VerticalTiltShiftShader.mjs +37 -0
  989. package/dist/shaders/VignetteShader.d.ts +20 -0
  990. package/dist/shaders/VignetteShader.js +38 -0
  991. package/dist/shaders/VignetteShader.mjs +38 -0
  992. package/dist/shaders/VolumeShader.d.ts +30 -0
  993. package/dist/shaders/VolumeShader.js +225 -0
  994. package/dist/shaders/VolumeShader.mjs +225 -0
  995. package/dist/shaders/WaterRefractionShader.d.ts +21 -0
  996. package/dist/shaders/WaterRefractionShader.js +59 -0
  997. package/dist/shaders/WaterRefractionShader.mjs +59 -0
  998. package/dist/shaders/types.d.ts +14 -0
  999. package/dist/shaders/types.js +1 -0
  1000. package/dist/shaders/types.mjs +1 -0
  1001. package/dist/textures/FlakesTexture.d.ts +4 -0
  1002. package/dist/textures/FlakesTexture.js +30 -0
  1003. package/dist/textures/FlakesTexture.mjs +30 -0
  1004. package/dist/types/helpers.d.ts +1 -0
  1005. package/dist/types/helpers.js +4 -0
  1006. package/dist/types/helpers.mjs +4 -0
  1007. package/dist/types/shared.d.ts +2 -0
  1008. package/dist/types/utils.d.ts +3 -0
  1009. package/dist/utils/BufferGeometryUtils.d.ts +48 -0
  1010. package/dist/utils/BufferGeometryUtils.js +636 -0
  1011. package/dist/utils/BufferGeometryUtils.mjs +636 -0
  1012. package/dist/utils/GeometryCompressionUtils.d.ts +7 -0
  1013. package/dist/utils/GeometryCompressionUtils.js +573 -0
  1014. package/dist/utils/GeometryCompressionUtils.mjs +573 -0
  1015. package/dist/utils/GeometryUtils.d.ts +6 -0
  1016. package/dist/utils/GeometryUtils.js +109 -0
  1017. package/dist/utils/GeometryUtils.mjs +109 -0
  1018. package/dist/utils/LDrawUtils.d.ts +5 -0
  1019. package/dist/utils/RoughnessMipmapper.js +219 -0
  1020. package/dist/utils/RoughnessMipmapper.mjs +219 -0
  1021. package/dist/utils/SceneUtils.d.ts +9 -0
  1022. package/dist/utils/SceneUtils.js +36 -0
  1023. package/dist/utils/SceneUtils.mjs +36 -0
  1024. package/dist/utils/ShadowMapViewer.d.ts +24 -0
  1025. package/dist/utils/ShadowMapViewer.js +114 -0
  1026. package/dist/utils/ShadowMapViewer.mjs +114 -0
  1027. package/dist/utils/SkeletonUtils.d.ts +30 -0
  1028. package/dist/utils/SkeletonUtils.js +292 -0
  1029. package/dist/utils/SkeletonUtils.mjs +292 -0
  1030. package/dist/utils/UVsDebug.d.ts +3 -0
  1031. package/dist/utils/UVsDebug.js +85 -0
  1032. package/dist/utils/UVsDebug.mjs +85 -0
  1033. package/dist/utils/WorkerPool.js +62 -0
  1034. package/dist/utils/WorkerPool.mjs +62 -0
  1035. package/dist/webxr/ARButton.d.ts +5 -0
  1036. package/dist/webxr/ARButton.js +119 -0
  1037. package/dist/webxr/ARButton.mjs +119 -0
  1038. package/dist/webxr/OculusHandModel.d.ts +22 -0
  1039. package/dist/webxr/OculusHandModel.js +82 -0
  1040. package/dist/webxr/OculusHandModel.mjs +82 -0
  1041. package/dist/webxr/OculusHandPointerModel.d.ts +63 -0
  1042. package/dist/webxr/OculusHandPointerModel.js +224 -0
  1043. package/dist/webxr/OculusHandPointerModel.mjs +207 -0
  1044. package/dist/webxr/Text2D.d.ts +3 -0
  1045. package/dist/webxr/Text2D.js +48 -0
  1046. package/dist/webxr/Text2D.mjs +31 -0
  1047. package/dist/webxr/VRButton.d.ts +7 -0
  1048. package/dist/webxr/VRButton.js +111 -0
  1049. package/dist/webxr/VRButton.mjs +111 -0
  1050. package/dist/webxr/XRControllerModelFactory.d.ts +23 -0
  1051. package/dist/webxr/XRControllerModelFactory.js +174 -0
  1052. package/dist/webxr/XRControllerModelFactory.mjs +174 -0
  1053. package/dist/webxr/XREstimatedLight.d.ts +33 -0
  1054. package/dist/webxr/XREstimatedLight.js +126 -0
  1055. package/dist/webxr/XREstimatedLight.mjs +126 -0
  1056. package/dist/webxr/XRHandMeshModel.d.ts +9 -0
  1057. package/dist/webxr/XRHandMeshModel.js +82 -0
  1058. package/dist/webxr/XRHandMeshModel.mjs +82 -0
  1059. package/dist/webxr/XRHandModelFactory.d.ts +25 -0
  1060. package/dist/webxr/XRHandModelFactory.js +61 -0
  1061. package/dist/webxr/XRHandModelFactory.mjs +61 -0
  1062. package/dist/webxr/XRHandPrimitiveModel.d.ts +24 -0
  1063. package/dist/webxr/XRHandPrimitiveModel.js +68 -0
  1064. package/dist/webxr/XRHandPrimitiveModel.mjs +68 -0
  1065. package/package.json +1 -1
@@ -0,0 +1,2459 @@
1
+ import { Loader, LoaderUtils, FileLoader, Color, SpotLight, PointLight, DirectionalLight, MeshBasicMaterial, MeshPhysicalMaterial, Vector2, Matrix4, Vector3, Quaternion, InstancedMesh, Object3D, Interpolant, NearestFilter, LinearFilter, NearestMipmapNearestFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter, ClampToEdgeWrapping, MirroredRepeatWrapping, RepeatWrapping, REVISION, InterpolateLinear, InterpolateDiscrete, MeshStandardMaterial, FrontSide, TextureLoader, ImageBitmapLoader, BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Texture, PointsMaterial, Material, LineBasicMaterial, DoubleSide, PropertyBinding, BufferGeometry, SkinnedMesh, Mesh, TriangleStripDrawMode, TriangleFanDrawMode, LineSegments, Line, LineLoop, Points, Group, PerspectiveCamera, MathUtils, OrthographicCamera, Skeleton, VectorKeyframeTrack, QuaternionKeyframeTrack, NumberKeyframeTrack, AnimationClip, Bone, Box3, Sphere } from "three";
2
+ import { toTrianglesDrawMode } from "../utils/BufferGeometryUtils.mjs";
3
+ class GLTFLoader extends Loader {
4
+ constructor(manager) {
5
+ super(manager);
6
+ this.dracoLoader = null;
7
+ this.ktx2Loader = null;
8
+ this.meshoptDecoder = null;
9
+ this.pluginCallbacks = [];
10
+ this.register(function(parser) {
11
+ return new GLTFMaterialsClearcoatExtension(parser);
12
+ });
13
+ this.register(function(parser) {
14
+ return new GLTFTextureBasisUExtension(parser);
15
+ });
16
+ this.register(function(parser) {
17
+ return new GLTFTextureWebPExtension(parser);
18
+ });
19
+ this.register(function(parser) {
20
+ return new GLTFTextureAVIFExtension(parser);
21
+ });
22
+ this.register(function(parser) {
23
+ return new GLTFMaterialsSheenExtension(parser);
24
+ });
25
+ this.register(function(parser) {
26
+ return new GLTFMaterialsTransmissionExtension(parser);
27
+ });
28
+ this.register(function(parser) {
29
+ return new GLTFMaterialsVolumeExtension(parser);
30
+ });
31
+ this.register(function(parser) {
32
+ return new GLTFMaterialsIorExtension(parser);
33
+ });
34
+ this.register(function(parser) {
35
+ return new GLTFMaterialsEmissiveStrengthExtension(parser);
36
+ });
37
+ this.register(function(parser) {
38
+ return new GLTFMaterialsSpecularExtension(parser);
39
+ });
40
+ this.register(function(parser) {
41
+ return new GLTFMaterialsIridescenceExtension(parser);
42
+ });
43
+ this.register(function(parser) {
44
+ return new GLTFLightsExtension(parser);
45
+ });
46
+ this.register(function(parser) {
47
+ return new GLTFMeshoptCompression(parser);
48
+ });
49
+ this.register(function(parser) {
50
+ return new GLTFMeshGpuInstancing(parser);
51
+ });
52
+ }
53
+ load(url, onLoad, onProgress, onError) {
54
+ const scope = this;
55
+ let resourcePath;
56
+ if (this.resourcePath !== "") {
57
+ resourcePath = this.resourcePath;
58
+ } else if (this.path !== "") {
59
+ resourcePath = this.path;
60
+ } else {
61
+ resourcePath = LoaderUtils.extractUrlBase(url);
62
+ }
63
+ this.manager.itemStart(url);
64
+ const _onError = function(e) {
65
+ if (onError) {
66
+ onError(e);
67
+ } else {
68
+ console.error(e);
69
+ }
70
+ scope.manager.itemError(url);
71
+ scope.manager.itemEnd(url);
72
+ };
73
+ const loader = new FileLoader(this.manager);
74
+ loader.setPath(this.path);
75
+ loader.setResponseType("arraybuffer");
76
+ loader.setRequestHeader(this.requestHeader);
77
+ loader.setWithCredentials(this.withCredentials);
78
+ loader.load(
79
+ url,
80
+ function(data) {
81
+ try {
82
+ scope.parse(
83
+ data,
84
+ resourcePath,
85
+ function(gltf) {
86
+ onLoad(gltf);
87
+ scope.manager.itemEnd(url);
88
+ },
89
+ _onError
90
+ );
91
+ } catch (e) {
92
+ _onError(e);
93
+ }
94
+ },
95
+ onProgress,
96
+ _onError
97
+ );
98
+ }
99
+ setDRACOLoader(dracoLoader) {
100
+ this.dracoLoader = dracoLoader;
101
+ return this;
102
+ }
103
+ setDDSLoader() {
104
+ throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".');
105
+ }
106
+ setKTX2Loader(ktx2Loader) {
107
+ this.ktx2Loader = ktx2Loader;
108
+ return this;
109
+ }
110
+ setMeshoptDecoder(meshoptDecoder) {
111
+ this.meshoptDecoder = meshoptDecoder;
112
+ return this;
113
+ }
114
+ register(callback) {
115
+ if (this.pluginCallbacks.indexOf(callback) === -1) {
116
+ this.pluginCallbacks.push(callback);
117
+ }
118
+ return this;
119
+ }
120
+ unregister(callback) {
121
+ if (this.pluginCallbacks.indexOf(callback) !== -1) {
122
+ this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(callback), 1);
123
+ }
124
+ return this;
125
+ }
126
+ parse(data, path, onLoad, onError) {
127
+ let json;
128
+ const extensions = {};
129
+ const plugins = {};
130
+ if (typeof data === "string") {
131
+ json = JSON.parse(data);
132
+ } else if (data instanceof ArrayBuffer) {
133
+ const magic = LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4)));
134
+ if (magic === BINARY_EXTENSION_HEADER_MAGIC) {
135
+ try {
136
+ extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);
137
+ } catch (error) {
138
+ if (onError)
139
+ onError(error);
140
+ return;
141
+ }
142
+ json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content);
143
+ } else {
144
+ json = JSON.parse(LoaderUtils.decodeText(new Uint8Array(data)));
145
+ }
146
+ } else {
147
+ json = data;
148
+ }
149
+ if (json.asset === void 0 || json.asset.version[0] < 2) {
150
+ if (onError)
151
+ onError(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
152
+ return;
153
+ }
154
+ const parser = new GLTFParser(json, {
155
+ path: path || this.resourcePath || "",
156
+ crossOrigin: this.crossOrigin,
157
+ requestHeader: this.requestHeader,
158
+ manager: this.manager,
159
+ ktx2Loader: this.ktx2Loader,
160
+ meshoptDecoder: this.meshoptDecoder
161
+ });
162
+ parser.fileLoader.setRequestHeader(this.requestHeader);
163
+ for (let i = 0; i < this.pluginCallbacks.length; i++) {
164
+ const plugin = this.pluginCallbacks[i](parser);
165
+ plugins[plugin.name] = plugin;
166
+ extensions[plugin.name] = true;
167
+ }
168
+ if (json.extensionsUsed) {
169
+ for (let i = 0; i < json.extensionsUsed.length; ++i) {
170
+ const extensionName = json.extensionsUsed[i];
171
+ const extensionsRequired = json.extensionsRequired || [];
172
+ switch (extensionName) {
173
+ case EXTENSIONS.KHR_MATERIALS_UNLIT:
174
+ extensions[extensionName] = new GLTFMaterialsUnlitExtension();
175
+ break;
176
+ case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:
177
+ extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader);
178
+ break;
179
+ case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
180
+ extensions[extensionName] = new GLTFTextureTransformExtension();
181
+ break;
182
+ case EXTENSIONS.KHR_MESH_QUANTIZATION:
183
+ extensions[extensionName] = new GLTFMeshQuantizationExtension();
184
+ break;
185
+ default:
186
+ if (extensionsRequired.indexOf(extensionName) >= 0 && plugins[extensionName] === void 0) {
187
+ console.warn('THREE.GLTFLoader: Unknown extension "' + extensionName + '".');
188
+ }
189
+ }
190
+ }
191
+ }
192
+ parser.setExtensions(extensions);
193
+ parser.setPlugins(plugins);
194
+ parser.parse(onLoad, onError);
195
+ }
196
+ parseAsync(data, path) {
197
+ const scope = this;
198
+ return new Promise(function(resolve, reject) {
199
+ scope.parse(data, path, resolve, reject);
200
+ });
201
+ }
202
+ }
203
+ function GLTFRegistry() {
204
+ let objects = {};
205
+ return {
206
+ get: function(key) {
207
+ return objects[key];
208
+ },
209
+ add: function(key, object) {
210
+ objects[key] = object;
211
+ },
212
+ remove: function(key) {
213
+ delete objects[key];
214
+ },
215
+ removeAll: function() {
216
+ objects = {};
217
+ }
218
+ };
219
+ }
220
+ const EXTENSIONS = {
221
+ KHR_BINARY_GLTF: "KHR_binary_glTF",
222
+ KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
223
+ KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
224
+ KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
225
+ KHR_MATERIALS_IOR: "KHR_materials_ior",
226
+ KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
227
+ KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
228
+ KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
229
+ KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
230
+ KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
231
+ KHR_MATERIALS_VOLUME: "KHR_materials_volume",
232
+ KHR_TEXTURE_BASISU: "KHR_texture_basisu",
233
+ KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
234
+ KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
235
+ KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
236
+ EXT_TEXTURE_WEBP: "EXT_texture_webp",
237
+ EXT_TEXTURE_AVIF: "EXT_texture_avif",
238
+ EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
239
+ EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
240
+ };
241
+ class GLTFLightsExtension {
242
+ constructor(parser) {
243
+ this.parser = parser;
244
+ this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;
245
+ this.cache = { refs: {}, uses: {} };
246
+ }
247
+ _markDefs() {
248
+ const parser = this.parser;
249
+ const nodeDefs = this.parser.json.nodes || [];
250
+ for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {
251
+ const nodeDef = nodeDefs[nodeIndex];
252
+ if (nodeDef.extensions && nodeDef.extensions[this.name] && nodeDef.extensions[this.name].light !== void 0) {
253
+ parser._addNodeRef(this.cache, nodeDef.extensions[this.name].light);
254
+ }
255
+ }
256
+ }
257
+ _loadLight(lightIndex) {
258
+ const parser = this.parser;
259
+ const cacheKey = "light:" + lightIndex;
260
+ let dependency = parser.cache.get(cacheKey);
261
+ if (dependency)
262
+ return dependency;
263
+ const json = parser.json;
264
+ const extensions = json.extensions && json.extensions[this.name] || {};
265
+ const lightDefs = extensions.lights || [];
266
+ const lightDef = lightDefs[lightIndex];
267
+ let lightNode;
268
+ const color = new Color(16777215);
269
+ if (lightDef.color !== void 0)
270
+ color.fromArray(lightDef.color);
271
+ const range = lightDef.range !== void 0 ? lightDef.range : 0;
272
+ switch (lightDef.type) {
273
+ case "directional":
274
+ lightNode = new DirectionalLight(color);
275
+ lightNode.target.position.set(0, 0, -1);
276
+ lightNode.add(lightNode.target);
277
+ break;
278
+ case "point":
279
+ lightNode = new PointLight(color);
280
+ lightNode.distance = range;
281
+ break;
282
+ case "spot":
283
+ lightNode = new SpotLight(color);
284
+ lightNode.distance = range;
285
+ lightDef.spot = lightDef.spot || {};
286
+ lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== void 0 ? lightDef.spot.innerConeAngle : 0;
287
+ lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== void 0 ? lightDef.spot.outerConeAngle : Math.PI / 4;
288
+ lightNode.angle = lightDef.spot.outerConeAngle;
289
+ lightNode.penumbra = 1 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
290
+ lightNode.target.position.set(0, 0, -1);
291
+ lightNode.add(lightNode.target);
292
+ break;
293
+ default:
294
+ throw new Error("THREE.GLTFLoader: Unexpected light type: " + lightDef.type);
295
+ }
296
+ lightNode.position.set(0, 0, 0);
297
+ lightNode.decay = 2;
298
+ assignExtrasToUserData(lightNode, lightDef);
299
+ if (lightDef.intensity !== void 0)
300
+ lightNode.intensity = lightDef.intensity;
301
+ lightNode.name = parser.createUniqueName(lightDef.name || "light_" + lightIndex);
302
+ dependency = Promise.resolve(lightNode);
303
+ parser.cache.add(cacheKey, dependency);
304
+ return dependency;
305
+ }
306
+ getDependency(type, index) {
307
+ if (type !== "light")
308
+ return;
309
+ return this._loadLight(index);
310
+ }
311
+ createNodeAttachment(nodeIndex) {
312
+ const self2 = this;
313
+ const parser = this.parser;
314
+ const json = parser.json;
315
+ const nodeDef = json.nodes[nodeIndex];
316
+ const lightDef = nodeDef.extensions && nodeDef.extensions[this.name] || {};
317
+ const lightIndex = lightDef.light;
318
+ if (lightIndex === void 0)
319
+ return null;
320
+ return this._loadLight(lightIndex).then(function(light) {
321
+ return parser._getNodeRef(self2.cache, lightIndex, light);
322
+ });
323
+ }
324
+ }
325
+ class GLTFMaterialsUnlitExtension {
326
+ constructor() {
327
+ this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;
328
+ }
329
+ getMaterialType() {
330
+ return MeshBasicMaterial;
331
+ }
332
+ extendParams(materialParams, materialDef, parser) {
333
+ const pending = [];
334
+ materialParams.color = new Color(1, 1, 1);
335
+ materialParams.opacity = 1;
336
+ const metallicRoughness = materialDef.pbrMetallicRoughness;
337
+ if (metallicRoughness) {
338
+ if (Array.isArray(metallicRoughness.baseColorFactor)) {
339
+ const array = metallicRoughness.baseColorFactor;
340
+ materialParams.color.fromArray(array);
341
+ materialParams.opacity = array[3];
342
+ }
343
+ if (metallicRoughness.baseColorTexture !== void 0) {
344
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, 3001));
345
+ }
346
+ }
347
+ return Promise.all(pending);
348
+ }
349
+ }
350
+ class GLTFMaterialsEmissiveStrengthExtension {
351
+ constructor(parser) {
352
+ this.parser = parser;
353
+ this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH;
354
+ }
355
+ extendMaterialParams(materialIndex, materialParams) {
356
+ const parser = this.parser;
357
+ const materialDef = parser.json.materials[materialIndex];
358
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
359
+ return Promise.resolve();
360
+ }
361
+ const emissiveStrength = materialDef.extensions[this.name].emissiveStrength;
362
+ if (emissiveStrength !== void 0) {
363
+ materialParams.emissiveIntensity = emissiveStrength;
364
+ }
365
+ return Promise.resolve();
366
+ }
367
+ }
368
+ class GLTFMaterialsClearcoatExtension {
369
+ constructor(parser) {
370
+ this.parser = parser;
371
+ this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;
372
+ }
373
+ getMaterialType(materialIndex) {
374
+ const parser = this.parser;
375
+ const materialDef = parser.json.materials[materialIndex];
376
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
377
+ return null;
378
+ return MeshPhysicalMaterial;
379
+ }
380
+ extendMaterialParams(materialIndex, materialParams) {
381
+ const parser = this.parser;
382
+ const materialDef = parser.json.materials[materialIndex];
383
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
384
+ return Promise.resolve();
385
+ }
386
+ const pending = [];
387
+ const extension = materialDef.extensions[this.name];
388
+ if (extension.clearcoatFactor !== void 0) {
389
+ materialParams.clearcoat = extension.clearcoatFactor;
390
+ }
391
+ if (extension.clearcoatTexture !== void 0) {
392
+ pending.push(parser.assignTexture(materialParams, "clearcoatMap", extension.clearcoatTexture));
393
+ }
394
+ if (extension.clearcoatRoughnessFactor !== void 0) {
395
+ materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;
396
+ }
397
+ if (extension.clearcoatRoughnessTexture !== void 0) {
398
+ pending.push(parser.assignTexture(materialParams, "clearcoatRoughnessMap", extension.clearcoatRoughnessTexture));
399
+ }
400
+ if (extension.clearcoatNormalTexture !== void 0) {
401
+ pending.push(parser.assignTexture(materialParams, "clearcoatNormalMap", extension.clearcoatNormalTexture));
402
+ if (extension.clearcoatNormalTexture.scale !== void 0) {
403
+ const scale = extension.clearcoatNormalTexture.scale;
404
+ materialParams.clearcoatNormalScale = new Vector2(scale, scale);
405
+ }
406
+ }
407
+ return Promise.all(pending);
408
+ }
409
+ }
410
+ class GLTFMaterialsIridescenceExtension {
411
+ constructor(parser) {
412
+ this.parser = parser;
413
+ this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE;
414
+ }
415
+ getMaterialType(materialIndex) {
416
+ const parser = this.parser;
417
+ const materialDef = parser.json.materials[materialIndex];
418
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
419
+ return null;
420
+ return MeshPhysicalMaterial;
421
+ }
422
+ extendMaterialParams(materialIndex, materialParams) {
423
+ const parser = this.parser;
424
+ const materialDef = parser.json.materials[materialIndex];
425
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
426
+ return Promise.resolve();
427
+ }
428
+ const pending = [];
429
+ const extension = materialDef.extensions[this.name];
430
+ if (extension.iridescenceFactor !== void 0) {
431
+ materialParams.iridescence = extension.iridescenceFactor;
432
+ }
433
+ if (extension.iridescenceTexture !== void 0) {
434
+ pending.push(parser.assignTexture(materialParams, "iridescenceMap", extension.iridescenceTexture));
435
+ }
436
+ if (extension.iridescenceIor !== void 0) {
437
+ materialParams.iridescenceIOR = extension.iridescenceIor;
438
+ }
439
+ if (materialParams.iridescenceThicknessRange === void 0) {
440
+ materialParams.iridescenceThicknessRange = [100, 400];
441
+ }
442
+ if (extension.iridescenceThicknessMinimum !== void 0) {
443
+ materialParams.iridescenceThicknessRange[0] = extension.iridescenceThicknessMinimum;
444
+ }
445
+ if (extension.iridescenceThicknessMaximum !== void 0) {
446
+ materialParams.iridescenceThicknessRange[1] = extension.iridescenceThicknessMaximum;
447
+ }
448
+ if (extension.iridescenceThicknessTexture !== void 0) {
449
+ pending.push(
450
+ parser.assignTexture(materialParams, "iridescenceThicknessMap", extension.iridescenceThicknessTexture)
451
+ );
452
+ }
453
+ return Promise.all(pending);
454
+ }
455
+ }
456
+ class GLTFMaterialsSheenExtension {
457
+ constructor(parser) {
458
+ this.parser = parser;
459
+ this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;
460
+ }
461
+ getMaterialType(materialIndex) {
462
+ const parser = this.parser;
463
+ const materialDef = parser.json.materials[materialIndex];
464
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
465
+ return null;
466
+ return MeshPhysicalMaterial;
467
+ }
468
+ extendMaterialParams(materialIndex, materialParams) {
469
+ const parser = this.parser;
470
+ const materialDef = parser.json.materials[materialIndex];
471
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
472
+ return Promise.resolve();
473
+ }
474
+ const pending = [];
475
+ materialParams.sheenColor = new Color(0, 0, 0);
476
+ materialParams.sheenRoughness = 0;
477
+ materialParams.sheen = 1;
478
+ const extension = materialDef.extensions[this.name];
479
+ if (extension.sheenColorFactor !== void 0) {
480
+ materialParams.sheenColor.fromArray(extension.sheenColorFactor);
481
+ }
482
+ if (extension.sheenRoughnessFactor !== void 0) {
483
+ materialParams.sheenRoughness = extension.sheenRoughnessFactor;
484
+ }
485
+ if (extension.sheenColorTexture !== void 0) {
486
+ pending.push(parser.assignTexture(materialParams, "sheenColorMap", extension.sheenColorTexture, 3001));
487
+ }
488
+ if (extension.sheenRoughnessTexture !== void 0) {
489
+ pending.push(parser.assignTexture(materialParams, "sheenRoughnessMap", extension.sheenRoughnessTexture));
490
+ }
491
+ return Promise.all(pending);
492
+ }
493
+ }
494
+ class GLTFMaterialsTransmissionExtension {
495
+ constructor(parser) {
496
+ this.parser = parser;
497
+ this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;
498
+ }
499
+ getMaterialType(materialIndex) {
500
+ const parser = this.parser;
501
+ const materialDef = parser.json.materials[materialIndex];
502
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
503
+ return null;
504
+ return MeshPhysicalMaterial;
505
+ }
506
+ extendMaterialParams(materialIndex, materialParams) {
507
+ const parser = this.parser;
508
+ const materialDef = parser.json.materials[materialIndex];
509
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
510
+ return Promise.resolve();
511
+ }
512
+ const pending = [];
513
+ const extension = materialDef.extensions[this.name];
514
+ if (extension.transmissionFactor !== void 0) {
515
+ materialParams.transmission = extension.transmissionFactor;
516
+ }
517
+ if (extension.transmissionTexture !== void 0) {
518
+ pending.push(parser.assignTexture(materialParams, "transmissionMap", extension.transmissionTexture));
519
+ }
520
+ return Promise.all(pending);
521
+ }
522
+ }
523
+ class GLTFMaterialsVolumeExtension {
524
+ constructor(parser) {
525
+ this.parser = parser;
526
+ this.name = EXTENSIONS.KHR_MATERIALS_VOLUME;
527
+ }
528
+ getMaterialType(materialIndex) {
529
+ const parser = this.parser;
530
+ const materialDef = parser.json.materials[materialIndex];
531
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
532
+ return null;
533
+ return MeshPhysicalMaterial;
534
+ }
535
+ extendMaterialParams(materialIndex, materialParams) {
536
+ const parser = this.parser;
537
+ const materialDef = parser.json.materials[materialIndex];
538
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
539
+ return Promise.resolve();
540
+ }
541
+ const pending = [];
542
+ const extension = materialDef.extensions[this.name];
543
+ materialParams.thickness = extension.thicknessFactor !== void 0 ? extension.thicknessFactor : 0;
544
+ if (extension.thicknessTexture !== void 0) {
545
+ pending.push(parser.assignTexture(materialParams, "thicknessMap", extension.thicknessTexture));
546
+ }
547
+ materialParams.attenuationDistance = extension.attenuationDistance || Infinity;
548
+ const colorArray = extension.attenuationColor || [1, 1, 1];
549
+ materialParams.attenuationColor = new Color(colorArray[0], colorArray[1], colorArray[2]);
550
+ return Promise.all(pending);
551
+ }
552
+ }
553
+ class GLTFMaterialsIorExtension {
554
+ constructor(parser) {
555
+ this.parser = parser;
556
+ this.name = EXTENSIONS.KHR_MATERIALS_IOR;
557
+ }
558
+ getMaterialType(materialIndex) {
559
+ const parser = this.parser;
560
+ const materialDef = parser.json.materials[materialIndex];
561
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
562
+ return null;
563
+ return MeshPhysicalMaterial;
564
+ }
565
+ extendMaterialParams(materialIndex, materialParams) {
566
+ const parser = this.parser;
567
+ const materialDef = parser.json.materials[materialIndex];
568
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
569
+ return Promise.resolve();
570
+ }
571
+ const extension = materialDef.extensions[this.name];
572
+ materialParams.ior = extension.ior !== void 0 ? extension.ior : 1.5;
573
+ return Promise.resolve();
574
+ }
575
+ }
576
+ class GLTFMaterialsSpecularExtension {
577
+ constructor(parser) {
578
+ this.parser = parser;
579
+ this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR;
580
+ }
581
+ getMaterialType(materialIndex) {
582
+ const parser = this.parser;
583
+ const materialDef = parser.json.materials[materialIndex];
584
+ if (!materialDef.extensions || !materialDef.extensions[this.name])
585
+ return null;
586
+ return MeshPhysicalMaterial;
587
+ }
588
+ extendMaterialParams(materialIndex, materialParams) {
589
+ const parser = this.parser;
590
+ const materialDef = parser.json.materials[materialIndex];
591
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
592
+ return Promise.resolve();
593
+ }
594
+ const pending = [];
595
+ const extension = materialDef.extensions[this.name];
596
+ materialParams.specularIntensity = extension.specularFactor !== void 0 ? extension.specularFactor : 1;
597
+ if (extension.specularTexture !== void 0) {
598
+ pending.push(parser.assignTexture(materialParams, "specularIntensityMap", extension.specularTexture));
599
+ }
600
+ const colorArray = extension.specularColorFactor || [1, 1, 1];
601
+ materialParams.specularColor = new Color(colorArray[0], colorArray[1], colorArray[2]);
602
+ if (extension.specularColorTexture !== void 0) {
603
+ pending.push(
604
+ parser.assignTexture(materialParams, "specularColorMap", extension.specularColorTexture, 3001)
605
+ // sRGBEncoding
606
+ );
607
+ }
608
+ return Promise.all(pending);
609
+ }
610
+ }
611
+ class GLTFTextureBasisUExtension {
612
+ constructor(parser) {
613
+ this.parser = parser;
614
+ this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
615
+ }
616
+ loadTexture(textureIndex) {
617
+ const parser = this.parser;
618
+ const json = parser.json;
619
+ const textureDef = json.textures[textureIndex];
620
+ if (!textureDef.extensions || !textureDef.extensions[this.name]) {
621
+ return null;
622
+ }
623
+ const extension = textureDef.extensions[this.name];
624
+ const loader = parser.options.ktx2Loader;
625
+ if (!loader) {
626
+ if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {
627
+ throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
628
+ } else {
629
+ return null;
630
+ }
631
+ }
632
+ return parser.loadTextureImage(textureIndex, extension.source, loader);
633
+ }
634
+ }
635
+ class GLTFTextureWebPExtension {
636
+ constructor(parser) {
637
+ this.parser = parser;
638
+ this.name = EXTENSIONS.EXT_TEXTURE_WEBP;
639
+ this.isSupported = null;
640
+ }
641
+ loadTexture(textureIndex) {
642
+ const name = this.name;
643
+ const parser = this.parser;
644
+ const json = parser.json;
645
+ const textureDef = json.textures[textureIndex];
646
+ if (!textureDef.extensions || !textureDef.extensions[name]) {
647
+ return null;
648
+ }
649
+ const extension = textureDef.extensions[name];
650
+ const source = json.images[extension.source];
651
+ let loader = parser.textureLoader;
652
+ if (source.uri) {
653
+ const handler = parser.options.manager.getHandler(source.uri);
654
+ if (handler !== null)
655
+ loader = handler;
656
+ }
657
+ return this.detectSupport().then(function(isSupported) {
658
+ if (isSupported)
659
+ return parser.loadTextureImage(textureIndex, extension.source, loader);
660
+ if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {
661
+ throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
662
+ }
663
+ return parser.loadTexture(textureIndex);
664
+ });
665
+ }
666
+ detectSupport() {
667
+ if (!this.isSupported) {
668
+ this.isSupported = new Promise(function(resolve) {
669
+ const image = new Image();
670
+ image.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
671
+ image.onload = image.onerror = function() {
672
+ resolve(image.height === 1);
673
+ };
674
+ });
675
+ }
676
+ return this.isSupported;
677
+ }
678
+ }
679
+ class GLTFTextureAVIFExtension {
680
+ constructor(parser) {
681
+ this.parser = parser;
682
+ this.name = EXTENSIONS.EXT_TEXTURE_AVIF;
683
+ this.isSupported = null;
684
+ }
685
+ loadTexture(textureIndex) {
686
+ const name = this.name;
687
+ const parser = this.parser;
688
+ const json = parser.json;
689
+ const textureDef = json.textures[textureIndex];
690
+ if (!textureDef.extensions || !textureDef.extensions[name]) {
691
+ return null;
692
+ }
693
+ const extension = textureDef.extensions[name];
694
+ const source = json.images[extension.source];
695
+ let loader = parser.textureLoader;
696
+ if (source.uri) {
697
+ const handler = parser.options.manager.getHandler(source.uri);
698
+ if (handler !== null)
699
+ loader = handler;
700
+ }
701
+ return this.detectSupport().then(function(isSupported) {
702
+ if (isSupported)
703
+ return parser.loadTextureImage(textureIndex, extension.source, loader);
704
+ if (json.extensionsRequired && json.extensionsRequired.indexOf(name) >= 0) {
705
+ throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
706
+ }
707
+ return parser.loadTexture(textureIndex);
708
+ });
709
+ }
710
+ detectSupport() {
711
+ if (!this.isSupported) {
712
+ this.isSupported = new Promise(function(resolve) {
713
+ const image = new Image();
714
+ image.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=";
715
+ image.onload = image.onerror = function() {
716
+ resolve(image.height === 1);
717
+ };
718
+ });
719
+ }
720
+ return this.isSupported;
721
+ }
722
+ }
723
+ class GLTFMeshoptCompression {
724
+ constructor(parser) {
725
+ this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION;
726
+ this.parser = parser;
727
+ }
728
+ loadBufferView(index) {
729
+ const json = this.parser.json;
730
+ const bufferView = json.bufferViews[index];
731
+ if (bufferView.extensions && bufferView.extensions[this.name]) {
732
+ const extensionDef = bufferView.extensions[this.name];
733
+ const buffer = this.parser.getDependency("buffer", extensionDef.buffer);
734
+ const decoder = this.parser.options.meshoptDecoder;
735
+ if (!decoder || !decoder.supported) {
736
+ if (json.extensionsRequired && json.extensionsRequired.indexOf(this.name) >= 0) {
737
+ throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
738
+ } else {
739
+ return null;
740
+ }
741
+ }
742
+ return buffer.then(function(res) {
743
+ const byteOffset = extensionDef.byteOffset || 0;
744
+ const byteLength = extensionDef.byteLength || 0;
745
+ const count = extensionDef.count;
746
+ const stride = extensionDef.byteStride;
747
+ const source = new Uint8Array(res, byteOffset, byteLength);
748
+ if (decoder.decodeGltfBufferAsync) {
749
+ return decoder.decodeGltfBufferAsync(count, stride, source, extensionDef.mode, extensionDef.filter).then(function(res2) {
750
+ return res2.buffer;
751
+ });
752
+ } else {
753
+ return decoder.ready.then(function() {
754
+ const result = new ArrayBuffer(count * stride);
755
+ decoder.decodeGltfBuffer(
756
+ new Uint8Array(result),
757
+ count,
758
+ stride,
759
+ source,
760
+ extensionDef.mode,
761
+ extensionDef.filter
762
+ );
763
+ return result;
764
+ });
765
+ }
766
+ });
767
+ } else {
768
+ return null;
769
+ }
770
+ }
771
+ }
772
+ class GLTFMeshGpuInstancing {
773
+ constructor(parser) {
774
+ this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING;
775
+ this.parser = parser;
776
+ }
777
+ createNodeMesh(nodeIndex) {
778
+ const json = this.parser.json;
779
+ const nodeDef = json.nodes[nodeIndex];
780
+ if (!nodeDef.extensions || !nodeDef.extensions[this.name] || nodeDef.mesh === void 0) {
781
+ return null;
782
+ }
783
+ const meshDef = json.meshes[nodeDef.mesh];
784
+ for (const primitive of meshDef.primitives) {
785
+ if (primitive.mode !== WEBGL_CONSTANTS.TRIANGLES && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP && primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN && primitive.mode !== void 0) {
786
+ return null;
787
+ }
788
+ }
789
+ const extensionDef = nodeDef.extensions[this.name];
790
+ const attributesDef = extensionDef.attributes;
791
+ const pending = [];
792
+ const attributes = {};
793
+ for (const key in attributesDef) {
794
+ pending.push(
795
+ this.parser.getDependency("accessor", attributesDef[key]).then((accessor) => {
796
+ attributes[key] = accessor;
797
+ return attributes[key];
798
+ })
799
+ );
800
+ }
801
+ if (pending.length < 1) {
802
+ return null;
803
+ }
804
+ pending.push(this.parser.createNodeMesh(nodeIndex));
805
+ return Promise.all(pending).then((results) => {
806
+ const nodeObject = results.pop();
807
+ const meshes = nodeObject.isGroup ? nodeObject.children : [nodeObject];
808
+ const count = results[0].count;
809
+ const instancedMeshes = [];
810
+ for (const mesh of meshes) {
811
+ const m = new Matrix4();
812
+ const p = new Vector3();
813
+ const q = new Quaternion();
814
+ const s = new Vector3(1, 1, 1);
815
+ const instancedMesh = new InstancedMesh(mesh.geometry, mesh.material, count);
816
+ for (let i = 0; i < count; i++) {
817
+ if (attributes.TRANSLATION) {
818
+ p.fromBufferAttribute(attributes.TRANSLATION, i);
819
+ }
820
+ if (attributes.ROTATION) {
821
+ q.fromBufferAttribute(attributes.ROTATION, i);
822
+ }
823
+ if (attributes.SCALE) {
824
+ s.fromBufferAttribute(attributes.SCALE, i);
825
+ }
826
+ instancedMesh.setMatrixAt(i, m.compose(p, q, s));
827
+ }
828
+ for (const attributeName in attributes) {
829
+ if (attributeName !== "TRANSLATION" && attributeName !== "ROTATION" && attributeName !== "SCALE") {
830
+ mesh.geometry.setAttribute(attributeName, attributes[attributeName]);
831
+ }
832
+ }
833
+ Object3D.prototype.copy.call(instancedMesh, mesh);
834
+ this.parser.assignFinalMaterial(instancedMesh);
835
+ instancedMeshes.push(instancedMesh);
836
+ }
837
+ if (nodeObject.isGroup) {
838
+ nodeObject.clear();
839
+ nodeObject.add(...instancedMeshes);
840
+ return nodeObject;
841
+ }
842
+ return instancedMeshes[0];
843
+ });
844
+ }
845
+ }
846
+ const BINARY_EXTENSION_HEADER_MAGIC = "glTF";
847
+ const BINARY_EXTENSION_HEADER_LENGTH = 12;
848
+ const BINARY_EXTENSION_CHUNK_TYPES = { JSON: 1313821514, BIN: 5130562 };
849
+ class GLTFBinaryExtension {
850
+ constructor(data) {
851
+ this.name = EXTENSIONS.KHR_BINARY_GLTF;
852
+ this.content = null;
853
+ this.body = null;
854
+ const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);
855
+ this.header = {
856
+ magic: LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))),
857
+ version: headerView.getUint32(4, true),
858
+ length: headerView.getUint32(8, true)
859
+ };
860
+ if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) {
861
+ throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
862
+ } else if (this.header.version < 2) {
863
+ throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
864
+ }
865
+ const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;
866
+ const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH);
867
+ let chunkIndex = 0;
868
+ while (chunkIndex < chunkContentsLength) {
869
+ const chunkLength = chunkView.getUint32(chunkIndex, true);
870
+ chunkIndex += 4;
871
+ const chunkType = chunkView.getUint32(chunkIndex, true);
872
+ chunkIndex += 4;
873
+ if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {
874
+ const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);
875
+ this.content = LoaderUtils.decodeText(contentArray);
876
+ } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {
877
+ const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
878
+ this.body = data.slice(byteOffset, byteOffset + chunkLength);
879
+ }
880
+ chunkIndex += chunkLength;
881
+ }
882
+ if (this.content === null) {
883
+ throw new Error("THREE.GLTFLoader: JSON content not found.");
884
+ }
885
+ }
886
+ }
887
+ class GLTFDracoMeshCompressionExtension {
888
+ constructor(json, dracoLoader) {
889
+ if (!dracoLoader) {
890
+ throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
891
+ }
892
+ this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;
893
+ this.json = json;
894
+ this.dracoLoader = dracoLoader;
895
+ this.dracoLoader.preload();
896
+ }
897
+ decodePrimitive(primitive, parser) {
898
+ const json = this.json;
899
+ const dracoLoader = this.dracoLoader;
900
+ const bufferViewIndex = primitive.extensions[this.name].bufferView;
901
+ const gltfAttributeMap = primitive.extensions[this.name].attributes;
902
+ const threeAttributeMap = {};
903
+ const attributeNormalizedMap = {};
904
+ const attributeTypeMap = {};
905
+ for (const attributeName in gltfAttributeMap) {
906
+ const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();
907
+ threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName];
908
+ }
909
+ for (const attributeName in primitive.attributes) {
910
+ const threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase();
911
+ if (gltfAttributeMap[attributeName] !== void 0) {
912
+ const accessorDef = json.accessors[primitive.attributes[attributeName]];
913
+ const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType];
914
+ attributeTypeMap[threeAttributeName] = componentType.name;
915
+ attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true;
916
+ }
917
+ }
918
+ return parser.getDependency("bufferView", bufferViewIndex).then(function(bufferView) {
919
+ return new Promise(function(resolve) {
920
+ dracoLoader.decodeDracoFile(
921
+ bufferView,
922
+ function(geometry) {
923
+ for (const attributeName in geometry.attributes) {
924
+ const attribute = geometry.attributes[attributeName];
925
+ const normalized = attributeNormalizedMap[attributeName];
926
+ if (normalized !== void 0)
927
+ attribute.normalized = normalized;
928
+ }
929
+ resolve(geometry);
930
+ },
931
+ threeAttributeMap,
932
+ attributeTypeMap
933
+ );
934
+ });
935
+ });
936
+ }
937
+ }
938
+ class GLTFTextureTransformExtension {
939
+ constructor() {
940
+ this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;
941
+ }
942
+ extendTexture(texture, transform) {
943
+ if ((transform.texCoord === void 0 || transform.texCoord === texture.channel) && transform.offset === void 0 && transform.rotation === void 0 && transform.scale === void 0) {
944
+ return texture;
945
+ }
946
+ texture = texture.clone();
947
+ if (transform.texCoord !== void 0) {
948
+ texture.channel = transform.texCoord;
949
+ }
950
+ if (transform.offset !== void 0) {
951
+ texture.offset.fromArray(transform.offset);
952
+ }
953
+ if (transform.rotation !== void 0) {
954
+ texture.rotation = transform.rotation;
955
+ }
956
+ if (transform.scale !== void 0) {
957
+ texture.repeat.fromArray(transform.scale);
958
+ }
959
+ texture.needsUpdate = true;
960
+ return texture;
961
+ }
962
+ }
963
+ class GLTFMeshQuantizationExtension {
964
+ constructor() {
965
+ this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;
966
+ }
967
+ }
968
+ class GLTFCubicSplineInterpolant extends Interpolant {
969
+ constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) {
970
+ super(parameterPositions, sampleValues, sampleSize, resultBuffer);
971
+ }
972
+ copySampleValue_(index) {
973
+ const result = this.resultBuffer, values = this.sampleValues, valueSize = this.valueSize, offset = index * valueSize * 3 + valueSize;
974
+ for (let i = 0; i !== valueSize; i++) {
975
+ result[i] = values[offset + i];
976
+ }
977
+ return result;
978
+ }
979
+ interpolate_(i1, t0, t, t1) {
980
+ const result = this.resultBuffer;
981
+ const values = this.sampleValues;
982
+ const stride = this.valueSize;
983
+ const stride2 = stride * 2;
984
+ const stride3 = stride * 3;
985
+ const td = t1 - t0;
986
+ const p = (t - t0) / td;
987
+ const pp = p * p;
988
+ const ppp = pp * p;
989
+ const offset1 = i1 * stride3;
990
+ const offset0 = offset1 - stride3;
991
+ const s2 = -2 * ppp + 3 * pp;
992
+ const s3 = ppp - pp;
993
+ const s0 = 1 - s2;
994
+ const s1 = s3 - pp + p;
995
+ for (let i = 0; i !== stride; i++) {
996
+ const p0 = values[offset0 + i + stride];
997
+ const m0 = values[offset0 + i + stride2] * td;
998
+ const p1 = values[offset1 + i + stride];
999
+ const m1 = values[offset1 + i] * td;
1000
+ result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
1001
+ }
1002
+ return result;
1003
+ }
1004
+ }
1005
+ const _q = new Quaternion();
1006
+ class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
1007
+ interpolate_(i1, t0, t, t1) {
1008
+ const result = super.interpolate_(i1, t0, t, t1);
1009
+ _q.fromArray(result).normalize().toArray(result);
1010
+ return result;
1011
+ }
1012
+ }
1013
+ const WEBGL_CONSTANTS = {
1014
+ FLOAT: 5126,
1015
+ //FLOAT_MAT2: 35674,
1016
+ FLOAT_MAT3: 35675,
1017
+ FLOAT_MAT4: 35676,
1018
+ FLOAT_VEC2: 35664,
1019
+ FLOAT_VEC3: 35665,
1020
+ FLOAT_VEC4: 35666,
1021
+ LINEAR: 9729,
1022
+ REPEAT: 10497,
1023
+ SAMPLER_2D: 35678,
1024
+ POINTS: 0,
1025
+ LINES: 1,
1026
+ LINE_LOOP: 2,
1027
+ LINE_STRIP: 3,
1028
+ TRIANGLES: 4,
1029
+ TRIANGLE_STRIP: 5,
1030
+ TRIANGLE_FAN: 6,
1031
+ UNSIGNED_BYTE: 5121,
1032
+ UNSIGNED_SHORT: 5123
1033
+ };
1034
+ const WEBGL_COMPONENT_TYPES = {
1035
+ 5120: Int8Array,
1036
+ 5121: Uint8Array,
1037
+ 5122: Int16Array,
1038
+ 5123: Uint16Array,
1039
+ 5125: Uint32Array,
1040
+ 5126: Float32Array
1041
+ };
1042
+ const WEBGL_FILTERS = {
1043
+ 9728: NearestFilter,
1044
+ 9729: LinearFilter,
1045
+ 9984: NearestMipmapNearestFilter,
1046
+ 9985: LinearMipmapNearestFilter,
1047
+ 9986: NearestMipmapLinearFilter,
1048
+ 9987: LinearMipmapLinearFilter
1049
+ };
1050
+ const WEBGL_WRAPPINGS = {
1051
+ 33071: ClampToEdgeWrapping,
1052
+ 33648: MirroredRepeatWrapping,
1053
+ 10497: RepeatWrapping
1054
+ };
1055
+ const WEBGL_TYPE_SIZES = {
1056
+ SCALAR: 1,
1057
+ VEC2: 2,
1058
+ VEC3: 3,
1059
+ VEC4: 4,
1060
+ MAT2: 4,
1061
+ MAT3: 9,
1062
+ MAT4: 16
1063
+ };
1064
+ const ATTRIBUTES = {
1065
+ POSITION: "position",
1066
+ NORMAL: "normal",
1067
+ TANGENT: "tangent",
1068
+ // uv => uv1, 4 uv channels
1069
+ // https://github.com/mrdoob/three.js/pull/25943
1070
+ // https://github.com/mrdoob/three.js/pull/25788
1071
+ ...REVISION.replace(/\D+/g, "") >= 152 ? {
1072
+ TEXCOORD_0: "uv",
1073
+ TEXCOORD_1: "uv1",
1074
+ TEXCOORD_2: "uv2",
1075
+ TEXCOORD_3: "uv3"
1076
+ } : {
1077
+ TEXCOORD_0: "uv",
1078
+ TEXCOORD_1: "uv2"
1079
+ },
1080
+ COLOR_0: "color",
1081
+ WEIGHTS_0: "skinWeight",
1082
+ JOINTS_0: "skinIndex"
1083
+ };
1084
+ const PATH_PROPERTIES = {
1085
+ scale: "scale",
1086
+ translation: "position",
1087
+ rotation: "quaternion",
1088
+ weights: "morphTargetInfluences"
1089
+ };
1090
+ const INTERPOLATION = {
1091
+ CUBICSPLINE: void 0,
1092
+ // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
1093
+ // keyframe track will be initialized with a default interpolation type, then modified.
1094
+ LINEAR: InterpolateLinear,
1095
+ STEP: InterpolateDiscrete
1096
+ };
1097
+ const ALPHA_MODES = {
1098
+ OPAQUE: "OPAQUE",
1099
+ MASK: "MASK",
1100
+ BLEND: "BLEND"
1101
+ };
1102
+ function createDefaultMaterial(cache) {
1103
+ if (cache["DefaultMaterial"] === void 0) {
1104
+ cache["DefaultMaterial"] = new MeshStandardMaterial({
1105
+ color: 16777215,
1106
+ emissive: 0,
1107
+ metalness: 1,
1108
+ roughness: 1,
1109
+ transparent: false,
1110
+ depthTest: true,
1111
+ side: FrontSide
1112
+ });
1113
+ }
1114
+ return cache["DefaultMaterial"];
1115
+ }
1116
+ function addUnknownExtensionsToUserData(knownExtensions, object, objectDef) {
1117
+ for (const name in objectDef.extensions) {
1118
+ if (knownExtensions[name] === void 0) {
1119
+ object.userData.gltfExtensions = object.userData.gltfExtensions || {};
1120
+ object.userData.gltfExtensions[name] = objectDef.extensions[name];
1121
+ }
1122
+ }
1123
+ }
1124
+ function assignExtrasToUserData(object, gltfDef) {
1125
+ if (gltfDef.extras !== void 0) {
1126
+ if (typeof gltfDef.extras === "object") {
1127
+ Object.assign(object.userData, gltfDef.extras);
1128
+ } else {
1129
+ console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + gltfDef.extras);
1130
+ }
1131
+ }
1132
+ }
1133
+ function addMorphTargets(geometry, targets, parser) {
1134
+ let hasMorphPosition = false;
1135
+ let hasMorphNormal = false;
1136
+ let hasMorphColor = false;
1137
+ for (let i = 0, il = targets.length; i < il; i++) {
1138
+ const target = targets[i];
1139
+ if (target.POSITION !== void 0)
1140
+ hasMorphPosition = true;
1141
+ if (target.NORMAL !== void 0)
1142
+ hasMorphNormal = true;
1143
+ if (target.COLOR_0 !== void 0)
1144
+ hasMorphColor = true;
1145
+ if (hasMorphPosition && hasMorphNormal && hasMorphColor)
1146
+ break;
1147
+ }
1148
+ if (!hasMorphPosition && !hasMorphNormal && !hasMorphColor)
1149
+ return Promise.resolve(geometry);
1150
+ const pendingPositionAccessors = [];
1151
+ const pendingNormalAccessors = [];
1152
+ const pendingColorAccessors = [];
1153
+ for (let i = 0, il = targets.length; i < il; i++) {
1154
+ const target = targets[i];
1155
+ if (hasMorphPosition) {
1156
+ const pendingAccessor = target.POSITION !== void 0 ? parser.getDependency("accessor", target.POSITION) : geometry.attributes.position;
1157
+ pendingPositionAccessors.push(pendingAccessor);
1158
+ }
1159
+ if (hasMorphNormal) {
1160
+ const pendingAccessor = target.NORMAL !== void 0 ? parser.getDependency("accessor", target.NORMAL) : geometry.attributes.normal;
1161
+ pendingNormalAccessors.push(pendingAccessor);
1162
+ }
1163
+ if (hasMorphColor) {
1164
+ const pendingAccessor = target.COLOR_0 !== void 0 ? parser.getDependency("accessor", target.COLOR_0) : geometry.attributes.color;
1165
+ pendingColorAccessors.push(pendingAccessor);
1166
+ }
1167
+ }
1168
+ return Promise.all([
1169
+ Promise.all(pendingPositionAccessors),
1170
+ Promise.all(pendingNormalAccessors),
1171
+ Promise.all(pendingColorAccessors)
1172
+ ]).then(function(accessors) {
1173
+ const morphPositions = accessors[0];
1174
+ const morphNormals = accessors[1];
1175
+ const morphColors = accessors[2];
1176
+ if (hasMorphPosition)
1177
+ geometry.morphAttributes.position = morphPositions;
1178
+ if (hasMorphNormal)
1179
+ geometry.morphAttributes.normal = morphNormals;
1180
+ if (hasMorphColor)
1181
+ geometry.morphAttributes.color = morphColors;
1182
+ geometry.morphTargetsRelative = true;
1183
+ return geometry;
1184
+ });
1185
+ }
1186
+ function updateMorphTargets(mesh, meshDef) {
1187
+ mesh.updateMorphTargets();
1188
+ if (meshDef.weights !== void 0) {
1189
+ for (let i = 0, il = meshDef.weights.length; i < il; i++) {
1190
+ mesh.morphTargetInfluences[i] = meshDef.weights[i];
1191
+ }
1192
+ }
1193
+ if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) {
1194
+ const targetNames = meshDef.extras.targetNames;
1195
+ if (mesh.morphTargetInfluences.length === targetNames.length) {
1196
+ mesh.morphTargetDictionary = {};
1197
+ for (let i = 0, il = targetNames.length; i < il; i++) {
1198
+ mesh.morphTargetDictionary[targetNames[i]] = i;
1199
+ }
1200
+ } else {
1201
+ console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
1202
+ }
1203
+ }
1204
+ }
1205
+ function createPrimitiveKey(primitiveDef) {
1206
+ const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION];
1207
+ let geometryKey;
1208
+ if (dracoExtension) {
1209
+ geometryKey = "draco:" + dracoExtension.bufferView + ":" + dracoExtension.indices + ":" + createAttributesKey(dracoExtension.attributes);
1210
+ } else {
1211
+ geometryKey = primitiveDef.indices + ":" + createAttributesKey(primitiveDef.attributes) + ":" + primitiveDef.mode;
1212
+ }
1213
+ return geometryKey;
1214
+ }
1215
+ function createAttributesKey(attributes) {
1216
+ let attributesKey = "";
1217
+ const keys = Object.keys(attributes).sort();
1218
+ for (let i = 0, il = keys.length; i < il; i++) {
1219
+ attributesKey += keys[i] + ":" + attributes[keys[i]] + ";";
1220
+ }
1221
+ return attributesKey;
1222
+ }
1223
+ function getNormalizedComponentScale(constructor) {
1224
+ switch (constructor) {
1225
+ case Int8Array:
1226
+ return 1 / 127;
1227
+ case Uint8Array:
1228
+ return 1 / 255;
1229
+ case Int16Array:
1230
+ return 1 / 32767;
1231
+ case Uint16Array:
1232
+ return 1 / 65535;
1233
+ default:
1234
+ throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
1235
+ }
1236
+ }
1237
+ function getImageURIMimeType(uri) {
1238
+ if (uri.search(/\.jpe?g($|\?)/i) > 0 || uri.search(/^data\:image\/jpeg/) === 0)
1239
+ return "image/jpeg";
1240
+ if (uri.search(/\.webp($|\?)/i) > 0 || uri.search(/^data\:image\/webp/) === 0)
1241
+ return "image/webp";
1242
+ return "image/png";
1243
+ }
1244
+ const _identityMatrix = new Matrix4();
1245
+ class GLTFParser {
1246
+ constructor(json = {}, options = {}) {
1247
+ this.json = json;
1248
+ this.extensions = {};
1249
+ this.plugins = {};
1250
+ this.options = options;
1251
+ this.cache = new GLTFRegistry();
1252
+ this.associations = /* @__PURE__ */ new Map();
1253
+ this.primitiveCache = {};
1254
+ this.nodeCache = {};
1255
+ this.meshCache = { refs: {}, uses: {} };
1256
+ this.cameraCache = { refs: {}, uses: {} };
1257
+ this.lightCache = { refs: {}, uses: {} };
1258
+ this.sourceCache = {};
1259
+ this.textureCache = {};
1260
+ this.nodeNamesUsed = {};
1261
+ let isSafari = false;
1262
+ let isFirefox = false;
1263
+ let firefoxVersion = -1;
1264
+ if (typeof navigator !== "undefined") {
1265
+ isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent) === true;
1266
+ isFirefox = navigator.userAgent.indexOf("Firefox") > -1;
1267
+ firefoxVersion = isFirefox ? navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1] : -1;
1268
+ }
1269
+ if (typeof createImageBitmap === "undefined" || isSafari || isFirefox && firefoxVersion < 98) {
1270
+ this.textureLoader = new TextureLoader(this.options.manager);
1271
+ } else {
1272
+ this.textureLoader = new ImageBitmapLoader(this.options.manager);
1273
+ }
1274
+ this.textureLoader.setCrossOrigin(this.options.crossOrigin);
1275
+ this.textureLoader.setRequestHeader(this.options.requestHeader);
1276
+ this.fileLoader = new FileLoader(this.options.manager);
1277
+ this.fileLoader.setResponseType("arraybuffer");
1278
+ if (this.options.crossOrigin === "use-credentials") {
1279
+ this.fileLoader.setWithCredentials(true);
1280
+ }
1281
+ }
1282
+ setExtensions(extensions) {
1283
+ this.extensions = extensions;
1284
+ }
1285
+ setPlugins(plugins) {
1286
+ this.plugins = plugins;
1287
+ }
1288
+ parse(onLoad, onError) {
1289
+ const parser = this;
1290
+ const json = this.json;
1291
+ const extensions = this.extensions;
1292
+ this.cache.removeAll();
1293
+ this.nodeCache = {};
1294
+ this._invokeAll(function(ext) {
1295
+ return ext._markDefs && ext._markDefs();
1296
+ });
1297
+ Promise.all(
1298
+ this._invokeAll(function(ext) {
1299
+ return ext.beforeRoot && ext.beforeRoot();
1300
+ })
1301
+ ).then(function() {
1302
+ return Promise.all([
1303
+ parser.getDependencies("scene"),
1304
+ parser.getDependencies("animation"),
1305
+ parser.getDependencies("camera")
1306
+ ]);
1307
+ }).then(function(dependencies) {
1308
+ const result = {
1309
+ scene: dependencies[0][json.scene || 0],
1310
+ scenes: dependencies[0],
1311
+ animations: dependencies[1],
1312
+ cameras: dependencies[2],
1313
+ asset: json.asset,
1314
+ parser,
1315
+ userData: {}
1316
+ };
1317
+ addUnknownExtensionsToUserData(extensions, result, json);
1318
+ assignExtrasToUserData(result, json);
1319
+ Promise.all(
1320
+ parser._invokeAll(function(ext) {
1321
+ return ext.afterRoot && ext.afterRoot(result);
1322
+ })
1323
+ ).then(function() {
1324
+ onLoad(result);
1325
+ });
1326
+ }).catch(onError);
1327
+ }
1328
+ /**
1329
+ * Marks the special nodes/meshes in json for efficient parse.
1330
+ */
1331
+ _markDefs() {
1332
+ const nodeDefs = this.json.nodes || [];
1333
+ const skinDefs = this.json.skins || [];
1334
+ const meshDefs = this.json.meshes || [];
1335
+ for (let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) {
1336
+ const joints = skinDefs[skinIndex].joints;
1337
+ for (let i = 0, il = joints.length; i < il; i++) {
1338
+ nodeDefs[joints[i]].isBone = true;
1339
+ }
1340
+ }
1341
+ for (let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) {
1342
+ const nodeDef = nodeDefs[nodeIndex];
1343
+ if (nodeDef.mesh !== void 0) {
1344
+ this._addNodeRef(this.meshCache, nodeDef.mesh);
1345
+ if (nodeDef.skin !== void 0) {
1346
+ meshDefs[nodeDef.mesh].isSkinnedMesh = true;
1347
+ }
1348
+ }
1349
+ if (nodeDef.camera !== void 0) {
1350
+ this._addNodeRef(this.cameraCache, nodeDef.camera);
1351
+ }
1352
+ }
1353
+ }
1354
+ /**
1355
+ * Counts references to shared node / Object3D resources. These resources
1356
+ * can be reused, or "instantiated", at multiple nodes in the scene
1357
+ * hierarchy. Mesh, Camera, and Light instances are instantiated and must
1358
+ * be marked. Non-scenegraph resources (like Materials, Geometries, and
1359
+ * Textures) can be reused directly and are not marked here.
1360
+ *
1361
+ * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
1362
+ */
1363
+ _addNodeRef(cache, index) {
1364
+ if (index === void 0)
1365
+ return;
1366
+ if (cache.refs[index] === void 0) {
1367
+ cache.refs[index] = cache.uses[index] = 0;
1368
+ }
1369
+ cache.refs[index]++;
1370
+ }
1371
+ /** Returns a reference to a shared resource, cloning it if necessary. */
1372
+ _getNodeRef(cache, index, object) {
1373
+ if (cache.refs[index] <= 1)
1374
+ return object;
1375
+ const ref = object.clone();
1376
+ const updateMappings = (original, clone) => {
1377
+ const mappings = this.associations.get(original);
1378
+ if (mappings != null) {
1379
+ this.associations.set(clone, mappings);
1380
+ }
1381
+ for (const [i, child] of original.children.entries()) {
1382
+ updateMappings(child, clone.children[i]);
1383
+ }
1384
+ };
1385
+ updateMappings(object, ref);
1386
+ ref.name += "_instance_" + cache.uses[index]++;
1387
+ return ref;
1388
+ }
1389
+ _invokeOne(func) {
1390
+ const extensions = Object.values(this.plugins);
1391
+ extensions.push(this);
1392
+ for (let i = 0; i < extensions.length; i++) {
1393
+ const result = func(extensions[i]);
1394
+ if (result)
1395
+ return result;
1396
+ }
1397
+ return null;
1398
+ }
1399
+ _invokeAll(func) {
1400
+ const extensions = Object.values(this.plugins);
1401
+ extensions.unshift(this);
1402
+ const pending = [];
1403
+ for (let i = 0; i < extensions.length; i++) {
1404
+ const result = func(extensions[i]);
1405
+ if (result)
1406
+ pending.push(result);
1407
+ }
1408
+ return pending;
1409
+ }
1410
+ /**
1411
+ * Requests the specified dependency asynchronously, with caching.
1412
+ * @param {string} type
1413
+ * @param {number} index
1414
+ * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
1415
+ */
1416
+ getDependency(type, index) {
1417
+ const cacheKey = type + ":" + index;
1418
+ let dependency = this.cache.get(cacheKey);
1419
+ if (!dependency) {
1420
+ switch (type) {
1421
+ case "scene":
1422
+ dependency = this.loadScene(index);
1423
+ break;
1424
+ case "node":
1425
+ dependency = this._invokeOne(function(ext) {
1426
+ return ext.loadNode && ext.loadNode(index);
1427
+ });
1428
+ break;
1429
+ case "mesh":
1430
+ dependency = this._invokeOne(function(ext) {
1431
+ return ext.loadMesh && ext.loadMesh(index);
1432
+ });
1433
+ break;
1434
+ case "accessor":
1435
+ dependency = this.loadAccessor(index);
1436
+ break;
1437
+ case "bufferView":
1438
+ dependency = this._invokeOne(function(ext) {
1439
+ return ext.loadBufferView && ext.loadBufferView(index);
1440
+ });
1441
+ break;
1442
+ case "buffer":
1443
+ dependency = this.loadBuffer(index);
1444
+ break;
1445
+ case "material":
1446
+ dependency = this._invokeOne(function(ext) {
1447
+ return ext.loadMaterial && ext.loadMaterial(index);
1448
+ });
1449
+ break;
1450
+ case "texture":
1451
+ dependency = this._invokeOne(function(ext) {
1452
+ return ext.loadTexture && ext.loadTexture(index);
1453
+ });
1454
+ break;
1455
+ case "skin":
1456
+ dependency = this.loadSkin(index);
1457
+ break;
1458
+ case "animation":
1459
+ dependency = this._invokeOne(function(ext) {
1460
+ return ext.loadAnimation && ext.loadAnimation(index);
1461
+ });
1462
+ break;
1463
+ case "camera":
1464
+ dependency = this.loadCamera(index);
1465
+ break;
1466
+ default:
1467
+ dependency = this._invokeOne(function(ext) {
1468
+ return ext != this && ext.getDependency && ext.getDependency(type, index);
1469
+ });
1470
+ if (!dependency) {
1471
+ throw new Error("Unknown type: " + type);
1472
+ }
1473
+ break;
1474
+ }
1475
+ this.cache.add(cacheKey, dependency);
1476
+ }
1477
+ return dependency;
1478
+ }
1479
+ /**
1480
+ * Requests all dependencies of the specified type asynchronously, with caching.
1481
+ * @param {string} type
1482
+ * @return {Promise<Array<Object>>}
1483
+ */
1484
+ getDependencies(type) {
1485
+ let dependencies = this.cache.get(type);
1486
+ if (!dependencies) {
1487
+ const parser = this;
1488
+ const defs = this.json[type + (type === "mesh" ? "es" : "s")] || [];
1489
+ dependencies = Promise.all(
1490
+ defs.map(function(def, index) {
1491
+ return parser.getDependency(type, index);
1492
+ })
1493
+ );
1494
+ this.cache.add(type, dependencies);
1495
+ }
1496
+ return dependencies;
1497
+ }
1498
+ /**
1499
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1500
+ * @param {number} bufferIndex
1501
+ * @return {Promise<ArrayBuffer>}
1502
+ */
1503
+ loadBuffer(bufferIndex) {
1504
+ const bufferDef = this.json.buffers[bufferIndex];
1505
+ const loader = this.fileLoader;
1506
+ if (bufferDef.type && bufferDef.type !== "arraybuffer") {
1507
+ throw new Error("THREE.GLTFLoader: " + bufferDef.type + " buffer type is not supported.");
1508
+ }
1509
+ if (bufferDef.uri === void 0 && bufferIndex === 0) {
1510
+ return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body);
1511
+ }
1512
+ const options = this.options;
1513
+ return new Promise(function(resolve, reject) {
1514
+ loader.load(LoaderUtils.resolveURL(bufferDef.uri, options.path), resolve, void 0, function() {
1515
+ reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".'));
1516
+ });
1517
+ });
1518
+ }
1519
+ /**
1520
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
1521
+ * @param {number} bufferViewIndex
1522
+ * @return {Promise<ArrayBuffer>}
1523
+ */
1524
+ loadBufferView(bufferViewIndex) {
1525
+ const bufferViewDef = this.json.bufferViews[bufferViewIndex];
1526
+ return this.getDependency("buffer", bufferViewDef.buffer).then(function(buffer) {
1527
+ const byteLength = bufferViewDef.byteLength || 0;
1528
+ const byteOffset = bufferViewDef.byteOffset || 0;
1529
+ return buffer.slice(byteOffset, byteOffset + byteLength);
1530
+ });
1531
+ }
1532
+ /**
1533
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
1534
+ * @param {number} accessorIndex
1535
+ * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
1536
+ */
1537
+ loadAccessor(accessorIndex) {
1538
+ const parser = this;
1539
+ const json = this.json;
1540
+ const accessorDef = this.json.accessors[accessorIndex];
1541
+ if (accessorDef.bufferView === void 0 && accessorDef.sparse === void 0) {
1542
+ const itemSize = WEBGL_TYPE_SIZES[accessorDef.type];
1543
+ const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];
1544
+ const normalized = accessorDef.normalized === true;
1545
+ const array = new TypedArray(accessorDef.count * itemSize);
1546
+ return Promise.resolve(new BufferAttribute(array, itemSize, normalized));
1547
+ }
1548
+ const pendingBufferViews = [];
1549
+ if (accessorDef.bufferView !== void 0) {
1550
+ pendingBufferViews.push(this.getDependency("bufferView", accessorDef.bufferView));
1551
+ } else {
1552
+ pendingBufferViews.push(null);
1553
+ }
1554
+ if (accessorDef.sparse !== void 0) {
1555
+ pendingBufferViews.push(this.getDependency("bufferView", accessorDef.sparse.indices.bufferView));
1556
+ pendingBufferViews.push(this.getDependency("bufferView", accessorDef.sparse.values.bufferView));
1557
+ }
1558
+ return Promise.all(pendingBufferViews).then(function(bufferViews) {
1559
+ const bufferView = bufferViews[0];
1560
+ const itemSize = WEBGL_TYPE_SIZES[accessorDef.type];
1561
+ const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType];
1562
+ const elementBytes = TypedArray.BYTES_PER_ELEMENT;
1563
+ const itemBytes = elementBytes * itemSize;
1564
+ const byteOffset = accessorDef.byteOffset || 0;
1565
+ const byteStride = accessorDef.bufferView !== void 0 ? json.bufferViews[accessorDef.bufferView].byteStride : void 0;
1566
+ const normalized = accessorDef.normalized === true;
1567
+ let array, bufferAttribute;
1568
+ if (byteStride && byteStride !== itemBytes) {
1569
+ const ibSlice = Math.floor(byteOffset / byteStride);
1570
+ const ibCacheKey = "InterleavedBuffer:" + accessorDef.bufferView + ":" + accessorDef.componentType + ":" + ibSlice + ":" + accessorDef.count;
1571
+ let ib = parser.cache.get(ibCacheKey);
1572
+ if (!ib) {
1573
+ array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes);
1574
+ ib = new InterleavedBuffer(array, byteStride / elementBytes);
1575
+ parser.cache.add(ibCacheKey, ib);
1576
+ }
1577
+ bufferAttribute = new InterleavedBufferAttribute(
1578
+ ib,
1579
+ itemSize,
1580
+ byteOffset % byteStride / elementBytes,
1581
+ normalized
1582
+ );
1583
+ } else {
1584
+ if (bufferView === null) {
1585
+ array = new TypedArray(accessorDef.count * itemSize);
1586
+ } else {
1587
+ array = new TypedArray(bufferView, byteOffset, accessorDef.count * itemSize);
1588
+ }
1589
+ bufferAttribute = new BufferAttribute(array, itemSize, normalized);
1590
+ }
1591
+ if (accessorDef.sparse !== void 0) {
1592
+ const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;
1593
+ const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType];
1594
+ const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;
1595
+ const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;
1596
+ const sparseIndices = new TypedArrayIndices(
1597
+ bufferViews[1],
1598
+ byteOffsetIndices,
1599
+ accessorDef.sparse.count * itemSizeIndices
1600
+ );
1601
+ const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize);
1602
+ if (bufferView !== null) {
1603
+ bufferAttribute = new BufferAttribute(
1604
+ bufferAttribute.array.slice(),
1605
+ bufferAttribute.itemSize,
1606
+ bufferAttribute.normalized
1607
+ );
1608
+ }
1609
+ for (let i = 0, il = sparseIndices.length; i < il; i++) {
1610
+ const index = sparseIndices[i];
1611
+ bufferAttribute.setX(index, sparseValues[i * itemSize]);
1612
+ if (itemSize >= 2)
1613
+ bufferAttribute.setY(index, sparseValues[i * itemSize + 1]);
1614
+ if (itemSize >= 3)
1615
+ bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]);
1616
+ if (itemSize >= 4)
1617
+ bufferAttribute.setW(index, sparseValues[i * itemSize + 3]);
1618
+ if (itemSize >= 5)
1619
+ throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
1620
+ }
1621
+ }
1622
+ return bufferAttribute;
1623
+ });
1624
+ }
1625
+ /**
1626
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
1627
+ * @param {number} textureIndex
1628
+ * @return {Promise<THREE.Texture|null>}
1629
+ */
1630
+ loadTexture(textureIndex) {
1631
+ const json = this.json;
1632
+ const options = this.options;
1633
+ const textureDef = json.textures[textureIndex];
1634
+ const sourceIndex = textureDef.source;
1635
+ const sourceDef = json.images[sourceIndex];
1636
+ let loader = this.textureLoader;
1637
+ if (sourceDef.uri) {
1638
+ const handler = options.manager.getHandler(sourceDef.uri);
1639
+ if (handler !== null)
1640
+ loader = handler;
1641
+ }
1642
+ return this.loadTextureImage(textureIndex, sourceIndex, loader);
1643
+ }
1644
+ loadTextureImage(textureIndex, sourceIndex, loader) {
1645
+ const parser = this;
1646
+ const json = this.json;
1647
+ const textureDef = json.textures[textureIndex];
1648
+ const sourceDef = json.images[sourceIndex];
1649
+ const cacheKey = (sourceDef.uri || sourceDef.bufferView) + ":" + textureDef.sampler;
1650
+ if (this.textureCache[cacheKey]) {
1651
+ return this.textureCache[cacheKey];
1652
+ }
1653
+ const promise = this.loadImageSource(sourceIndex, loader).then(function(texture) {
1654
+ texture.flipY = false;
1655
+ texture.name = textureDef.name || sourceDef.name || "";
1656
+ if (texture.name === "" && typeof sourceDef.uri === "string" && sourceDef.uri.startsWith("data:image/") === false) {
1657
+ texture.name = sourceDef.uri;
1658
+ }
1659
+ const samplers = json.samplers || {};
1660
+ const sampler = samplers[textureDef.sampler] || {};
1661
+ texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || LinearFilter;
1662
+ texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || LinearMipmapLinearFilter;
1663
+ texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || RepeatWrapping;
1664
+ texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || RepeatWrapping;
1665
+ parser.associations.set(texture, { textures: textureIndex });
1666
+ return texture;
1667
+ }).catch(function() {
1668
+ return null;
1669
+ });
1670
+ this.textureCache[cacheKey] = promise;
1671
+ return promise;
1672
+ }
1673
+ loadImageSource(sourceIndex, loader) {
1674
+ const parser = this;
1675
+ const json = this.json;
1676
+ const options = this.options;
1677
+ if (this.sourceCache[sourceIndex] !== void 0) {
1678
+ return this.sourceCache[sourceIndex].then((texture) => texture.clone());
1679
+ }
1680
+ const sourceDef = json.images[sourceIndex];
1681
+ const URL = self.URL || self.webkitURL;
1682
+ let sourceURI = sourceDef.uri || "";
1683
+ let isObjectURL = false;
1684
+ if (sourceDef.bufferView !== void 0) {
1685
+ sourceURI = parser.getDependency("bufferView", sourceDef.bufferView).then(function(bufferView) {
1686
+ isObjectURL = true;
1687
+ const blob = new Blob([bufferView], { type: sourceDef.mimeType });
1688
+ sourceURI = URL.createObjectURL(blob);
1689
+ return sourceURI;
1690
+ });
1691
+ } else if (sourceDef.uri === void 0) {
1692
+ throw new Error("THREE.GLTFLoader: Image " + sourceIndex + " is missing URI and bufferView");
1693
+ }
1694
+ const promise = Promise.resolve(sourceURI).then(function(sourceURI2) {
1695
+ return new Promise(function(resolve, reject) {
1696
+ let onLoad = resolve;
1697
+ if (loader.isImageBitmapLoader === true) {
1698
+ onLoad = function(imageBitmap) {
1699
+ const texture = new Texture(imageBitmap);
1700
+ texture.needsUpdate = true;
1701
+ resolve(texture);
1702
+ };
1703
+ }
1704
+ loader.load(LoaderUtils.resolveURL(sourceURI2, options.path), onLoad, void 0, reject);
1705
+ });
1706
+ }).then(function(texture) {
1707
+ if (isObjectURL === true) {
1708
+ URL.revokeObjectURL(sourceURI);
1709
+ }
1710
+ texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri);
1711
+ return texture;
1712
+ }).catch(function(error) {
1713
+ console.error("THREE.GLTFLoader: Couldn't load texture", sourceURI);
1714
+ throw error;
1715
+ });
1716
+ this.sourceCache[sourceIndex] = promise;
1717
+ return promise;
1718
+ }
1719
+ /**
1720
+ * Asynchronously assigns a texture to the given material parameters.
1721
+ * @param {Object} materialParams
1722
+ * @param {string} mapName
1723
+ * @param {Object} mapDef
1724
+ * @return {Promise<Texture>}
1725
+ */
1726
+ assignTexture(materialParams, mapName, mapDef, encoding) {
1727
+ const parser = this;
1728
+ return this.getDependency("texture", mapDef.index).then(function(texture) {
1729
+ if (!texture)
1730
+ return null;
1731
+ if (mapDef.texCoord !== void 0 && mapDef.texCoord > 0) {
1732
+ texture = texture.clone();
1733
+ texture.channel = mapDef.texCoord;
1734
+ }
1735
+ if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) {
1736
+ const transform = mapDef.extensions !== void 0 ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : void 0;
1737
+ if (transform) {
1738
+ const gltfReference = parser.associations.get(texture);
1739
+ texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform);
1740
+ parser.associations.set(texture, gltfReference);
1741
+ }
1742
+ }
1743
+ if (encoding !== void 0) {
1744
+ if ("colorSpace" in texture)
1745
+ texture.colorSpace = encoding === 3001 ? "srgb" : "srgb-linear";
1746
+ else
1747
+ texture.encoding = encoding;
1748
+ }
1749
+ materialParams[mapName] = texture;
1750
+ return texture;
1751
+ });
1752
+ }
1753
+ /**
1754
+ * Assigns final material to a Mesh, Line, or Points instance. The instance
1755
+ * already has a material (generated from the glTF material options alone)
1756
+ * but reuse of the same glTF material may require multiple threejs materials
1757
+ * to accommodate different primitive types, defines, etc. New materials will
1758
+ * be created if necessary, and reused from a cache.
1759
+ * @param {Object3D} mesh Mesh, Line, or Points instance.
1760
+ */
1761
+ assignFinalMaterial(mesh) {
1762
+ const geometry = mesh.geometry;
1763
+ let material = mesh.material;
1764
+ const useDerivativeTangents = geometry.attributes.tangent === void 0;
1765
+ const useVertexColors = geometry.attributes.color !== void 0;
1766
+ const useFlatShading = geometry.attributes.normal === void 0;
1767
+ if (mesh.isPoints) {
1768
+ const cacheKey = "PointsMaterial:" + material.uuid;
1769
+ let pointsMaterial = this.cache.get(cacheKey);
1770
+ if (!pointsMaterial) {
1771
+ pointsMaterial = new PointsMaterial();
1772
+ Material.prototype.copy.call(pointsMaterial, material);
1773
+ pointsMaterial.color.copy(material.color);
1774
+ pointsMaterial.map = material.map;
1775
+ pointsMaterial.sizeAttenuation = false;
1776
+ this.cache.add(cacheKey, pointsMaterial);
1777
+ }
1778
+ material = pointsMaterial;
1779
+ } else if (mesh.isLine) {
1780
+ const cacheKey = "LineBasicMaterial:" + material.uuid;
1781
+ let lineMaterial = this.cache.get(cacheKey);
1782
+ if (!lineMaterial) {
1783
+ lineMaterial = new LineBasicMaterial();
1784
+ Material.prototype.copy.call(lineMaterial, material);
1785
+ lineMaterial.color.copy(material.color);
1786
+ lineMaterial.map = material.map;
1787
+ this.cache.add(cacheKey, lineMaterial);
1788
+ }
1789
+ material = lineMaterial;
1790
+ }
1791
+ if (useDerivativeTangents || useVertexColors || useFlatShading) {
1792
+ let cacheKey = "ClonedMaterial:" + material.uuid + ":";
1793
+ if (useDerivativeTangents)
1794
+ cacheKey += "derivative-tangents:";
1795
+ if (useVertexColors)
1796
+ cacheKey += "vertex-colors:";
1797
+ if (useFlatShading)
1798
+ cacheKey += "flat-shading:";
1799
+ let cachedMaterial = this.cache.get(cacheKey);
1800
+ if (!cachedMaterial) {
1801
+ cachedMaterial = material.clone();
1802
+ if (useVertexColors)
1803
+ cachedMaterial.vertexColors = true;
1804
+ if (useFlatShading)
1805
+ cachedMaterial.flatShading = true;
1806
+ if (useDerivativeTangents) {
1807
+ if (cachedMaterial.normalScale)
1808
+ cachedMaterial.normalScale.y *= -1;
1809
+ if (cachedMaterial.clearcoatNormalScale)
1810
+ cachedMaterial.clearcoatNormalScale.y *= -1;
1811
+ }
1812
+ this.cache.add(cacheKey, cachedMaterial);
1813
+ this.associations.set(cachedMaterial, this.associations.get(material));
1814
+ }
1815
+ material = cachedMaterial;
1816
+ }
1817
+ mesh.material = material;
1818
+ }
1819
+ getMaterialType() {
1820
+ return MeshStandardMaterial;
1821
+ }
1822
+ /**
1823
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
1824
+ * @param {number} materialIndex
1825
+ * @return {Promise<Material>}
1826
+ */
1827
+ loadMaterial(materialIndex) {
1828
+ const parser = this;
1829
+ const json = this.json;
1830
+ const extensions = this.extensions;
1831
+ const materialDef = json.materials[materialIndex];
1832
+ let materialType;
1833
+ const materialParams = {};
1834
+ const materialExtensions = materialDef.extensions || {};
1835
+ const pending = [];
1836
+ if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) {
1837
+ const kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT];
1838
+ materialType = kmuExtension.getMaterialType();
1839
+ pending.push(kmuExtension.extendParams(materialParams, materialDef, parser));
1840
+ } else {
1841
+ const metallicRoughness = materialDef.pbrMetallicRoughness || {};
1842
+ materialParams.color = new Color(1, 1, 1);
1843
+ materialParams.opacity = 1;
1844
+ if (Array.isArray(metallicRoughness.baseColorFactor)) {
1845
+ const array = metallicRoughness.baseColorFactor;
1846
+ materialParams.color.fromArray(array);
1847
+ materialParams.opacity = array[3];
1848
+ }
1849
+ if (metallicRoughness.baseColorTexture !== void 0) {
1850
+ pending.push(parser.assignTexture(materialParams, "map", metallicRoughness.baseColorTexture, 3001));
1851
+ }
1852
+ materialParams.metalness = metallicRoughness.metallicFactor !== void 0 ? metallicRoughness.metallicFactor : 1;
1853
+ materialParams.roughness = metallicRoughness.roughnessFactor !== void 0 ? metallicRoughness.roughnessFactor : 1;
1854
+ if (metallicRoughness.metallicRoughnessTexture !== void 0) {
1855
+ pending.push(parser.assignTexture(materialParams, "metalnessMap", metallicRoughness.metallicRoughnessTexture));
1856
+ pending.push(parser.assignTexture(materialParams, "roughnessMap", metallicRoughness.metallicRoughnessTexture));
1857
+ }
1858
+ materialType = this._invokeOne(function(ext) {
1859
+ return ext.getMaterialType && ext.getMaterialType(materialIndex);
1860
+ });
1861
+ pending.push(
1862
+ Promise.all(
1863
+ this._invokeAll(function(ext) {
1864
+ return ext.extendMaterialParams && ext.extendMaterialParams(materialIndex, materialParams);
1865
+ })
1866
+ )
1867
+ );
1868
+ }
1869
+ if (materialDef.doubleSided === true) {
1870
+ materialParams.side = DoubleSide;
1871
+ }
1872
+ const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;
1873
+ if (alphaMode === ALPHA_MODES.BLEND) {
1874
+ materialParams.transparent = true;
1875
+ materialParams.depthWrite = false;
1876
+ } else {
1877
+ materialParams.transparent = false;
1878
+ if (alphaMode === ALPHA_MODES.MASK) {
1879
+ materialParams.alphaTest = materialDef.alphaCutoff !== void 0 ? materialDef.alphaCutoff : 0.5;
1880
+ }
1881
+ }
1882
+ if (materialDef.normalTexture !== void 0 && materialType !== MeshBasicMaterial) {
1883
+ pending.push(parser.assignTexture(materialParams, "normalMap", materialDef.normalTexture));
1884
+ materialParams.normalScale = new Vector2(1, 1);
1885
+ if (materialDef.normalTexture.scale !== void 0) {
1886
+ const scale = materialDef.normalTexture.scale;
1887
+ materialParams.normalScale.set(scale, scale);
1888
+ }
1889
+ }
1890
+ if (materialDef.occlusionTexture !== void 0 && materialType !== MeshBasicMaterial) {
1891
+ pending.push(parser.assignTexture(materialParams, "aoMap", materialDef.occlusionTexture));
1892
+ if (materialDef.occlusionTexture.strength !== void 0) {
1893
+ materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;
1894
+ }
1895
+ }
1896
+ if (materialDef.emissiveFactor !== void 0 && materialType !== MeshBasicMaterial) {
1897
+ materialParams.emissive = new Color().fromArray(materialDef.emissiveFactor);
1898
+ }
1899
+ if (materialDef.emissiveTexture !== void 0 && materialType !== MeshBasicMaterial) {
1900
+ pending.push(parser.assignTexture(materialParams, "emissiveMap", materialDef.emissiveTexture, 3001));
1901
+ }
1902
+ return Promise.all(pending).then(function() {
1903
+ const material = new materialType(materialParams);
1904
+ if (materialDef.name)
1905
+ material.name = materialDef.name;
1906
+ assignExtrasToUserData(material, materialDef);
1907
+ parser.associations.set(material, { materials: materialIndex });
1908
+ if (materialDef.extensions)
1909
+ addUnknownExtensionsToUserData(extensions, material, materialDef);
1910
+ return material;
1911
+ });
1912
+ }
1913
+ /** When Object3D instances are targeted by animation, they need unique names. */
1914
+ createUniqueName(originalName) {
1915
+ const sanitizedName = PropertyBinding.sanitizeNodeName(originalName || "");
1916
+ let name = sanitizedName;
1917
+ for (let i = 1; this.nodeNamesUsed[name]; ++i) {
1918
+ name = sanitizedName + "_" + i;
1919
+ }
1920
+ this.nodeNamesUsed[name] = true;
1921
+ return name;
1922
+ }
1923
+ /**
1924
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
1925
+ *
1926
+ * Creates BufferGeometries from primitives.
1927
+ *
1928
+ * @param {Array<GLTF.Primitive>} primitives
1929
+ * @return {Promise<Array<BufferGeometry>>}
1930
+ */
1931
+ loadGeometries(primitives) {
1932
+ const parser = this;
1933
+ const extensions = this.extensions;
1934
+ const cache = this.primitiveCache;
1935
+ function createDracoPrimitive(primitive) {
1936
+ return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function(geometry) {
1937
+ return addPrimitiveAttributes(geometry, primitive, parser);
1938
+ });
1939
+ }
1940
+ const pending = [];
1941
+ for (let i = 0, il = primitives.length; i < il; i++) {
1942
+ const primitive = primitives[i];
1943
+ const cacheKey = createPrimitiveKey(primitive);
1944
+ const cached = cache[cacheKey];
1945
+ if (cached) {
1946
+ pending.push(cached.promise);
1947
+ } else {
1948
+ let geometryPromise;
1949
+ if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) {
1950
+ geometryPromise = createDracoPrimitive(primitive);
1951
+ } else {
1952
+ geometryPromise = addPrimitiveAttributes(new BufferGeometry(), primitive, parser);
1953
+ }
1954
+ cache[cacheKey] = { primitive, promise: geometryPromise };
1955
+ pending.push(geometryPromise);
1956
+ }
1957
+ }
1958
+ return Promise.all(pending);
1959
+ }
1960
+ /**
1961
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
1962
+ * @param {number} meshIndex
1963
+ * @return {Promise<Group|Mesh|SkinnedMesh>}
1964
+ */
1965
+ loadMesh(meshIndex) {
1966
+ const parser = this;
1967
+ const json = this.json;
1968
+ const extensions = this.extensions;
1969
+ const meshDef = json.meshes[meshIndex];
1970
+ const primitives = meshDef.primitives;
1971
+ const pending = [];
1972
+ for (let i = 0, il = primitives.length; i < il; i++) {
1973
+ const material = primitives[i].material === void 0 ? createDefaultMaterial(this.cache) : this.getDependency("material", primitives[i].material);
1974
+ pending.push(material);
1975
+ }
1976
+ pending.push(parser.loadGeometries(primitives));
1977
+ return Promise.all(pending).then(function(results) {
1978
+ const materials = results.slice(0, results.length - 1);
1979
+ const geometries = results[results.length - 1];
1980
+ const meshes = [];
1981
+ for (let i = 0, il = geometries.length; i < il; i++) {
1982
+ const geometry = geometries[i];
1983
+ const primitive = primitives[i];
1984
+ let mesh;
1985
+ const material = materials[i];
1986
+ if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === void 0) {
1987
+ mesh = meshDef.isSkinnedMesh === true ? new SkinnedMesh(geometry, material) : new Mesh(geometry, material);
1988
+ if (mesh.isSkinnedMesh === true) {
1989
+ mesh.normalizeSkinWeights();
1990
+ }
1991
+ if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP) {
1992
+ mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleStripDrawMode);
1993
+ } else if (primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN) {
1994
+ mesh.geometry = toTrianglesDrawMode(mesh.geometry, TriangleFanDrawMode);
1995
+ }
1996
+ } else if (primitive.mode === WEBGL_CONSTANTS.LINES) {
1997
+ mesh = new LineSegments(geometry, material);
1998
+ } else if (primitive.mode === WEBGL_CONSTANTS.LINE_STRIP) {
1999
+ mesh = new Line(geometry, material);
2000
+ } else if (primitive.mode === WEBGL_CONSTANTS.LINE_LOOP) {
2001
+ mesh = new LineLoop(geometry, material);
2002
+ } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) {
2003
+ mesh = new Points(geometry, material);
2004
+ } else {
2005
+ throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + primitive.mode);
2006
+ }
2007
+ if (Object.keys(mesh.geometry.morphAttributes).length > 0) {
2008
+ updateMorphTargets(mesh, meshDef);
2009
+ }
2010
+ mesh.name = parser.createUniqueName(meshDef.name || "mesh_" + meshIndex);
2011
+ assignExtrasToUserData(mesh, meshDef);
2012
+ if (primitive.extensions)
2013
+ addUnknownExtensionsToUserData(extensions, mesh, primitive);
2014
+ parser.assignFinalMaterial(mesh);
2015
+ meshes.push(mesh);
2016
+ }
2017
+ for (let i = 0, il = meshes.length; i < il; i++) {
2018
+ parser.associations.set(meshes[i], {
2019
+ meshes: meshIndex,
2020
+ primitives: i
2021
+ });
2022
+ }
2023
+ if (meshes.length === 1) {
2024
+ return meshes[0];
2025
+ }
2026
+ const group = new Group();
2027
+ parser.associations.set(group, { meshes: meshIndex });
2028
+ for (let i = 0, il = meshes.length; i < il; i++) {
2029
+ group.add(meshes[i]);
2030
+ }
2031
+ return group;
2032
+ });
2033
+ }
2034
+ /**
2035
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
2036
+ * @param {number} cameraIndex
2037
+ * @return {Promise<THREE.Camera>}
2038
+ */
2039
+ loadCamera(cameraIndex) {
2040
+ let camera;
2041
+ const cameraDef = this.json.cameras[cameraIndex];
2042
+ const params = cameraDef[cameraDef.type];
2043
+ if (!params) {
2044
+ console.warn("THREE.GLTFLoader: Missing camera parameters.");
2045
+ return;
2046
+ }
2047
+ if (cameraDef.type === "perspective") {
2048
+ camera = new PerspectiveCamera(
2049
+ MathUtils.radToDeg(params.yfov),
2050
+ params.aspectRatio || 1,
2051
+ params.znear || 1,
2052
+ params.zfar || 2e6
2053
+ );
2054
+ } else if (cameraDef.type === "orthographic") {
2055
+ camera = new OrthographicCamera(-params.xmag, params.xmag, params.ymag, -params.ymag, params.znear, params.zfar);
2056
+ }
2057
+ if (cameraDef.name)
2058
+ camera.name = this.createUniqueName(cameraDef.name);
2059
+ assignExtrasToUserData(camera, cameraDef);
2060
+ return Promise.resolve(camera);
2061
+ }
2062
+ /**
2063
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
2064
+ * @param {number} skinIndex
2065
+ * @return {Promise<Skeleton>}
2066
+ */
2067
+ loadSkin(skinIndex) {
2068
+ const skinDef = this.json.skins[skinIndex];
2069
+ const pending = [];
2070
+ for (let i = 0, il = skinDef.joints.length; i < il; i++) {
2071
+ pending.push(this._loadNodeShallow(skinDef.joints[i]));
2072
+ }
2073
+ if (skinDef.inverseBindMatrices !== void 0) {
2074
+ pending.push(this.getDependency("accessor", skinDef.inverseBindMatrices));
2075
+ } else {
2076
+ pending.push(null);
2077
+ }
2078
+ return Promise.all(pending).then(function(results) {
2079
+ const inverseBindMatrices = results.pop();
2080
+ const jointNodes = results;
2081
+ const bones = [];
2082
+ const boneInverses = [];
2083
+ for (let i = 0, il = jointNodes.length; i < il; i++) {
2084
+ const jointNode = jointNodes[i];
2085
+ if (jointNode) {
2086
+ bones.push(jointNode);
2087
+ const mat = new Matrix4();
2088
+ if (inverseBindMatrices !== null) {
2089
+ mat.fromArray(inverseBindMatrices.array, i * 16);
2090
+ }
2091
+ boneInverses.push(mat);
2092
+ } else {
2093
+ console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', skinDef.joints[i]);
2094
+ }
2095
+ }
2096
+ return new Skeleton(bones, boneInverses);
2097
+ });
2098
+ }
2099
+ /**
2100
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
2101
+ * @param {number} animationIndex
2102
+ * @return {Promise<AnimationClip>}
2103
+ */
2104
+ loadAnimation(animationIndex) {
2105
+ const json = this.json;
2106
+ const animationDef = json.animations[animationIndex];
2107
+ const animationName = animationDef.name ? animationDef.name : "animation_" + animationIndex;
2108
+ const pendingNodes = [];
2109
+ const pendingInputAccessors = [];
2110
+ const pendingOutputAccessors = [];
2111
+ const pendingSamplers = [];
2112
+ const pendingTargets = [];
2113
+ for (let i = 0, il = animationDef.channels.length; i < il; i++) {
2114
+ const channel = animationDef.channels[i];
2115
+ const sampler = animationDef.samplers[channel.sampler];
2116
+ const target = channel.target;
2117
+ const name = target.node;
2118
+ const input = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.input] : sampler.input;
2119
+ const output = animationDef.parameters !== void 0 ? animationDef.parameters[sampler.output] : sampler.output;
2120
+ if (target.node === void 0)
2121
+ continue;
2122
+ pendingNodes.push(this.getDependency("node", name));
2123
+ pendingInputAccessors.push(this.getDependency("accessor", input));
2124
+ pendingOutputAccessors.push(this.getDependency("accessor", output));
2125
+ pendingSamplers.push(sampler);
2126
+ pendingTargets.push(target);
2127
+ }
2128
+ return Promise.all([
2129
+ Promise.all(pendingNodes),
2130
+ Promise.all(pendingInputAccessors),
2131
+ Promise.all(pendingOutputAccessors),
2132
+ Promise.all(pendingSamplers),
2133
+ Promise.all(pendingTargets)
2134
+ ]).then(function(dependencies) {
2135
+ const nodes = dependencies[0];
2136
+ const inputAccessors = dependencies[1];
2137
+ const outputAccessors = dependencies[2];
2138
+ const samplers = dependencies[3];
2139
+ const targets = dependencies[4];
2140
+ const tracks = [];
2141
+ for (let i = 0, il = nodes.length; i < il; i++) {
2142
+ const node = nodes[i];
2143
+ const inputAccessor = inputAccessors[i];
2144
+ const outputAccessor = outputAccessors[i];
2145
+ const sampler = samplers[i];
2146
+ const target = targets[i];
2147
+ if (node === void 0)
2148
+ continue;
2149
+ node.updateMatrix();
2150
+ let TypedKeyframeTrack;
2151
+ switch (PATH_PROPERTIES[target.path]) {
2152
+ case PATH_PROPERTIES.weights:
2153
+ TypedKeyframeTrack = NumberKeyframeTrack;
2154
+ break;
2155
+ case PATH_PROPERTIES.rotation:
2156
+ TypedKeyframeTrack = QuaternionKeyframeTrack;
2157
+ break;
2158
+ case PATH_PROPERTIES.position:
2159
+ case PATH_PROPERTIES.scale:
2160
+ default:
2161
+ TypedKeyframeTrack = VectorKeyframeTrack;
2162
+ break;
2163
+ }
2164
+ const targetName = node.name ? node.name : node.uuid;
2165
+ const interpolation = sampler.interpolation !== void 0 ? INTERPOLATION[sampler.interpolation] : InterpolateLinear;
2166
+ const targetNames = [];
2167
+ if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) {
2168
+ node.traverse(function(object) {
2169
+ if (object.morphTargetInfluences) {
2170
+ targetNames.push(object.name ? object.name : object.uuid);
2171
+ }
2172
+ });
2173
+ } else {
2174
+ targetNames.push(targetName);
2175
+ }
2176
+ let outputArray = outputAccessor.array;
2177
+ if (outputAccessor.normalized) {
2178
+ const scale = getNormalizedComponentScale(outputArray.constructor);
2179
+ const scaled = new Float32Array(outputArray.length);
2180
+ for (let j = 0, jl = outputArray.length; j < jl; j++) {
2181
+ scaled[j] = outputArray[j] * scale;
2182
+ }
2183
+ outputArray = scaled;
2184
+ }
2185
+ for (let j = 0, jl = targetNames.length; j < jl; j++) {
2186
+ const track = new TypedKeyframeTrack(
2187
+ targetNames[j] + "." + PATH_PROPERTIES[target.path],
2188
+ inputAccessor.array,
2189
+ outputArray,
2190
+ interpolation
2191
+ );
2192
+ if (sampler.interpolation === "CUBICSPLINE") {
2193
+ track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) {
2194
+ const interpolantType = this instanceof QuaternionKeyframeTrack ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
2195
+ return new interpolantType(this.times, this.values, this.getValueSize() / 3, result);
2196
+ };
2197
+ track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;
2198
+ }
2199
+ tracks.push(track);
2200
+ }
2201
+ }
2202
+ return new AnimationClip(animationName, void 0, tracks);
2203
+ });
2204
+ }
2205
+ createNodeMesh(nodeIndex) {
2206
+ const json = this.json;
2207
+ const parser = this;
2208
+ const nodeDef = json.nodes[nodeIndex];
2209
+ if (nodeDef.mesh === void 0)
2210
+ return null;
2211
+ return parser.getDependency("mesh", nodeDef.mesh).then(function(mesh) {
2212
+ const node = parser._getNodeRef(parser.meshCache, nodeDef.mesh, mesh);
2213
+ if (nodeDef.weights !== void 0) {
2214
+ node.traverse(function(o) {
2215
+ if (!o.isMesh)
2216
+ return;
2217
+ for (let i = 0, il = nodeDef.weights.length; i < il; i++) {
2218
+ o.morphTargetInfluences[i] = nodeDef.weights[i];
2219
+ }
2220
+ });
2221
+ }
2222
+ return node;
2223
+ });
2224
+ }
2225
+ /**
2226
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
2227
+ * @param {number} nodeIndex
2228
+ * @return {Promise<Object3D>}
2229
+ */
2230
+ loadNode(nodeIndex) {
2231
+ const json = this.json;
2232
+ const parser = this;
2233
+ const nodeDef = json.nodes[nodeIndex];
2234
+ const nodePending = parser._loadNodeShallow(nodeIndex);
2235
+ const childPending = [];
2236
+ const childrenDef = nodeDef.children || [];
2237
+ for (let i = 0, il = childrenDef.length; i < il; i++) {
2238
+ childPending.push(parser.getDependency("node", childrenDef[i]));
2239
+ }
2240
+ const skeletonPending = nodeDef.skin === void 0 ? Promise.resolve(null) : parser.getDependency("skin", nodeDef.skin);
2241
+ return Promise.all([nodePending, Promise.all(childPending), skeletonPending]).then(function(results) {
2242
+ const node = results[0];
2243
+ const children = results[1];
2244
+ const skeleton = results[2];
2245
+ if (skeleton !== null) {
2246
+ node.traverse(function(mesh) {
2247
+ if (!mesh.isSkinnedMesh)
2248
+ return;
2249
+ mesh.bind(skeleton, _identityMatrix);
2250
+ });
2251
+ }
2252
+ for (let i = 0, il = children.length; i < il; i++) {
2253
+ node.add(children[i]);
2254
+ }
2255
+ return node;
2256
+ });
2257
+ }
2258
+ // ._loadNodeShallow() parses a single node.
2259
+ // skin and child nodes are created and added in .loadNode() (no '_' prefix).
2260
+ _loadNodeShallow(nodeIndex) {
2261
+ const json = this.json;
2262
+ const extensions = this.extensions;
2263
+ const parser = this;
2264
+ if (this.nodeCache[nodeIndex] !== void 0) {
2265
+ return this.nodeCache[nodeIndex];
2266
+ }
2267
+ const nodeDef = json.nodes[nodeIndex];
2268
+ const nodeName = nodeDef.name ? parser.createUniqueName(nodeDef.name) : "";
2269
+ const pending = [];
2270
+ const meshPromise = parser._invokeOne(function(ext) {
2271
+ return ext.createNodeMesh && ext.createNodeMesh(nodeIndex);
2272
+ });
2273
+ if (meshPromise) {
2274
+ pending.push(meshPromise);
2275
+ }
2276
+ if (nodeDef.camera !== void 0) {
2277
+ pending.push(
2278
+ parser.getDependency("camera", nodeDef.camera).then(function(camera) {
2279
+ return parser._getNodeRef(parser.cameraCache, nodeDef.camera, camera);
2280
+ })
2281
+ );
2282
+ }
2283
+ parser._invokeAll(function(ext) {
2284
+ return ext.createNodeAttachment && ext.createNodeAttachment(nodeIndex);
2285
+ }).forEach(function(promise) {
2286
+ pending.push(promise);
2287
+ });
2288
+ this.nodeCache[nodeIndex] = Promise.all(pending).then(function(objects) {
2289
+ let node;
2290
+ if (nodeDef.isBone === true) {
2291
+ node = new Bone();
2292
+ } else if (objects.length > 1) {
2293
+ node = new Group();
2294
+ } else if (objects.length === 1) {
2295
+ node = objects[0];
2296
+ } else {
2297
+ node = new Object3D();
2298
+ }
2299
+ if (node !== objects[0]) {
2300
+ for (let i = 0, il = objects.length; i < il; i++) {
2301
+ node.add(objects[i]);
2302
+ }
2303
+ }
2304
+ if (nodeDef.name) {
2305
+ node.userData.name = nodeDef.name;
2306
+ node.name = nodeName;
2307
+ }
2308
+ assignExtrasToUserData(node, nodeDef);
2309
+ if (nodeDef.extensions)
2310
+ addUnknownExtensionsToUserData(extensions, node, nodeDef);
2311
+ if (nodeDef.matrix !== void 0) {
2312
+ const matrix = new Matrix4();
2313
+ matrix.fromArray(nodeDef.matrix);
2314
+ node.applyMatrix4(matrix);
2315
+ } else {
2316
+ if (nodeDef.translation !== void 0) {
2317
+ node.position.fromArray(nodeDef.translation);
2318
+ }
2319
+ if (nodeDef.rotation !== void 0) {
2320
+ node.quaternion.fromArray(nodeDef.rotation);
2321
+ }
2322
+ if (nodeDef.scale !== void 0) {
2323
+ node.scale.fromArray(nodeDef.scale);
2324
+ }
2325
+ }
2326
+ if (!parser.associations.has(node)) {
2327
+ parser.associations.set(node, {});
2328
+ }
2329
+ parser.associations.get(node).nodes = nodeIndex;
2330
+ return node;
2331
+ });
2332
+ return this.nodeCache[nodeIndex];
2333
+ }
2334
+ /**
2335
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
2336
+ * @param {number} sceneIndex
2337
+ * @return {Promise<Group>}
2338
+ */
2339
+ loadScene(sceneIndex) {
2340
+ const extensions = this.extensions;
2341
+ const sceneDef = this.json.scenes[sceneIndex];
2342
+ const parser = this;
2343
+ const scene = new Group();
2344
+ if (sceneDef.name)
2345
+ scene.name = parser.createUniqueName(sceneDef.name);
2346
+ assignExtrasToUserData(scene, sceneDef);
2347
+ if (sceneDef.extensions)
2348
+ addUnknownExtensionsToUserData(extensions, scene, sceneDef);
2349
+ const nodeIds = sceneDef.nodes || [];
2350
+ const pending = [];
2351
+ for (let i = 0, il = nodeIds.length; i < il; i++) {
2352
+ pending.push(parser.getDependency("node", nodeIds[i]));
2353
+ }
2354
+ return Promise.all(pending).then(function(nodes) {
2355
+ for (let i = 0, il = nodes.length; i < il; i++) {
2356
+ scene.add(nodes[i]);
2357
+ }
2358
+ const reduceAssociations = (node) => {
2359
+ const reducedAssociations = /* @__PURE__ */ new Map();
2360
+ for (const [key, value] of parser.associations) {
2361
+ if (key instanceof Material || key instanceof Texture) {
2362
+ reducedAssociations.set(key, value);
2363
+ }
2364
+ }
2365
+ node.traverse((node2) => {
2366
+ const mappings = parser.associations.get(node2);
2367
+ if (mappings != null) {
2368
+ reducedAssociations.set(node2, mappings);
2369
+ }
2370
+ });
2371
+ return reducedAssociations;
2372
+ };
2373
+ parser.associations = reduceAssociations(scene);
2374
+ return scene;
2375
+ });
2376
+ }
2377
+ }
2378
+ function computeBounds(geometry, primitiveDef, parser) {
2379
+ const attributes = primitiveDef.attributes;
2380
+ const box = new Box3();
2381
+ if (attributes.POSITION !== void 0) {
2382
+ const accessor = parser.json.accessors[attributes.POSITION];
2383
+ const min = accessor.min;
2384
+ const max = accessor.max;
2385
+ if (min !== void 0 && max !== void 0) {
2386
+ box.set(new Vector3(min[0], min[1], min[2]), new Vector3(max[0], max[1], max[2]));
2387
+ if (accessor.normalized) {
2388
+ const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);
2389
+ box.min.multiplyScalar(boxScale);
2390
+ box.max.multiplyScalar(boxScale);
2391
+ }
2392
+ } else {
2393
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
2394
+ return;
2395
+ }
2396
+ } else {
2397
+ return;
2398
+ }
2399
+ const targets = primitiveDef.targets;
2400
+ if (targets !== void 0) {
2401
+ const maxDisplacement = new Vector3();
2402
+ const vector = new Vector3();
2403
+ for (let i = 0, il = targets.length; i < il; i++) {
2404
+ const target = targets[i];
2405
+ if (target.POSITION !== void 0) {
2406
+ const accessor = parser.json.accessors[target.POSITION];
2407
+ const min = accessor.min;
2408
+ const max = accessor.max;
2409
+ if (min !== void 0 && max !== void 0) {
2410
+ vector.setX(Math.max(Math.abs(min[0]), Math.abs(max[0])));
2411
+ vector.setY(Math.max(Math.abs(min[1]), Math.abs(max[1])));
2412
+ vector.setZ(Math.max(Math.abs(min[2]), Math.abs(max[2])));
2413
+ if (accessor.normalized) {
2414
+ const boxScale = getNormalizedComponentScale(WEBGL_COMPONENT_TYPES[accessor.componentType]);
2415
+ vector.multiplyScalar(boxScale);
2416
+ }
2417
+ maxDisplacement.max(vector);
2418
+ } else {
2419
+ console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
2420
+ }
2421
+ }
2422
+ }
2423
+ box.expandByVector(maxDisplacement);
2424
+ }
2425
+ geometry.boundingBox = box;
2426
+ const sphere = new Sphere();
2427
+ box.getCenter(sphere.center);
2428
+ sphere.radius = box.min.distanceTo(box.max) / 2;
2429
+ geometry.boundingSphere = sphere;
2430
+ }
2431
+ function addPrimitiveAttributes(geometry, primitiveDef, parser) {
2432
+ const attributes = primitiveDef.attributes;
2433
+ const pending = [];
2434
+ function assignAttributeAccessor(accessorIndex, attributeName) {
2435
+ return parser.getDependency("accessor", accessorIndex).then(function(accessor) {
2436
+ geometry.setAttribute(attributeName, accessor);
2437
+ });
2438
+ }
2439
+ for (const gltfAttributeName in attributes) {
2440
+ const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase();
2441
+ if (threeAttributeName in geometry.attributes)
2442
+ continue;
2443
+ pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName));
2444
+ }
2445
+ if (primitiveDef.indices !== void 0 && !geometry.index) {
2446
+ const accessor = parser.getDependency("accessor", primitiveDef.indices).then(function(accessor2) {
2447
+ geometry.setIndex(accessor2);
2448
+ });
2449
+ pending.push(accessor);
2450
+ }
2451
+ assignExtrasToUserData(geometry, primitiveDef);
2452
+ computeBounds(geometry, primitiveDef, parser);
2453
+ return Promise.all(pending).then(function() {
2454
+ return primitiveDef.targets !== void 0 ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry;
2455
+ });
2456
+ }
2457
+ export {
2458
+ GLTFLoader
2459
+ };