three-stdlib 2.22.7 → 2.22.9

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