@unikia/upe-renderer 0.0.0-stage → 0.186.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2234) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.types +21 -0
  3. package/README.md +37 -2
  4. package/README.three.md +85 -0
  5. package/UPSTREAM.md +11 -0
  6. package/build/three.cjs +17 -0
  7. package/build/three.core.d.ts +1 -0
  8. package/build/three.core.js +60602 -0
  9. package/build/three.d.cts +1 -0
  10. package/build/three.module.d.ts +1 -0
  11. package/build/three.module.js +19719 -0
  12. package/build/three.tsl.d.ts +1 -0
  13. package/build/three.tsl.js +691 -0
  14. package/build/three.webgpu.d.ts +1 -0
  15. package/build/three.webgpu.js +93270 -0
  16. package/build/three.webgpu.nodes.d.ts +1 -0
  17. package/build/three.webgpu.nodes.js +92988 -0
  18. package/examples/jsm/Addons.d.ts +300 -0
  19. package/examples/jsm/Addons.js +301 -0
  20. package/examples/jsm/animation/AnimationClipCreator.d.ts +12 -0
  21. package/examples/jsm/animation/AnimationClipCreator.js +168 -0
  22. package/examples/jsm/animation/CCDIKSolver.d.ts +44 -0
  23. package/examples/jsm/animation/CCDIKSolver.js +595 -0
  24. package/examples/jsm/capabilities/WebGL.d.ts +6 -0
  25. package/examples/jsm/capabilities/WebGL.js +113 -0
  26. package/examples/jsm/capabilities/WebGPU.d.ts +7 -0
  27. package/examples/jsm/capabilities/WebGPU.js +59 -0
  28. package/examples/jsm/controls/ArcballControls.d.ts +208 -0
  29. package/examples/jsm/controls/ArcballControls.js +3543 -0
  30. package/examples/jsm/controls/DragControls.d.ts +81 -0
  31. package/examples/jsm/controls/DragControls.js +452 -0
  32. package/examples/jsm/controls/FirstPersonControls.d.ts +105 -0
  33. package/examples/jsm/controls/FirstPersonControls.js +512 -0
  34. package/examples/jsm/controls/FlyControls.d.ts +44 -0
  35. package/examples/jsm/controls/FlyControls.js +384 -0
  36. package/examples/jsm/controls/MapControls.d.ts +21 -0
  37. package/examples/jsm/controls/MapControls.js +116 -0
  38. package/examples/jsm/controls/OrbitControls.d.ts +295 -0
  39. package/examples/jsm/controls/OrbitControls.js +1972 -0
  40. package/examples/jsm/controls/PointerLockControls.d.ts +84 -0
  41. package/examples/jsm/controls/PointerLockControls.js +264 -0
  42. package/examples/jsm/controls/TrackballControls.d.ts +152 -0
  43. package/examples/jsm/controls/TrackballControls.js +1106 -0
  44. package/examples/jsm/controls/TransformControls.d.ts +363 -0
  45. package/examples/jsm/controls/TransformControls.js +2003 -0
  46. package/examples/jsm/csm/CSM.d.ts +55 -0
  47. package/examples/jsm/csm/CSM.js +598 -0
  48. package/examples/jsm/csm/CSMFrustum.d.ts +85 -0
  49. package/examples/jsm/csm/CSMFrustum.js +234 -0
  50. package/examples/jsm/csm/CSMHelper.d.ts +28 -0
  51. package/examples/jsm/csm/CSMHelper.js +243 -0
  52. package/examples/jsm/csm/CSMShader.d.ts +4 -0
  53. package/examples/jsm/csm/CSMShader.js +307 -0
  54. package/examples/jsm/csm/CSMShadowNode.d.ts +44 -0
  55. package/examples/jsm/csm/CSMShadowNode.js +619 -0
  56. package/examples/jsm/curves/CurveExtras.d.ts +68 -0
  57. package/examples/jsm/curves/CurveExtras.js +694 -0
  58. package/examples/jsm/curves/NURBSCurve.d.ts +28 -0
  59. package/examples/jsm/curves/NURBSCurve.js +155 -0
  60. package/examples/jsm/curves/NURBSSurface.d.ts +13 -0
  61. package/examples/jsm/curves/NURBSSurface.js +98 -0
  62. package/examples/jsm/curves/NURBSUtils.d.ts +146 -0
  63. package/examples/jsm/curves/NURBSUtils.js +532 -0
  64. package/examples/jsm/curves/NURBSVolume.d.ts +23 -0
  65. package/examples/jsm/curves/NURBSVolume.js +82 -0
  66. package/examples/jsm/effects/AnaglyphEffect.d.ts +21 -0
  67. package/examples/jsm/effects/AnaglyphEffect.js +274 -0
  68. package/examples/jsm/effects/AsciiEffect.d.ts +18 -0
  69. package/examples/jsm/effects/AsciiEffect.js +323 -0
  70. package/examples/jsm/effects/OutlineEffect.d.ts +28 -0
  71. package/examples/jsm/effects/OutlineEffect.js +489 -0
  72. package/examples/jsm/effects/ParallaxBarrierEffect.d.ts +11 -0
  73. package/examples/jsm/effects/ParallaxBarrierEffect.js +155 -0
  74. package/examples/jsm/effects/StereoEffect.d.ts +9 -0
  75. package/examples/jsm/effects/StereoEffect.js +91 -0
  76. package/examples/jsm/environments/ColorEnvironment.d.ts +9 -0
  77. package/examples/jsm/environments/ColorEnvironment.js +59 -0
  78. package/examples/jsm/environments/DebugEnvironment.d.ts +5 -0
  79. package/examples/jsm/environments/DebugEnvironment.js +102 -0
  80. package/examples/jsm/environments/RoomEnvironment.d.ts +6 -0
  81. package/examples/jsm/environments/RoomEnvironment.js +185 -0
  82. package/examples/jsm/exporters/DRACOExporter.d.ts +17 -0
  83. package/examples/jsm/exporters/DRACOExporter.js +332 -0
  84. package/examples/jsm/exporters/EXRExporter.d.ts +27 -0
  85. package/examples/jsm/exporters/EXRExporter.js +618 -0
  86. package/examples/jsm/exporters/GLTFExporter.d.ts +161 -0
  87. package/examples/jsm/exporters/GLTFExporter.js +3856 -0
  88. package/examples/jsm/exporters/KTX2Exporter.d.ts +7 -0
  89. package/examples/jsm/exporters/KTX2Exporter.js +347 -0
  90. package/examples/jsm/exporters/OBJExporter.d.ts +7 -0
  91. package/examples/jsm/exporters/OBJExporter.js +308 -0
  92. package/examples/jsm/exporters/PLYExporter.d.ts +31 -0
  93. package/examples/jsm/exporters/PLYExporter.js +775 -0
  94. package/examples/jsm/exporters/STLExporter.d.ts +21 -0
  95. package/examples/jsm/exporters/STLExporter.js +221 -0
  96. package/examples/jsm/exporters/USDZExporter.d.ts +30 -0
  97. package/examples/jsm/exporters/USDZExporter.js +1489 -0
  98. package/examples/jsm/generators/CityGenerator.d.ts +131 -0
  99. package/examples/jsm/generators/CityGenerator.js +678 -0
  100. package/examples/jsm/generators/ForestGenerator.d.ts +73 -0
  101. package/examples/jsm/generators/ForestGenerator.js +347 -0
  102. package/examples/jsm/generators/TerrainGenerator.d.ts +57 -0
  103. package/examples/jsm/generators/TerrainGenerator.js +516 -0
  104. package/examples/jsm/generators/TreeGenerator.d.ts +102 -0
  105. package/examples/jsm/generators/TreeGenerator.js +371 -0
  106. package/examples/jsm/generators/city/BenchGenerator.d.ts +29 -0
  107. package/examples/jsm/generators/city/BenchGenerator.js +127 -0
  108. package/examples/jsm/generators/city/CarGenerator.d.ts +43 -0
  109. package/examples/jsm/generators/city/CarGenerator.js +479 -0
  110. package/examples/jsm/generators/city/CityGeneratorUtils.js +31 -0
  111. package/examples/jsm/generators/city/HydrantGenerator.d.ts +27 -0
  112. package/examples/jsm/generators/city/HydrantGenerator.js +106 -0
  113. package/examples/jsm/generators/city/InstancedMeshGenerator.d.ts +29 -0
  114. package/examples/jsm/generators/city/InstancedMeshGenerator.js +86 -0
  115. package/examples/jsm/generators/city/PersonGenerator.d.ts +44 -0
  116. package/examples/jsm/generators/city/PersonGenerator.js +447 -0
  117. package/examples/jsm/generators/city/SidewalkGenerator.d.ts +40 -0
  118. package/examples/jsm/generators/city/SidewalkGenerator.js +248 -0
  119. package/examples/jsm/generators/city/SkyscraperGenerator.d.ts +83 -0
  120. package/examples/jsm/generators/city/SkyscraperGenerator.js +1757 -0
  121. package/examples/jsm/generators/city/StreetTreeGenerator.d.ts +30 -0
  122. package/examples/jsm/generators/city/StreetTreeGenerator.js +231 -0
  123. package/examples/jsm/generators/city/StreetlightGenerator.d.ts +28 -0
  124. package/examples/jsm/generators/city/StreetlightGenerator.js +100 -0
  125. package/examples/jsm/generators/city/TrafficlightGenerator.d.ts +29 -0
  126. package/examples/jsm/generators/city/TrafficlightGenerator.js +106 -0
  127. package/examples/jsm/generators/city/TrashcanGenerator.d.ts +24 -0
  128. package/examples/jsm/generators/city/TrashcanGenerator.js +100 -0
  129. package/examples/jsm/geometries/BoxLineGeometry.d.ts +12 -0
  130. package/examples/jsm/geometries/BoxLineGeometry.js +92 -0
  131. package/examples/jsm/geometries/ConvexGeometry.d.ts +5 -0
  132. package/examples/jsm/geometries/ConvexGeometry.js +72 -0
  133. package/examples/jsm/geometries/DecalGeometry.d.ts +16 -0
  134. package/examples/jsm/geometries/DecalGeometry.js +420 -0
  135. package/examples/jsm/geometries/LoftGeometry.d.ts +83 -0
  136. package/examples/jsm/geometries/LoftGeometry.js +355 -0
  137. package/examples/jsm/geometries/ParametricFunctions.d.ts +8 -0
  138. package/examples/jsm/geometries/ParametricFunctions.js +100 -0
  139. package/examples/jsm/geometries/ParametricGeometry.d.ts +18 -0
  140. package/examples/jsm/geometries/ParametricGeometry.js +172 -0
  141. package/examples/jsm/geometries/RoundedBoxGeometry.d.ts +5 -0
  142. package/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
  143. package/examples/jsm/geometries/TeapotGeometry.d.ts +37 -0
  144. package/examples/jsm/geometries/TeapotGeometry.js +689 -0
  145. package/examples/jsm/geometries/TextGeometry.d.ts +89 -0
  146. package/examples/jsm/geometries/TextGeometry.js +102 -0
  147. package/examples/jsm/gpgpu/BitonicSort.d.ts +21 -0
  148. package/examples/jsm/gpgpu/BitonicSort.js +715 -0
  149. package/examples/jsm/gpgpu/CountingSort.d.ts +31 -0
  150. package/examples/jsm/gpgpu/CountingSort.js +271 -0
  151. package/examples/jsm/helpers/AnimationPathHelper.d.ts +38 -0
  152. package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
  153. package/examples/jsm/helpers/LightProbeGridHelper.d.ts +12 -0
  154. package/examples/jsm/helpers/LightProbeGridHelper.js +166 -0
  155. package/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts +12 -0
  156. package/examples/jsm/helpers/LightProbeGridHelperWebGL.js +221 -0
  157. package/examples/jsm/helpers/LightProbeHelper.d.ts +12 -0
  158. package/examples/jsm/helpers/LightProbeHelper.js +166 -0
  159. package/examples/jsm/helpers/LightProbeHelperGPU.d.ts +12 -0
  160. package/examples/jsm/helpers/LightProbeHelperGPU.js +102 -0
  161. package/examples/jsm/helpers/OctreeHelper.d.ts +17 -0
  162. package/examples/jsm/helpers/OctreeHelper.js +109 -0
  163. package/examples/jsm/helpers/PositionalAudioHelper.d.ts +13 -0
  164. package/examples/jsm/helpers/PositionalAudioHelper.js +169 -0
  165. package/examples/jsm/helpers/RapierHelper.d.ts +13 -0
  166. package/examples/jsm/helpers/RapierHelper.js +59 -0
  167. package/examples/jsm/helpers/RectAreaLightHelper.d.ts +10 -0
  168. package/examples/jsm/helpers/RectAreaLightHelper.js +118 -0
  169. package/examples/jsm/helpers/TextureHelper.d.ts +10 -0
  170. package/examples/jsm/helpers/TextureHelper.js +265 -0
  171. package/examples/jsm/helpers/TextureHelperGPU.d.ts +10 -0
  172. package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
  173. package/examples/jsm/helpers/VertexNormalsHelper.d.ts +14 -0
  174. package/examples/jsm/helpers/VertexNormalsHelper.js +155 -0
  175. package/examples/jsm/helpers/VertexTangentsHelper.d.ts +12 -0
  176. package/examples/jsm/helpers/VertexTangentsHelper.js +133 -0
  177. package/examples/jsm/helpers/ViewHelper.d.ts +20 -0
  178. package/examples/jsm/helpers/ViewHelper.js +529 -0
  179. package/examples/jsm/inspector/Extension.d.ts +22 -0
  180. package/examples/jsm/inspector/Extension.js +107 -0
  181. package/examples/jsm/inspector/Inspector.d.ts +54 -0
  182. package/examples/jsm/inspector/Inspector.js +684 -0
  183. package/examples/jsm/inspector/RendererInspector.d.ts +9 -0
  184. package/examples/jsm/inspector/RendererInspector.js +589 -0
  185. package/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts +34 -0
  186. package/examples/jsm/inspector/extensions/color-grading/ColorGrading.js +2609 -0
  187. package/examples/jsm/inspector/extensions/color-grading/ColorWheel.js +352 -0
  188. package/examples/jsm/inspector/extensions/color-grading/CurveEditor.js +599 -0
  189. package/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.js +1201 -0
  190. package/examples/jsm/inspector/extensions/color-grading/LUTMath.js +788 -0
  191. package/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.js +72 -0
  192. package/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.js +112 -0
  193. package/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.js +82 -0
  194. package/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.js +109 -0
  195. package/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.js +110 -0
  196. package/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.js +73 -0
  197. package/examples/jsm/inspector/extensions/color-grading/modules/HueModule.js +78 -0
  198. package/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.js +89 -0
  199. package/examples/jsm/inspector/extensions/color-grading/modules/Module.js +285 -0
  200. package/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.js +101 -0
  201. package/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.js +225 -0
  202. package/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.js +102 -0
  203. package/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.js +76 -0
  204. package/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.js +76 -0
  205. package/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.js +86 -0
  206. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts +20 -0
  207. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +911 -0
  208. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts +11 -0
  209. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +282 -0
  210. package/examples/jsm/inspector/tabs/Console.js +420 -0
  211. package/examples/jsm/inspector/tabs/Memory.js +134 -0
  212. package/examples/jsm/inspector/tabs/Parameters.d.ts +122 -0
  213. package/examples/jsm/inspector/tabs/Parameters.js +440 -0
  214. package/examples/jsm/inspector/tabs/Performance.js +283 -0
  215. package/examples/jsm/inspector/tabs/Settings.js +310 -0
  216. package/examples/jsm/inspector/tabs/Timeline.js +1748 -0
  217. package/examples/jsm/inspector/tabs/Viewer.js +1374 -0
  218. package/examples/jsm/inspector/ui/Graph.js +232 -0
  219. package/examples/jsm/inspector/ui/Item.d.ts +5 -0
  220. package/examples/jsm/inspector/ui/Item.js +249 -0
  221. package/examples/jsm/inspector/ui/List.js +81 -0
  222. package/examples/jsm/inspector/ui/Profiler.js +2273 -0
  223. package/examples/jsm/inspector/ui/Style.js +2300 -0
  224. package/examples/jsm/inspector/ui/Tab.d.ts +9 -0
  225. package/examples/jsm/inspector/ui/Tab.js +269 -0
  226. package/examples/jsm/inspector/ui/Values.d.ts +103 -0
  227. package/examples/jsm/inspector/ui/Values.js +553 -0
  228. package/examples/jsm/inspector/ui/utils.js +189 -0
  229. package/examples/jsm/interaction/InteractionManager.d.ts +18 -0
  230. package/examples/jsm/interaction/InteractionManager.js +226 -0
  231. package/examples/jsm/interactive/HTMLMesh.d.ts +13 -0
  232. package/examples/jsm/interactive/HTMLMesh.js +617 -0
  233. package/examples/jsm/interactive/InteractiveGroup.d.ts +28 -0
  234. package/examples/jsm/interactive/InteractiveGroup.js +224 -0
  235. package/examples/jsm/interactive/SelectionBox.d.ts +16 -0
  236. package/examples/jsm/interactive/SelectionBox.js +324 -0
  237. package/examples/jsm/interactive/SelectionHelper.d.ts +17 -0
  238. package/examples/jsm/interactive/SelectionHelper.js +150 -0
  239. package/examples/jsm/libs/basis/README.md +45 -0
  240. package/examples/jsm/libs/basis/basis_transcoder.js +19 -0
  241. package/examples/jsm/libs/basis/basis_transcoder.wasm +0 -0
  242. package/examples/jsm/libs/chevrotain.module.min.js +141 -0
  243. package/examples/jsm/libs/demuxer_mp4.js +109 -0
  244. package/examples/jsm/libs/draco/README.md +31 -0
  245. package/examples/jsm/libs/draco/draco_decoder.js +34 -0
  246. package/examples/jsm/libs/draco/draco_decoder.wasm +0 -0
  247. package/examples/jsm/libs/draco/draco_wasm_wrapper.js +117 -0
  248. package/examples/jsm/libs/draco/gltf/draco_decoder.js +33 -0
  249. package/examples/jsm/libs/draco/gltf/draco_decoder.wasm +0 -0
  250. package/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.js +116 -0
  251. package/examples/jsm/libs/fflate.module.d.ts +1 -0
  252. package/examples/jsm/libs/fflate.module.js +2672 -0
  253. package/examples/jsm/libs/ktx-parse.module.js +1 -0
  254. package/examples/jsm/libs/lil-gui.module.min.d.ts +608 -0
  255. package/examples/jsm/libs/lil-gui.module.min.js +8 -0
  256. package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
  257. package/examples/jsm/libs/meshopt_decoder.module.d.ts +1 -0
  258. package/examples/jsm/libs/meshopt_decoder.module.js +196 -0
  259. package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
  260. package/examples/jsm/libs/mikktspace.module.d.ts +19 -0
  261. package/examples/jsm/libs/mikktspace.module.js +153 -0
  262. package/examples/jsm/libs/motion-controllers.module.js +397 -0
  263. package/examples/jsm/libs/potpack.module.js +125 -0
  264. package/examples/jsm/libs/stats.module.d.ts +3 -0
  265. package/examples/jsm/libs/stats.module.js +167 -0
  266. package/examples/jsm/libs/surfaceNet.js +201 -0
  267. package/examples/jsm/libs/tween.module.d.ts +2 -0
  268. package/examples/jsm/libs/tween.module.js +876 -0
  269. package/examples/jsm/libs/utif.module.js +1665 -0
  270. package/examples/jsm/libs/zstddec.module.d.ts +5 -0
  271. package/examples/jsm/libs/zstddec.module.js +1 -0
  272. package/examples/jsm/lighting/ClusteredLighting.d.ts +45 -0
  273. package/examples/jsm/lighting/ClusteredLighting.js +55 -0
  274. package/examples/jsm/lighting/DynamicLighting.d.ts +16 -0
  275. package/examples/jsm/lighting/DynamicLighting.js +82 -0
  276. package/examples/jsm/lighting/LightProbeGrid.d.ts +177 -0
  277. package/examples/jsm/lighting/LightProbeGrid.js +820 -0
  278. package/examples/jsm/lighting/LightProbeGridUtils.js +107 -0
  279. package/examples/jsm/lighting/LightProbeGridWebGL.d.ts +178 -0
  280. package/examples/jsm/lighting/LightProbeGridWebGL.js +830 -0
  281. package/examples/jsm/lighting/vxgi/VXGIConeTracer.js +194 -0
  282. package/examples/jsm/lighting/vxgi/VXGINode.d.ts +100 -0
  283. package/examples/jsm/lighting/vxgi/VXGINode.js +660 -0
  284. package/examples/jsm/lighting/vxgi/VXGISceneCollector.js +478 -0
  285. package/examples/jsm/lighting/vxgi/VXGIVolume.d.ts +245 -0
  286. package/examples/jsm/lighting/vxgi/VXGIVolume.js +1430 -0
  287. package/examples/jsm/lights/LightProbeGenerator.d.ts +16 -0
  288. package/examples/jsm/lights/LightProbeGenerator.js +337 -0
  289. package/examples/jsm/lights/RectAreaLightTexturesLib.d.ts +7 -0
  290. package/examples/jsm/lights/RectAreaLightTexturesLib.js +127 -0
  291. package/examples/jsm/lights/RectAreaLightUniformsLib.d.ts +5 -0
  292. package/examples/jsm/lights/RectAreaLightUniformsLib.js +40 -0
  293. package/examples/jsm/lights/SunLight.d.ts +53 -0
  294. package/examples/jsm/lights/SunLight.js +95 -0
  295. package/examples/jsm/lights/SunLightNode.d.ts +25 -0
  296. package/examples/jsm/lights/SunLightNode.js +56 -0
  297. package/examples/jsm/lights/SunLightShadow.d.ts +57 -0
  298. package/examples/jsm/lights/SunLightShadow.js +319 -0
  299. package/examples/jsm/lights/SunShadowNode.d.ts +53 -0
  300. package/examples/jsm/lights/SunShadowNode.js +312 -0
  301. package/examples/jsm/lines/Line2.d.ts +25 -0
  302. package/examples/jsm/lines/Line2.js +56 -0
  303. package/examples/jsm/lines/LineGeometry.d.ts +27 -0
  304. package/examples/jsm/lines/LineGeometry.js +157 -0
  305. package/examples/jsm/lines/LineMaterial.d.ts +82 -0
  306. package/examples/jsm/lines/LineMaterial.js +726 -0
  307. package/examples/jsm/lines/LineSegments2.d.ts +39 -0
  308. package/examples/jsm/lines/LineSegments2.js +434 -0
  309. package/examples/jsm/lines/LineSegmentsGeometry.d.ts +53 -0
  310. package/examples/jsm/lines/LineSegmentsGeometry.js +298 -0
  311. package/examples/jsm/lines/Wireframe.d.ts +14 -0
  312. package/examples/jsm/lines/Wireframe.js +108 -0
  313. package/examples/jsm/lines/WireframeGeometry2.d.ts +8 -0
  314. package/examples/jsm/lines/WireframeGeometry2.js +49 -0
  315. package/examples/jsm/lines/webgpu/Line2.d.ts +14 -0
  316. package/examples/jsm/lines/webgpu/Line2.js +46 -0
  317. package/examples/jsm/lines/webgpu/LineSegments2.d.ts +15 -0
  318. package/examples/jsm/lines/webgpu/LineSegments2.js +419 -0
  319. package/examples/jsm/lines/webgpu/Wireframe.d.ts +13 -0
  320. package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
  321. package/examples/jsm/loaders/3DMLoader.d.ts +12 -0
  322. package/examples/jsm/loaders/3DMLoader.js +1937 -0
  323. package/examples/jsm/loaders/3MFLoader.d.ts +9 -0
  324. package/examples/jsm/loaders/3MFLoader.js +1822 -0
  325. package/examples/jsm/loaders/AMFLoader.d.ts +7 -0
  326. package/examples/jsm/loaders/AMFLoader.js +541 -0
  327. package/examples/jsm/loaders/BVHLoader.d.ts +14 -0
  328. package/examples/jsm/loaders/BVHLoader.js +484 -0
  329. package/examples/jsm/loaders/ColladaLoader.d.ts +35 -0
  330. package/examples/jsm/loaders/ColladaLoader.js +153 -0
  331. package/examples/jsm/loaders/DDSLoader.d.ts +22 -0
  332. package/examples/jsm/loaders/DDSLoader.js +385 -0
  333. package/examples/jsm/loaders/DRACOLoader.d.ts +39 -0
  334. package/examples/jsm/loaders/DRACOLoader.js +772 -0
  335. package/examples/jsm/loaders/EXRLoader.d.ts +24 -0
  336. package/examples/jsm/loaders/EXRLoader.js +3395 -0
  337. package/examples/jsm/loaders/FBXLoader.d.ts +8 -0
  338. package/examples/jsm/loaders/FBXLoader.js +4656 -0
  339. package/examples/jsm/loaders/FontLoader.d.ts +41 -0
  340. package/examples/jsm/loaders/FontLoader.js +260 -0
  341. package/examples/jsm/loaders/GCodeLoader.d.ts +8 -0
  342. package/examples/jsm/loaders/GCodeLoader.js +318 -0
  343. package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts +14 -0
  344. package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.js +330 -0
  345. package/examples/jsm/loaders/GLTFLoader.d.ts +153 -0
  346. package/examples/jsm/loaders/GLTFLoader.js +4925 -0
  347. package/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts +9 -0
  348. package/examples/jsm/loaders/GaussianSplatPLYLoader.js +386 -0
  349. package/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +18 -0
  350. package/examples/jsm/loaders/HDRCubeTextureLoader.js +164 -0
  351. package/examples/jsm/loaders/HDRLoader.d.ts +12 -0
  352. package/examples/jsm/loaders/HDRLoader.js +463 -0
  353. package/examples/jsm/loaders/IESLoader.d.ts +5 -0
  354. package/examples/jsm/loaders/IESLoader.js +379 -0
  355. package/examples/jsm/loaders/KMZLoader.d.ts +9 -0
  356. package/examples/jsm/loaders/KMZLoader.js +163 -0
  357. package/examples/jsm/loaders/KSPLATLoader.d.ts +9 -0
  358. package/examples/jsm/loaders/KSPLATLoader.js +463 -0
  359. package/examples/jsm/loaders/KTX2Loader.d.ts +58 -0
  360. package/examples/jsm/loaders/KTX2Loader.js +1276 -0
  361. package/examples/jsm/loaders/KTXLoader.d.ts +22 -0
  362. package/examples/jsm/loaders/KTXLoader.js +197 -0
  363. package/examples/jsm/loaders/LDrawLoader.d.ts +38 -0
  364. package/examples/jsm/loaders/LDrawLoader.js +2510 -0
  365. package/examples/jsm/loaders/LUT3dlLoader.d.ts +39 -0
  366. package/examples/jsm/loaders/LUT3dlLoader.js +205 -0
  367. package/examples/jsm/loaders/LUTCubeLoader.d.ts +42 -0
  368. package/examples/jsm/loaders/LUTCubeLoader.js +190 -0
  369. package/examples/jsm/loaders/LUTImageLoader.d.ts +18 -0
  370. package/examples/jsm/loaders/LUTImageLoader.js +190 -0
  371. package/examples/jsm/loaders/LWOLoader.d.ts +25 -0
  372. package/examples/jsm/loaders/LWOLoader.js +1051 -0
  373. package/examples/jsm/loaders/MD2Loader.d.ts +7 -0
  374. package/examples/jsm/loaders/MD2Loader.js +435 -0
  375. package/examples/jsm/loaders/MDDLoader.d.ts +12 -0
  376. package/examples/jsm/loaders/MDDLoader.js +147 -0
  377. package/examples/jsm/loaders/MTLLoader.d.ts +95 -0
  378. package/examples/jsm/loaders/MTLLoader.js +593 -0
  379. package/examples/jsm/loaders/MaterialXLoader.d.ts +70 -0
  380. package/examples/jsm/loaders/MaterialXLoader.js +227 -0
  381. package/examples/jsm/loaders/NRRDLoader.d.ts +15 -0
  382. package/examples/jsm/loaders/NRRDLoader.js +718 -0
  383. package/examples/jsm/loaders/OBJLoader.d.ts +10 -0
  384. package/examples/jsm/loaders/OBJLoader.js +955 -0
  385. package/examples/jsm/loaders/PCDLoader.d.ts +8 -0
  386. package/examples/jsm/loaders/PCDLoader.js +620 -0
  387. package/examples/jsm/loaders/PDBLoader.d.ts +15 -0
  388. package/examples/jsm/loaders/PDBLoader.js +272 -0
  389. package/examples/jsm/loaders/PLYLoader.d.ts +11 -0
  390. package/examples/jsm/loaders/PLYLoader.js +968 -0
  391. package/examples/jsm/loaders/PVRLoader.d.ts +16 -0
  392. package/examples/jsm/loaders/PVRLoader.js +270 -0
  393. package/examples/jsm/loaders/RGBELoader.d.ts +7 -0
  394. package/examples/jsm/loaders/RGBELoader.js +18 -0
  395. package/examples/jsm/loaders/SPLATLoader.d.ts +9 -0
  396. package/examples/jsm/loaders/SPLATLoader.js +139 -0
  397. package/examples/jsm/loaders/SPZLoader.d.ts +18 -0
  398. package/examples/jsm/loaders/SPZLoader.js +561 -0
  399. package/examples/jsm/loaders/STLLoader.d.ts +7 -0
  400. package/examples/jsm/loaders/STLLoader.js +421 -0
  401. package/examples/jsm/loaders/SVGLoader.d.ts +67 -0
  402. package/examples/jsm/loaders/SVGLoader.js +3319 -0
  403. package/examples/jsm/loaders/TDSLoader.d.ts +35 -0
  404. package/examples/jsm/loaders/TDSLoader.js +1142 -0
  405. package/examples/jsm/loaders/TGALoader.d.ts +7 -0
  406. package/examples/jsm/loaders/TGALoader.js +538 -0
  407. package/examples/jsm/loaders/TIFFLoader.d.ts +7 -0
  408. package/examples/jsm/loaders/TIFFLoader.js +59 -0
  409. package/examples/jsm/loaders/TTFLoader.d.ts +10 -0
  410. package/examples/jsm/loaders/TTFLoader.js +261 -0
  411. package/examples/jsm/loaders/USDLoader.d.ts +14 -0
  412. package/examples/jsm/loaders/USDLoader.js +303 -0
  413. package/examples/jsm/loaders/USDZLoader.d.ts +14 -0
  414. package/examples/jsm/loaders/USDZLoader.js +16 -0
  415. package/examples/jsm/loaders/UltraHDRLoader.d.ts +28 -0
  416. package/examples/jsm/loaders/UltraHDRLoader.js +755 -0
  417. package/examples/jsm/loaders/VOXLoader.d.ts +38 -0
  418. package/examples/jsm/loaders/VOXLoader.js +919 -0
  419. package/examples/jsm/loaders/VRMLLoader.d.ts +7 -0
  420. package/examples/jsm/loaders/VRMLLoader.js +3646 -0
  421. package/examples/jsm/loaders/VTKLoader.d.ts +13 -0
  422. package/examples/jsm/loaders/VTKLoader.js +1293 -0
  423. package/examples/jsm/loaders/XYZLoader.d.ts +7 -0
  424. package/examples/jsm/loaders/XYZLoader.js +143 -0
  425. package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
  426. package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
  427. package/examples/jsm/loaders/lwo/IFFParser.js +1217 -0
  428. package/examples/jsm/loaders/lwo/LWO2Parser.js +414 -0
  429. package/examples/jsm/loaders/lwo/LWO3Parser.js +373 -0
  430. package/examples/jsm/loaders/materialx/MaterialXArchive.js +108 -0
  431. package/examples/jsm/loaders/materialx/MaterialXDocument.js +878 -0
  432. package/examples/jsm/loaders/materialx/MaterialXHextile.d.ts +24 -0
  433. package/examples/jsm/loaders/materialx/MaterialXHextile.js +183 -0
  434. package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts +8 -0
  435. package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.js +376 -0
  436. package/examples/jsm/loaders/materialx/MaterialXLog.d.ts +33 -0
  437. package/examples/jsm/loaders/materialx/MaterialXLog.js +75 -0
  438. package/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.js +4 -0
  439. package/examples/jsm/loaders/materialx/MaterialXNodeLibrary.js +1021 -0
  440. package/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.js +661 -0
  441. package/examples/jsm/loaders/materialx/MaterialXUtils.js +57 -0
  442. package/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.js +997 -0
  443. package/examples/jsm/loaders/materialx/parse/MaterialXParser.js +28 -0
  444. package/examples/jsm/loaders/usd/USDAParser.js +914 -0
  445. package/examples/jsm/loaders/usd/USDCParser.js +1875 -0
  446. package/examples/jsm/loaders/usd/USDComposer.js +4665 -0
  447. package/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts +9 -0
  448. package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
  449. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +9 -0
  450. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
  451. package/examples/jsm/materials/WoodNodeMaterial.d.ts +75 -0
  452. package/examples/jsm/materials/WoodNodeMaterial.js +431 -0
  453. package/examples/jsm/math/Capsule.d.ts +26 -0
  454. package/examples/jsm/math/Capsule.js +159 -0
  455. package/examples/jsm/math/ColorConverter.d.ts +19 -0
  456. package/examples/jsm/math/ColorConverter.js +58 -0
  457. package/examples/jsm/math/ColorSpaces.d.ts +15 -0
  458. package/examples/jsm/math/ColorSpaces.js +147 -0
  459. package/examples/jsm/math/ConvexHull.d.ts +89 -0
  460. package/examples/jsm/math/ConvexHull.js +1695 -0
  461. package/examples/jsm/math/ImprovedNoise.d.ts +4 -0
  462. package/examples/jsm/math/ImprovedNoise.js +88 -0
  463. package/examples/jsm/math/Lut.d.ts +27 -0
  464. package/examples/jsm/math/Lut.js +317 -0
  465. package/examples/jsm/math/MeshSurfaceSampler.d.ts +21 -0
  466. package/examples/jsm/math/MeshSurfaceSampler.js +315 -0
  467. package/examples/jsm/math/OBB.d.ts +24 -0
  468. package/examples/jsm/math/OBB.js +535 -0
  469. package/examples/jsm/math/Octree.d.ts +54 -0
  470. package/examples/jsm/math/Octree.js +822 -0
  471. package/examples/jsm/math/SimplexNoise.d.ts +9 -0
  472. package/examples/jsm/math/SimplexNoise.js +470 -0
  473. package/examples/jsm/misc/ConvexObjectBreaker.d.ts +25 -0
  474. package/examples/jsm/misc/ConvexObjectBreaker.js +539 -0
  475. package/examples/jsm/misc/GPUComputationRenderer.d.ts +55 -0
  476. package/examples/jsm/misc/GPUComputationRenderer.js +508 -0
  477. package/examples/jsm/misc/Gyroscope.d.ts +5 -0
  478. package/examples/jsm/misc/Gyroscope.js +78 -0
  479. package/examples/jsm/misc/MD2Character.d.ts +33 -0
  480. package/examples/jsm/misc/MD2Character.js +391 -0
  481. package/examples/jsm/misc/MD2CharacterComplex.d.ts +55 -0
  482. package/examples/jsm/misc/MD2CharacterComplex.js +740 -0
  483. package/examples/jsm/misc/MorphAnimMesh.d.ts +13 -0
  484. package/examples/jsm/misc/MorphAnimMesh.js +119 -0
  485. package/examples/jsm/misc/MorphBlendMesh.d.ts +21 -0
  486. package/examples/jsm/misc/MorphBlendMesh.js +425 -0
  487. package/examples/jsm/misc/ProgressiveLightMap.d.ts +58 -0
  488. package/examples/jsm/misc/ProgressiveLightMap.js +370 -0
  489. package/examples/jsm/misc/ProgressiveLightMapGPU.d.ts +27 -0
  490. package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
  491. package/examples/jsm/misc/RollerCoaster.d.ts +26 -0
  492. package/examples/jsm/misc/RollerCoaster.js +661 -0
  493. package/examples/jsm/misc/SculptGL.LICENSE.txt +21 -0
  494. package/examples/jsm/misc/Sculptor.d.ts +259 -0
  495. package/examples/jsm/misc/Sculptor.js +1679 -0
  496. package/examples/jsm/misc/SculptorMesh.js +1504 -0
  497. package/examples/jsm/misc/SculptorTools.js +1180 -0
  498. package/examples/jsm/misc/SculptorUtils.js +345 -0
  499. package/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +49 -0
  500. package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
  501. package/examples/jsm/misc/TubePainter.d.ts +10 -0
  502. package/examples/jsm/misc/TubePainter.js +611 -0
  503. package/examples/jsm/misc/Volume.d.ts +37 -0
  504. package/examples/jsm/misc/Volume.js +520 -0
  505. package/examples/jsm/misc/VolumeSlice.d.ts +28 -0
  506. package/examples/jsm/misc/VolumeSlice.js +275 -0
  507. package/examples/jsm/modifiers/CurveModifier.d.ts +41 -0
  508. package/examples/jsm/modifiers/CurveModifier.js +374 -0
  509. package/examples/jsm/modifiers/CurveModifierGPU.d.ts +31 -0
  510. package/examples/jsm/modifiers/CurveModifierGPU.js +256 -0
  511. package/examples/jsm/modifiers/EdgeSplitModifier.d.ts +26 -0
  512. package/examples/jsm/modifiers/EdgeSplitModifier.js +299 -0
  513. package/examples/jsm/modifiers/SimplifyModifier.d.ts +6 -0
  514. package/examples/jsm/modifiers/SimplifyModifier.js +139 -0
  515. package/examples/jsm/modifiers/TessellateModifier.d.ts +9 -0
  516. package/examples/jsm/modifiers/TessellateModifier.js +340 -0
  517. package/examples/jsm/objects/GaussianSplat.d.ts +35 -0
  518. package/examples/jsm/objects/GaussianSplat.js +1039 -0
  519. package/examples/jsm/objects/GroundedSkybox.d.ts +5 -0
  520. package/examples/jsm/objects/GroundedSkybox.js +69 -0
  521. package/examples/jsm/objects/Lensflare.d.ts +21 -0
  522. package/examples/jsm/objects/Lensflare.js +489 -0
  523. package/examples/jsm/objects/LensflareMesh.d.ts +21 -0
  524. package/examples/jsm/objects/LensflareMesh.js +376 -0
  525. package/examples/jsm/objects/MarchingCubes.d.ts +76 -0
  526. package/examples/jsm/objects/MarchingCubes.js +1261 -0
  527. package/examples/jsm/objects/Reflector.d.ts +54 -0
  528. package/examples/jsm/objects/Reflector.js +385 -0
  529. package/examples/jsm/objects/ReflectorForSSRPass.d.ts +62 -0
  530. package/examples/jsm/objects/ReflectorForSSRPass.js +393 -0
  531. package/examples/jsm/objects/Refractor.d.ts +21 -0
  532. package/examples/jsm/objects/Refractor.js +389 -0
  533. package/examples/jsm/objects/ShadowMesh.d.ts +10 -0
  534. package/examples/jsm/objects/ShadowMesh.js +130 -0
  535. package/examples/jsm/objects/Sky.d.ts +28 -0
  536. package/examples/jsm/objects/Sky.js +342 -0
  537. package/examples/jsm/objects/SkyMesh.d.ts +26 -0
  538. package/examples/jsm/objects/SkyMesh.js +396 -0
  539. package/examples/jsm/objects/Water.d.ts +22 -0
  540. package/examples/jsm/objects/Water.js +374 -0
  541. package/examples/jsm/objects/Water2.d.ts +21 -0
  542. package/examples/jsm/objects/Water2.js +403 -0
  543. package/examples/jsm/objects/Water2Mesh.d.ts +53 -0
  544. package/examples/jsm/objects/Water2Mesh.js +199 -0
  545. package/examples/jsm/objects/WaterMesh.d.ts +40 -0
  546. package/examples/jsm/objects/WaterMesh.js +194 -0
  547. package/examples/jsm/offscreen/jank.js +45 -0
  548. package/examples/jsm/offscreen/offscreen.js +8 -0
  549. package/examples/jsm/offscreen/scene.js +86 -0
  550. package/examples/jsm/physics/AmmoPhysics.d.ts +9 -0
  551. package/examples/jsm/physics/AmmoPhysics.js +366 -0
  552. package/examples/jsm/physics/JoltPhysics.d.ts +10 -0
  553. package/examples/jsm/physics/JoltPhysics.js +334 -0
  554. package/examples/jsm/physics/RapierPhysics.d.ts +26 -0
  555. package/examples/jsm/physics/RapierPhysics.js +461 -0
  556. package/examples/jsm/postprocessing/AfterimagePass.d.ts +17 -0
  557. package/examples/jsm/postprocessing/AfterimagePass.js +187 -0
  558. package/examples/jsm/postprocessing/BloomPass.d.ts +14 -0
  559. package/examples/jsm/postprocessing/BloomPass.js +274 -0
  560. package/examples/jsm/postprocessing/BokehPass.d.ts +23 -0
  561. package/examples/jsm/postprocessing/BokehPass.js +218 -0
  562. package/examples/jsm/postprocessing/ClearPass.d.ts +9 -0
  563. package/examples/jsm/postprocessing/ClearPass.js +97 -0
  564. package/examples/jsm/postprocessing/CubeTexturePass.d.ts +14 -0
  565. package/examples/jsm/postprocessing/CubeTexturePass.js +146 -0
  566. package/examples/jsm/postprocessing/DotScreenPass.d.ts +10 -0
  567. package/examples/jsm/postprocessing/DotScreenPass.js +114 -0
  568. package/examples/jsm/postprocessing/EffectComposer.d.ts +30 -0
  569. package/examples/jsm/postprocessing/EffectComposer.js +365 -0
  570. package/examples/jsm/postprocessing/FXAAPass.d.ts +7 -0
  571. package/examples/jsm/postprocessing/FXAAPass.js +40 -0
  572. package/examples/jsm/postprocessing/FilmPass.d.ts +10 -0
  573. package/examples/jsm/postprocessing/FilmPass.js +113 -0
  574. package/examples/jsm/postprocessing/GTAOPass.d.ts +121 -0
  575. package/examples/jsm/postprocessing/GTAOPass.js +727 -0
  576. package/examples/jsm/postprocessing/GlitchPass.d.ts +16 -0
  577. package/examples/jsm/postprocessing/GlitchPass.js +177 -0
  578. package/examples/jsm/postprocessing/HalftonePass.d.ts +37 -0
  579. package/examples/jsm/postprocessing/HalftonePass.js +134 -0
  580. package/examples/jsm/postprocessing/LUTPass.d.ts +13 -0
  581. package/examples/jsm/postprocessing/LUTPass.js +138 -0
  582. package/examples/jsm/postprocessing/MaskPass.d.ts +14 -0
  583. package/examples/jsm/postprocessing/MaskPass.js +195 -0
  584. package/examples/jsm/postprocessing/OutlinePass.d.ts +64 -0
  585. package/examples/jsm/postprocessing/OutlinePass.js +776 -0
  586. package/examples/jsm/postprocessing/OutputPass.d.ts +14 -0
  587. package/examples/jsm/postprocessing/OutputPass.js +148 -0
  588. package/examples/jsm/postprocessing/Pass.d.ts +31 -0
  589. package/examples/jsm/postprocessing/Pass.js +191 -0
  590. package/examples/jsm/postprocessing/RenderPass.d.ts +28 -0
  591. package/examples/jsm/postprocessing/RenderPass.js +193 -0
  592. package/examples/jsm/postprocessing/RenderPixelatedPass.d.ts +30 -0
  593. package/examples/jsm/postprocessing/RenderPixelatedPass.js +314 -0
  594. package/examples/jsm/postprocessing/RenderTransitionPass.d.ts +33 -0
  595. package/examples/jsm/postprocessing/RenderTransitionPass.js +267 -0
  596. package/examples/jsm/postprocessing/SAOPass.d.ts +70 -0
  597. package/examples/jsm/postprocessing/SAOPass.js +407 -0
  598. package/examples/jsm/postprocessing/SMAAPass.d.ts +21 -0
  599. package/examples/jsm/postprocessing/SMAAPass.js +230 -0
  600. package/examples/jsm/postprocessing/SSAARenderPass.d.ts +26 -0
  601. package/examples/jsm/postprocessing/SSAARenderPass.js +313 -0
  602. package/examples/jsm/postprocessing/SSAOPass.d.ts +68 -0
  603. package/examples/jsm/postprocessing/SSAOPass.js +527 -0
  604. package/examples/jsm/postprocessing/SSRPass.d.ts +99 -0
  605. package/examples/jsm/postprocessing/SSRPass.js +858 -0
  606. package/examples/jsm/postprocessing/SavePass.d.ts +12 -0
  607. package/examples/jsm/postprocessing/SavePass.js +132 -0
  608. package/examples/jsm/postprocessing/ShaderPass.d.ts +11 -0
  609. package/examples/jsm/postprocessing/ShaderPass.js +135 -0
  610. package/examples/jsm/postprocessing/TAARenderPass.d.ts +8 -0
  611. package/examples/jsm/postprocessing/TAARenderPass.js +243 -0
  612. package/examples/jsm/postprocessing/TexturePass.d.ts +12 -0
  613. package/examples/jsm/postprocessing/TexturePass.js +131 -0
  614. package/examples/jsm/postprocessing/UnrealBloomPass.d.ts +26 -0
  615. package/examples/jsm/postprocessing/UnrealBloomPass.js +541 -0
  616. package/examples/jsm/renderers/CSS2DRenderer.d.ts +29 -0
  617. package/examples/jsm/renderers/CSS2DRenderer.js +352 -0
  618. package/examples/jsm/renderers/CSS3DRenderer.d.ts +26 -0
  619. package/examples/jsm/renderers/CSS3DRenderer.js +454 -0
  620. package/examples/jsm/renderers/Projector.d.ts +60 -0
  621. package/examples/jsm/renderers/Projector.js +1154 -0
  622. package/examples/jsm/renderers/SVGRenderer.d.ts +26 -0
  623. package/examples/jsm/renderers/SVGRenderer.js +799 -0
  624. package/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts +11 -0
  625. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +96 -0
  626. package/examples/jsm/shaders/AfterimageShader.d.ts +12 -0
  627. package/examples/jsm/shaders/AfterimageShader.js +63 -0
  628. package/examples/jsm/shaders/BasicShader.d.ts +6 -0
  629. package/examples/jsm/shaders/BasicShader.js +36 -0
  630. package/examples/jsm/shaders/BleachBypassShader.d.ts +10 -0
  631. package/examples/jsm/shaders/BleachBypassShader.js +68 -0
  632. package/examples/jsm/shaders/BlendShader.d.ts +13 -0
  633. package/examples/jsm/shaders/BlendShader.js +56 -0
  634. package/examples/jsm/shaders/BokehShader.d.ts +21 -0
  635. package/examples/jsm/shaders/BokehShader.js +151 -0
  636. package/examples/jsm/shaders/BokehShader2.d.ts +44 -0
  637. package/examples/jsm/shaders/BokehShader2.js +404 -0
  638. package/examples/jsm/shaders/BrightnessContrastShader.d.ts +12 -0
  639. package/examples/jsm/shaders/BrightnessContrastShader.js +62 -0
  640. package/examples/jsm/shaders/ColorCorrectionShader.d.ts +13 -0
  641. package/examples/jsm/shaders/ColorCorrectionShader.js +59 -0
  642. package/examples/jsm/shaders/ColorifyShader.d.ts +10 -0
  643. package/examples/jsm/shaders/ColorifyShader.js +57 -0
  644. package/examples/jsm/shaders/ConvolutionShader.d.ts +17 -0
  645. package/examples/jsm/shaders/ConvolutionShader.js +74 -0
  646. package/examples/jsm/shaders/CopyShader.d.ts +10 -0
  647. package/examples/jsm/shaders/CopyShader.js +52 -0
  648. package/examples/jsm/shaders/DOFMipMapShader.d.ts +13 -0
  649. package/examples/jsm/shaders/DOFMipMapShader.js +63 -0
  650. package/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +28 -0
  651. package/examples/jsm/shaders/DepthLimitedBlurShader.js +183 -0
  652. package/examples/jsm/shaders/DigitalGlitch.d.ts +19 -0
  653. package/examples/jsm/shaders/DigitalGlitch.js +104 -0
  654. package/examples/jsm/shaders/DotScreenShader.d.ts +13 -0
  655. package/examples/jsm/shaders/DotScreenShader.js +75 -0
  656. package/examples/jsm/shaders/ExposureShader.d.ts +11 -0
  657. package/examples/jsm/shaders/ExposureShader.js +51 -0
  658. package/examples/jsm/shaders/FXAAShader.d.ts +11 -0
  659. package/examples/jsm/shaders/FXAAShader.js +298 -0
  660. package/examples/jsm/shaders/FilmShader.d.ts +12 -0
  661. package/examples/jsm/shaders/FilmShader.js +73 -0
  662. package/examples/jsm/shaders/FocusShader.d.ts +14 -0
  663. package/examples/jsm/shaders/FocusShader.js +94 -0
  664. package/examples/jsm/shaders/FreiChenShader.d.ts +11 -0
  665. package/examples/jsm/shaders/FreiChenShader.js +103 -0
  666. package/examples/jsm/shaders/GTAOShader.d.ts +59 -0
  667. package/examples/jsm/shaders/GTAOShader.js +434 -0
  668. package/examples/jsm/shaders/GammaCorrectionShader.d.ts +9 -0
  669. package/examples/jsm/shaders/GammaCorrectionShader.js +52 -0
  670. package/examples/jsm/shaders/HalftoneShader.d.ts +22 -0
  671. package/examples/jsm/shaders/HalftoneShader.js +332 -0
  672. package/examples/jsm/shaders/HorizontalBlurShader.d.ts +10 -0
  673. package/examples/jsm/shaders/HorizontalBlurShader.js +68 -0
  674. package/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +12 -0
  675. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +70 -0
  676. package/examples/jsm/shaders/HueSaturationShader.d.ts +12 -0
  677. package/examples/jsm/shaders/HueSaturationShader.js +74 -0
  678. package/examples/jsm/shaders/KaleidoShader.d.ts +12 -0
  679. package/examples/jsm/shaders/KaleidoShader.js +65 -0
  680. package/examples/jsm/shaders/LuminosityHighPassShader.d.ts +15 -0
  681. package/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
  682. package/examples/jsm/shaders/LuminosityShader.d.ts +10 -0
  683. package/examples/jsm/shaders/LuminosityShader.js +54 -0
  684. package/examples/jsm/shaders/MirrorShader.d.ts +11 -0
  685. package/examples/jsm/shaders/MirrorShader.js +62 -0
  686. package/examples/jsm/shaders/NormalMapShader.d.ts +13 -0
  687. package/examples/jsm/shaders/NormalMapShader.js +60 -0
  688. package/examples/jsm/shaders/OutputShader.d.ts +11 -0
  689. package/examples/jsm/shaders/OutputShader.js +103 -0
  690. package/examples/jsm/shaders/PoissonDenoiseShader.d.ts +28 -0
  691. package/examples/jsm/shaders/PoissonDenoiseShader.js +239 -0
  692. package/examples/jsm/shaders/RGBShiftShader.d.ts +11 -0
  693. package/examples/jsm/shaders/RGBShiftShader.js +61 -0
  694. package/examples/jsm/shaders/SAOShader.d.ts +29 -0
  695. package/examples/jsm/shaders/SAOShader.js +201 -0
  696. package/examples/jsm/shaders/SMAAShader.d.ts +43 -0
  697. package/examples/jsm/shaders/SMAAShader.js +489 -0
  698. package/examples/jsm/shaders/SSAOShader.d.ts +49 -0
  699. package/examples/jsm/shaders/SSAOShader.js +331 -0
  700. package/examples/jsm/shaders/SSRShader.d.ts +62 -0
  701. package/examples/jsm/shaders/SSRShader.js +396 -0
  702. package/examples/jsm/shaders/SepiaShader.d.ts +10 -0
  703. package/examples/jsm/shaders/SepiaShader.js +57 -0
  704. package/examples/jsm/shaders/SobelOperatorShader.d.ts +11 -0
  705. package/examples/jsm/shaders/SobelOperatorShader.js +98 -0
  706. package/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts +38 -0
  707. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +95 -0
  708. package/examples/jsm/shaders/TechnicolorShader.d.ts +10 -0
  709. package/examples/jsm/shaders/TechnicolorShader.js +51 -0
  710. package/examples/jsm/shaders/ToonShader.d.ts +54 -0
  711. package/examples/jsm/shaders/ToonShader.js +349 -0
  712. package/examples/jsm/shaders/TriangleBlurShader.d.ts +11 -0
  713. package/examples/jsm/shaders/TriangleBlurShader.js +79 -0
  714. package/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +11 -0
  715. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +60 -0
  716. package/examples/jsm/shaders/VelocityShader.d.ts +16 -0
  717. package/examples/jsm/shaders/VelocityShader.js +137 -0
  718. package/examples/jsm/shaders/VerticalBlurShader.d.ts +10 -0
  719. package/examples/jsm/shaders/VerticalBlurShader.js +66 -0
  720. package/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +12 -0
  721. package/examples/jsm/shaders/VerticalTiltShiftShader.js +70 -0
  722. package/examples/jsm/shaders/VignetteShader.d.ts +11 -0
  723. package/examples/jsm/shaders/VignetteShader.js +56 -0
  724. package/examples/jsm/shaders/VolumeShader.d.ts +14 -0
  725. package/examples/jsm/shaders/VolumeShader.js +285 -0
  726. package/examples/jsm/shaders/WaterRefractionShader.d.ts +14 -0
  727. package/examples/jsm/shaders/WaterRefractionShader.js +106 -0
  728. package/examples/jsm/textures/FlakesTexture.d.ts +3 -0
  729. package/examples/jsm/textures/FlakesTexture.js +54 -0
  730. package/examples/jsm/transpiler/AST.d.ts +293 -0
  731. package/examples/jsm/transpiler/AST.js +694 -0
  732. package/examples/jsm/transpiler/GLSLDecoder.d.ts +7 -0
  733. package/examples/jsm/transpiler/GLSLDecoder.js +1718 -0
  734. package/examples/jsm/transpiler/Linker.js +327 -0
  735. package/examples/jsm/transpiler/ShaderToyDecoder.d.ts +3 -0
  736. package/examples/jsm/transpiler/ShaderToyDecoder.js +51 -0
  737. package/examples/jsm/transpiler/TSLEncoder.d.ts +51 -0
  738. package/examples/jsm/transpiler/TSLEncoder.js +1055 -0
  739. package/examples/jsm/transpiler/Transpiler.d.ts +5 -0
  740. package/examples/jsm/transpiler/Transpiler.js +67 -0
  741. package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
  742. package/examples/jsm/transpiler/WGSLEncoder.js +868 -0
  743. package/examples/jsm/tsl/WebGLNodesHandler.d.ts +17 -0
  744. package/examples/jsm/tsl/WebGLNodesHandler.js +595 -0
  745. package/examples/jsm/tsl/display/AfterImageNode.d.ts +15 -0
  746. package/examples/jsm/tsl/display/AfterImageNode.js +256 -0
  747. package/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +42 -0
  748. package/examples/jsm/tsl/display/AnaglyphPassNode.js +550 -0
  749. package/examples/jsm/tsl/display/BilateralBlurNode.d.ts +27 -0
  750. package/examples/jsm/tsl/display/BilateralBlurNode.js +377 -0
  751. package/examples/jsm/tsl/display/BleachBypass.d.ts +3 -0
  752. package/examples/jsm/tsl/display/BleachBypass.js +33 -0
  753. package/examples/jsm/tsl/display/BloomNode.d.ts +44 -0
  754. package/examples/jsm/tsl/display/BloomNode.js +599 -0
  755. package/examples/jsm/tsl/display/CRT.d.ts +22 -0
  756. package/examples/jsm/tsl/display/CRT.js +150 -0
  757. package/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +19 -0
  758. package/examples/jsm/tsl/display/ChromaticAberrationNode.js +174 -0
  759. package/examples/jsm/tsl/display/DenoiseNode.d.ts +26 -0
  760. package/examples/jsm/tsl/display/DenoiseNode.js +354 -0
  761. package/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +28 -0
  762. package/examples/jsm/tsl/display/DepthOfFieldNode.js +572 -0
  763. package/examples/jsm/tsl/display/DotScreenNode.d.ts +17 -0
  764. package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
  765. package/examples/jsm/tsl/display/FSR1Node.d.ts +17 -0
  766. package/examples/jsm/tsl/display/FSR1Node.js +481 -0
  767. package/examples/jsm/tsl/display/FXAANode.d.ts +11 -0
  768. package/examples/jsm/tsl/display/FXAANode.js +364 -0
  769. package/examples/jsm/tsl/display/FilmNode.d.ts +17 -0
  770. package/examples/jsm/tsl/display/FilmNode.js +101 -0
  771. package/examples/jsm/tsl/display/GTAONode.d.ts +37 -0
  772. package/examples/jsm/tsl/display/GTAONode.js +719 -0
  773. package/examples/jsm/tsl/display/GaussianBlurNode.d.ts +56 -0
  774. package/examples/jsm/tsl/display/GaussianBlurNode.js +412 -0
  775. package/examples/jsm/tsl/display/GodraysNode.d.ts +20 -0
  776. package/examples/jsm/tsl/display/GodraysNode.js +618 -0
  777. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +84 -0
  778. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
  779. package/examples/jsm/tsl/display/LensflareNode.d.ts +34 -0
  780. package/examples/jsm/tsl/display/LensflareNode.js +282 -0
  781. package/examples/jsm/tsl/display/Lut3DNode.d.ts +19 -0
  782. package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
  783. package/examples/jsm/tsl/display/MotionBlur.d.ts +7 -0
  784. package/examples/jsm/tsl/display/MotionBlur.js +33 -0
  785. package/examples/jsm/tsl/display/OITPassNode.d.ts +64 -0
  786. package/examples/jsm/tsl/display/OITPassNode.js +352 -0
  787. package/examples/jsm/tsl/display/OutlineNode.d.ts +31 -0
  788. package/examples/jsm/tsl/display/OutlineNode.js +814 -0
  789. package/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts +12 -0
  790. package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +90 -0
  791. package/examples/jsm/tsl/display/PixelationPassNode.d.ts +27 -0
  792. package/examples/jsm/tsl/display/PixelationPassNode.js +335 -0
  793. package/examples/jsm/tsl/display/RGBShiftNode.d.ts +15 -0
  794. package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
  795. package/examples/jsm/tsl/display/RecurrentDenoiseNode.d.ts +89 -0
  796. package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +915 -0
  797. package/examples/jsm/tsl/display/RetroPassNode.d.ts +17 -0
  798. package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
  799. package/examples/jsm/tsl/display/SMAANode.d.ts +17 -0
  800. package/examples/jsm/tsl/display/SMAANode.js +729 -0
  801. package/examples/jsm/tsl/display/SSAAPassNode.d.ts +18 -0
  802. package/examples/jsm/tsl/display/SSAAPassNode.js +344 -0
  803. package/examples/jsm/tsl/display/SSAONode.d.ts +116 -0
  804. package/examples/jsm/tsl/display/SSAONode.js +436 -0
  805. package/examples/jsm/tsl/display/SSGINode.d.ts +33 -0
  806. package/examples/jsm/tsl/display/SSGINode.js +691 -0
  807. package/examples/jsm/tsl/display/SSRNode.d.ts +315 -0
  808. package/examples/jsm/tsl/display/SSRNode.js +1358 -0
  809. package/examples/jsm/tsl/display/SSSNode.d.ts +20 -0
  810. package/examples/jsm/tsl/display/SSSNode.js +493 -0
  811. package/examples/jsm/tsl/display/Sepia.d.ts +3 -0
  812. package/examples/jsm/tsl/display/Sepia.js +24 -0
  813. package/examples/jsm/tsl/display/Shape.d.ts +3 -0
  814. package/examples/jsm/tsl/display/Shape.js +29 -0
  815. package/examples/jsm/tsl/display/SharpenNode.d.ts +22 -0
  816. package/examples/jsm/tsl/display/SharpenNode.js +284 -0
  817. package/examples/jsm/tsl/display/SobelOperatorNode.d.ts +11 -0
  818. package/examples/jsm/tsl/display/SobelOperatorNode.js +168 -0
  819. package/examples/jsm/tsl/display/StereoCompositePassNode.d.ts +13 -0
  820. package/examples/jsm/tsl/display/StereoCompositePassNode.js +190 -0
  821. package/examples/jsm/tsl/display/StereoPassNode.d.ts +13 -0
  822. package/examples/jsm/tsl/display/StereoPassNode.js +117 -0
  823. package/examples/jsm/tsl/display/TAAUNode.d.ts +31 -0
  824. package/examples/jsm/tsl/display/TAAUNode.js +732 -0
  825. package/examples/jsm/tsl/display/TRAANode.d.ts +26 -0
  826. package/examples/jsm/tsl/display/TRAANode.js +641 -0
  827. package/examples/jsm/tsl/display/TemporalReprojectNode.d.ts +64 -0
  828. package/examples/jsm/tsl/display/TemporalReprojectNode.js +1029 -0
  829. package/examples/jsm/tsl/display/TransitionNode.d.ts +31 -0
  830. package/examples/jsm/tsl/display/TransitionNode.js +141 -0
  831. package/examples/jsm/tsl/display/boxBlur.d.ts +10 -0
  832. package/examples/jsm/tsl/display/boxBlur.js +65 -0
  833. package/examples/jsm/tsl/display/depthAwareBlend.d.ts +15 -0
  834. package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
  835. package/examples/jsm/tsl/display/depthAwareBlur.d.ts +10 -0
  836. package/examples/jsm/tsl/display/depthAwareBlur.js +63 -0
  837. package/examples/jsm/tsl/display/hashBlur.d.ts +12 -0
  838. package/examples/jsm/tsl/display/hashBlur.js +55 -0
  839. package/examples/jsm/tsl/display/radialBlur.d.ts +12 -0
  840. package/examples/jsm/tsl/display/radialBlur.js +68 -0
  841. package/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +54 -0
  842. package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +633 -0
  843. package/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts +21 -0
  844. package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
  845. package/examples/jsm/tsl/lighting/LightProbeGridNode.js +136 -0
  846. package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts +9 -0
  847. package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
  848. package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts +9 -0
  849. package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
  850. package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts +9 -0
  851. package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
  852. package/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts +9 -0
  853. package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
  854. package/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts +9 -0
  855. package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
  856. package/examples/jsm/tsl/math/Bayer.d.ts +5 -0
  857. package/examples/jsm/tsl/math/Bayer.js +84 -0
  858. package/examples/jsm/tsl/math/curlNoise.d.ts +38 -0
  859. package/examples/jsm/tsl/math/curlNoise.js +107 -0
  860. package/examples/jsm/tsl/math/voronoiNoise.d.ts +52 -0
  861. package/examples/jsm/tsl/math/voronoiNoise.js +112 -0
  862. package/examples/jsm/tsl/shadows/TileShadowNode.d.ts +14 -0
  863. package/examples/jsm/tsl/shadows/TileShadowNode.js +454 -0
  864. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +14 -0
  865. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
  866. package/examples/jsm/tsl/utils/GroundedSkybox.d.ts +17 -0
  867. package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
  868. package/examples/jsm/tsl/utils/RNoise.d.ts +12 -0
  869. package/examples/jsm/tsl/utils/RNoise.js +51 -0
  870. package/examples/jsm/tsl/utils/Raymarching.d.ts +8 -0
  871. package/examples/jsm/tsl/utils/Raymarching.js +70 -0
  872. package/examples/jsm/tsl/utils/SoftParticles.d.ts +21 -0
  873. package/examples/jsm/tsl/utils/SoftParticles.js +60 -0
  874. package/examples/jsm/tsl/utils/SpecularHelpers.d.ts +20 -0
  875. package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
  876. package/examples/jsm/tsl/utils/TAAUtils.js +195 -0
  877. package/examples/jsm/utils/BufferGeometryUtils.d.ts +37 -0
  878. package/examples/jsm/utils/BufferGeometryUtils.js +1501 -0
  879. package/examples/jsm/utils/CameraUtils.d.ts +9 -0
  880. package/examples/jsm/utils/CameraUtils.js +82 -0
  881. package/examples/jsm/utils/ColorUtils.d.ts +5 -0
  882. package/examples/jsm/utils/ColorUtils.js +76 -0
  883. package/examples/jsm/utils/GaussianSplatUtils.d.ts +68 -0
  884. package/examples/jsm/utils/GaussianSplatUtils.js +229 -0
  885. package/examples/jsm/utils/GeometryCompressionUtils.d.ts +21 -0
  886. package/examples/jsm/utils/GeometryCompressionUtils.js +547 -0
  887. package/examples/jsm/utils/GeometryUtils.d.ts +25 -0
  888. package/examples/jsm/utils/GeometryUtils.js +226 -0
  889. package/examples/jsm/utils/LDrawUtils.d.ts +5 -0
  890. package/examples/jsm/utils/LDrawUtils.js +211 -0
  891. package/examples/jsm/utils/SceneOptimizer.d.ts +18 -0
  892. package/examples/jsm/utils/SceneOptimizer.js +458 -0
  893. package/examples/jsm/utils/SceneUtils.d.ts +57 -0
  894. package/examples/jsm/utils/SceneUtils.js +363 -0
  895. package/examples/jsm/utils/ShadowMapViewer.d.ts +26 -0
  896. package/examples/jsm/utils/ShadowMapViewer.js +244 -0
  897. package/examples/jsm/utils/ShadowMapViewerGPU.d.ts +26 -0
  898. package/examples/jsm/utils/ShadowMapViewerGPU.js +233 -0
  899. package/examples/jsm/utils/SkeletonUtils.d.ts +32 -0
  900. package/examples/jsm/utils/SkeletonUtils.js +496 -0
  901. package/examples/jsm/utils/SortUtils.d.ts +7 -0
  902. package/examples/jsm/utils/SortUtils.js +175 -0
  903. package/examples/jsm/utils/UVsDebug.d.ts +3 -0
  904. package/examples/jsm/utils/UVsDebug.js +173 -0
  905. package/examples/jsm/utils/WebGLTextureUtils.d.ts +3 -0
  906. package/examples/jsm/utils/WebGLTextureUtils.js +115 -0
  907. package/examples/jsm/utils/WebGPUTextureUtils.d.ts +3 -0
  908. package/examples/jsm/utils/WebGPUTextureUtils.js +81 -0
  909. package/examples/jsm/utils/WorkerPool.d.ts +26 -0
  910. package/examples/jsm/utils/WorkerPool.js +167 -0
  911. package/examples/jsm/webxr/ARButton.d.ts +9 -0
  912. package/examples/jsm/webxr/ARButton.js +251 -0
  913. package/examples/jsm/webxr/OculusHandModel.d.ts +23 -0
  914. package/examples/jsm/webxr/OculusHandModel.js +194 -0
  915. package/examples/jsm/webxr/OculusHandPointerModel.d.ts +67 -0
  916. package/examples/jsm/webxr/OculusHandPointerModel.js +539 -0
  917. package/examples/jsm/webxr/Text2D.d.ts +3 -0
  918. package/examples/jsm/webxr/Text2D.js +52 -0
  919. package/examples/jsm/webxr/VRButton.d.ts +7 -0
  920. package/examples/jsm/webxr/VRButton.js +264 -0
  921. package/examples/jsm/webxr/WebGLXRFallback.d.ts +14 -0
  922. package/examples/jsm/webxr/WebGLXRFallback.js +75 -0
  923. package/examples/jsm/webxr/XRButton.d.ts +7 -0
  924. package/examples/jsm/webxr/XRButton.js +246 -0
  925. package/examples/jsm/webxr/XRControllerModelFactory.d.ts +23 -0
  926. package/examples/jsm/webxr/XRControllerModelFactory.js +415 -0
  927. package/examples/jsm/webxr/XREstimatedLight.d.ts +69 -0
  928. package/examples/jsm/webxr/XREstimatedLight.js +254 -0
  929. package/examples/jsm/webxr/XRHandMeshModel.d.ts +20 -0
  930. package/examples/jsm/webxr/XRHandMeshModel.js +177 -0
  931. package/examples/jsm/webxr/XRHandModelFactory.d.ts +32 -0
  932. package/examples/jsm/webxr/XRHandModelFactory.js +198 -0
  933. package/examples/jsm/webxr/XRHandPrimitiveModel.d.ts +24 -0
  934. package/examples/jsm/webxr/XRHandPrimitiveModel.js +147 -0
  935. package/examples/jsm/webxr/XRPlanes.d.ts +5 -0
  936. package/examples/jsm/webxr/XRPlanes.js +118 -0
  937. package/index.d.ts +6 -0
  938. package/package.json +68 -4
  939. package/src/Three.Core.d.ts +176 -0
  940. package/src/Three.Core.js +189 -0
  941. package/src/Three.Legacy.js +0 -0
  942. package/src/Three.TSL.d.ts +686 -0
  943. package/src/Three.TSL.js +684 -0
  944. package/src/Three.WebGPU.Nodes.d.ts +36 -0
  945. package/src/Three.WebGPU.Nodes.js +33 -0
  946. package/src/Three.WebGPU.d.ts +44 -0
  947. package/src/Three.WebGPU.js +43 -0
  948. package/src/Three.d.ts +47 -0
  949. package/src/Three.js +10 -0
  950. package/src/animation/AnimationAction.d.ts +286 -0
  951. package/src/animation/AnimationAction.js +946 -0
  952. package/src/animation/AnimationClip.d.ts +168 -0
  953. package/src/animation/AnimationClip.js +502 -0
  954. package/src/animation/AnimationMixer.d.ts +175 -0
  955. package/src/animation/AnimationMixer.js +860 -0
  956. package/src/animation/AnimationObjectGroup.d.ts +58 -0
  957. package/src/animation/AnimationObjectGroup.js +423 -0
  958. package/src/animation/AnimationUtils.d.ts +182 -0
  959. package/src/animation/AnimationUtils.js +521 -0
  960. package/src/animation/KeyframeTrack.d.ts +197 -0
  961. package/src/animation/KeyframeTrack.js +673 -0
  962. package/src/animation/PropertyBinding.d.ts +101 -0
  963. package/src/animation/PropertyBinding.js +794 -0
  964. package/src/animation/PropertyMixer.d.ts +75 -0
  965. package/src/animation/PropertyMixer.js +385 -0
  966. package/src/animation/tracks/BooleanKeyframeTrack.d.ts +18 -0
  967. package/src/animation/tracks/BooleanKeyframeTrack.js +55 -0
  968. package/src/animation/tracks/ColorKeyframeTrack.d.ts +17 -0
  969. package/src/animation/tracks/ColorKeyframeTrack.js +36 -0
  970. package/src/animation/tracks/NumberKeyframeTrack.d.ts +17 -0
  971. package/src/animation/tracks/NumberKeyframeTrack.js +36 -0
  972. package/src/animation/tracks/QuaternionKeyframeTrack.d.ts +17 -0
  973. package/src/animation/tracks/QuaternionKeyframeTrack.js +51 -0
  974. package/src/animation/tracks/StringKeyframeTrack.d.ts +18 -0
  975. package/src/animation/tracks/StringKeyframeTrack.js +55 -0
  976. package/src/animation/tracks/VectorKeyframeTrack.d.ts +17 -0
  977. package/src/animation/tracks/VectorKeyframeTrack.js +36 -0
  978. package/src/audio/Audio.d.ts +340 -0
  979. package/src/audio/Audio.js +778 -0
  980. package/src/audio/AudioAnalyser.d.ts +63 -0
  981. package/src/audio/AudioAnalyser.js +97 -0
  982. package/src/audio/AudioContext.d.ts +19 -0
  983. package/src/audio/AudioContext.js +40 -0
  984. package/src/audio/AudioListener.d.ts +75 -0
  985. package/src/audio/AudioListener.js +218 -0
  986. package/src/audio/PositionalAudio.d.ts +108 -0
  987. package/src/audio/PositionalAudio.js +253 -0
  988. package/src/cameras/ArrayCamera.d.ts +35 -0
  989. package/src/cameras/ArrayCamera.js +54 -0
  990. package/src/cameras/Camera.d.ts +42 -0
  991. package/src/cameras/Camera.js +160 -0
  992. package/src/cameras/CubeCamera.d.ts +89 -0
  993. package/src/cameras/CubeCamera.js +259 -0
  994. package/src/cameras/OrthographicCamera.d.ts +144 -0
  995. package/src/cameras/OrthographicCamera.js +245 -0
  996. package/src/cameras/PerspectiveCamera.d.ts +241 -0
  997. package/src/cameras/PerspectiveCamera.js +407 -0
  998. package/src/cameras/StereoCamera.d.ts +44 -0
  999. package/src/cameras/StereoCamera.js +149 -0
  1000. package/src/constants.d.ts +976 -0
  1001. package/src/constants.js +1782 -0
  1002. package/src/core/BufferAttribute.d.ts +650 -0
  1003. package/src/core/BufferAttribute.js +1057 -0
  1004. package/src/core/BufferGeometry.d.ts +442 -0
  1005. package/src/core/BufferGeometry.js +1480 -0
  1006. package/src/core/Clock.d.ts +73 -0
  1007. package/src/core/Clock.js +135 -0
  1008. package/src/core/EventDispatcher.d.ts +82 -0
  1009. package/src/core/EventDispatcher.js +131 -0
  1010. package/src/core/GLBufferAttribute.d.ts +138 -0
  1011. package/src/core/GLBufferAttribute.js +171 -0
  1012. package/src/core/InstancedBufferAttribute.d.ts +32 -0
  1013. package/src/core/InstancedBufferAttribute.js +68 -0
  1014. package/src/core/InstancedBufferGeometry.d.ts +37 -0
  1015. package/src/core/InstancedBufferGeometry.js +60 -0
  1016. package/src/core/InstancedInterleavedBuffer.d.ts +22 -0
  1017. package/src/core/InstancedInterleavedBuffer.js +74 -0
  1018. package/src/core/InterleavedBuffer.d.ts +162 -0
  1019. package/src/core/InterleavedBuffer.js +295 -0
  1020. package/src/core/InterleavedBufferAttribute.d.ts +201 -0
  1021. package/src/core/InterleavedBufferAttribute.js +549 -0
  1022. package/src/core/Layers.d.ts +72 -0
  1023. package/src/core/Layers.js +121 -0
  1024. package/src/core/Object3D.d.ts +725 -0
  1025. package/src/core/Object3D.js +1709 -0
  1026. package/src/core/Raycaster.d.ts +212 -0
  1027. package/src/core/Raycaster.js +266 -0
  1028. package/src/core/RenderTarget.d.ts +153 -0
  1029. package/src/core/RenderTarget.js +495 -0
  1030. package/src/core/RenderTarget3D.d.ts +9 -0
  1031. package/src/core/RenderTarget3D.js +52 -0
  1032. package/src/core/Timer.d.ts +77 -0
  1033. package/src/core/Timer.js +184 -0
  1034. package/src/core/Uniform.d.ts +38 -0
  1035. package/src/core/Uniform.js +46 -0
  1036. package/src/core/UniformsGroup.d.ts +39 -0
  1037. package/src/core/UniformsGroup.js +180 -0
  1038. package/src/extras/Controls.d.ts +59 -0
  1039. package/src/extras/Controls.js +112 -0
  1040. package/src/extras/DataUtils.d.ts +22 -0
  1041. package/src/extras/DataUtils.js +217 -0
  1042. package/src/extras/Earcut.d.ts +17 -0
  1043. package/src/extras/Earcut.js +28 -0
  1044. package/src/extras/ImageUtils.d.ts +33 -0
  1045. package/src/extras/ImageUtils.js +137 -0
  1046. package/src/extras/PMREMGenerator.d.ts +95 -0
  1047. package/src/extras/PMREMGenerator.js +1063 -0
  1048. package/src/extras/ShapeUtils.d.ts +25 -0
  1049. package/src/extras/ShapeUtils.js +114 -0
  1050. package/src/extras/TextureUtils.d.ts +42 -0
  1051. package/src/extras/TextureUtils.js +297 -0
  1052. package/src/extras/core/Curve.d.ts +162 -0
  1053. package/src/extras/core/Curve.js +517 -0
  1054. package/src/extras/core/CurvePath.d.ts +77 -0
  1055. package/src/extras/core/CurvePath.js +296 -0
  1056. package/src/extras/core/Interpolations.d.ts +36 -0
  1057. package/src/extras/core/Interpolations.js +111 -0
  1058. package/src/extras/core/Path.d.ts +166 -0
  1059. package/src/extras/core/Path.js +329 -0
  1060. package/src/extras/core/Shape.d.ts +86 -0
  1061. package/src/extras/core/Shape.js +165 -0
  1062. package/src/extras/core/ShapePath.d.ts +94 -0
  1063. package/src/extras/core/ShapePath.js +356 -0
  1064. package/src/extras/curves/ArcCurve.d.ts +41 -0
  1065. package/src/extras/curves/ArcCurve.js +39 -0
  1066. package/src/extras/curves/CatmullRomCurve3.d.ts +77 -0
  1067. package/src/extras/curves/CatmullRomCurve3.js +327 -0
  1068. package/src/extras/curves/CubicBezierCurve.d.ts +72 -0
  1069. package/src/extras/curves/CubicBezierCurve.js +145 -0
  1070. package/src/extras/curves/CubicBezierCurve3.d.ts +72 -0
  1071. package/src/extras/curves/CubicBezierCurve3.js +129 -0
  1072. package/src/extras/curves/Curves.d.ts +10 -0
  1073. package/src/extras/curves/Curves.js +10 -0
  1074. package/src/extras/curves/EllipseCurve.d.ts +115 -0
  1075. package/src/extras/curves/EllipseCurve.js +258 -0
  1076. package/src/extras/curves/LineCurve.d.ts +42 -0
  1077. package/src/extras/curves/LineCurve.js +128 -0
  1078. package/src/extras/curves/LineCurve3.d.ts +42 -0
  1079. package/src/extras/curves/LineCurve3.js +128 -0
  1080. package/src/extras/curves/QuadraticBezierCurve.d.ts +64 -0
  1081. package/src/extras/curves/QuadraticBezierCurve.js +133 -0
  1082. package/src/extras/curves/QuadraticBezierCurve3.d.ts +64 -0
  1083. package/src/extras/curves/QuadraticBezierCurve3.js +118 -0
  1084. package/src/extras/curves/SplineCurve.d.ts +52 -0
  1085. package/src/extras/curves/SplineCurve.js +145 -0
  1086. package/src/extras/lib/earcut.js +685 -0
  1087. package/src/geometries/BoxGeometry.d.ts +59 -0
  1088. package/src/geometries/BoxGeometry.js +219 -0
  1089. package/src/geometries/CapsuleGeometry.d.ts +56 -0
  1090. package/src/geometries/CapsuleGeometry.js +218 -0
  1091. package/src/geometries/CircleGeometry.d.ts +51 -0
  1092. package/src/geometries/CircleGeometry.js +142 -0
  1093. package/src/geometries/ConeGeometry.d.ts +64 -0
  1094. package/src/geometries/ConeGeometry.js +70 -0
  1095. package/src/geometries/CylinderGeometry.d.ts +64 -0
  1096. package/src/geometries/CylinderGeometry.js +333 -0
  1097. package/src/geometries/DodecahedronGeometry.d.ts +25 -0
  1098. package/src/geometries/DodecahedronGeometry.js +99 -0
  1099. package/src/geometries/EdgesGeometry.d.ts +41 -0
  1100. package/src/geometries/EdgesGeometry.js +180 -0
  1101. package/src/geometries/ExtrudeGeometry.d.ts +138 -0
  1102. package/src/geometries/ExtrudeGeometry.js +910 -0
  1103. package/src/geometries/Geometries.d.ts +21 -0
  1104. package/src/geometries/Geometries.js +21 -0
  1105. package/src/geometries/IcosahedronGeometry.d.ts +26 -0
  1106. package/src/geometries/IcosahedronGeometry.js +75 -0
  1107. package/src/geometries/LatheGeometry.d.ts +55 -0
  1108. package/src/geometries/LatheGeometry.js +230 -0
  1109. package/src/geometries/OctahedronGeometry.d.ts +25 -0
  1110. package/src/geometries/OctahedronGeometry.js +70 -0
  1111. package/src/geometries/PlaneGeometry.d.ts +48 -0
  1112. package/src/geometries/PlaneGeometry.js +133 -0
  1113. package/src/geometries/PolyhedronGeometry.d.ts +54 -0
  1114. package/src/geometries/PolyhedronGeometry.js +348 -0
  1115. package/src/geometries/RingGeometry.d.ts +59 -0
  1116. package/src/geometries/RingGeometry.js +165 -0
  1117. package/src/geometries/ShapeGeometry.d.ts +53 -0
  1118. package/src/geometries/ShapeGeometry.js +233 -0
  1119. package/src/geometries/SphereGeometry.d.ts +67 -0
  1120. package/src/geometries/SphereGeometry.js +180 -0
  1121. package/src/geometries/TetrahedronGeometry.d.ts +25 -0
  1122. package/src/geometries/TetrahedronGeometry.js +67 -0
  1123. package/src/geometries/TorusGeometry.d.ts +69 -0
  1124. package/src/geometries/TorusGeometry.js +161 -0
  1125. package/src/geometries/TorusKnotGeometry.d.ts +59 -0
  1126. package/src/geometries/TorusKnotGeometry.js +206 -0
  1127. package/src/geometries/TubeGeometry.d.ts +86 -0
  1128. package/src/geometries/TubeGeometry.js +253 -0
  1129. package/src/geometries/WireframeGeometry.d.ts +40 -0
  1130. package/src/geometries/WireframeGeometry.js +179 -0
  1131. package/src/helpers/ArrowHelper.d.ts +72 -0
  1132. package/src/helpers/ArrowHelper.js +173 -0
  1133. package/src/helpers/AxesHelper.d.ts +33 -0
  1134. package/src/helpers/AxesHelper.js +98 -0
  1135. package/src/helpers/Box3Helper.d.ts +28 -0
  1136. package/src/helpers/Box3Helper.js +85 -0
  1137. package/src/helpers/BoxHelper.d.ts +48 -0
  1138. package/src/helpers/BoxHelper.js +151 -0
  1139. package/src/helpers/CameraHelper.d.ts +54 -0
  1140. package/src/helpers/CameraHelper.js +347 -0
  1141. package/src/helpers/DirectionalLightHelper.d.ts +55 -0
  1142. package/src/helpers/DirectionalLightHelper.js +152 -0
  1143. package/src/helpers/GridHelper.d.ts +28 -0
  1144. package/src/helpers/GridHelper.js +84 -0
  1145. package/src/helpers/HemisphereLightHelper.d.ts +44 -0
  1146. package/src/helpers/HemisphereLightHelper.js +134 -0
  1147. package/src/helpers/PlaneHelper.d.ts +33 -0
  1148. package/src/helpers/PlaneHelper.js +98 -0
  1149. package/src/helpers/PointLightHelper.d.ts +43 -0
  1150. package/src/helpers/PointLightHelper.js +115 -0
  1151. package/src/helpers/PolarGridHelper.d.ts +37 -0
  1152. package/src/helpers/PolarGridHelper.js +128 -0
  1153. package/src/helpers/SkeletonHelper.d.ts +44 -0
  1154. package/src/helpers/SkeletonHelper.js +196 -0
  1155. package/src/helpers/SpotLightHelper.d.ts +45 -0
  1156. package/src/helpers/SpotLightHelper.js +156 -0
  1157. package/src/lights/AmbientLight.d.ts +28 -0
  1158. package/src/lights/AmbientLight.js +42 -0
  1159. package/src/lights/DirectionalLight.d.ts +68 -0
  1160. package/src/lights/DirectionalLight.js +113 -0
  1161. package/src/lights/DirectionalLightShadow.d.ts +18 -0
  1162. package/src/lights/DirectionalLightShadow.js +31 -0
  1163. package/src/lights/HemisphereLight.d.ts +41 -0
  1164. package/src/lights/HemisphereLight.js +76 -0
  1165. package/src/lights/Light.d.ts +39 -0
  1166. package/src/lights/Light.js +75 -0
  1167. package/src/lights/LightProbe.d.ts +46 -0
  1168. package/src/lights/LightProbe.js +75 -0
  1169. package/src/lights/LightShadow.d.ts +201 -0
  1170. package/src/lights/LightShadow.js +378 -0
  1171. package/src/lights/PointLight.d.ts +72 -0
  1172. package/src/lights/PointLight.js +131 -0
  1173. package/src/lights/PointLightShadow.d.ts +18 -0
  1174. package/src/lights/PointLightShadow.js +31 -0
  1175. package/src/lights/RectAreaLight.d.ts +62 -0
  1176. package/src/lights/RectAreaLight.js +115 -0
  1177. package/src/lights/SpotLight.d.ts +124 -0
  1178. package/src/lights/SpotLight.js +194 -0
  1179. package/src/lights/SpotLightShadow.d.ts +44 -0
  1180. package/src/lights/SpotLightShadow.js +98 -0
  1181. package/src/lights/webgpu/IESSpotLight.d.ts +18 -0
  1182. package/src/lights/webgpu/IESSpotLight.js +47 -0
  1183. package/src/lights/webgpu/ProjectorLight.d.ts +16 -0
  1184. package/src/lights/webgpu/ProjectorLight.js +46 -0
  1185. package/src/loaders/AnimationLoader.d.ts +9 -0
  1186. package/src/loaders/AnimationLoader.js +98 -0
  1187. package/src/loaders/AudioLoader.d.ts +6 -0
  1188. package/src/loaders/AudioLoader.js +108 -0
  1189. package/src/loaders/BufferGeometryLoader.d.ts +10 -0
  1190. package/src/loaders/BufferGeometryLoader.js +247 -0
  1191. package/src/loaders/Cache.d.ts +21 -0
  1192. package/src/loaders/Cache.js +115 -0
  1193. package/src/loaders/CompressedTextureLoader.d.ts +14 -0
  1194. package/src/loaders/CompressedTextureLoader.js +167 -0
  1195. package/src/loaders/CubeTextureLoader.d.ts +14 -0
  1196. package/src/loaders/CubeTextureLoader.js +103 -0
  1197. package/src/loaders/DataTextureLoader.d.ts +48 -0
  1198. package/src/loaders/DataTextureLoader.js +205 -0
  1199. package/src/loaders/FileLoader.d.ts +19 -0
  1200. package/src/loaders/FileLoader.js +367 -0
  1201. package/src/loaders/ImageBitmapLoader.d.ts +22 -0
  1202. package/src/loaders/ImageBitmapLoader.js +225 -0
  1203. package/src/loaders/ImageLoader.d.ts +17 -0
  1204. package/src/loaders/ImageLoader.js +168 -0
  1205. package/src/loaders/Loader.d.ts +51 -0
  1206. package/src/loaders/Loader.js +222 -0
  1207. package/src/loaders/LoaderUtils.d.ts +5 -0
  1208. package/src/loaders/LoaderUtils.js +59 -0
  1209. package/src/loaders/LoadingManager.d.ts +73 -0
  1210. package/src/loaders/LoadingManager.js +334 -0
  1211. package/src/loaders/MaterialLoader.d.ts +29 -0
  1212. package/src/loaders/MaterialLoader.js +209 -0
  1213. package/src/loaders/ObjectLoader.d.ts +35 -0
  1214. package/src/loaders/ObjectLoader.js +1309 -0
  1215. package/src/loaders/TextureLoader.d.ts +18 -0
  1216. package/src/loaders/TextureLoader.js +74 -0
  1217. package/src/loaders/nodes/NodeLoader.d.ts +21 -0
  1218. package/src/loaders/nodes/NodeLoader.js +194 -0
  1219. package/src/loaders/nodes/NodeMaterialLoader.d.ts +11 -0
  1220. package/src/loaders/nodes/NodeMaterialLoader.js +108 -0
  1221. package/src/loaders/nodes/NodeObjectLoader.d.ts +22 -0
  1222. package/src/loaders/nodes/NodeObjectLoader.js +169 -0
  1223. package/src/materials/LineBasicMaterial.d.ts +93 -0
  1224. package/src/materials/LineBasicMaterial.js +126 -0
  1225. package/src/materials/LineDashedMaterial.d.ts +56 -0
  1226. package/src/materials/LineDashedMaterial.js +86 -0
  1227. package/src/materials/Material.d.ts +663 -0
  1228. package/src/materials/Material.js +1235 -0
  1229. package/src/materials/Materials.d.ts +18 -0
  1230. package/src/materials/Materials.js +39 -0
  1231. package/src/materials/MeshBasicMaterial.d.ts +204 -0
  1232. package/src/materials/MeshBasicMaterial.js +274 -0
  1233. package/src/materials/MeshDepthMaterial.d.ts +119 -0
  1234. package/src/materials/MeshDepthMaterial.js +158 -0
  1235. package/src/materials/MeshDistanceMaterial.d.ts +102 -0
  1236. package/src/materials/MeshDistanceMaterial.js +129 -0
  1237. package/src/materials/MeshLambertMaterial.d.ts +331 -0
  1238. package/src/materials/MeshLambertMaterial.js +441 -0
  1239. package/src/materials/MeshMatcapMaterial.d.ts +199 -0
  1240. package/src/materials/MeshMatcapMaterial.js +269 -0
  1241. package/src/materials/MeshNormalMaterial.d.ts +134 -0
  1242. package/src/materials/MeshNormalMaterial.js +183 -0
  1243. package/src/materials/MeshPhongMaterial.d.ts +343 -0
  1244. package/src/materials/MeshPhongMaterial.js +460 -0
  1245. package/src/materials/MeshPhysicalMaterial.d.ts +353 -0
  1246. package/src/materials/MeshPhysicalMaterial.js +606 -0
  1247. package/src/materials/MeshStandardMaterial.d.ts +352 -0
  1248. package/src/materials/MeshStandardMaterial.js +466 -0
  1249. package/src/materials/MeshToonMaterial.d.ts +265 -0
  1250. package/src/materials/MeshToonMaterial.js +354 -0
  1251. package/src/materials/PointsMaterial.d.ts +113 -0
  1252. package/src/materials/PointsMaterial.js +146 -0
  1253. package/src/materials/RawShaderMaterial.d.ts +17 -0
  1254. package/src/materials/RawShaderMaterial.js +42 -0
  1255. package/src/materials/ShaderMaterial.d.ts +268 -0
  1256. package/src/materials/ShaderMaterial.js +499 -0
  1257. package/src/materials/ShadowMaterial.d.ts +61 -0
  1258. package/src/materials/ShadowMaterial.js +91 -0
  1259. package/src/materials/SpriteMaterial.d.ts +100 -0
  1260. package/src/materials/SpriteMaterial.js +143 -0
  1261. package/src/materials/nodes/Line2NodeMaterial.d.ts +102 -0
  1262. package/src/materials/nodes/Line2NodeMaterial.js +634 -0
  1263. package/src/materials/nodes/LineBasicNodeMaterial.d.ts +38 -0
  1264. package/src/materials/nodes/LineBasicNodeMaterial.js +46 -0
  1265. package/src/materials/nodes/LineDashedNodeMaterial.d.ts +88 -0
  1266. package/src/materials/nodes/LineDashedNodeMaterial.js +132 -0
  1267. package/src/materials/nodes/MeshBasicNodeMaterial.d.ts +55 -0
  1268. package/src/materials/nodes/MeshBasicNodeMaterial.js +134 -0
  1269. package/src/materials/nodes/MeshLambertNodeMaterial.d.ts +55 -0
  1270. package/src/materials/nodes/MeshLambertNodeMaterial.js +82 -0
  1271. package/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +45 -0
  1272. package/src/materials/nodes/MeshMatcapNodeMaterial.js +77 -0
  1273. package/src/materials/nodes/MeshNormalNodeMaterial.d.ts +41 -0
  1274. package/src/materials/nodes/MeshNormalNodeMaterial.js +67 -0
  1275. package/src/materials/nodes/MeshPhongNodeMaterial.d.ts +77 -0
  1276. package/src/materials/nodes/MeshPhongNodeMaterial.js +132 -0
  1277. package/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +286 -0
  1278. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +528 -0
  1279. package/src/materials/nodes/MeshSSSNodeMaterial.d.ts +110 -0
  1280. package/src/materials/nodes/MeshSSSNodeMaterial.js +162 -0
  1281. package/src/materials/nodes/MeshStandardNodeMaterial.d.ts +93 -0
  1282. package/src/materials/nodes/MeshStandardNodeMaterial.js +176 -0
  1283. package/src/materials/nodes/MeshToonNodeMaterial.d.ts +45 -0
  1284. package/src/materials/nodes/MeshToonNodeMaterial.js +66 -0
  1285. package/src/materials/nodes/NodeMaterial.d.ts +503 -0
  1286. package/src/materials/nodes/NodeMaterial.js +1380 -0
  1287. package/src/materials/nodes/NodeMaterials.d.ts +18 -0
  1288. package/src/materials/nodes/NodeMaterials.js +21 -0
  1289. package/src/materials/nodes/PointsNodeMaterial.d.ts +60 -0
  1290. package/src/materials/nodes/PointsNodeMaterial.js +212 -0
  1291. package/src/materials/nodes/ShadowNodeMaterial.d.ts +45 -0
  1292. package/src/materials/nodes/ShadowNodeMaterial.js +76 -0
  1293. package/src/materials/nodes/SpriteNodeMaterial.d.ts +74 -0
  1294. package/src/materials/nodes/SpriteNodeMaterial.js +176 -0
  1295. package/src/materials/nodes/VolumeNodeMaterial.d.ts +56 -0
  1296. package/src/materials/nodes/VolumeNodeMaterial.js +81 -0
  1297. package/src/materials/nodes/manager/NodeMaterialObserver.d.ts +58 -0
  1298. package/src/materials/nodes/manager/NodeMaterialObserver.js +973 -0
  1299. package/src/math/Box2.d.ts +48 -0
  1300. package/src/math/Box2.js +381 -0
  1301. package/src/math/Box3.d.ts +310 -0
  1302. package/src/math/Box3.js +810 -0
  1303. package/src/math/Color.d.ts +376 -0
  1304. package/src/math/Color.js +967 -0
  1305. package/src/math/ColorManagement.d.ts +59 -0
  1306. package/src/math/ColorManagement.js +215 -0
  1307. package/src/math/Cylindrical.d.ts +26 -0
  1308. package/src/math/Cylindrical.js +120 -0
  1309. package/src/math/Euler.d.ts +50 -0
  1310. package/src/math/Euler.js +449 -0
  1311. package/src/math/Frustum.d.ts +30 -0
  1312. package/src/math/Frustum.js +294 -0
  1313. package/src/math/FrustumArray.d.ts +86 -0
  1314. package/src/math/FrustumArray.js +228 -0
  1315. package/src/math/Interpolant.d.ts +113 -0
  1316. package/src/math/Interpolant.js +320 -0
  1317. package/src/math/Line3.d.ts +30 -0
  1318. package/src/math/Line3.js +337 -0
  1319. package/src/math/MathUtils.d.ts +153 -0
  1320. package/src/math/MathUtils.js +753 -0
  1321. package/src/math/Matrix2.d.ts +53 -0
  1322. package/src/math/Matrix2.js +128 -0
  1323. package/src/math/Matrix3.d.ts +193 -0
  1324. package/src/math/Matrix3.js +628 -0
  1325. package/src/math/Matrix4.d.ts +506 -0
  1326. package/src/math/Matrix4.js +1332 -0
  1327. package/src/math/Plane.d.ts +55 -0
  1328. package/src/math/Plane.js +397 -0
  1329. package/src/math/Quaternion.d.ts +189 -0
  1330. package/src/math/Quaternion.js +908 -0
  1331. package/src/math/Ray.d.ts +60 -0
  1332. package/src/math/Ray.js +705 -0
  1333. package/src/math/Sphere.d.ts +55 -0
  1334. package/src/math/Sphere.js +420 -0
  1335. package/src/math/Spherical.d.ts +27 -0
  1336. package/src/math/Spherical.js +147 -0
  1337. package/src/math/SphericalHarmonics3.d.ts +50 -0
  1338. package/src/math/SphericalHarmonics3.js +341 -0
  1339. package/src/math/Triangle.d.ts +110 -0
  1340. package/src/math/Triangle.js +537 -0
  1341. package/src/math/Vector2.d.ts +321 -0
  1342. package/src/math/Vector2.js +870 -0
  1343. package/src/math/Vector3.d.ts +301 -0
  1344. package/src/math/Vector3.js +1263 -0
  1345. package/src/math/Vector4.d.ts +241 -0
  1346. package/src/math/Vector4.js +1063 -0
  1347. package/src/math/interpolants/BezierInterpolant.d.ts +23 -0
  1348. package/src/math/interpolants/BezierInterpolant.js +119 -0
  1349. package/src/math/interpolants/CubicInterpolant.d.ts +22 -0
  1350. package/src/math/interpolants/CubicInterpolant.js +159 -0
  1351. package/src/math/interpolants/DiscreteInterpolant.d.ts +12 -0
  1352. package/src/math/interpolants/DiscreteInterpolant.js +34 -0
  1353. package/src/math/interpolants/LinearInterpolant.d.ts +11 -0
  1354. package/src/math/interpolants/LinearInterpolant.js +51 -0
  1355. package/src/math/interpolants/QuaternionLinearInterpolant.d.ts +11 -0
  1356. package/src/math/interpolants/QuaternionLinearInterpolant.js +48 -0
  1357. package/src/nodes/Nodes.d.ts +170 -0
  1358. package/src/nodes/Nodes.js +165 -0
  1359. package/src/nodes/TSL.d.ts +183 -0
  1360. package/src/nodes/TSL.js +183 -0
  1361. package/src/nodes/accessors/AccessorsUtils.d.ts +8 -0
  1362. package/src/nodes/accessors/AccessorsUtils.js +53 -0
  1363. package/src/nodes/accessors/Arrays.d.ts +22 -0
  1364. package/src/nodes/accessors/Arrays.js +68 -0
  1365. package/src/nodes/accessors/Batch.d.ts +25 -0
  1366. package/src/nodes/accessors/Batch.js +180 -0
  1367. package/src/nodes/accessors/Bitangent.d.ts +6 -0
  1368. package/src/nodes/accessors/Bitangent.js +82 -0
  1369. package/src/nodes/accessors/BufferAttributeNode.d.ts +247 -0
  1370. package/src/nodes/accessors/BufferAttributeNode.js +452 -0
  1371. package/src/nodes/accessors/BufferNode.d.ts +33 -0
  1372. package/src/nodes/accessors/BufferNode.js +138 -0
  1373. package/src/nodes/accessors/BuiltinNode.d.ts +13 -0
  1374. package/src/nodes/accessors/BuiltinNode.js +63 -0
  1375. package/src/nodes/accessors/Camera.d.ts +16 -0
  1376. package/src/nodes/accessors/Camera.js +403 -0
  1377. package/src/nodes/accessors/ClippingNode.d.ts +19 -0
  1378. package/src/nodes/accessors/ClippingNode.js +255 -0
  1379. package/src/nodes/accessors/CubeTextureNode.d.ts +38 -0
  1380. package/src/nodes/accessors/CubeTextureNode.js +215 -0
  1381. package/src/nodes/accessors/Instance.d.ts +32 -0
  1382. package/src/nodes/accessors/Instance.js +349 -0
  1383. package/src/nodes/accessors/Lights.d.ts +17 -0
  1384. package/src/nodes/accessors/Lights.js +139 -0
  1385. package/src/nodes/accessors/MaterialNode.d.ts +134 -0
  1386. package/src/nodes/accessors/MaterialNode.js +808 -0
  1387. package/src/nodes/accessors/MaterialProperties.d.ts +8 -0
  1388. package/src/nodes/accessors/MaterialProperties.js +57 -0
  1389. package/src/nodes/accessors/MaterialReferenceNode.d.ts +15 -0
  1390. package/src/nodes/accessors/MaterialReferenceNode.js +84 -0
  1391. package/src/nodes/accessors/ModelNode.d.ts +49 -0
  1392. package/src/nodes/accessors/ModelNode.js +260 -0
  1393. package/src/nodes/accessors/ModelViewProjectionNode.d.ts +3 -0
  1394. package/src/nodes/accessors/ModelViewProjectionNode.js +13 -0
  1395. package/src/nodes/accessors/Morph.d.ts +11 -0
  1396. package/src/nodes/accessors/Morph.js +297 -0
  1397. package/src/nodes/accessors/Normal.d.ts +36 -0
  1398. package/src/nodes/accessors/Normal.js +243 -0
  1399. package/src/nodes/accessors/Object3DNode.d.ts +42 -0
  1400. package/src/nodes/accessors/Object3DNode.js +268 -0
  1401. package/src/nodes/accessors/PointUVNode.d.ts +9 -0
  1402. package/src/nodes/accessors/PointUVNode.js +55 -0
  1403. package/src/nodes/accessors/Position.d.ts +11 -0
  1404. package/src/nodes/accessors/Position.js +126 -0
  1405. package/src/nodes/accessors/ReferenceBaseNode.d.ts +26 -0
  1406. package/src/nodes/accessors/ReferenceBaseNode.js +288 -0
  1407. package/src/nodes/accessors/ReferenceElementNode.d.ts +15 -0
  1408. package/src/nodes/accessors/ReferenceElementNode.js +72 -0
  1409. package/src/nodes/accessors/ReferenceNode.d.ts +37 -0
  1410. package/src/nodes/accessors/ReferenceNode.js +356 -0
  1411. package/src/nodes/accessors/ReflectVector.d.ts +7 -0
  1412. package/src/nodes/accessors/ReflectVector.js +36 -0
  1413. package/src/nodes/accessors/RendererReferenceNode.d.ts +14 -0
  1414. package/src/nodes/accessors/RendererReferenceNode.js +78 -0
  1415. package/src/nodes/accessors/SceneProperties.d.ts +5 -0
  1416. package/src/nodes/accessors/SceneProperties.js +47 -0
  1417. package/src/nodes/accessors/Skinning.d.ts +23 -0
  1418. package/src/nodes/accessors/Skinning.js +375 -0
  1419. package/src/nodes/accessors/StorageBufferNode.d.ts +82 -0
  1420. package/src/nodes/accessors/StorageBufferNode.js +405 -0
  1421. package/src/nodes/accessors/StorageTexture3DNode.d.ts +17 -0
  1422. package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
  1423. package/src/nodes/accessors/StorageTextureNode.d.ts +47 -0
  1424. package/src/nodes/accessors/StorageTextureNode.js +331 -0
  1425. package/src/nodes/accessors/Tangent.d.ts +6 -0
  1426. package/src/nodes/accessors/Tangent.js +60 -0
  1427. package/src/nodes/accessors/TangentUtils.d.ts +21 -0
  1428. package/src/nodes/accessors/TangentUtils.js +46 -0
  1429. package/src/nodes/accessors/Texture3DNode.d.ts +29 -0
  1430. package/src/nodes/accessors/Texture3DNode.js +196 -0
  1431. package/src/nodes/accessors/TextureBicubic.d.ts +6 -0
  1432. package/src/nodes/accessors/TextureBicubic.js +92 -0
  1433. package/src/nodes/accessors/TextureNode.d.ts +104 -0
  1434. package/src/nodes/accessors/TextureNode.js +1056 -0
  1435. package/src/nodes/accessors/TextureSizeNode.d.ts +17 -0
  1436. package/src/nodes/accessors/TextureSizeNode.js +79 -0
  1437. package/src/nodes/accessors/UV.d.ts +3 -0
  1438. package/src/nodes/accessors/UV.js +11 -0
  1439. package/src/nodes/accessors/UniformArrayNode.d.ts +29 -0
  1440. package/src/nodes/accessors/UniformArrayNode.js +375 -0
  1441. package/src/nodes/accessors/UserDataNode.d.ts +14 -0
  1442. package/src/nodes/accessors/UserDataNode.js +76 -0
  1443. package/src/nodes/accessors/VelocityNode.d.ts +19 -0
  1444. package/src/nodes/accessors/VelocityNode.js +224 -0
  1445. package/src/nodes/accessors/VertexColorNode.d.ts +11 -0
  1446. package/src/nodes/accessors/VertexColorNode.js +109 -0
  1447. package/src/nodes/code/CodeNode.d.ts +22 -0
  1448. package/src/nodes/code/CodeNode.js +181 -0
  1449. package/src/nodes/code/ExpressionNode.d.ts +9 -0
  1450. package/src/nodes/code/ExpressionNode.js +68 -0
  1451. package/src/nodes/code/FunctionCallNode.d.ts +27 -0
  1452. package/src/nodes/code/FunctionCallNode.js +187 -0
  1453. package/src/nodes/code/FunctionNode.d.ts +40 -0
  1454. package/src/nodes/code/FunctionNode.js +178 -0
  1455. package/src/nodes/core/ArrayNode.d.ts +33 -0
  1456. package/src/nodes/core/ArrayNode.js +174 -0
  1457. package/src/nodes/core/AssignNode.d.ts +15 -0
  1458. package/src/nodes/core/AssignNode.js +202 -0
  1459. package/src/nodes/core/AttributeNode.d.ts +21 -0
  1460. package/src/nodes/core/AttributeNode.js +168 -0
  1461. package/src/nodes/core/BypassNode.d.ts +17 -0
  1462. package/src/nodes/core/BypassNode.js +93 -0
  1463. package/src/nodes/core/ConstNode.d.ts +16 -0
  1464. package/src/nodes/core/ConstNode.js +67 -0
  1465. package/src/nodes/core/ContextNode.d.ts +65 -0
  1466. package/src/nodes/core/ContextNode.js +336 -0
  1467. package/src/nodes/core/IndexNode.d.ts +33 -0
  1468. package/src/nodes/core/IndexNode.js +230 -0
  1469. package/src/nodes/core/InputNode.d.ts +23 -0
  1470. package/src/nodes/core/InputNode.js +136 -0
  1471. package/src/nodes/core/InspectorNode.d.ts +15 -0
  1472. package/src/nodes/core/InspectorNode.js +128 -0
  1473. package/src/nodes/core/IsolateNode.d.ts +31 -0
  1474. package/src/nodes/core/IsolateNode.js +133 -0
  1475. package/src/nodes/core/LightingModel.d.ts +33 -0
  1476. package/src/nodes/core/LightingModel.js +77 -0
  1477. package/src/nodes/core/MRTNode.d.ts +38 -0
  1478. package/src/nodes/core/MRTNode.js +243 -0
  1479. package/src/nodes/core/Node.d.ts +622 -0
  1480. package/src/nodes/core/Node.js +1220 -0
  1481. package/src/nodes/core/NodeAttribute.d.ts +47 -0
  1482. package/src/nodes/core/NodeAttribute.js +53 -0
  1483. package/src/nodes/core/NodeBuilder.d.ts +25 -0
  1484. package/src/nodes/core/NodeBuilder.js +3476 -0
  1485. package/src/nodes/core/NodeCache.d.ts +50 -0
  1486. package/src/nodes/core/NodeCache.js +75 -0
  1487. package/src/nodes/core/NodeCode.d.ts +4 -0
  1488. package/src/nodes/core/NodeCode.js +46 -0
  1489. package/src/nodes/core/NodeError.d.ts +9 -0
  1490. package/src/nodes/core/NodeError.js +28 -0
  1491. package/src/nodes/core/NodeFrame.d.ts +36 -0
  1492. package/src/nodes/core/NodeFrame.js +322 -0
  1493. package/src/nodes/core/NodeFunction.d.ts +13 -0
  1494. package/src/nodes/core/NodeFunction.js +69 -0
  1495. package/src/nodes/core/NodeFunctionInput.d.ts +7 -0
  1496. package/src/nodes/core/NodeFunctionInput.js +61 -0
  1497. package/src/nodes/core/NodeParser.d.ts +18 -0
  1498. package/src/nodes/core/NodeParser.js +23 -0
  1499. package/src/nodes/core/NodeUniform.d.ts +66 -0
  1500. package/src/nodes/core/NodeUniform.js +91 -0
  1501. package/src/nodes/core/NodeUtils.d.ts +26 -0
  1502. package/src/nodes/core/NodeUtils.js +496 -0
  1503. package/src/nodes/core/NodeVar.d.ts +51 -0
  1504. package/src/nodes/core/NodeVar.js +60 -0
  1505. package/src/nodes/core/NodeVarying.d.ts +59 -0
  1506. package/src/nodes/core/NodeVarying.js +63 -0
  1507. package/src/nodes/core/OutputStructNode.d.ts +11 -0
  1508. package/src/nodes/core/OutputStructNode.js +105 -0
  1509. package/src/nodes/core/OverrideContextNode.d.ts +92 -0
  1510. package/src/nodes/core/OverrideContextNode.js +153 -0
  1511. package/src/nodes/core/ParameterNode.d.ts +18 -0
  1512. package/src/nodes/core/ParameterNode.js +94 -0
  1513. package/src/nodes/core/PropertyNode.d.ts +66 -0
  1514. package/src/nodes/core/PropertyNode.js +421 -0
  1515. package/src/nodes/core/StackNode.d.ts +25 -0
  1516. package/src/nodes/core/StackNode.js +447 -0
  1517. package/src/nodes/core/StackTrace.d.ts +9 -0
  1518. package/src/nodes/core/StackTrace.js +139 -0
  1519. package/src/nodes/core/StructNode.d.ts +37 -0
  1520. package/src/nodes/core/StructNode.js +133 -0
  1521. package/src/nodes/core/StructType.d.ts +10 -0
  1522. package/src/nodes/core/StructType.js +13 -0
  1523. package/src/nodes/core/StructTypeNode.d.ts +57 -0
  1524. package/src/nodes/core/StructTypeNode.js +148 -0
  1525. package/src/nodes/core/SubBuildNode.d.ts +14 -0
  1526. package/src/nodes/core/SubBuildNode.js +89 -0
  1527. package/src/nodes/core/TempNode.d.ts +16 -0
  1528. package/src/nodes/core/TempNode.js +88 -0
  1529. package/src/nodes/core/UniformGroupNode.d.ts +22 -0
  1530. package/src/nodes/core/UniformGroupNode.js +168 -0
  1531. package/src/nodes/core/UniformNode.d.ts +162 -0
  1532. package/src/nodes/core/UniformNode.js +273 -0
  1533. package/src/nodes/core/VarNode.d.ts +45 -0
  1534. package/src/nodes/core/VarNode.js +374 -0
  1535. package/src/nodes/core/VaryingNode.d.ts +36 -0
  1536. package/src/nodes/core/VaryingNode.js +220 -0
  1537. package/src/nodes/core/constants.d.ts +72 -0
  1538. package/src/nodes/core/constants.js +68 -0
  1539. package/src/nodes/display/BlendModes.d.ts +76 -0
  1540. package/src/nodes/display/BlendModes.js +131 -0
  1541. package/src/nodes/display/BumpMapNode.d.ts +16 -0
  1542. package/src/nodes/display/BumpMapNode.js +122 -0
  1543. package/src/nodes/display/ColorAdjustment.d.ts +54 -0
  1544. package/src/nodes/display/ColorAdjustment.js +159 -0
  1545. package/src/nodes/display/ColorSpaceFunctions.d.ts +5 -0
  1546. package/src/nodes/display/ColorSpaceFunctions.js +54 -0
  1547. package/src/nodes/display/ColorSpaceNode.d.ts +54 -0
  1548. package/src/nodes/display/ColorSpaceNode.js +164 -0
  1549. package/src/nodes/display/FrontFacingNode.d.ts +71 -0
  1550. package/src/nodes/display/FrontFacingNode.js +131 -0
  1551. package/src/nodes/display/NormalMapNode.d.ts +18 -0
  1552. package/src/nodes/display/NormalMapNode.js +153 -0
  1553. package/src/nodes/display/PassNode.d.ts +124 -0
  1554. package/src/nodes/display/PassNode.js +1108 -0
  1555. package/src/nodes/display/PremultiplyAlphaFunctions.d.ts +37 -0
  1556. package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
  1557. package/src/nodes/display/RenderOutputNode.d.ts +29 -0
  1558. package/src/nodes/display/RenderOutputNode.js +159 -0
  1559. package/src/nodes/display/ScreenNode.d.ts +44 -0
  1560. package/src/nodes/display/ScreenNode.js +249 -0
  1561. package/src/nodes/display/ToneMappingFunctions.d.ts +13 -0
  1562. package/src/nodes/display/ToneMappingFunctions.js +242 -0
  1563. package/src/nodes/display/ToneMappingNode.d.ts +29 -0
  1564. package/src/nodes/display/ToneMappingNode.js +147 -0
  1565. package/src/nodes/display/ToonOutlinePassNode.d.ts +23 -0
  1566. package/src/nodes/display/ToonOutlinePassNode.js +191 -0
  1567. package/src/nodes/display/ViewportDepthNode.d.ts +41 -0
  1568. package/src/nodes/display/ViewportDepthNode.js +342 -0
  1569. package/src/nodes/display/ViewportDepthTextureNode.d.ts +14 -0
  1570. package/src/nodes/display/ViewportDepthTextureNode.js +63 -0
  1571. package/src/nodes/display/ViewportSharedTextureNode.d.ts +16 -0
  1572. package/src/nodes/display/ViewportSharedTextureNode.js +73 -0
  1573. package/src/nodes/display/ViewportTextureNode.d.ts +33 -0
  1574. package/src/nodes/display/ViewportTextureNode.js +256 -0
  1575. package/src/nodes/fog/Fog.d.ts +27 -0
  1576. package/src/nodes/fog/Fog.js +97 -0
  1577. package/src/nodes/functions/BSDF/BRDF_GGX.d.ts +15 -0
  1578. package/src/nodes/functions/BSDF/BRDF_GGX.js +55 -0
  1579. package/src/nodes/functions/BSDF/BRDF_Lambert.d.ts +6 -0
  1580. package/src/nodes/functions/BSDF/BRDF_Lambert.js +9 -0
  1581. package/src/nodes/functions/BSDF/BRDF_Sheen.d.ts +6 -0
  1582. package/src/nodes/functions/BSDF/BRDF_Sheen.js +57 -0
  1583. package/src/nodes/functions/BSDF/DFGLUT.d.ts +13 -0
  1584. package/src/nodes/functions/BSDF/DFGLUT.js +57 -0
  1585. package/src/nodes/functions/BSDF/D_GGX.d.ts +9 -0
  1586. package/src/nodes/functions/BSDF/D_GGX.js +23 -0
  1587. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts +9 -0
  1588. package/src/nodes/functions/BSDF/D_GGX_Anisotropic.js +28 -0
  1589. package/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts +8 -0
  1590. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +13 -0
  1591. package/src/nodes/functions/BSDF/F_Schlick.d.ts +6 -0
  1592. package/src/nodes/functions/BSDF/F_Schlick.js +16 -0
  1593. package/src/nodes/functions/BSDF/LTC.d.ts +13 -0
  1594. package/src/nodes/functions/BSDF/LTC.js +175 -0
  1595. package/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +9 -0
  1596. package/src/nodes/functions/BSDF/Schlick_to_F0.js +21 -0
  1597. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +10 -0
  1598. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +26 -0
  1599. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts +15 -0
  1600. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +29 -0
  1601. package/src/nodes/functions/BasicLightingModel.d.ts +7 -0
  1602. package/src/nodes/functions/BasicLightingModel.js +100 -0
  1603. package/src/nodes/functions/PhongLightingModel.d.ts +7 -0
  1604. package/src/nodes/functions/PhongLightingModel.js +99 -0
  1605. package/src/nodes/functions/PhysicalLightingModel.d.ts +40 -0
  1606. package/src/nodes/functions/PhysicalLightingModel.js +936 -0
  1607. package/src/nodes/functions/ShadowMaskModel.d.ts +8 -0
  1608. package/src/nodes/functions/ShadowMaskModel.js +58 -0
  1609. package/src/nodes/functions/ToonLightingModel.d.ts +4 -0
  1610. package/src/nodes/functions/ToonLightingModel.js +70 -0
  1611. package/src/nodes/functions/VolumetricLightingModel.d.ts +6 -0
  1612. package/src/nodes/functions/VolumetricLightingModel.js +216 -0
  1613. package/src/nodes/functions/material/getAlphaHashThreshold.d.ts +5 -0
  1614. package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
  1615. package/src/nodes/functions/material/getGeometryRoughness.d.ts +5 -0
  1616. package/src/nodes/functions/material/getGeometryRoughness.js +19 -0
  1617. package/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +9 -0
  1618. package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
  1619. package/src/nodes/functions/material/getRoughness.d.ts +6 -0
  1620. package/src/nodes/functions/material/getRoughness.js +18 -0
  1621. package/src/nodes/functions/material/getShIrradianceAt.d.ts +5 -0
  1622. package/src/nodes/functions/material/getShIrradianceAt.js +28 -0
  1623. package/src/nodes/geometry/RangeNode.d.ts +62 -0
  1624. package/src/nodes/geometry/RangeNode.js +210 -0
  1625. package/src/nodes/gpgpu/AtomicFunctionNode.d.ts +91 -0
  1626. package/src/nodes/gpgpu/AtomicFunctionNode.js +325 -0
  1627. package/src/nodes/gpgpu/BarrierNode.d.ts +15 -0
  1628. package/src/nodes/gpgpu/BarrierNode.js +107 -0
  1629. package/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +22 -0
  1630. package/src/nodes/gpgpu/ComputeBuiltinNode.js +227 -0
  1631. package/src/nodes/gpgpu/ComputeNode.d.ts +50 -0
  1632. package/src/nodes/gpgpu/ComputeNode.js +313 -0
  1633. package/src/nodes/gpgpu/SubgroupFunctionNode.d.ts +99 -0
  1634. package/src/nodes/gpgpu/SubgroupFunctionNode.js +583 -0
  1635. package/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +24 -0
  1636. package/src/nodes/gpgpu/WorkgroupInfoNode.js +272 -0
  1637. package/src/nodes/lighting/AONode.d.ts +8 -0
  1638. package/src/nodes/lighting/AONode.js +45 -0
  1639. package/src/nodes/lighting/AmbientLightNode.d.ts +8 -0
  1640. package/src/nodes/lighting/AmbientLightNode.js +35 -0
  1641. package/src/nodes/lighting/AnalyticLightNode.d.ts +32 -0
  1642. package/src/nodes/lighting/AnalyticLightNode.js +309 -0
  1643. package/src/nodes/lighting/BasicEnvironmentNode.d.ts +10 -0
  1644. package/src/nodes/lighting/BasicEnvironmentNode.js +49 -0
  1645. package/src/nodes/lighting/BasicLightMapNode.d.ts +8 -0
  1646. package/src/nodes/lighting/BasicLightMapNode.js +49 -0
  1647. package/src/nodes/lighting/DirectionalLightNode.d.ts +8 -0
  1648. package/src/nodes/lighting/DirectionalLightNode.js +39 -0
  1649. package/src/nodes/lighting/EnvironmentNode.d.ts +8 -0
  1650. package/src/nodes/lighting/EnvironmentNode.js +214 -0
  1651. package/src/nodes/lighting/HemisphereLightNode.d.ts +14 -0
  1652. package/src/nodes/lighting/HemisphereLightNode.js +87 -0
  1653. package/src/nodes/lighting/IESSpotLightNode.d.ts +5 -0
  1654. package/src/nodes/lighting/IESSpotLightNode.js +87 -0
  1655. package/src/nodes/lighting/IrradianceNode.d.ts +8 -0
  1656. package/src/nodes/lighting/IrradianceNode.js +44 -0
  1657. package/src/nodes/lighting/LightProbeNode.d.ts +11 -0
  1658. package/src/nodes/lighting/LightProbeNode.js +73 -0
  1659. package/src/nodes/lighting/LightUtils.d.ts +8 -0
  1660. package/src/nodes/lighting/LightUtils.js +25 -0
  1661. package/src/nodes/lighting/LightingContextNode.d.ts +41 -0
  1662. package/src/nodes/lighting/LightingContextNode.js +123 -0
  1663. package/src/nodes/lighting/LightingNode.d.ts +7 -0
  1664. package/src/nodes/lighting/LightingNode.js +36 -0
  1665. package/src/nodes/lighting/LightsNode.d.ts +48 -0
  1666. package/src/nodes/lighting/LightsNode.js +501 -0
  1667. package/src/nodes/lighting/PointLightNode.d.ts +23 -0
  1668. package/src/nodes/lighting/PointLightNode.js +102 -0
  1669. package/src/nodes/lighting/PointShadowNode.d.ts +25 -0
  1670. package/src/nodes/lighting/PointShadowNode.js +330 -0
  1671. package/src/nodes/lighting/ProjectorLightNode.d.ts +5 -0
  1672. package/src/nodes/lighting/ProjectorLightNode.js +91 -0
  1673. package/src/nodes/lighting/RectAreaLightNode.d.ts +21 -0
  1674. package/src/nodes/lighting/RectAreaLightNode.js +133 -0
  1675. package/src/nodes/lighting/ShadowBaseNode.d.ts +47 -0
  1676. package/src/nodes/lighting/ShadowBaseNode.js +238 -0
  1677. package/src/nodes/lighting/ShadowFilterNode.d.ts +17 -0
  1678. package/src/nodes/lighting/ShadowFilterNode.js +129 -0
  1679. package/src/nodes/lighting/ShadowNode.d.ts +11 -0
  1680. package/src/nodes/lighting/ShadowNode.js +841 -0
  1681. package/src/nodes/lighting/SpotLightNode.d.ts +22 -0
  1682. package/src/nodes/lighting/SpotLightNode.js +168 -0
  1683. package/src/nodes/materialx/DISCLAIMER.md +199 -0
  1684. package/src/nodes/materialx/MaterialXColor.d.ts +5 -0
  1685. package/src/nodes/materialx/MaterialXColor.js +124 -0
  1686. package/src/nodes/materialx/MaterialXColorTransform.d.ts +3 -0
  1687. package/src/nodes/materialx/MaterialXColorTransform.js +20 -0
  1688. package/src/nodes/materialx/MaterialXCore.d.ts +5 -0
  1689. package/src/nodes/materialx/MaterialXCore.js +37 -0
  1690. package/src/nodes/materialx/MaterialXNodes.d.ts +206 -0
  1691. package/src/nodes/materialx/MaterialXNodes.js +189 -0
  1692. package/src/nodes/materialx/MaterialXNoise.d.ts +415 -0
  1693. package/src/nodes/materialx/MaterialXNoise.js +1720 -0
  1694. package/src/nodes/math/BitcastNode.d.ts +24 -0
  1695. package/src/nodes/math/BitcastNode.js +156 -0
  1696. package/src/nodes/math/BitcountNode.d.ts +23 -0
  1697. package/src/nodes/math/BitcountNode.js +453 -0
  1698. package/src/nodes/math/ConditionalNode.d.ts +51 -0
  1699. package/src/nodes/math/ConditionalNode.js +245 -0
  1700. package/src/nodes/math/Hash.d.ts +3 -0
  1701. package/src/nodes/math/Hash.js +21 -0
  1702. package/src/nodes/math/MathNode.d.ts +895 -0
  1703. package/src/nodes/math/MathNode.js +1230 -0
  1704. package/src/nodes/math/MathUtils.d.ts +10 -0
  1705. package/src/nodes/math/MathUtils.js +65 -0
  1706. package/src/nodes/math/OperatorNode.d.ts +709 -0
  1707. package/src/nodes/math/OperatorNode.js +752 -0
  1708. package/src/nodes/math/PackFloatNode.d.ts +24 -0
  1709. package/src/nodes/math/PackFloatNode.js +126 -0
  1710. package/src/nodes/math/Packed4x8IntegerNode.d.ts +49 -0
  1711. package/src/nodes/math/Packed4x8IntegerNode.js +433 -0
  1712. package/src/nodes/math/TriNoise3D.d.ts +11 -0
  1713. package/src/nodes/math/TriNoise3D.js +71 -0
  1714. package/src/nodes/math/UnpackFloatNode.d.ts +21 -0
  1715. package/src/nodes/math/UnpackFloatNode.js +124 -0
  1716. package/src/nodes/parsers/GLSLNodeFunction.d.ts +9 -0
  1717. package/src/nodes/parsers/GLSLNodeFunction.js +168 -0
  1718. package/src/nodes/parsers/GLSLNodeParser.d.ts +8 -0
  1719. package/src/nodes/parsers/GLSLNodeParser.js +25 -0
  1720. package/src/nodes/pmrem/PMREMNode.d.ts +21 -0
  1721. package/src/nodes/pmrem/PMREMNode.js +428 -0
  1722. package/src/nodes/pmrem/PMREMUtils.d.ts +21 -0
  1723. package/src/nodes/pmrem/PMREMUtils.js +354 -0
  1724. package/src/nodes/procedural/Checker.d.ts +3 -0
  1725. package/src/nodes/procedural/Checker.js +22 -0
  1726. package/src/nodes/shapes/Shapes.d.ts +3 -0
  1727. package/src/nodes/shapes/Shapes.js +33 -0
  1728. package/src/nodes/tsl/TSLBase.d.ts +30 -0
  1729. package/src/nodes/tsl/TSLBase.js +36 -0
  1730. package/src/nodes/tsl/TSLCore.d.ts +2420 -0
  1731. package/src/nodes/tsl/TSLCore.js +1265 -0
  1732. package/src/nodes/utils/ArrayElementNode.d.ts +15 -0
  1733. package/src/nodes/utils/ArrayElementNode.js +90 -0
  1734. package/src/nodes/utils/ConvertNode.d.ts +14 -0
  1735. package/src/nodes/utils/ConvertNode.js +100 -0
  1736. package/src/nodes/utils/CubeMapNode.d.ts +12 -0
  1737. package/src/nodes/utils/CubeMapNode.js +237 -0
  1738. package/src/nodes/utils/DebugNode.d.ts +22 -0
  1739. package/src/nodes/utils/DebugNode.js +83 -0
  1740. package/src/nodes/utils/Discard.d.ts +10 -0
  1741. package/src/nodes/utils/Discard.js +24 -0
  1742. package/src/nodes/utils/EquirectUV.d.ts +33 -0
  1743. package/src/nodes/utils/EquirectUV.js +52 -0
  1744. package/src/nodes/utils/EventNode.d.ts +41 -0
  1745. package/src/nodes/utils/EventNode.js +223 -0
  1746. package/src/nodes/utils/FlipNode.d.ts +11 -0
  1747. package/src/nodes/utils/FlipNode.js +106 -0
  1748. package/src/nodes/utils/FunctionOverloadingNode.d.ts +12 -0
  1749. package/src/nodes/utils/FunctionOverloadingNode.js +170 -0
  1750. package/src/nodes/utils/JoinNode.d.ts +14 -0
  1751. package/src/nodes/utils/JoinNode.js +117 -0
  1752. package/src/nodes/utils/LoopNode.d.ts +43 -0
  1753. package/src/nodes/utils/LoopNode.js +390 -0
  1754. package/src/nodes/utils/MatcapUV.d.ts +3 -0
  1755. package/src/nodes/utils/MatcapUV.js +22 -0
  1756. package/src/nodes/utils/MaxMipLevelNode.d.ts +13 -0
  1757. package/src/nodes/utils/MaxMipLevelNode.js +103 -0
  1758. package/src/nodes/utils/MemberNode.d.ts +11 -0
  1759. package/src/nodes/utils/MemberNode.js +120 -0
  1760. package/src/nodes/utils/Oscillators.d.ts +6 -0
  1761. package/src/nodes/utils/Oscillators.js +41 -0
  1762. package/src/nodes/utils/Packing.d.ts +52 -0
  1763. package/src/nodes/utils/Packing.js +64 -0
  1764. package/src/nodes/utils/PostProcessingUtils.d.ts +56 -0
  1765. package/src/nodes/utils/PostProcessingUtils.js +175 -0
  1766. package/src/nodes/utils/RTTNode.d.ts +46 -0
  1767. package/src/nodes/utils/RTTNode.js +370 -0
  1768. package/src/nodes/utils/ReflectorNode.d.ts +61 -0
  1769. package/src/nodes/utils/ReflectorNode.js +634 -0
  1770. package/src/nodes/utils/Remap.d.ts +223 -0
  1771. package/src/nodes/utils/Remap.js +48 -0
  1772. package/src/nodes/utils/RotateNode.d.ts +26 -0
  1773. package/src/nodes/utils/RotateNode.js +180 -0
  1774. package/src/nodes/utils/SampleNode.d.ts +26 -0
  1775. package/src/nodes/utils/SampleNode.js +91 -0
  1776. package/src/nodes/utils/SetNode.d.ts +11 -0
  1777. package/src/nodes/utils/SetNode.js +108 -0
  1778. package/src/nodes/utils/SplitNode.d.ts +14 -0
  1779. package/src/nodes/utils/SplitNode.js +179 -0
  1780. package/src/nodes/utils/SpriteSheetUV.d.ts +7 -0
  1781. package/src/nodes/utils/SpriteSheetUV.js +35 -0
  1782. package/src/nodes/utils/SpriteUtils.d.ts +5 -0
  1783. package/src/nodes/utils/SpriteUtils.js +98 -0
  1784. package/src/nodes/utils/StorageArrayElementNode.d.ts +28 -0
  1785. package/src/nodes/utils/StorageArrayElementNode.js +143 -0
  1786. package/src/nodes/utils/Timer.d.ts +5 -0
  1787. package/src/nodes/utils/Timer.js +26 -0
  1788. package/src/nodes/utils/TriplanarTextures.d.ts +19 -0
  1789. package/src/nodes/utils/TriplanarTextures.js +65 -0
  1790. package/src/nodes/utils/UVUtils.d.ts +19 -0
  1791. package/src/nodes/utils/UVUtils.js +67 -0
  1792. package/src/nodes/utils/ViewportUtils.d.ts +3 -0
  1793. package/src/nodes/utils/ViewportUtils.js +26 -0
  1794. package/src/objects/BatchedMesh.d.ts +280 -0
  1795. package/src/objects/BatchedMesh.js +1696 -0
  1796. package/src/objects/Bone.d.ts +36 -0
  1797. package/src/objects/Bone.js +41 -0
  1798. package/src/objects/ClippingGroup.d.ts +41 -0
  1799. package/src/objects/ClippingGroup.js +68 -0
  1800. package/src/objects/Group.d.ts +37 -0
  1801. package/src/objects/Group.js +41 -0
  1802. package/src/objects/InstancedMesh.d.ts +175 -0
  1803. package/src/objects/InstancedMesh.js +411 -0
  1804. package/src/objects/LOD.d.ts +112 -0
  1805. package/src/objects/LOD.js +329 -0
  1806. package/src/objects/Line.d.ts +96 -0
  1807. package/src/objects/Line.js +341 -0
  1808. package/src/objects/LineLoop.d.ts +40 -0
  1809. package/src/objects/LineLoop.js +37 -0
  1810. package/src/objects/LineSegments.d.ts +41 -0
  1811. package/src/objects/LineSegments.js +74 -0
  1812. package/src/objects/Mesh.d.ts +111 -0
  1813. package/src/objects/Mesh.js +508 -0
  1814. package/src/objects/Points.d.ts +75 -0
  1815. package/src/objects/Points.js +240 -0
  1816. package/src/objects/Skeleton.d.ts +120 -0
  1817. package/src/objects/Skeleton.js +383 -0
  1818. package/src/objects/SkinnedMesh.d.ts +163 -0
  1819. package/src/objects/SkinnedMesh.js +370 -0
  1820. package/src/objects/Sprite.d.ts +82 -0
  1821. package/src/objects/Sprite.js +257 -0
  1822. package/src/renderers/WebGL3DRenderTarget.d.ts +29 -0
  1823. package/src/renderers/WebGL3DRenderTarget.js +48 -0
  1824. package/src/renderers/WebGLArrayRenderTarget.d.ts +29 -0
  1825. package/src/renderers/WebGLArrayRenderTarget.js +48 -0
  1826. package/src/renderers/WebGLCubeRenderTarget.d.ts +18 -0
  1827. package/src/renderers/WebGLCubeRenderTarget.js +182 -0
  1828. package/src/renderers/WebGLRenderTarget.d.ts +8 -0
  1829. package/src/renderers/WebGLRenderTarget.js +34 -0
  1830. package/src/renderers/WebGLRenderer.d.ts +489 -0
  1831. package/src/renderers/WebGLRenderer.js +3769 -0
  1832. package/src/renderers/common/Animation.js +169 -0
  1833. package/src/renderers/common/Attributes.js +187 -0
  1834. package/src/renderers/common/Backend.d.ts +29 -0
  1835. package/src/renderers/common/Backend.js +841 -0
  1836. package/src/renderers/common/Background.js +225 -0
  1837. package/src/renderers/common/BindGroup.js +45 -0
  1838. package/src/renderers/common/Binding.js +71 -0
  1839. package/src/renderers/common/Bindings.js +535 -0
  1840. package/src/renderers/common/BlendMode.d.ts +22 -0
  1841. package/src/renderers/common/BlendMode.js +143 -0
  1842. package/src/renderers/common/Buffer.js +136 -0
  1843. package/src/renderers/common/BufferUtils.d.ts +28 -0
  1844. package/src/renderers/common/BufferUtils.js +58 -0
  1845. package/src/renderers/common/BundleGroup.d.ts +46 -0
  1846. package/src/renderers/common/BundleGroup.js +87 -0
  1847. package/src/renderers/common/CanvasTarget.d.ts +158 -0
  1848. package/src/renderers/common/CanvasTarget.js +341 -0
  1849. package/src/renderers/common/CapabilityTier.js +18 -0
  1850. package/src/renderers/common/ChainMap.js +122 -0
  1851. package/src/renderers/common/ClippingContext.d.ts +134 -0
  1852. package/src/renderers/common/ClippingContext.js +280 -0
  1853. package/src/renderers/common/Color4.d.ts +53 -0
  1854. package/src/renderers/common/Color4.js +86 -0
  1855. package/src/renderers/common/ComputePipeline.js +41 -0
  1856. package/src/renderers/common/Constants.d.ts +9 -0
  1857. package/src/renderers/common/Constants.js +10 -0
  1858. package/src/renderers/common/CubeRenderTarget.d.ts +47 -0
  1859. package/src/renderers/common/CubeRenderTarget.js +147 -0
  1860. package/src/renderers/common/DataMap.js +90 -0
  1861. package/src/renderers/common/DirectRenderPipeline.d.ts +20 -0
  1862. package/src/renderers/common/DirectRenderPipeline.js +233 -0
  1863. package/src/renderers/common/GPUInstanceCuller.d.ts +43 -0
  1864. package/src/renderers/common/GPUInstanceCuller.js +372 -0
  1865. package/src/renderers/common/GPUTimings.js +66 -0
  1866. package/src/renderers/common/Geometries.js +485 -0
  1867. package/src/renderers/common/IndirectStorageBufferAttribute.d.ts +10 -0
  1868. package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
  1869. package/src/renderers/common/Info.d.ts +194 -0
  1870. package/src/renderers/common/Info.js +542 -0
  1871. package/src/renderers/common/InspectorBase.d.ts +129 -0
  1872. package/src/renderers/common/InspectorBase.js +180 -0
  1873. package/src/renderers/common/Lighting.d.ts +55 -0
  1874. package/src/renderers/common/Lighting.js +112 -0
  1875. package/src/renderers/common/Pipeline.js +35 -0
  1876. package/src/renderers/common/Pipelines.js +500 -0
  1877. package/src/renderers/common/PostProcessing.d.ts +21 -0
  1878. package/src/renderers/common/PostProcessing.js +28 -0
  1879. package/src/renderers/common/ProgrammableStage.js +78 -0
  1880. package/src/renderers/common/QuadMesh.d.ts +19 -0
  1881. package/src/renderers/common/QuadMesh.js +126 -0
  1882. package/src/renderers/common/ReadbackBuffer.d.ts +63 -0
  1883. package/src/renderers/common/ReadbackBuffer.js +78 -0
  1884. package/src/renderers/common/RenderBundle.js +26 -0
  1885. package/src/renderers/common/RenderBundles.js +71 -0
  1886. package/src/renderers/common/RenderContext.js +289 -0
  1887. package/src/renderers/common/RenderContexts.js +100 -0
  1888. package/src/renderers/common/RenderList.js +475 -0
  1889. package/src/renderers/common/RenderLists.js +125 -0
  1890. package/src/renderers/common/RenderObject.js +989 -0
  1891. package/src/renderers/common/RenderObjectPipeline.js +40 -0
  1892. package/src/renderers/common/RenderObjects.js +245 -0
  1893. package/src/renderers/common/RenderPipeline.d.ts +26 -0
  1894. package/src/renderers/common/RenderPipeline.js +263 -0
  1895. package/src/renderers/common/Renderer.d.ts +1209 -0
  1896. package/src/renderers/common/Renderer.js +4115 -0
  1897. package/src/renderers/common/RendererUtils.d.ts +77 -0
  1898. package/src/renderers/common/RendererUtils.js +200 -0
  1899. package/src/renderers/common/SampledTexture.js +152 -0
  1900. package/src/renderers/common/Sampler.js +133 -0
  1901. package/src/renderers/common/Storage3DTexture.d.ts +42 -0
  1902. package/src/renderers/common/Storage3DTexture.js +116 -0
  1903. package/src/renderers/common/StorageArrayTexture.d.ts +31 -0
  1904. package/src/renderers/common/StorageArrayTexture.js +84 -0
  1905. package/src/renderers/common/StorageBuffer.js +53 -0
  1906. package/src/renderers/common/StorageBufferAttribute.d.ts +7 -0
  1907. package/src/renderers/common/StorageBufferAttribute.js +46 -0
  1908. package/src/renderers/common/StorageInstancedBufferAttribute.d.ts +8 -0
  1909. package/src/renderers/common/StorageInstancedBufferAttribute.js +46 -0
  1910. package/src/renderers/common/StorageTexture.d.ts +7 -0
  1911. package/src/renderers/common/StorageTexture.js +86 -0
  1912. package/src/renderers/common/Textures.js +656 -0
  1913. package/src/renderers/common/TimestampQueryPool.d.ts +120 -0
  1914. package/src/renderers/common/TimestampQueryPool.js +173 -0
  1915. package/src/renderers/common/Uniform.js +375 -0
  1916. package/src/renderers/common/UniformBuffer.js +34 -0
  1917. package/src/renderers/common/UniformsGroup.js +570 -0
  1918. package/src/renderers/common/XRManager.d.ts +293 -0
  1919. package/src/renderers/common/XRManager.js +2009 -0
  1920. package/src/renderers/common/XRRenderTarget.js +91 -0
  1921. package/src/renderers/common/extras/PMREMGenerator.d.ts +52 -0
  1922. package/src/renderers/common/extras/PMREMGenerator.js +951 -0
  1923. package/src/renderers/common/nodes/NodeBuilderState.js +160 -0
  1924. package/src/renderers/common/nodes/NodeLibrary.d.ts +129 -0
  1925. package/src/renderers/common/nodes/NodeLibrary.js +196 -0
  1926. package/src/renderers/common/nodes/NodeManager.js +1170 -0
  1927. package/src/renderers/common/nodes/NodeSampledTexture.js +140 -0
  1928. package/src/renderers/common/nodes/NodeSampler.js +62 -0
  1929. package/src/renderers/common/nodes/NodeStorageBuffer.js +74 -0
  1930. package/src/renderers/common/nodes/NodeUniform.js +418 -0
  1931. package/src/renderers/common/nodes/NodeUniformBuffer.js +120 -0
  1932. package/src/renderers/common/nodes/NodeUniformsGroup.js +51 -0
  1933. package/src/renderers/shaders/DFGLUTData.js +50 -0
  1934. package/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.js +7 -0
  1935. package/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.js +68 -0
  1936. package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +7 -0
  1937. package/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.js +7 -0
  1938. package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +16 -0
  1939. package/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.js +5 -0
  1940. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +26 -0
  1941. package/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.js +8 -0
  1942. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +49 -0
  1943. package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
  1944. package/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.js +9 -0
  1945. package/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.js +9 -0
  1946. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +33 -0
  1947. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +43 -0
  1948. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +7 -0
  1949. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +10 -0
  1950. package/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.js +21 -0
  1951. package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +78 -0
  1952. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.js +9 -0
  1953. package/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.js +7 -0
  1954. package/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.js +7 -0
  1955. package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +7 -0
  1956. package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +7 -0
  1957. package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +7 -0
  1958. package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +29 -0
  1959. package/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.js +3 -0
  1960. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +15 -0
  1961. package/src/renderers/shaders/ShaderChunk/common.glsl.js +134 -0
  1962. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +186 -0
  1963. package/src/renderers/shaders/ShaderChunk/default_fragment.glsl.js +5 -0
  1964. package/src/renderers/shaders/ShaderChunk/default_vertex.glsl.js +5 -0
  1965. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +59 -0
  1966. package/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.js +9 -0
  1967. package/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.js +7 -0
  1968. package/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.js +7 -0
  1969. package/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.js +20 -0
  1970. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +17 -0
  1971. package/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.js +7 -0
  1972. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +14 -0
  1973. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +58 -0
  1974. package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +21 -0
  1975. package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +22 -0
  1976. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +117 -0
  1977. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +37 -0
  1978. package/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.js +17 -0
  1979. package/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.js +19 -0
  1980. package/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.js +7 -0
  1981. package/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.js +7 -0
  1982. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +27 -0
  1983. package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +120 -0
  1984. package/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.js +14 -0
  1985. package/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.js +8 -0
  1986. package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
  1987. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +262 -0
  1988. package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +19 -0
  1989. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +62 -0
  1990. package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
  1991. package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +28 -0
  1992. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +236 -0
  1993. package/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.js +7 -0
  1994. package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +32 -0
  1995. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +167 -0
  1996. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +660 -0
  1997. package/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.js +4 -0
  1998. package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +26 -0
  1999. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +9 -0
  2000. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +9 -0
  2001. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +8 -0
  2002. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +8 -0
  2003. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +17 -0
  2004. package/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.js +7 -0
  2005. package/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.js +27 -0
  2006. package/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.js +27 -0
  2007. package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +12 -0
  2008. package/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.js +7 -0
  2009. package/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.js +24 -0
  2010. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
  2011. package/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.js +16 -0
  2012. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +26 -0
  2013. package/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.js +16 -0
  2014. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +76 -0
  2015. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +40 -0
  2016. package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +14 -0
  2017. package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +14 -0
  2018. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +20 -0
  2019. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +43 -0
  2020. package/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.js +11 -0
  2021. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +116 -0
  2022. package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +7 -0
  2023. package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +19 -0
  2024. package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -0
  2025. package/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.js +7 -0
  2026. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +458 -0
  2027. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +80 -0
  2028. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +85 -0
  2029. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +81 -0
  2030. package/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.js +10 -0
  2031. package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +25 -0
  2032. package/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.js +15 -0
  2033. package/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.js +20 -0
  2034. package/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.js +14 -0
  2035. package/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.js +7 -0
  2036. package/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.js +7 -0
  2037. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +200 -0
  2038. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +36 -0
  2039. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +235 -0
  2040. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +119 -0
  2041. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +145 -0
  2042. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +122 -0
  2043. package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +21 -0
  2044. package/src/renderers/shaders/ShaderChunk.d.ts +144 -0
  2045. package/src/renderers/shaders/ShaderChunk.js +272 -0
  2046. package/src/renderers/shaders/ShaderLib/background.glsl.js +40 -0
  2047. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
  2048. package/src/renderers/shaders/ShaderLib/cube.glsl.js +36 -0
  2049. package/src/renderers/shaders/ShaderLib/depth.glsl.js +117 -0
  2050. package/src/renderers/shaders/ShaderLib/distance.glsl.js +77 -0
  2051. package/src/renderers/shaders/ShaderLib/equirect.glsl.js +35 -0
  2052. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +76 -0
  2053. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +116 -0
  2054. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +126 -0
  2055. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +112 -0
  2056. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +86 -0
  2057. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +128 -0
  2058. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +228 -0
  2059. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +118 -0
  2060. package/src/renderers/shaders/ShaderLib/points.glsl.js +87 -0
  2061. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +58 -0
  2062. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +79 -0
  2063. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +51 -0
  2064. package/src/renderers/shaders/ShaderLib.d.ts +29 -0
  2065. package/src/renderers/shaders/ShaderLib.js +363 -0
  2066. package/src/renderers/shaders/UniformsLib.d.ts +209 -0
  2067. package/src/renderers/shaders/UniformsLib.js +250 -0
  2068. package/src/renderers/shaders/UniformsUtils.d.ts +14 -0
  2069. package/src/renderers/shaders/UniformsUtils.js +154 -0
  2070. package/src/renderers/webgl/WebGLAnimation.js +54 -0
  2071. package/src/renderers/webgl/WebGLAttributes.d.ts +23 -0
  2072. package/src/renderers/webgl/WebGLAttributes.js +237 -0
  2073. package/src/renderers/webgl/WebGLBackground.js +303 -0
  2074. package/src/renderers/webgl/WebGLBindingStates.d.ts +26 -0
  2075. package/src/renderers/webgl/WebGLBindingStates.js +666 -0
  2076. package/src/renderers/webgl/WebGLBufferRenderer.d.ts +15 -0
  2077. package/src/renderers/webgl/WebGLBufferRenderer.js +57 -0
  2078. package/src/renderers/webgl/WebGLCapabilities.d.ts +48 -0
  2079. package/src/renderers/webgl/WebGLCapabilities.js +150 -0
  2080. package/src/renderers/webgl/WebGLClipping.d.ts +26 -0
  2081. package/src/renderers/webgl/WebGLClipping.js +171 -0
  2082. package/src/renderers/webgl/WebGLEnvironments.d.ts +8 -0
  2083. package/src/renderers/webgl/WebGLEnvironments.js +228 -0
  2084. package/src/renderers/webgl/WebGLExtensions.d.ts +7 -0
  2085. package/src/renderers/webgl/WebGLExtensions.js +61 -0
  2086. package/src/renderers/webgl/WebGLGeometries.d.ts +13 -0
  2087. package/src/renderers/webgl/WebGLGeometries.js +186 -0
  2088. package/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +13 -0
  2089. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +68 -0
  2090. package/src/renderers/webgl/WebGLInfo.d.ts +39 -0
  2091. package/src/renderers/webgl/WebGLInfo.js +73 -0
  2092. package/src/renderers/webgl/WebGLLights.d.ts +57 -0
  2093. package/src/renderers/webgl/WebGLLights.js +654 -0
  2094. package/src/renderers/webgl/WebGLMaterials.js +608 -0
  2095. package/src/renderers/webgl/WebGLMorphtargets.js +168 -0
  2096. package/src/renderers/webgl/WebGLObjects.d.ts +19 -0
  2097. package/src/renderers/webgl/WebGLObjects.js +94 -0
  2098. package/src/renderers/webgl/WebGLOutput.js +283 -0
  2099. package/src/renderers/webgl/WebGLProgram.d.ts +22 -0
  2100. package/src/renderers/webgl/WebGLProgram.js +1035 -0
  2101. package/src/renderers/webgl/WebGLPrograms.d.ts +242 -0
  2102. package/src/renderers/webgl/WebGLPrograms.js +694 -0
  2103. package/src/renderers/webgl/WebGLProperties.d.ts +9 -0
  2104. package/src/renderers/webgl/WebGLProperties.js +55 -0
  2105. package/src/renderers/webgl/WebGLRenderLists.d.ts +68 -0
  2106. package/src/renderers/webgl/WebGLRenderLists.js +257 -0
  2107. package/src/renderers/webgl/WebGLRenderStates.js +124 -0
  2108. package/src/renderers/webgl/WebGLShader.d.ts +1 -0
  2109. package/src/renderers/webgl/WebGLShader.js +12 -0
  2110. package/src/renderers/webgl/WebGLShaderCache.js +118 -0
  2111. package/src/renderers/webgl/WebGLShadowMap.d.ts +33 -0
  2112. package/src/renderers/webgl/WebGLShadowMap.js +611 -0
  2113. package/src/renderers/webgl/WebGLState.d.ts +399 -0
  2114. package/src/renderers/webgl/WebGLState.js +1370 -0
  2115. package/src/renderers/webgl/WebGLTextures.d.ts +31 -0
  2116. package/src/renderers/webgl/WebGLTextures.js +2519 -0
  2117. package/src/renderers/webgl/WebGLUniforms.d.ts +5 -0
  2118. package/src/renderers/webgl/WebGLUniforms.js +1203 -0
  2119. package/src/renderers/webgl/WebGLUniformsGroups.d.ts +17 -0
  2120. package/src/renderers/webgl/WebGLUniformsGroups.js +441 -0
  2121. package/src/renderers/webgl/WebGLUtils.d.ts +11 -0
  2122. package/src/renderers/webgl/WebGLUtils.js +217 -0
  2123. package/src/renderers/webgl-fallback/WebGLBackend.d.ts +16 -0
  2124. package/src/renderers/webgl-fallback/WebGLBackend.js +2950 -0
  2125. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +99 -0
  2126. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +9 -0
  2127. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +1860 -0
  2128. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +359 -0
  2129. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts +51 -0
  2130. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +105 -0
  2131. package/src/renderers/webgl-fallback/utils/WebGLConstants.js +13 -0
  2132. package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +83 -0
  2133. package/src/renderers/webgl-fallback/utils/WebGLState.js +1507 -0
  2134. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +1381 -0
  2135. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +406 -0
  2136. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +319 -0
  2137. package/src/renderers/webgpu/WebGPUBackend.d.ts +32 -0
  2138. package/src/renderers/webgpu/WebGPUBackend.js +3321 -0
  2139. package/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts +12 -0
  2140. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +69 -0
  2141. package/src/renderers/webgpu/WebGPURenderer.d.ts +17 -0
  2142. package/src/renderers/webgpu/WebGPURenderer.js +107 -0
  2143. package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
  2144. package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
  2145. package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
  2146. package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
  2147. package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
  2148. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
  2149. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
  2150. package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
  2151. package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
  2152. package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
  2153. package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
  2154. package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
  2155. package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
  2156. package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
  2157. package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
  2158. package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
  2159. package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
  2160. package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
  2161. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
  2162. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
  2163. package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
  2164. package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
  2165. package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
  2166. package/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +13 -0
  2167. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +66 -0
  2168. package/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +91 -0
  2169. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +99 -0
  2170. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +9 -0
  2171. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +2759 -0
  2172. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +188 -0
  2173. package/src/renderers/webgpu/nodes/WGSLNodeParser.js +25 -0
  2174. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +573 -0
  2175. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +683 -0
  2176. package/src/renderers/webgpu/utils/WebGPUCapabilities.js +149 -0
  2177. package/src/renderers/webgpu/utils/WebGPUConstants.d.ts +348 -0
  2178. package/src/renderers/webgpu/utils/WebGPUConstants.js +354 -0
  2179. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +1007 -0
  2180. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +452 -0
  2181. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1884 -0
  2182. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +337 -0
  2183. package/src/renderers/webgpu/utils/WebGPUUniformArena.js +240 -0
  2184. package/src/renderers/webgpu/utils/WebGPUUtils.js +342 -0
  2185. package/src/renderers/webxr/WebXRController.d.ts +67 -0
  2186. package/src/renderers/webxr/WebXRController.js +440 -0
  2187. package/src/renderers/webxr/WebXRDepthSensing.d.ts +21 -0
  2188. package/src/renderers/webxr/WebXRDepthSensing.js +155 -0
  2189. package/src/renderers/webxr/WebXRManager.d.ts +89 -0
  2190. package/src/renderers/webxr/WebXRManager.js +1126 -0
  2191. package/src/scenes/Fog.d.ts +71 -0
  2192. package/src/scenes/Fog.js +98 -0
  2193. package/src/scenes/FogExp2.d.ts +61 -0
  2194. package/src/scenes/FogExp2.js +86 -0
  2195. package/src/scenes/Scene.d.ts +104 -0
  2196. package/src/scenes/Scene.js +165 -0
  2197. package/src/textures/CanvasTexture.d.ts +51 -0
  2198. package/src/textures/CanvasTexture.js +45 -0
  2199. package/src/textures/CompressedArrayTexture.d.ts +65 -0
  2200. package/src/textures/CompressedArrayTexture.js +105 -0
  2201. package/src/textures/CompressedCubeTexture.d.ts +13 -0
  2202. package/src/textures/CompressedCubeTexture.js +48 -0
  2203. package/src/textures/CompressedTexture.d.ts +92 -0
  2204. package/src/textures/CompressedTexture.js +86 -0
  2205. package/src/textures/CubeDepthTexture.d.ts +40 -0
  2206. package/src/textures/CubeDepthTexture.js +76 -0
  2207. package/src/textures/CubeTexture.d.ts +82 -0
  2208. package/src/textures/CubeTexture.js +81 -0
  2209. package/src/textures/Data3DTexture.d.ts +94 -0
  2210. package/src/textures/Data3DTexture.js +128 -0
  2211. package/src/textures/DataArrayTexture.d.ts +123 -0
  2212. package/src/textures/DataArrayTexture.js +150 -0
  2213. package/src/textures/DataTexture.d.ts +112 -0
  2214. package/src/textures/DataTexture.js +87 -0
  2215. package/src/textures/DepthTexture.d.ts +105 -0
  2216. package/src/textures/DepthTexture.js +104 -0
  2217. package/src/textures/ExternalTexture.d.ts +14 -0
  2218. package/src/textures/ExternalTexture.js +53 -0
  2219. package/src/textures/FramebufferTexture.d.ts +67 -0
  2220. package/src/textures/FramebufferTexture.js +85 -0
  2221. package/src/textures/HTMLTexture.d.ts +27 -0
  2222. package/src/textures/HTMLTexture.js +74 -0
  2223. package/src/textures/Texture.d.ts +565 -0
  2224. package/src/textures/Texture.js +812 -0
  2225. package/src/textures/TextureSource.d.ts +99 -0
  2226. package/src/textures/TextureSource.js +261 -0
  2227. package/src/textures/VideoFrameTexture.d.ts +27 -0
  2228. package/src/textures/VideoFrameTexture.js +72 -0
  2229. package/src/textures/VideoTexture.d.ts +90 -0
  2230. package/src/textures/VideoTexture.js +127 -0
  2231. package/src/upe.d.ts +5 -0
  2232. package/src/upe.js +17 -0
  2233. package/src/utils.d.ts +36 -0
  2234. package/src/utils.js +493 -0
@@ -0,0 +1,4925 @@
1
+ import {
2
+ AnimationClip,
3
+ Bone,
4
+ Box3,
5
+ BufferAttribute,
6
+ BufferGeometry,
7
+ ClampToEdgeWrapping,
8
+ Color,
9
+ ColorManagement,
10
+ DirectionalLight,
11
+ DoubleSide,
12
+ FileLoader,
13
+ FrontSide,
14
+ Group,
15
+ ImageBitmapLoader,
16
+ InstancedMesh,
17
+ InterleavedBuffer,
18
+ InterleavedBufferAttribute,
19
+ Interpolant,
20
+ InterpolateDiscrete,
21
+ InterpolateLinear,
22
+ Line,
23
+ LineBasicMaterial,
24
+ LineLoop,
25
+ LineSegments,
26
+ LinearFilter,
27
+ LinearMipmapLinearFilter,
28
+ LinearMipmapNearestFilter,
29
+ LinearSRGBColorSpace,
30
+ Loader,
31
+ LoaderUtils,
32
+ Material,
33
+ MathUtils,
34
+ Matrix4,
35
+ Mesh,
36
+ MeshBasicMaterial,
37
+ MeshPhysicalMaterial,
38
+ MeshStandardMaterial,
39
+ MirroredRepeatWrapping,
40
+ NearestFilter,
41
+ NearestMipmapLinearFilter,
42
+ NearestMipmapNearestFilter,
43
+ NumberKeyframeTrack,
44
+ Object3D,
45
+ OrthographicCamera,
46
+ PerspectiveCamera,
47
+ PointLight,
48
+ Points,
49
+ PointsMaterial,
50
+ PropertyBinding,
51
+ Quaternion,
52
+ QuaternionKeyframeTrack,
53
+ RepeatWrapping,
54
+ Skeleton,
55
+ SkinnedMesh,
56
+ Sphere,
57
+ SpotLight,
58
+ Texture,
59
+ TextureLoader,
60
+ TriangleFanDrawMode,
61
+ TriangleStripDrawMode,
62
+ Vector2,
63
+ Vector3,
64
+ VectorKeyframeTrack,
65
+ SRGBColorSpace,
66
+ InstancedBufferAttribute
67
+ } from 'three';
68
+ import { toTrianglesDrawMode } from '../utils/BufferGeometryUtils.js';
69
+ import { clone } from '../utils/SkeletonUtils.js';
70
+
71
+ /**
72
+ * A loader for the glTF 2.0 format.
73
+ *
74
+ * [glTF](https://www.khronos.org/gltf/) (GL Transmission Format) is an [open format specification]{@link https://github.com/KhronosGroup/glTF/tree/main/specification/2.0)
75
+ * for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb)
76
+ * format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver
77
+ * one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights,
78
+ * and/or cameras.
79
+ *
80
+ * `GLTFLoader` uses {@link ImageBitmapLoader} whenever possible. Be advised that image bitmaps are not
81
+ * automatically GC-collected when they are no longer referenced, and they require special handling during
82
+ * the disposal process.
83
+ *
84
+ * `GLTFLoader` supports the following glTF 2.0 extensions:
85
+ * - KHR_draco_mesh_compression
86
+ * - KHR_lights_punctual
87
+ * - KHR_materials_anisotropy
88
+ * - KHR_materials_clearcoat
89
+ * - KHR_materials_dispersion
90
+ * - KHR_materials_emissive_strength
91
+ * - KHR_materials_ior
92
+ * - KHR_materials_specular
93
+ * - KHR_materials_transmission
94
+ * - KHR_materials_iridescence
95
+ * - KHR_materials_unlit
96
+ * - KHR_materials_volume
97
+ * - KHR_mesh_quantization
98
+ * - KHR_meshopt_compression
99
+ * - KHR_texture_basisu
100
+ * - KHR_texture_transform
101
+ * - EXT_materials_bump
102
+ * - EXT_meshopt_compression
103
+ * - EXT_mesh_gpu_instancing
104
+ * - EXT_texture_avif
105
+ * - EXT_texture_webp
106
+ *
107
+ * The following glTF 2.0 extensions are supported by separately registered plugins:
108
+ * - KHR_gaussian_splatting
109
+ * - [KHR_materials_variants](https://github.com/takahirox/three-gltf-extensions)
110
+ * - [MSFT_texture_dds](https://github.com/takahirox/three-gltf-extensions)
111
+ * - [KHR_animation_pointer](https://github.com/needle-tools/three-animation-pointer)
112
+ * - [NEEDLE_progressive](https://github.com/needle-tools/gltf-progressive)
113
+ *
114
+ * ```js
115
+ * const loader = new GLTFLoader();
116
+ *
117
+ * // Optional: Provide a DRACOLoader instance to decode compressed mesh data
118
+ * const dracoLoader = new DRACOLoader();
119
+ * dracoLoader.setDecoderPath( '/examples/jsm/libs/draco/' );
120
+ * loader.setDRACOLoader( dracoLoader );
121
+ *
122
+ * const gltf = await loader.loadAsync( 'models/gltf/duck/duck.gltf' );
123
+ * scene.add( gltf.scene );
124
+ * ```
125
+ *
126
+ * @augments Loader
127
+ * @three_import import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
128
+ */
129
+ class GLTFLoader extends Loader {
130
+
131
+ /**
132
+ * Constructs a new glTF loader.
133
+ *
134
+ * @param {LoadingManager} [manager] - The loading manager.
135
+ */
136
+ constructor( manager ) {
137
+
138
+ super( manager );
139
+
140
+ this.dracoLoader = null;
141
+ this.ktx2Loader = null;
142
+ this.meshoptDecoder = null;
143
+
144
+ this.pluginCallbacks = [];
145
+
146
+ this.register( function ( parser ) {
147
+
148
+ return new GLTFMaterialsClearcoatExtension( parser );
149
+
150
+ } );
151
+
152
+ this.register( function ( parser ) {
153
+
154
+ return new GLTFMaterialsDispersionExtension( parser );
155
+
156
+ } );
157
+
158
+ this.register( function ( parser ) {
159
+
160
+ return new GLTFTextureBasisUExtension( parser );
161
+
162
+ } );
163
+
164
+ this.register( function ( parser ) {
165
+
166
+ return new GLTFTextureWebPExtension( parser );
167
+
168
+ } );
169
+
170
+ this.register( function ( parser ) {
171
+
172
+ return new GLTFTextureAVIFExtension( parser );
173
+
174
+ } );
175
+
176
+ this.register( function ( parser ) {
177
+
178
+ return new GLTFMaterialsSheenExtension( parser );
179
+
180
+ } );
181
+
182
+ this.register( function ( parser ) {
183
+
184
+ return new GLTFMaterialsTransmissionExtension( parser );
185
+
186
+ } );
187
+
188
+ this.register( function ( parser ) {
189
+
190
+ return new GLTFMaterialsVolumeExtension( parser );
191
+
192
+ } );
193
+
194
+ this.register( function ( parser ) {
195
+
196
+ return new GLTFMaterialsIorExtension( parser );
197
+
198
+ } );
199
+
200
+ this.register( function ( parser ) {
201
+
202
+ return new GLTFMaterialsEmissiveStrengthExtension( parser );
203
+
204
+ } );
205
+
206
+ this.register( function ( parser ) {
207
+
208
+ return new GLTFMaterialsSpecularExtension( parser );
209
+
210
+ } );
211
+
212
+ this.register( function ( parser ) {
213
+
214
+ return new GLTFMaterialsIridescenceExtension( parser );
215
+
216
+ } );
217
+
218
+ this.register( function ( parser ) {
219
+
220
+ return new GLTFMaterialsAnisotropyExtension( parser );
221
+
222
+ } );
223
+
224
+ this.register( function ( parser ) {
225
+
226
+ return new GLTFMaterialsBumpExtension( parser );
227
+
228
+ } );
229
+
230
+ this.register( function ( parser ) {
231
+
232
+ return new GLTFLightsExtension( parser );
233
+
234
+ } );
235
+
236
+ this.register( function ( parser ) {
237
+
238
+ return new GLTFMeshoptCompression( parser, EXTENSIONS.EXT_MESHOPT_COMPRESSION );
239
+
240
+ } );
241
+
242
+ this.register( function ( parser ) {
243
+
244
+ return new GLTFMeshoptCompression( parser, EXTENSIONS.KHR_MESHOPT_COMPRESSION );
245
+
246
+ } );
247
+
248
+ this.register( function ( parser ) {
249
+
250
+ return new GLTFMeshGpuInstancing( parser );
251
+
252
+ } );
253
+
254
+ }
255
+
256
+ /**
257
+ * Starts loading from the given URL and passes the loaded glTF asset
258
+ * to the `onLoad()` callback.
259
+ *
260
+ * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
261
+ * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
262
+ * @param {onProgressCallback} onProgress - Executed while the loading is in progress.
263
+ * @param {onErrorCallback} onError - Executed when errors occur.
264
+ */
265
+ load( url, onLoad, onProgress, onError ) {
266
+
267
+ const scope = this;
268
+
269
+ let resourcePath;
270
+
271
+ if ( this.resourcePath !== '' ) {
272
+
273
+ resourcePath = this.resourcePath;
274
+
275
+ } else if ( this.path !== '' ) {
276
+
277
+ // If a base path is set, resources will be relative paths from that plus the relative path of the gltf file
278
+ // Example path = 'https://my-cnd-server.com/', url = 'assets/models/model.gltf'
279
+ // resourcePath = 'https://my-cnd-server.com/assets/models/'
280
+ // referenced resource 'model.bin' will be loaded from 'https://my-cnd-server.com/assets/models/model.bin'
281
+ // referenced resource '../textures/texture.png' will be loaded from 'https://my-cnd-server.com/assets/textures/texture.png'
282
+ const relativeUrl = LoaderUtils.extractUrlBase( url );
283
+ resourcePath = LoaderUtils.resolveURL( relativeUrl, this.path );
284
+
285
+ } else {
286
+
287
+ resourcePath = LoaderUtils.extractUrlBase( url );
288
+
289
+ }
290
+
291
+ // Tells the LoadingManager to track an extra item, which resolves after
292
+ // the model is fully loaded. This means the count of items loaded will
293
+ // be incorrect, but ensures manager.onLoad() does not fire early.
294
+ this.manager.itemStart( url );
295
+
296
+ const _onError = function ( e ) {
297
+
298
+ if ( onError ) {
299
+
300
+ onError( e );
301
+
302
+ } else {
303
+
304
+ console.error( e );
305
+
306
+ }
307
+
308
+ scope.manager.itemError( url );
309
+ scope.manager.itemEnd( url );
310
+
311
+ };
312
+
313
+ const loader = new FileLoader( this.manager );
314
+
315
+ loader.setPath( this.path );
316
+ loader.setResponseType( 'arraybuffer' );
317
+ loader.setRequestHeader( this.requestHeader );
318
+ loader.setWithCredentials( this.withCredentials );
319
+
320
+ loader.load( url, function ( data ) {
321
+
322
+ try {
323
+
324
+ scope.parse( data, resourcePath, function ( gltf ) {
325
+
326
+ onLoad( gltf );
327
+
328
+ scope.manager.itemEnd( url );
329
+
330
+ }, _onError );
331
+
332
+ } catch ( e ) {
333
+
334
+ _onError( e );
335
+
336
+ }
337
+
338
+ }, onProgress, _onError );
339
+
340
+ }
341
+
342
+ /**
343
+ * Sets the given Draco loader to this loader. Required for decoding assets
344
+ * compressed with the `KHR_draco_mesh_compression` extension.
345
+ *
346
+ * @param {DRACOLoader} dracoLoader - The Draco loader to set.
347
+ * @return {GLTFLoader} A reference to this loader.
348
+ */
349
+ setDRACOLoader( dracoLoader ) {
350
+
351
+ this.dracoLoader = dracoLoader;
352
+ return this;
353
+
354
+ }
355
+
356
+ /**
357
+ * Sets the given KTX2 loader to this loader. Required for loading KTX2
358
+ * compressed textures.
359
+ *
360
+ * @param {KTX2Loader} ktx2Loader - The KTX2 loader to set.
361
+ * @return {GLTFLoader} A reference to this loader.
362
+ */
363
+ setKTX2Loader( ktx2Loader ) {
364
+
365
+ this.ktx2Loader = ktx2Loader;
366
+ return this;
367
+
368
+ }
369
+
370
+ /**
371
+ * Sets the given meshopt decoder. Required for decoding assets
372
+ * compressed with the `EXT_meshopt_compression` extension.
373
+ *
374
+ * @param {Object} meshoptDecoder - The meshopt decoder to set.
375
+ * @return {GLTFLoader} A reference to this loader.
376
+ */
377
+ setMeshoptDecoder( meshoptDecoder ) {
378
+
379
+ this.meshoptDecoder = meshoptDecoder;
380
+ return this;
381
+
382
+ }
383
+
384
+ /**
385
+ * Registers a plugin callback. This API is internally used to implement the various
386
+ * glTF extensions but can also used by third-party code to add additional logic
387
+ * to the loader.
388
+ *
389
+ * @param {function(parser:GLTFParser)} callback - The callback function to register.
390
+ * @return {GLTFLoader} A reference to this loader.
391
+ */
392
+ register( callback ) {
393
+
394
+ if ( this.pluginCallbacks.indexOf( callback ) === - 1 ) {
395
+
396
+ this.pluginCallbacks.push( callback );
397
+
398
+ }
399
+
400
+ return this;
401
+
402
+ }
403
+
404
+ /**
405
+ * Unregisters a plugin callback.
406
+ *
407
+ * @param {Function} callback - The callback function to unregister.
408
+ * @return {GLTFLoader} A reference to this loader.
409
+ */
410
+ unregister( callback ) {
411
+
412
+ if ( this.pluginCallbacks.indexOf( callback ) !== - 1 ) {
413
+
414
+ this.pluginCallbacks.splice( this.pluginCallbacks.indexOf( callback ), 1 );
415
+
416
+ }
417
+
418
+ return this;
419
+
420
+ }
421
+
422
+ /**
423
+ * Parses the given glTF data and returns the resulting group.
424
+ *
425
+ * @param {string|ArrayBuffer} data - The raw glTF data.
426
+ * @param {string} path - The URL base path.
427
+ * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished.
428
+ * @param {onErrorCallback} onError - Executed when errors occur.
429
+ */
430
+ parse( data, path, onLoad, onError ) {
431
+
432
+ let json;
433
+ const extensions = {};
434
+ const plugins = {};
435
+ const textDecoder = new TextDecoder();
436
+
437
+ if ( typeof data === 'string' ) {
438
+
439
+ json = JSON.parse( data );
440
+
441
+ } else if ( data instanceof ArrayBuffer ) {
442
+
443
+ const magic = textDecoder.decode( new Uint8Array( data, 0, 4 ) );
444
+
445
+ if ( magic === BINARY_EXTENSION_HEADER_MAGIC ) {
446
+
447
+ try {
448
+
449
+ extensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( data );
450
+
451
+ } catch ( error ) {
452
+
453
+ if ( onError ) onError( error );
454
+ return;
455
+
456
+ }
457
+
458
+ json = JSON.parse( extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content );
459
+
460
+ } else {
461
+
462
+ json = JSON.parse( textDecoder.decode( data ) );
463
+
464
+ }
465
+
466
+ } else {
467
+
468
+ json = data;
469
+
470
+ }
471
+
472
+ if ( json.asset === undefined || json.asset.version[ 0 ] < 2 ) {
473
+
474
+ if ( onError ) onError( new Error( 'THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.' ) );
475
+ return;
476
+
477
+ }
478
+
479
+ const parser = new GLTFParser( json, {
480
+
481
+ path: path || this.resourcePath || '',
482
+ crossOrigin: this.crossOrigin,
483
+ requestHeader: this.requestHeader,
484
+ manager: this.manager,
485
+ ktx2Loader: this.ktx2Loader,
486
+ meshoptDecoder: this.meshoptDecoder
487
+
488
+ } );
489
+
490
+ parser.fileLoader.setRequestHeader( this.requestHeader );
491
+
492
+ for ( let i = 0; i < this.pluginCallbacks.length; i ++ ) {
493
+
494
+ const plugin = this.pluginCallbacks[ i ]( parser );
495
+
496
+ if ( ! plugin.name ) console.error( 'THREE.GLTFLoader: Invalid plugin found: missing name' );
497
+
498
+ plugins[ plugin.name ] = plugin;
499
+
500
+ // Workaround to avoid determining as unknown extension
501
+ // in addUnknownExtensionsToUserData().
502
+ // Remove this workaround if we move all the existing
503
+ // extension handlers to plugin system
504
+ extensions[ plugin.name ] = true;
505
+
506
+ }
507
+
508
+ if ( json.extensionsUsed ) {
509
+
510
+ for ( let i = 0; i < json.extensionsUsed.length; ++ i ) {
511
+
512
+ const extensionName = json.extensionsUsed[ i ];
513
+ const extensionsRequired = json.extensionsRequired || [];
514
+
515
+ switch ( extensionName ) {
516
+
517
+ case EXTENSIONS.KHR_MATERIALS_UNLIT:
518
+ extensions[ extensionName ] = new GLTFMaterialsUnlitExtension();
519
+ break;
520
+
521
+ case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:
522
+ extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
523
+ break;
524
+
525
+ case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
526
+ extensions[ extensionName ] = new GLTFTextureTransformExtension();
527
+ break;
528
+
529
+ case EXTENSIONS.KHR_MESH_QUANTIZATION:
530
+ extensions[ extensionName ] = new GLTFMeshQuantizationExtension();
531
+ break;
532
+
533
+ default:
534
+
535
+ if ( extensionsRequired.indexOf( extensionName ) >= 0 && plugins[ extensionName ] === undefined ) {
536
+
537
+ console.warn( 'THREE.GLTFLoader: Unknown extension "' + extensionName + '".' );
538
+
539
+ }
540
+
541
+ }
542
+
543
+ }
544
+
545
+ }
546
+
547
+ parser.setExtensions( extensions );
548
+ parser.setPlugins( plugins );
549
+ parser.parse( onLoad, onError );
550
+
551
+ }
552
+
553
+ /**
554
+ * Async version of {@link GLTFLoader#parse}.
555
+ *
556
+ * @async
557
+ * @param {string|ArrayBuffer} data - The raw glTF data.
558
+ * @param {string} path - The URL base path.
559
+ * @return {Promise<GLTFLoader~LoadObject>} A Promise that resolves with the loaded glTF when the parsing has been finished.
560
+ */
561
+ parseAsync( data, path ) {
562
+
563
+ const scope = this;
564
+
565
+ return new Promise( function ( resolve, reject ) {
566
+
567
+ scope.parse( data, path, resolve, reject );
568
+
569
+ } );
570
+
571
+ }
572
+
573
+ }
574
+
575
+ /* GLTFREGISTRY */
576
+
577
+ function GLTFRegistry() {
578
+
579
+ let objects = {};
580
+
581
+ return {
582
+
583
+ get: function ( key ) {
584
+
585
+ return objects[ key ];
586
+
587
+ },
588
+
589
+ add: function ( key, object ) {
590
+
591
+ objects[ key ] = object;
592
+
593
+ },
594
+
595
+ remove: function ( key ) {
596
+
597
+ delete objects[ key ];
598
+
599
+ },
600
+
601
+ removeAll: function () {
602
+
603
+ objects = {};
604
+
605
+ }
606
+
607
+ };
608
+
609
+ }
610
+
611
+ /*********************************/
612
+ /********** EXTENSIONS ***********/
613
+ /*********************************/
614
+
615
+ function getMaterialExtension( parser, materialIndex, extensionName ) {
616
+
617
+ const materialDef = parser.json.materials[ materialIndex ];
618
+
619
+ if ( materialDef.extensions && materialDef.extensions[ extensionName ] ) {
620
+
621
+ return materialDef.extensions[ extensionName ];
622
+
623
+ }
624
+
625
+ return null;
626
+
627
+ }
628
+
629
+ const EXTENSIONS = {
630
+ KHR_BINARY_GLTF: 'KHR_binary_glTF',
631
+ KHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',
632
+ KHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',
633
+ KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
634
+ KHR_MATERIALS_DISPERSION: 'KHR_materials_dispersion',
635
+ KHR_MATERIALS_IOR: 'KHR_materials_ior',
636
+ KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',
637
+ KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',
638
+ KHR_MATERIALS_TRANSMISSION: 'KHR_materials_transmission',
639
+ KHR_MATERIALS_IRIDESCENCE: 'KHR_materials_iridescence',
640
+ KHR_MATERIALS_ANISOTROPY: 'KHR_materials_anisotropy',
641
+ KHR_MATERIALS_UNLIT: 'KHR_materials_unlit',
642
+ KHR_MATERIALS_VOLUME: 'KHR_materials_volume',
643
+ KHR_TEXTURE_BASISU: 'KHR_texture_basisu',
644
+ KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
645
+ KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
646
+ KHR_MATERIALS_EMISSIVE_STRENGTH: 'KHR_materials_emissive_strength',
647
+ EXT_MATERIALS_BUMP: 'EXT_materials_bump',
648
+ EXT_TEXTURE_WEBP: 'EXT_texture_webp',
649
+ EXT_TEXTURE_AVIF: 'EXT_texture_avif',
650
+ EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',
651
+ KHR_MESHOPT_COMPRESSION: 'KHR_meshopt_compression',
652
+ EXT_MESH_GPU_INSTANCING: 'EXT_mesh_gpu_instancing'
653
+ };
654
+
655
+ /**
656
+ * Punctual Lights Extension
657
+ *
658
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual
659
+ *
660
+ * @private
661
+ */
662
+ class GLTFLightsExtension {
663
+
664
+ constructor( parser ) {
665
+
666
+ this.parser = parser;
667
+ this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL;
668
+
669
+ // Object3D instance caches
670
+ this.cache = { refs: {}, uses: {} };
671
+
672
+ }
673
+
674
+ _markDefs() {
675
+
676
+ const parser = this.parser;
677
+ const nodeDefs = this.parser.json.nodes || [];
678
+
679
+ for ( let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex ++ ) {
680
+
681
+ const nodeDef = nodeDefs[ nodeIndex ];
682
+
683
+ if ( nodeDef.extensions
684
+ && nodeDef.extensions[ this.name ]
685
+ && nodeDef.extensions[ this.name ].light !== undefined ) {
686
+
687
+ parser._addNodeRef( this.cache, nodeDef.extensions[ this.name ].light );
688
+
689
+ }
690
+
691
+ }
692
+
693
+ }
694
+
695
+ _loadLight( lightIndex ) {
696
+
697
+ const parser = this.parser;
698
+ const cacheKey = 'light:' + lightIndex;
699
+ let dependency = parser.cache.get( cacheKey );
700
+
701
+ if ( dependency ) return dependency;
702
+
703
+ const json = parser.json;
704
+ const extensions = ( json.extensions && json.extensions[ this.name ] ) || {};
705
+ const lightDefs = extensions.lights || [];
706
+ const lightDef = lightDefs[ lightIndex ];
707
+ let lightNode;
708
+
709
+ const color = new Color( 0xffffff );
710
+
711
+ if ( lightDef.color !== undefined ) color.setRGB( lightDef.color[ 0 ], lightDef.color[ 1 ], lightDef.color[ 2 ], LinearSRGBColorSpace );
712
+
713
+ const range = lightDef.range !== undefined ? lightDef.range : 0;
714
+
715
+ switch ( lightDef.type ) {
716
+
717
+ case 'directional':
718
+ lightNode = new DirectionalLight( color );
719
+ lightNode.target.position.set( 0, 0, - 1 );
720
+ lightNode.add( lightNode.target );
721
+ break;
722
+
723
+ case 'point':
724
+ lightNode = new PointLight( color );
725
+ lightNode.distance = range;
726
+ break;
727
+
728
+ case 'spot':
729
+ lightNode = new SpotLight( color );
730
+ lightNode.distance = range;
731
+ // Handle spotlight properties.
732
+ lightDef.spot = lightDef.spot || {};
733
+ lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0;
734
+ lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0;
735
+ lightNode.angle = lightDef.spot.outerConeAngle;
736
+ lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle;
737
+ lightNode.target.position.set( 0, 0, - 1 );
738
+ lightNode.add( lightNode.target );
739
+ break;
740
+
741
+ default:
742
+ throw new Error( 'THREE.GLTFLoader: Unexpected light type: ' + lightDef.type );
743
+
744
+ }
745
+
746
+ // Some lights (e.g. spot) default to a position other than the origin. Reset the position
747
+ // here, because node-level parsing will only override position if explicitly specified.
748
+ lightNode.position.set( 0, 0, 0 );
749
+
750
+ assignExtrasToUserData( lightNode, lightDef );
751
+
752
+ if ( lightDef.intensity !== undefined ) lightNode.intensity = lightDef.intensity;
753
+
754
+ lightNode.name = parser.createUniqueName( lightDef.name || ( 'light_' + lightIndex ) );
755
+
756
+ dependency = Promise.resolve( lightNode );
757
+
758
+ parser.cache.add( cacheKey, dependency );
759
+
760
+ return dependency;
761
+
762
+ }
763
+
764
+ getDependency( type, index ) {
765
+
766
+ if ( type !== 'light' ) return;
767
+
768
+ return this._loadLight( index );
769
+
770
+ }
771
+
772
+ createNodeAttachment( nodeIndex ) {
773
+
774
+ const self = this;
775
+ const parser = this.parser;
776
+ const json = parser.json;
777
+ const nodeDef = json.nodes[ nodeIndex ];
778
+ const lightDef = ( nodeDef.extensions && nodeDef.extensions[ this.name ] ) || {};
779
+ const lightIndex = lightDef.light;
780
+
781
+ if ( lightIndex === undefined ) return null;
782
+
783
+ return this._loadLight( lightIndex ).then( function ( light ) {
784
+
785
+ return parser._getNodeRef( self.cache, lightIndex, light );
786
+
787
+ } );
788
+
789
+ }
790
+
791
+ }
792
+
793
+ /**
794
+ * Unlit Materials Extension
795
+ *
796
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit
797
+ *
798
+ * @private
799
+ */
800
+ class GLTFMaterialsUnlitExtension {
801
+
802
+ constructor() {
803
+
804
+ this.name = EXTENSIONS.KHR_MATERIALS_UNLIT;
805
+
806
+ }
807
+
808
+ getMaterialType() {
809
+
810
+ return MeshBasicMaterial;
811
+
812
+ }
813
+
814
+ extendParams( materialParams, materialDef, parser ) {
815
+
816
+ const pending = [];
817
+
818
+ materialParams.color = new Color( 1.0, 1.0, 1.0 );
819
+ materialParams.opacity = 1.0;
820
+
821
+ const metallicRoughness = materialDef.pbrMetallicRoughness;
822
+
823
+ if ( metallicRoughness ) {
824
+
825
+ if ( Array.isArray( metallicRoughness.baseColorFactor ) ) {
826
+
827
+ const array = metallicRoughness.baseColorFactor;
828
+
829
+ materialParams.color.setRGB( array[ 0 ], array[ 1 ], array[ 2 ], LinearSRGBColorSpace );
830
+ materialParams.opacity = array[ 3 ];
831
+
832
+ }
833
+
834
+ if ( metallicRoughness.baseColorTexture !== undefined ) {
835
+
836
+ pending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace ) );
837
+
838
+ }
839
+
840
+ }
841
+
842
+ return Promise.all( pending );
843
+
844
+ }
845
+
846
+ }
847
+
848
+ /**
849
+ * Materials Emissive Strength Extension
850
+ *
851
+ * Specification: https://github.com/KhronosGroup/glTF/blob/5768b3ce0ef32bc39cdf1bef10b948586635ead3/extensions/2.0/Khronos/KHR_materials_emissive_strength/README.md
852
+ *
853
+ * @private
854
+ */
855
+ class GLTFMaterialsEmissiveStrengthExtension {
856
+
857
+ constructor( parser ) {
858
+
859
+ this.parser = parser;
860
+ this.name = EXTENSIONS.KHR_MATERIALS_EMISSIVE_STRENGTH;
861
+
862
+ }
863
+
864
+ extendMaterialParams( materialIndex, materialParams ) {
865
+
866
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
867
+
868
+ if ( extension === null ) return Promise.resolve();
869
+
870
+ if ( extension.emissiveStrength !== undefined ) {
871
+
872
+ materialParams.emissiveIntensity = extension.emissiveStrength;
873
+
874
+ }
875
+
876
+ return Promise.resolve();
877
+
878
+ }
879
+
880
+ }
881
+
882
+ /**
883
+ * Clearcoat Materials Extension
884
+ *
885
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_clearcoat
886
+ *
887
+ * @private
888
+ */
889
+ class GLTFMaterialsClearcoatExtension {
890
+
891
+ constructor( parser ) {
892
+
893
+ this.parser = parser;
894
+ this.name = EXTENSIONS.KHR_MATERIALS_CLEARCOAT;
895
+
896
+ }
897
+
898
+ getMaterialType( materialIndex ) {
899
+
900
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
901
+
902
+ return extension !== null ? MeshPhysicalMaterial : null;
903
+
904
+ }
905
+
906
+ extendMaterialParams( materialIndex, materialParams ) {
907
+
908
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
909
+
910
+ if ( extension === null ) return Promise.resolve();
911
+
912
+ const pending = [];
913
+
914
+ if ( extension.clearcoatFactor !== undefined ) {
915
+
916
+ materialParams.clearcoat = extension.clearcoatFactor;
917
+
918
+ }
919
+
920
+ if ( extension.clearcoatTexture !== undefined ) {
921
+
922
+ pending.push( this.parser.assignTexture( materialParams, 'clearcoatMap', extension.clearcoatTexture ) );
923
+
924
+ }
925
+
926
+ if ( extension.clearcoatRoughnessFactor !== undefined ) {
927
+
928
+ materialParams.clearcoatRoughness = extension.clearcoatRoughnessFactor;
929
+
930
+ }
931
+
932
+ if ( extension.clearcoatRoughnessTexture !== undefined ) {
933
+
934
+ pending.push( this.parser.assignTexture( materialParams, 'clearcoatRoughnessMap', extension.clearcoatRoughnessTexture ) );
935
+
936
+ }
937
+
938
+ if ( extension.clearcoatNormalTexture !== undefined ) {
939
+
940
+ pending.push( this.parser.assignTexture( materialParams, 'clearcoatNormalMap', extension.clearcoatNormalTexture ) );
941
+
942
+ if ( extension.clearcoatNormalTexture.scale !== undefined ) {
943
+
944
+ const scale = extension.clearcoatNormalTexture.scale;
945
+
946
+ materialParams.clearcoatNormalScale = new Vector2( scale, scale );
947
+
948
+ }
949
+
950
+ }
951
+
952
+ return Promise.all( pending );
953
+
954
+ }
955
+
956
+ }
957
+
958
+ /**
959
+ * Materials dispersion Extension
960
+ *
961
+ * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion
962
+ *
963
+ * @private
964
+ */
965
+ class GLTFMaterialsDispersionExtension {
966
+
967
+ constructor( parser ) {
968
+
969
+ this.parser = parser;
970
+ this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION;
971
+
972
+ }
973
+
974
+ getMaterialType( materialIndex ) {
975
+
976
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
977
+
978
+ return extension !== null ? MeshPhysicalMaterial : null;
979
+
980
+ }
981
+
982
+ extendMaterialParams( materialIndex, materialParams ) {
983
+
984
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
985
+
986
+ if ( extension === null ) return Promise.resolve();
987
+
988
+ materialParams.dispersion = extension.dispersion !== undefined ? extension.dispersion : 0;
989
+
990
+ return Promise.resolve();
991
+
992
+ }
993
+
994
+ }
995
+
996
+ /**
997
+ * Iridescence Materials Extension
998
+ *
999
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_iridescence
1000
+ *
1001
+ * @private
1002
+ */
1003
+ class GLTFMaterialsIridescenceExtension {
1004
+
1005
+ constructor( parser ) {
1006
+
1007
+ this.parser = parser;
1008
+ this.name = EXTENSIONS.KHR_MATERIALS_IRIDESCENCE;
1009
+
1010
+ }
1011
+
1012
+ getMaterialType( materialIndex ) {
1013
+
1014
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1015
+
1016
+ return extension !== null ? MeshPhysicalMaterial : null;
1017
+
1018
+ }
1019
+
1020
+ extendMaterialParams( materialIndex, materialParams ) {
1021
+
1022
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1023
+
1024
+ if ( extension === null ) return Promise.resolve();
1025
+
1026
+ const pending = [];
1027
+
1028
+ if ( extension.iridescenceFactor !== undefined ) {
1029
+
1030
+ materialParams.iridescence = extension.iridescenceFactor;
1031
+
1032
+ }
1033
+
1034
+ if ( extension.iridescenceTexture !== undefined ) {
1035
+
1036
+ pending.push( this.parser.assignTexture( materialParams, 'iridescenceMap', extension.iridescenceTexture ) );
1037
+
1038
+ }
1039
+
1040
+ if ( extension.iridescenceIor !== undefined ) {
1041
+
1042
+ materialParams.iridescenceIOR = extension.iridescenceIor;
1043
+
1044
+ }
1045
+
1046
+ if ( materialParams.iridescenceThicknessRange === undefined ) {
1047
+
1048
+ materialParams.iridescenceThicknessRange = [ 100, 400 ];
1049
+
1050
+ }
1051
+
1052
+ if ( extension.iridescenceThicknessMinimum !== undefined ) {
1053
+
1054
+ materialParams.iridescenceThicknessRange[ 0 ] = extension.iridescenceThicknessMinimum;
1055
+
1056
+ }
1057
+
1058
+ if ( extension.iridescenceThicknessMaximum !== undefined ) {
1059
+
1060
+ materialParams.iridescenceThicknessRange[ 1 ] = extension.iridescenceThicknessMaximum;
1061
+
1062
+ }
1063
+
1064
+ if ( extension.iridescenceThicknessTexture !== undefined ) {
1065
+
1066
+ pending.push( this.parser.assignTexture( materialParams, 'iridescenceThicknessMap', extension.iridescenceThicknessTexture ) );
1067
+
1068
+ }
1069
+
1070
+ return Promise.all( pending );
1071
+
1072
+ }
1073
+
1074
+ }
1075
+
1076
+ /**
1077
+ * Sheen Materials Extension
1078
+ *
1079
+ * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_sheen
1080
+ *
1081
+ * @private
1082
+ */
1083
+ class GLTFMaterialsSheenExtension {
1084
+
1085
+ constructor( parser ) {
1086
+
1087
+ this.parser = parser;
1088
+ this.name = EXTENSIONS.KHR_MATERIALS_SHEEN;
1089
+
1090
+ }
1091
+
1092
+ getMaterialType( materialIndex ) {
1093
+
1094
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1095
+
1096
+ return extension !== null ? MeshPhysicalMaterial : null;
1097
+
1098
+ }
1099
+
1100
+ extendMaterialParams( materialIndex, materialParams ) {
1101
+
1102
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1103
+
1104
+ if ( extension === null ) return Promise.resolve();
1105
+
1106
+ const pending = [];
1107
+
1108
+ materialParams.sheenColor = new Color( 0, 0, 0 );
1109
+ materialParams.sheenRoughness = 0;
1110
+ materialParams.sheen = 1;
1111
+
1112
+ if ( extension.sheenColorFactor !== undefined ) {
1113
+
1114
+ const colorFactor = extension.sheenColorFactor;
1115
+ materialParams.sheenColor.setRGB( colorFactor[ 0 ], colorFactor[ 1 ], colorFactor[ 2 ], LinearSRGBColorSpace );
1116
+
1117
+ }
1118
+
1119
+ if ( extension.sheenRoughnessFactor !== undefined ) {
1120
+
1121
+ materialParams.sheenRoughness = extension.sheenRoughnessFactor;
1122
+
1123
+ }
1124
+
1125
+ if ( extension.sheenColorTexture !== undefined ) {
1126
+
1127
+ pending.push( this.parser.assignTexture( materialParams, 'sheenColorMap', extension.sheenColorTexture, SRGBColorSpace ) );
1128
+
1129
+ }
1130
+
1131
+ if ( extension.sheenRoughnessTexture !== undefined ) {
1132
+
1133
+ pending.push( this.parser.assignTexture( materialParams, 'sheenRoughnessMap', extension.sheenRoughnessTexture ) );
1134
+
1135
+ }
1136
+
1137
+ return Promise.all( pending );
1138
+
1139
+ }
1140
+
1141
+ }
1142
+
1143
+ /**
1144
+ * Transmission Materials Extension
1145
+ *
1146
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_transmission
1147
+ * Draft: https://github.com/KhronosGroup/glTF/pull/1698
1148
+ *
1149
+ * @private
1150
+ */
1151
+ class GLTFMaterialsTransmissionExtension {
1152
+
1153
+ constructor( parser ) {
1154
+
1155
+ this.parser = parser;
1156
+ this.name = EXTENSIONS.KHR_MATERIALS_TRANSMISSION;
1157
+
1158
+ }
1159
+
1160
+ getMaterialType( materialIndex ) {
1161
+
1162
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1163
+
1164
+ return extension !== null ? MeshPhysicalMaterial : null;
1165
+
1166
+ }
1167
+
1168
+ extendMaterialParams( materialIndex, materialParams ) {
1169
+
1170
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1171
+
1172
+ if ( extension === null ) return Promise.resolve();
1173
+
1174
+ const pending = [];
1175
+
1176
+ if ( extension.transmissionFactor !== undefined ) {
1177
+
1178
+ materialParams.transmission = extension.transmissionFactor;
1179
+
1180
+ }
1181
+
1182
+ if ( extension.transmissionTexture !== undefined ) {
1183
+
1184
+ pending.push( this.parser.assignTexture( materialParams, 'transmissionMap', extension.transmissionTexture ) );
1185
+
1186
+ }
1187
+
1188
+ return Promise.all( pending );
1189
+
1190
+ }
1191
+
1192
+ }
1193
+
1194
+ /**
1195
+ * Materials Volume Extension
1196
+ *
1197
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_volume
1198
+ *
1199
+ * @private
1200
+ */
1201
+ class GLTFMaterialsVolumeExtension {
1202
+
1203
+ constructor( parser ) {
1204
+
1205
+ this.parser = parser;
1206
+ this.name = EXTENSIONS.KHR_MATERIALS_VOLUME;
1207
+
1208
+ }
1209
+
1210
+ getMaterialType( materialIndex ) {
1211
+
1212
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1213
+
1214
+ return extension !== null ? MeshPhysicalMaterial : null;
1215
+
1216
+ }
1217
+
1218
+ extendMaterialParams( materialIndex, materialParams ) {
1219
+
1220
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1221
+
1222
+ if ( extension === null ) return Promise.resolve();
1223
+
1224
+ const pending = [];
1225
+
1226
+ materialParams.thickness = extension.thicknessFactor !== undefined ? extension.thicknessFactor : 0;
1227
+
1228
+ if ( extension.thicknessTexture !== undefined ) {
1229
+
1230
+ pending.push( this.parser.assignTexture( materialParams, 'thicknessMap', extension.thicknessTexture ) );
1231
+
1232
+ }
1233
+
1234
+ materialParams.attenuationDistance = extension.attenuationDistance || Infinity;
1235
+
1236
+ const colorArray = extension.attenuationColor || [ 1, 1, 1 ];
1237
+ materialParams.attenuationColor = new Color().setRGB( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ], LinearSRGBColorSpace );
1238
+
1239
+ return Promise.all( pending );
1240
+
1241
+ }
1242
+
1243
+ }
1244
+
1245
+ /**
1246
+ * Materials ior Extension
1247
+ *
1248
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_ior
1249
+ *
1250
+ * @private
1251
+ */
1252
+ class GLTFMaterialsIorExtension {
1253
+
1254
+ constructor( parser ) {
1255
+
1256
+ this.parser = parser;
1257
+ this.name = EXTENSIONS.KHR_MATERIALS_IOR;
1258
+
1259
+ }
1260
+
1261
+ getMaterialType( materialIndex ) {
1262
+
1263
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1264
+
1265
+ return extension !== null ? MeshPhysicalMaterial : null;
1266
+
1267
+ }
1268
+
1269
+ extendMaterialParams( materialIndex, materialParams ) {
1270
+
1271
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1272
+
1273
+ if ( extension === null ) return Promise.resolve();
1274
+
1275
+ materialParams.ior = extension.ior !== undefined ? extension.ior : 1.5;
1276
+
1277
+ if ( materialParams.ior === 0 ) materialParams.ior = 1000; // see #26167
1278
+
1279
+ return Promise.resolve();
1280
+
1281
+ }
1282
+
1283
+ }
1284
+
1285
+ /**
1286
+ * Materials specular Extension
1287
+ *
1288
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_specular
1289
+ *
1290
+ * @private
1291
+ */
1292
+ class GLTFMaterialsSpecularExtension {
1293
+
1294
+ constructor( parser ) {
1295
+
1296
+ this.parser = parser;
1297
+ this.name = EXTENSIONS.KHR_MATERIALS_SPECULAR;
1298
+
1299
+ }
1300
+
1301
+ getMaterialType( materialIndex ) {
1302
+
1303
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1304
+
1305
+ return extension !== null ? MeshPhysicalMaterial : null;
1306
+
1307
+ }
1308
+
1309
+ extendMaterialParams( materialIndex, materialParams ) {
1310
+
1311
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1312
+
1313
+ if ( extension === null ) return Promise.resolve();
1314
+
1315
+ const pending = [];
1316
+
1317
+ materialParams.specularIntensity = extension.specularFactor !== undefined ? extension.specularFactor : 1.0;
1318
+
1319
+ if ( extension.specularTexture !== undefined ) {
1320
+
1321
+ pending.push( this.parser.assignTexture( materialParams, 'specularIntensityMap', extension.specularTexture ) );
1322
+
1323
+ }
1324
+
1325
+ const colorArray = extension.specularColorFactor || [ 1, 1, 1 ];
1326
+ materialParams.specularColor = new Color().setRGB( colorArray[ 0 ], colorArray[ 1 ], colorArray[ 2 ], LinearSRGBColorSpace );
1327
+
1328
+ if ( extension.specularColorTexture !== undefined ) {
1329
+
1330
+ pending.push( this.parser.assignTexture( materialParams, 'specularColorMap', extension.specularColorTexture, SRGBColorSpace ) );
1331
+
1332
+ }
1333
+
1334
+ return Promise.all( pending );
1335
+
1336
+ }
1337
+
1338
+ }
1339
+
1340
+
1341
+ /**
1342
+ * Materials bump Extension
1343
+ *
1344
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/EXT_materials_bump
1345
+ *
1346
+ * @private
1347
+ */
1348
+ class GLTFMaterialsBumpExtension {
1349
+
1350
+ constructor( parser ) {
1351
+
1352
+ this.parser = parser;
1353
+ this.name = EXTENSIONS.EXT_MATERIALS_BUMP;
1354
+
1355
+ }
1356
+
1357
+ getMaterialType( materialIndex ) {
1358
+
1359
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1360
+
1361
+ return extension !== null ? MeshPhysicalMaterial : null;
1362
+
1363
+ }
1364
+
1365
+ extendMaterialParams( materialIndex, materialParams ) {
1366
+
1367
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1368
+
1369
+ if ( extension === null ) return Promise.resolve();
1370
+
1371
+ const pending = [];
1372
+
1373
+ materialParams.bumpScale = extension.bumpFactor !== undefined ? extension.bumpFactor : 1.0;
1374
+
1375
+ if ( extension.bumpTexture !== undefined ) {
1376
+
1377
+ pending.push( this.parser.assignTexture( materialParams, 'bumpMap', extension.bumpTexture ) );
1378
+
1379
+ }
1380
+
1381
+ return Promise.all( pending );
1382
+
1383
+ }
1384
+
1385
+ }
1386
+
1387
+ /**
1388
+ * Materials anisotropy Extension
1389
+ *
1390
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_anisotropy
1391
+ *
1392
+ * @private
1393
+ */
1394
+ class GLTFMaterialsAnisotropyExtension {
1395
+
1396
+ constructor( parser ) {
1397
+
1398
+ this.parser = parser;
1399
+ this.name = EXTENSIONS.KHR_MATERIALS_ANISOTROPY;
1400
+
1401
+ }
1402
+
1403
+ getMaterialType( materialIndex ) {
1404
+
1405
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1406
+
1407
+ return extension !== null ? MeshPhysicalMaterial : null;
1408
+
1409
+ }
1410
+
1411
+ extendMaterialParams( materialIndex, materialParams ) {
1412
+
1413
+ const extension = getMaterialExtension( this.parser, materialIndex, this.name );
1414
+
1415
+ if ( extension === null ) return Promise.resolve();
1416
+
1417
+ const pending = [];
1418
+
1419
+ if ( extension.anisotropyStrength !== undefined ) {
1420
+
1421
+ materialParams.anisotropy = extension.anisotropyStrength;
1422
+
1423
+ }
1424
+
1425
+ if ( extension.anisotropyRotation !== undefined ) {
1426
+
1427
+ materialParams.anisotropyRotation = extension.anisotropyRotation;
1428
+
1429
+ }
1430
+
1431
+ if ( extension.anisotropyTexture !== undefined ) {
1432
+
1433
+ pending.push( this.parser.assignTexture( materialParams, 'anisotropyMap', extension.anisotropyTexture ) );
1434
+
1435
+ }
1436
+
1437
+ return Promise.all( pending );
1438
+
1439
+ }
1440
+
1441
+ }
1442
+
1443
+ /**
1444
+ * BasisU Texture Extension
1445
+ *
1446
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu
1447
+ *
1448
+ * @private
1449
+ */
1450
+ class GLTFTextureBasisUExtension {
1451
+
1452
+ constructor( parser ) {
1453
+
1454
+ this.parser = parser;
1455
+ this.name = EXTENSIONS.KHR_TEXTURE_BASISU;
1456
+
1457
+ }
1458
+
1459
+ loadTexture( textureIndex ) {
1460
+
1461
+ const parser = this.parser;
1462
+ const json = parser.json;
1463
+
1464
+ const textureDef = json.textures[ textureIndex ];
1465
+
1466
+ if ( ! textureDef.extensions || ! textureDef.extensions[ this.name ] ) {
1467
+
1468
+ return null;
1469
+
1470
+ }
1471
+
1472
+ const extension = textureDef.extensions[ this.name ];
1473
+ const loader = parser.options.ktx2Loader;
1474
+
1475
+ if ( ! loader ) {
1476
+
1477
+ if ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {
1478
+
1479
+ throw new Error( 'THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures' );
1480
+
1481
+ } else {
1482
+
1483
+ // Assumes that the extension is optional and that a fallback texture is present
1484
+ return null;
1485
+
1486
+ }
1487
+
1488
+ }
1489
+
1490
+ return parser.loadTextureImage( textureIndex, extension.source, loader );
1491
+
1492
+ }
1493
+
1494
+ }
1495
+
1496
+ /**
1497
+ * WebP Texture Extension
1498
+ *
1499
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp
1500
+ *
1501
+ * @private
1502
+ */
1503
+ class GLTFTextureWebPExtension {
1504
+
1505
+ constructor( parser ) {
1506
+
1507
+ this.parser = parser;
1508
+ this.name = EXTENSIONS.EXT_TEXTURE_WEBP;
1509
+
1510
+ }
1511
+
1512
+ loadTexture( textureIndex ) {
1513
+
1514
+ const name = this.name;
1515
+ const parser = this.parser;
1516
+ const json = parser.json;
1517
+
1518
+ const textureDef = json.textures[ textureIndex ];
1519
+
1520
+ if ( ! textureDef.extensions || ! textureDef.extensions[ name ] ) {
1521
+
1522
+ return null;
1523
+
1524
+ }
1525
+
1526
+ const extension = textureDef.extensions[ name ];
1527
+ const source = json.images[ extension.source ];
1528
+
1529
+ let loader = parser.textureLoader;
1530
+ if ( source.uri ) {
1531
+
1532
+ const handler = parser.options.manager.getHandler( source.uri );
1533
+ if ( handler !== null ) loader = handler;
1534
+
1535
+ }
1536
+
1537
+ return parser.loadTextureImage( textureIndex, extension.source, loader );
1538
+
1539
+ }
1540
+
1541
+ }
1542
+
1543
+ /**
1544
+ * AVIF Texture Extension
1545
+ *
1546
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_avif
1547
+ *
1548
+ * @private
1549
+ */
1550
+ class GLTFTextureAVIFExtension {
1551
+
1552
+ constructor( parser ) {
1553
+
1554
+ this.parser = parser;
1555
+ this.name = EXTENSIONS.EXT_TEXTURE_AVIF;
1556
+
1557
+ }
1558
+
1559
+ loadTexture( textureIndex ) {
1560
+
1561
+ const name = this.name;
1562
+ const parser = this.parser;
1563
+ const json = parser.json;
1564
+
1565
+ const textureDef = json.textures[ textureIndex ];
1566
+
1567
+ if ( ! textureDef.extensions || ! textureDef.extensions[ name ] ) {
1568
+
1569
+ return null;
1570
+
1571
+ }
1572
+
1573
+ const extension = textureDef.extensions[ name ];
1574
+ const source = json.images[ extension.source ];
1575
+
1576
+ let loader = parser.textureLoader;
1577
+ if ( source.uri ) {
1578
+
1579
+ const handler = parser.options.manager.getHandler( source.uri );
1580
+ if ( handler !== null ) loader = handler;
1581
+
1582
+ }
1583
+
1584
+ return parser.loadTextureImage( textureIndex, extension.source, loader );
1585
+
1586
+ }
1587
+
1588
+ }
1589
+
1590
+ /**
1591
+ * meshopt BufferView Compression Extension
1592
+ *
1593
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression
1594
+ *
1595
+ * @private
1596
+ */
1597
+ class GLTFMeshoptCompression {
1598
+
1599
+ constructor( parser, name ) {
1600
+
1601
+ this.name = name;
1602
+ this.parser = parser;
1603
+
1604
+ }
1605
+
1606
+ loadBufferView( index ) {
1607
+
1608
+ const json = this.parser.json;
1609
+ const bufferView = json.bufferViews[ index ];
1610
+
1611
+ if ( bufferView.extensions && bufferView.extensions[ this.name ] ) {
1612
+
1613
+ const extensionDef = bufferView.extensions[ this.name ];
1614
+
1615
+ const buffer = this.parser.getDependency( 'buffer', extensionDef.buffer );
1616
+ const decoder = this.parser.options.meshoptDecoder;
1617
+
1618
+ if ( ! decoder || ! decoder.supported ) {
1619
+
1620
+ if ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {
1621
+
1622
+ throw new Error( 'THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files' );
1623
+
1624
+ } else {
1625
+
1626
+ // Assumes that the extension is optional and that fallback buffer data is present
1627
+ return null;
1628
+
1629
+ }
1630
+
1631
+ }
1632
+
1633
+ return buffer.then( function ( res ) {
1634
+
1635
+ const byteOffset = extensionDef.byteOffset || 0;
1636
+ const byteLength = extensionDef.byteLength || 0;
1637
+
1638
+ const count = extensionDef.count;
1639
+ const stride = extensionDef.byteStride;
1640
+
1641
+ const source = new Uint8Array( res, byteOffset, byteLength );
1642
+
1643
+ if ( decoder.decodeGltfBufferAsync ) {
1644
+
1645
+ return decoder.decodeGltfBufferAsync( count, stride, source, extensionDef.mode, extensionDef.filter ).then( function ( res ) {
1646
+
1647
+ return res.buffer;
1648
+
1649
+ } );
1650
+
1651
+ } else {
1652
+
1653
+ // Support for MeshoptDecoder 0.18 or earlier, without decodeGltfBufferAsync
1654
+ return decoder.ready.then( function () {
1655
+
1656
+ const result = new ArrayBuffer( count * stride );
1657
+ decoder.decodeGltfBuffer( new Uint8Array( result ), count, stride, source, extensionDef.mode, extensionDef.filter );
1658
+ return result;
1659
+
1660
+ } );
1661
+
1662
+ }
1663
+
1664
+ } );
1665
+
1666
+ } else {
1667
+
1668
+ return null;
1669
+
1670
+ }
1671
+
1672
+ }
1673
+
1674
+ }
1675
+
1676
+ /**
1677
+ * GPU Instancing Extension
1678
+ *
1679
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_mesh_gpu_instancing
1680
+ *
1681
+ * @private
1682
+ */
1683
+ class GLTFMeshGpuInstancing {
1684
+
1685
+ constructor( parser ) {
1686
+
1687
+ this.name = EXTENSIONS.EXT_MESH_GPU_INSTANCING;
1688
+ this.parser = parser;
1689
+
1690
+ }
1691
+
1692
+ createNodeMesh( nodeIndex ) {
1693
+
1694
+ const json = this.parser.json;
1695
+ const nodeDef = json.nodes[ nodeIndex ];
1696
+
1697
+ if ( ! nodeDef.extensions || ! nodeDef.extensions[ this.name ] ||
1698
+ nodeDef.mesh === undefined ) {
1699
+
1700
+ return null;
1701
+
1702
+ }
1703
+
1704
+ const meshDef = json.meshes[ nodeDef.mesh ];
1705
+
1706
+ // No Points or Lines + Instancing support yet
1707
+
1708
+ for ( const primitive of meshDef.primitives ) {
1709
+
1710
+ if ( primitive.mode !== WEBGL_CONSTANTS.TRIANGLES &&
1711
+ primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_STRIP &&
1712
+ primitive.mode !== WEBGL_CONSTANTS.TRIANGLE_FAN &&
1713
+ primitive.mode !== undefined ) {
1714
+
1715
+ return null;
1716
+
1717
+ }
1718
+
1719
+ }
1720
+
1721
+ const extensionDef = nodeDef.extensions[ this.name ];
1722
+ const attributesDef = extensionDef.attributes;
1723
+
1724
+ // @TODO: Can we support InstancedMesh + SkinnedMesh?
1725
+
1726
+ const pending = [];
1727
+ const attributes = {};
1728
+
1729
+ for ( const key in attributesDef ) {
1730
+
1731
+ pending.push( this.parser.getDependency( 'accessor', attributesDef[ key ] ).then( accessor => {
1732
+
1733
+ attributes[ key ] = accessor;
1734
+ return attributes[ key ];
1735
+
1736
+ } ) );
1737
+
1738
+ }
1739
+
1740
+ if ( pending.length < 1 ) {
1741
+
1742
+ return null;
1743
+
1744
+ }
1745
+
1746
+ pending.push( this.parser.createNodeMesh( nodeIndex ) );
1747
+
1748
+ return Promise.all( pending ).then( results => {
1749
+
1750
+ const nodeObject = results.pop();
1751
+ const meshes = nodeObject.isGroup ? nodeObject.children : [ nodeObject ];
1752
+ const count = results[ 0 ].count; // All attribute counts should be same
1753
+ const instancedMeshes = [];
1754
+
1755
+ for ( const mesh of meshes ) {
1756
+
1757
+ // Temporal variables
1758
+ const m = new Matrix4();
1759
+ const p = new Vector3();
1760
+ const q = new Quaternion();
1761
+ const s = new Vector3( 1, 1, 1 );
1762
+
1763
+ const instancedMesh = new InstancedMesh( mesh.geometry, mesh.material, count );
1764
+
1765
+ for ( let i = 0; i < count; i ++ ) {
1766
+
1767
+ if ( attributes.TRANSLATION ) {
1768
+
1769
+ p.fromBufferAttribute( attributes.TRANSLATION, i );
1770
+
1771
+ }
1772
+
1773
+ if ( attributes.ROTATION ) {
1774
+
1775
+ q.fromBufferAttribute( attributes.ROTATION, i );
1776
+
1777
+ }
1778
+
1779
+ if ( attributes.SCALE ) {
1780
+
1781
+ s.fromBufferAttribute( attributes.SCALE, i );
1782
+
1783
+ }
1784
+
1785
+ instancedMesh.setMatrixAt( i, m.compose( p, q, s ) );
1786
+
1787
+ }
1788
+
1789
+ // Add instance attributes to the geometry, excluding TRS.
1790
+
1791
+ let instanceGeometry = null;
1792
+
1793
+ for ( const attributeName in attributes ) {
1794
+
1795
+ if ( attributeName === '_COLOR_0' ) {
1796
+
1797
+ const attr = attributes[ attributeName ];
1798
+ instancedMesh.instanceColor = new InstancedBufferAttribute( attr.array, attr.itemSize, attr.normalized );
1799
+
1800
+ } else if ( attributeName !== 'TRANSLATION' &&
1801
+ attributeName !== 'ROTATION' &&
1802
+ attributeName !== 'SCALE' ) {
1803
+
1804
+ if ( instanceGeometry === null ) {
1805
+
1806
+ // do a shallow clone of the goemetry so per-instance data are not shared
1807
+
1808
+ const source = instancedMesh.geometry;
1809
+ instanceGeometry = new BufferGeometry();
1810
+ instanceGeometry.name = source.name;
1811
+
1812
+ for ( const name in source.attributes ) instanceGeometry.setAttribute( name, source.attributes[ name ] );
1813
+ for ( const name in source.morphAttributes ) instanceGeometry.morphAttributes[ name ] = source.morphAttributes[ name ];
1814
+ if ( source.index !== null ) instanceGeometry.setIndex( source.index );
1815
+
1816
+ instanceGeometry.morphTargetsRelative = source.morphTargetsRelative;
1817
+
1818
+ for ( const group of source.groups ) instanceGeometry.addGroup( group.start, group.count, group.materialIndex );
1819
+
1820
+ if ( source.boundingBox !== null ) instanceGeometry.boundingBox = source.boundingBox.clone();
1821
+ if ( source.boundingSphere !== null ) instanceGeometry.boundingSphere = source.boundingSphere.clone();
1822
+
1823
+ instanceGeometry.drawRange.start = source.drawRange.start;
1824
+ instanceGeometry.drawRange.count = source.drawRange.count;
1825
+
1826
+ instanceGeometry.userData = Object.assign( {}, source.userData );
1827
+
1828
+ instancedMesh.geometry = instanceGeometry;
1829
+
1830
+ }
1831
+
1832
+ const attr = attributes[ attributeName ];
1833
+ instanceGeometry.setAttribute( attributeName, new InstancedBufferAttribute( attr.array, attr.itemSize, attr.normalized ) );
1834
+
1835
+ }
1836
+
1837
+ }
1838
+
1839
+ // Just in case
1840
+ Object3D.prototype.copy.call( instancedMesh, mesh );
1841
+
1842
+ this.parser.assignFinalMaterial( instancedMesh );
1843
+
1844
+ instancedMeshes.push( instancedMesh );
1845
+
1846
+ }
1847
+
1848
+ if ( nodeObject.isGroup ) {
1849
+
1850
+ nodeObject.clear();
1851
+
1852
+ nodeObject.add( ... instancedMeshes );
1853
+
1854
+ return nodeObject;
1855
+
1856
+ }
1857
+
1858
+ return instancedMeshes[ 0 ];
1859
+
1860
+ } );
1861
+
1862
+ }
1863
+
1864
+ }
1865
+
1866
+ /* BINARY EXTENSION */
1867
+ const BINARY_EXTENSION_HEADER_MAGIC = 'glTF';
1868
+ const BINARY_EXTENSION_HEADER_LENGTH = 12;
1869
+ const BINARY_EXTENSION_CHUNK_TYPES = { JSON: 0x4E4F534A, BIN: 0x004E4942 };
1870
+
1871
+ class GLTFBinaryExtension {
1872
+
1873
+ constructor( data ) {
1874
+
1875
+ this.name = EXTENSIONS.KHR_BINARY_GLTF;
1876
+ this.content = null;
1877
+ this.body = null;
1878
+
1879
+ const headerView = new DataView( data, 0, BINARY_EXTENSION_HEADER_LENGTH );
1880
+ const textDecoder = new TextDecoder();
1881
+
1882
+ this.header = {
1883
+ magic: textDecoder.decode( new Uint8Array( data.slice( 0, 4 ) ) ),
1884
+ version: headerView.getUint32( 4, true ),
1885
+ length: headerView.getUint32( 8, true )
1886
+ };
1887
+
1888
+ if ( this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC ) {
1889
+
1890
+ throw new Error( 'THREE.GLTFLoader: Unsupported glTF-Binary header.' );
1891
+
1892
+ } else if ( this.header.version < 2.0 ) {
1893
+
1894
+ throw new Error( 'THREE.GLTFLoader: Legacy binary file detected.' );
1895
+
1896
+ }
1897
+
1898
+ const chunkContentsLength = this.header.length - BINARY_EXTENSION_HEADER_LENGTH;
1899
+ const chunkView = new DataView( data, BINARY_EXTENSION_HEADER_LENGTH );
1900
+ let chunkIndex = 0;
1901
+
1902
+ while ( chunkIndex < chunkContentsLength ) {
1903
+
1904
+ const chunkLength = chunkView.getUint32( chunkIndex, true );
1905
+ chunkIndex += 4;
1906
+
1907
+ const chunkType = chunkView.getUint32( chunkIndex, true );
1908
+ chunkIndex += 4;
1909
+
1910
+ if ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON ) {
1911
+
1912
+ const contentArray = new Uint8Array( data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength );
1913
+ this.content = textDecoder.decode( contentArray );
1914
+
1915
+ } else if ( chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN ) {
1916
+
1917
+ const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
1918
+ this.body = data.slice( byteOffset, byteOffset + chunkLength );
1919
+
1920
+ }
1921
+
1922
+ // Clients must ignore chunks with unknown types.
1923
+
1924
+ chunkIndex += chunkLength;
1925
+
1926
+ }
1927
+
1928
+ if ( this.content === null ) {
1929
+
1930
+ throw new Error( 'THREE.GLTFLoader: JSON content not found.' );
1931
+
1932
+ }
1933
+
1934
+ }
1935
+
1936
+ }
1937
+
1938
+ /**
1939
+ * DRACO Mesh Compression Extension
1940
+ *
1941
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
1942
+ *
1943
+ * @private
1944
+ */
1945
+ class GLTFDracoMeshCompressionExtension {
1946
+
1947
+ constructor( json, dracoLoader ) {
1948
+
1949
+ if ( ! dracoLoader ) {
1950
+
1951
+ throw new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' );
1952
+
1953
+ }
1954
+
1955
+ this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION;
1956
+ this.json = json;
1957
+ this.dracoLoader = dracoLoader;
1958
+ this.dracoLoader.preload();
1959
+
1960
+ }
1961
+
1962
+ decodePrimitive( primitive, parser ) {
1963
+
1964
+ const json = this.json;
1965
+ const dracoLoader = this.dracoLoader;
1966
+ const bufferViewIndex = primitive.extensions[ this.name ].bufferView;
1967
+ const gltfAttributeMap = primitive.extensions[ this.name ].attributes;
1968
+ const threeAttributeMap = {};
1969
+ const attributeNormalizedMap = {};
1970
+ const attributeTypeMap = {};
1971
+
1972
+ for ( const attributeName in gltfAttributeMap ) {
1973
+
1974
+ const threeAttributeName = ATTRIBUTES[ attributeName ] || attributeName.toLowerCase();
1975
+
1976
+ threeAttributeMap[ threeAttributeName ] = gltfAttributeMap[ attributeName ];
1977
+
1978
+ }
1979
+
1980
+ for ( const attributeName in primitive.attributes ) {
1981
+
1982
+ const threeAttributeName = ATTRIBUTES[ attributeName ] || attributeName.toLowerCase();
1983
+
1984
+ if ( gltfAttributeMap[ attributeName ] !== undefined ) {
1985
+
1986
+ const accessorDef = json.accessors[ primitive.attributes[ attributeName ] ];
1987
+ const componentType = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
1988
+
1989
+ attributeTypeMap[ threeAttributeName ] = componentType.name;
1990
+ attributeNormalizedMap[ threeAttributeName ] = accessorDef.normalized === true;
1991
+
1992
+ }
1993
+
1994
+ }
1995
+
1996
+ return parser.getDependency( 'bufferView', bufferViewIndex ).then( function ( bufferView ) {
1997
+
1998
+ return new Promise( function ( resolve, reject ) {
1999
+
2000
+ dracoLoader.decodeDracoFile( bufferView, function ( geometry ) {
2001
+
2002
+ for ( const attributeName in geometry.attributes ) {
2003
+
2004
+ const attribute = geometry.attributes[ attributeName ];
2005
+ const normalized = attributeNormalizedMap[ attributeName ];
2006
+
2007
+ if ( normalized !== undefined ) attribute.normalized = normalized;
2008
+
2009
+ }
2010
+
2011
+ resolve( geometry );
2012
+
2013
+ }, threeAttributeMap, attributeTypeMap, LinearSRGBColorSpace, reject );
2014
+
2015
+ } );
2016
+
2017
+ } );
2018
+
2019
+ }
2020
+
2021
+ }
2022
+
2023
+ /**
2024
+ * Texture Transform Extension
2025
+ *
2026
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_transform
2027
+ *
2028
+ * @private
2029
+ */
2030
+ class GLTFTextureTransformExtension {
2031
+
2032
+ constructor() {
2033
+
2034
+ this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM;
2035
+
2036
+ }
2037
+
2038
+ extendTexture( texture, transform ) {
2039
+
2040
+ if ( ( transform.texCoord === undefined || transform.texCoord === texture.channel )
2041
+ && transform.offset === undefined
2042
+ && transform.rotation === undefined
2043
+ && transform.scale === undefined ) {
2044
+
2045
+ // See https://github.com/mrdoob/three.js/issues/21819.
2046
+ return texture;
2047
+
2048
+ }
2049
+
2050
+ texture = texture.clone();
2051
+
2052
+ if ( transform.texCoord !== undefined ) {
2053
+
2054
+ texture.channel = transform.texCoord;
2055
+
2056
+ }
2057
+
2058
+ if ( transform.offset !== undefined ) {
2059
+
2060
+ texture.offset.fromArray( transform.offset );
2061
+
2062
+ }
2063
+
2064
+ if ( transform.rotation !== undefined ) {
2065
+
2066
+ texture.rotation = transform.rotation;
2067
+
2068
+ }
2069
+
2070
+ if ( transform.scale !== undefined ) {
2071
+
2072
+ texture.repeat.fromArray( transform.scale );
2073
+
2074
+ }
2075
+
2076
+ if ( transform.rotation !== undefined ) {
2077
+
2078
+ // glTF's KHR_texture_transform order differs from three.js:
2079
+ // glTF defines the UV transform as T * R * S
2080
+ // three.js defines the UV transform as T * S * R
2081
+ //
2082
+ // To fix this, we need to override the matrix with the value computed per glTF spec
2083
+ // We still set the other fields so that you can inspect/export the resulting object.
2084
+
2085
+ const c = Math.cos( texture.rotation );
2086
+ const s = Math.sin( texture.rotation );
2087
+
2088
+ texture.matrix.set(
2089
+ texture.repeat.x * c, texture.repeat.y * s, texture.offset.x,
2090
+ - texture.repeat.x * s, texture.repeat.y * c, texture.offset.y,
2091
+ 0, 0, 1
2092
+ );
2093
+ texture.matrixAutoUpdate = false;
2094
+
2095
+ }
2096
+
2097
+ texture.needsUpdate = true;
2098
+
2099
+ return texture;
2100
+
2101
+ }
2102
+
2103
+ }
2104
+
2105
+ /**
2106
+ * Mesh Quantization Extension
2107
+ *
2108
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization
2109
+ *
2110
+ * @private
2111
+ */
2112
+ class GLTFMeshQuantizationExtension {
2113
+
2114
+ constructor() {
2115
+
2116
+ this.name = EXTENSIONS.KHR_MESH_QUANTIZATION;
2117
+
2118
+ }
2119
+
2120
+ }
2121
+
2122
+ /*********************************/
2123
+ /********** INTERPOLATION ********/
2124
+ /*********************************/
2125
+
2126
+ // Spline Interpolation
2127
+ // Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation
2128
+ class GLTFCubicSplineInterpolant extends Interpolant {
2129
+
2130
+ constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
2131
+
2132
+ super( parameterPositions, sampleValues, sampleSize, resultBuffer );
2133
+
2134
+ }
2135
+
2136
+ copySampleValue_( index ) {
2137
+
2138
+ // Copies a sample value to the result buffer. See description of glTF
2139
+ // CUBICSPLINE values layout in interpolate_() function below.
2140
+
2141
+ const result = this.resultBuffer,
2142
+ values = this.sampleValues,
2143
+ valueSize = this.valueSize,
2144
+ offset = index * valueSize * 3 + valueSize;
2145
+
2146
+ for ( let i = 0; i !== valueSize; i ++ ) {
2147
+
2148
+ result[ i ] = values[ offset + i ];
2149
+
2150
+ }
2151
+
2152
+ return result;
2153
+
2154
+ }
2155
+
2156
+ interpolate_( i1, t0, t, t1 ) {
2157
+
2158
+ const result = this.resultBuffer;
2159
+ const values = this.sampleValues;
2160
+ const stride = this.valueSize;
2161
+
2162
+ const stride2 = stride * 2;
2163
+ const stride3 = stride * 3;
2164
+
2165
+ const td = t1 - t0;
2166
+
2167
+ const p = ( t - t0 ) / td;
2168
+ const pp = p * p;
2169
+ const ppp = pp * p;
2170
+
2171
+ const offset1 = i1 * stride3;
2172
+ const offset0 = offset1 - stride3;
2173
+
2174
+ const s2 = - 2 * ppp + 3 * pp;
2175
+ const s3 = ppp - pp;
2176
+ const s0 = 1 - s2;
2177
+ const s1 = s3 - pp + p;
2178
+
2179
+ // Layout of keyframe output values for CUBICSPLINE animations:
2180
+ // [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
2181
+ for ( let i = 0; i !== stride; i ++ ) {
2182
+
2183
+ const p0 = values[ offset0 + i + stride ]; // splineVertex_k
2184
+ const m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k)
2185
+ const p1 = values[ offset1 + i + stride ]; // splineVertex_k+1
2186
+ const m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k)
2187
+
2188
+ result[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
2189
+
2190
+ }
2191
+
2192
+ return result;
2193
+
2194
+ }
2195
+
2196
+ }
2197
+
2198
+ const _quaternion = new Quaternion();
2199
+
2200
+ class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant {
2201
+
2202
+ interpolate_( i1, t0, t, t1 ) {
2203
+
2204
+ const result = super.interpolate_( i1, t0, t, t1 );
2205
+
2206
+ _quaternion.fromArray( result ).normalize().toArray( result );
2207
+
2208
+ return result;
2209
+
2210
+ }
2211
+
2212
+ }
2213
+
2214
+
2215
+ /*********************************/
2216
+ /********** INTERNALS ************/
2217
+ /*********************************/
2218
+
2219
+ /* CONSTANTS */
2220
+
2221
+ const WEBGL_CONSTANTS = {
2222
+ FLOAT: 5126,
2223
+ //FLOAT_MAT2: 35674,
2224
+ FLOAT_MAT3: 35675,
2225
+ FLOAT_MAT4: 35676,
2226
+ FLOAT_VEC2: 35664,
2227
+ FLOAT_VEC3: 35665,
2228
+ FLOAT_VEC4: 35666,
2229
+ LINEAR: 9729,
2230
+ REPEAT: 10497,
2231
+ SAMPLER_2D: 35678,
2232
+ POINTS: 0,
2233
+ LINES: 1,
2234
+ LINE_LOOP: 2,
2235
+ LINE_STRIP: 3,
2236
+ TRIANGLES: 4,
2237
+ TRIANGLE_STRIP: 5,
2238
+ TRIANGLE_FAN: 6,
2239
+ UNSIGNED_BYTE: 5121,
2240
+ UNSIGNED_SHORT: 5123
2241
+ };
2242
+
2243
+ const WEBGL_COMPONENT_TYPES = {
2244
+ 5120: Int8Array,
2245
+ 5121: Uint8Array,
2246
+ 5122: Int16Array,
2247
+ 5123: Uint16Array,
2248
+ 5125: Uint32Array,
2249
+ 5126: Float32Array
2250
+ };
2251
+
2252
+ const WEBGL_FILTERS = {
2253
+ 9728: NearestFilter,
2254
+ 9729: LinearFilter,
2255
+ 9984: NearestMipmapNearestFilter,
2256
+ 9985: LinearMipmapNearestFilter,
2257
+ 9986: NearestMipmapLinearFilter,
2258
+ 9987: LinearMipmapLinearFilter
2259
+ };
2260
+
2261
+ const WEBGL_WRAPPINGS = {
2262
+ 33071: ClampToEdgeWrapping,
2263
+ 33648: MirroredRepeatWrapping,
2264
+ 10497: RepeatWrapping
2265
+ };
2266
+
2267
+ const WEBGL_TYPE_SIZES = {
2268
+ 'SCALAR': 1,
2269
+ 'VEC2': 2,
2270
+ 'VEC3': 3,
2271
+ 'VEC4': 4,
2272
+ 'MAT2': 4,
2273
+ 'MAT3': 9,
2274
+ 'MAT4': 16
2275
+ };
2276
+
2277
+ const ATTRIBUTES = {
2278
+ POSITION: 'position',
2279
+ NORMAL: 'normal',
2280
+ TANGENT: 'tangent',
2281
+ TEXCOORD_0: 'uv',
2282
+ TEXCOORD_1: 'uv1',
2283
+ TEXCOORD_2: 'uv2',
2284
+ TEXCOORD_3: 'uv3',
2285
+ COLOR_0: 'color',
2286
+ WEIGHTS_0: 'skinWeight',
2287
+ JOINTS_0: 'skinIndex',
2288
+ };
2289
+
2290
+ const PATH_PROPERTIES = {
2291
+ scale: 'scale',
2292
+ translation: 'position',
2293
+ rotation: 'quaternion',
2294
+ weights: 'morphTargetInfluences'
2295
+ };
2296
+
2297
+ const INTERPOLATION = {
2298
+ CUBICSPLINE: undefined, // We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
2299
+ // keyframe track will be initialized with a default interpolation type, then modified.
2300
+ LINEAR: InterpolateLinear,
2301
+ STEP: InterpolateDiscrete
2302
+ };
2303
+
2304
+ const ALPHA_MODES = {
2305
+ OPAQUE: 'OPAQUE',
2306
+ MASK: 'MASK',
2307
+ BLEND: 'BLEND'
2308
+ };
2309
+
2310
+ /**
2311
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
2312
+ *
2313
+ * @private
2314
+ * @param {Object<string, Material>} cache
2315
+ * @return {Material}
2316
+ */
2317
+ function createDefaultMaterial( cache ) {
2318
+
2319
+ if ( cache[ 'DefaultMaterial' ] === undefined ) {
2320
+
2321
+ cache[ 'DefaultMaterial' ] = new MeshStandardMaterial( {
2322
+ color: 0xFFFFFF,
2323
+ emissive: 0x000000,
2324
+ metalness: 1,
2325
+ roughness: 1,
2326
+ transparent: false,
2327
+ depthTest: true,
2328
+ side: FrontSide
2329
+ } );
2330
+
2331
+ }
2332
+
2333
+ return cache[ 'DefaultMaterial' ];
2334
+
2335
+ }
2336
+
2337
+ function addUnknownExtensionsToUserData( knownExtensions, object, objectDef ) {
2338
+
2339
+ // Add unknown glTF extensions to an object's userData.
2340
+
2341
+ for ( const name in objectDef.extensions ) {
2342
+
2343
+ if ( knownExtensions[ name ] === undefined ) {
2344
+
2345
+ object.userData.gltfExtensions = object.userData.gltfExtensions || {};
2346
+ object.userData.gltfExtensions[ name ] = objectDef.extensions[ name ];
2347
+
2348
+ }
2349
+
2350
+ }
2351
+
2352
+ }
2353
+
2354
+ /**
2355
+ *
2356
+ * @private
2357
+ * @param {Object3D|Material|BufferGeometry|Object|AnimationClip} object
2358
+ * @param {GLTF.definition} gltfDef
2359
+ */
2360
+ function assignExtrasToUserData( object, gltfDef ) {
2361
+
2362
+ if ( gltfDef.extras !== undefined ) {
2363
+
2364
+ if ( typeof gltfDef.extras === 'object' ) {
2365
+
2366
+ Object.assign( object.userData, gltfDef.extras );
2367
+
2368
+ } else {
2369
+
2370
+ console.warn( 'THREE.GLTFLoader: Ignoring primitive type .extras, ' + gltfDef.extras );
2371
+
2372
+ }
2373
+
2374
+ }
2375
+
2376
+ }
2377
+
2378
+ /**
2379
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
2380
+ *
2381
+ * @private
2382
+ * @param {BufferGeometry} geometry
2383
+ * @param {Array<GLTF.Target>} targets
2384
+ * @param {GLTFParser} parser
2385
+ * @return {Promise<BufferGeometry>}
2386
+ */
2387
+ function addMorphTargets( geometry, targets, parser ) {
2388
+
2389
+ let hasMorphPosition = false;
2390
+ let hasMorphNormal = false;
2391
+ let hasMorphColor = false;
2392
+
2393
+ for ( let i = 0, il = targets.length; i < il; i ++ ) {
2394
+
2395
+ const target = targets[ i ];
2396
+
2397
+ if ( target.POSITION !== undefined ) hasMorphPosition = true;
2398
+ if ( target.NORMAL !== undefined ) hasMorphNormal = true;
2399
+ if ( target.COLOR_0 !== undefined ) hasMorphColor = true;
2400
+
2401
+ if ( hasMorphPosition && hasMorphNormal && hasMorphColor ) break;
2402
+
2403
+ }
2404
+
2405
+ if ( ! hasMorphPosition && ! hasMorphNormal && ! hasMorphColor ) return Promise.resolve( geometry );
2406
+
2407
+ const pendingPositionAccessors = [];
2408
+ const pendingNormalAccessors = [];
2409
+ const pendingColorAccessors = [];
2410
+
2411
+ for ( let i = 0, il = targets.length; i < il; i ++ ) {
2412
+
2413
+ const target = targets[ i ];
2414
+
2415
+ if ( hasMorphPosition ) {
2416
+
2417
+ const pendingAccessor = target.POSITION !== undefined
2418
+ ? parser.getDependency( 'accessor', target.POSITION )
2419
+ : geometry.attributes.position;
2420
+
2421
+ pendingPositionAccessors.push( pendingAccessor );
2422
+
2423
+ }
2424
+
2425
+ if ( hasMorphNormal ) {
2426
+
2427
+ const pendingAccessor = target.NORMAL !== undefined
2428
+ ? parser.getDependency( 'accessor', target.NORMAL )
2429
+ : geometry.attributes.normal;
2430
+
2431
+ pendingNormalAccessors.push( pendingAccessor );
2432
+
2433
+ }
2434
+
2435
+ if ( hasMorphColor ) {
2436
+
2437
+ const pendingAccessor = target.COLOR_0 !== undefined
2438
+ ? parser.getDependency( 'accessor', target.COLOR_0 )
2439
+ : geometry.attributes.color;
2440
+
2441
+ pendingColorAccessors.push( pendingAccessor );
2442
+
2443
+ }
2444
+
2445
+ }
2446
+
2447
+ return Promise.all( [
2448
+ Promise.all( pendingPositionAccessors ),
2449
+ Promise.all( pendingNormalAccessors ),
2450
+ Promise.all( pendingColorAccessors )
2451
+ ] ).then( function ( accessors ) {
2452
+
2453
+ const morphPositions = accessors[ 0 ];
2454
+ const morphNormals = accessors[ 1 ];
2455
+ const morphColors = accessors[ 2 ];
2456
+
2457
+ if ( hasMorphPosition ) geometry.morphAttributes.position = morphPositions;
2458
+ if ( hasMorphNormal ) geometry.morphAttributes.normal = morphNormals;
2459
+ if ( hasMorphColor ) geometry.morphAttributes.color = morphColors;
2460
+ geometry.morphTargetsRelative = true;
2461
+
2462
+ return geometry;
2463
+
2464
+ } );
2465
+
2466
+ }
2467
+
2468
+ /**
2469
+ *
2470
+ * @private
2471
+ * @param {Mesh} mesh
2472
+ * @param {GLTF.Mesh} meshDef
2473
+ */
2474
+ function updateMorphTargets( mesh, meshDef ) {
2475
+
2476
+ mesh.updateMorphTargets();
2477
+
2478
+ if ( meshDef.weights !== undefined ) {
2479
+
2480
+ for ( let i = 0, il = meshDef.weights.length; i < il; i ++ ) {
2481
+
2482
+ mesh.morphTargetInfluences[ i ] = meshDef.weights[ i ];
2483
+
2484
+ }
2485
+
2486
+ }
2487
+
2488
+ // .extras has user-defined data, so check that .extras.targetNames is an array.
2489
+ if ( meshDef.extras && Array.isArray( meshDef.extras.targetNames ) ) {
2490
+
2491
+ const targetNames = meshDef.extras.targetNames;
2492
+
2493
+ if ( mesh.morphTargetInfluences.length === targetNames.length ) {
2494
+
2495
+ mesh.morphTargetDictionary = {};
2496
+
2497
+ for ( let i = 0, il = targetNames.length; i < il; i ++ ) {
2498
+
2499
+ mesh.morphTargetDictionary[ targetNames[ i ] ] = i;
2500
+
2501
+ }
2502
+
2503
+ } else {
2504
+
2505
+ console.warn( 'THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.' );
2506
+
2507
+ }
2508
+
2509
+ }
2510
+
2511
+ }
2512
+
2513
+ function createPrimitiveKey( primitiveDef ) {
2514
+
2515
+ let geometryKey;
2516
+
2517
+ const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ];
2518
+
2519
+ if ( dracoExtension ) {
2520
+
2521
+ geometryKey = 'draco:' + dracoExtension.bufferView
2522
+ + ':' + dracoExtension.indices
2523
+ + ':' + createAttributesKey( dracoExtension.attributes );
2524
+
2525
+ } else {
2526
+
2527
+ geometryKey = primitiveDef.indices + ':' + createAttributesKey( primitiveDef.attributes ) + ':' + primitiveDef.mode;
2528
+
2529
+ }
2530
+
2531
+ if ( primitiveDef.targets !== undefined ) {
2532
+
2533
+ for ( let i = 0, il = primitiveDef.targets.length; i < il; i ++ ) {
2534
+
2535
+ geometryKey += ':' + createAttributesKey( primitiveDef.targets[ i ] );
2536
+
2537
+ }
2538
+
2539
+ }
2540
+
2541
+ return geometryKey;
2542
+
2543
+ }
2544
+
2545
+ function createAttributesKey( attributes ) {
2546
+
2547
+ let attributesKey = '';
2548
+
2549
+ const keys = Object.keys( attributes ).sort();
2550
+
2551
+ for ( let i = 0, il = keys.length; i < il; i ++ ) {
2552
+
2553
+ attributesKey += keys[ i ] + ':' + attributes[ keys[ i ] ] + ';';
2554
+
2555
+ }
2556
+
2557
+ return attributesKey;
2558
+
2559
+ }
2560
+
2561
+ function getNormalizedComponentScale( constructor ) {
2562
+
2563
+ // Reference:
2564
+ // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data
2565
+
2566
+ switch ( constructor ) {
2567
+
2568
+ case Int8Array:
2569
+ return 1 / 127;
2570
+
2571
+ case Uint8Array:
2572
+ return 1 / 255;
2573
+
2574
+ case Int16Array:
2575
+ return 1 / 32767;
2576
+
2577
+ case Uint16Array:
2578
+ return 1 / 65535;
2579
+
2580
+ default:
2581
+ throw new Error( 'THREE.GLTFLoader: Unsupported normalized accessor component type.' );
2582
+
2583
+ }
2584
+
2585
+ }
2586
+
2587
+ function getImageURIMimeType( uri ) {
2588
+
2589
+ if ( uri.search( /\.jpe?g($|\?)/i ) > 0 || uri.search( /^data\:image\/jpeg/ ) === 0 ) return 'image/jpeg';
2590
+ if ( uri.search( /\.webp($|\?)/i ) > 0 || uri.search( /^data\:image\/webp/ ) === 0 ) return 'image/webp';
2591
+ if ( uri.search( /\.ktx2($|\?)/i ) > 0 || uri.search( /^data\:image\/ktx2/ ) === 0 ) return 'image/ktx2';
2592
+
2593
+ return 'image/png';
2594
+
2595
+ }
2596
+
2597
+ const _identityMatrix = new Matrix4();
2598
+
2599
+ /* GLTF PARSER */
2600
+
2601
+ class GLTFParser {
2602
+
2603
+ constructor( json = {}, options = {} ) {
2604
+
2605
+ this.json = json;
2606
+ this.extensions = {};
2607
+ this.plugins = {};
2608
+ this.options = options;
2609
+
2610
+ // loader object cache
2611
+ this.cache = new GLTFRegistry();
2612
+
2613
+ // associations between Three.js objects and glTF elements
2614
+ this.associations = new Map();
2615
+
2616
+ // BufferGeometry caching
2617
+ this.primitiveCache = {};
2618
+
2619
+ // Node cache
2620
+ this.nodeCache = {};
2621
+
2622
+ // Object3D instance caches
2623
+ this.meshCache = { refs: {}, uses: {} };
2624
+ this.cameraCache = { refs: {}, uses: {} };
2625
+ this.lightCache = { refs: {}, uses: {} };
2626
+
2627
+ this.sourceCache = {};
2628
+ this.textureCache = {};
2629
+
2630
+ // Track node names, to ensure no duplicates
2631
+ this.nodeNamesUsed = {};
2632
+
2633
+ // Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
2634
+ // expensive work of uploading a texture to the GPU off the main thread.
2635
+
2636
+ let isSafari = false;
2637
+ let safariVersion = - 1;
2638
+ let isFirefox = false;
2639
+ let firefoxVersion = - 1;
2640
+
2641
+ if ( typeof navigator !== 'undefined' && typeof navigator.userAgent !== 'undefined' ) {
2642
+
2643
+ const userAgent = navigator.userAgent;
2644
+
2645
+ isSafari = /^((?!chrome|android).)*safari/i.test( userAgent ) === true;
2646
+ const safariMatch = userAgent.match( /Version\/(\d+)/ );
2647
+ safariVersion = isSafari && safariMatch ? parseInt( safariMatch[ 1 ], 10 ) : - 1;
2648
+
2649
+ isFirefox = userAgent.indexOf( 'Firefox' ) > - 1;
2650
+ firefoxVersion = isFirefox ? userAgent.match( /Firefox\/([0-9]+)\./ )[ 1 ] : - 1;
2651
+
2652
+ }
2653
+
2654
+ if ( typeof createImageBitmap === 'undefined' || ( isSafari && safariVersion < 17 ) || ( isFirefox && firefoxVersion < 98 ) ) {
2655
+
2656
+ this.textureLoader = new TextureLoader( this.options.manager );
2657
+
2658
+ } else {
2659
+
2660
+ this.textureLoader = new ImageBitmapLoader( this.options.manager );
2661
+
2662
+ }
2663
+
2664
+ this.textureLoader.setCrossOrigin( this.options.crossOrigin );
2665
+ this.textureLoader.setRequestHeader( this.options.requestHeader );
2666
+
2667
+ this.fileLoader = new FileLoader( this.options.manager );
2668
+ this.fileLoader.setResponseType( 'arraybuffer' );
2669
+
2670
+ if ( this.options.crossOrigin === 'use-credentials' ) {
2671
+
2672
+ this.fileLoader.setWithCredentials( true );
2673
+
2674
+ }
2675
+
2676
+ }
2677
+
2678
+ setExtensions( extensions ) {
2679
+
2680
+ this.extensions = extensions;
2681
+
2682
+ }
2683
+
2684
+ setPlugins( plugins ) {
2685
+
2686
+ this.plugins = plugins;
2687
+
2688
+ }
2689
+
2690
+ parse( onLoad, onError ) {
2691
+
2692
+ const parser = this;
2693
+ const json = this.json;
2694
+ const extensions = this.extensions;
2695
+
2696
+ // Clear the loader cache
2697
+ this.cache.removeAll();
2698
+ this.nodeCache = {};
2699
+
2700
+ // Mark the special nodes/meshes in json for efficient parse
2701
+ this._invokeAll( function ( ext ) {
2702
+
2703
+ return ext._markDefs && ext._markDefs();
2704
+
2705
+ } );
2706
+
2707
+ Promise.all( this._invokeAll( function ( ext ) {
2708
+
2709
+ return ext.beforeRoot && ext.beforeRoot();
2710
+
2711
+ } ) ).then( function () {
2712
+
2713
+ return Promise.all( [
2714
+
2715
+ parser.getDependencies( 'scene' ),
2716
+ parser.getDependencies( 'animation' ),
2717
+ parser.getDependencies( 'camera' ),
2718
+
2719
+ ] );
2720
+
2721
+ } ).then( function ( dependencies ) {
2722
+
2723
+ const result = {
2724
+ scene: dependencies[ 0 ][ json.scene || 0 ],
2725
+ scenes: dependencies[ 0 ],
2726
+ animations: dependencies[ 1 ],
2727
+ cameras: dependencies[ 2 ],
2728
+ asset: json.asset,
2729
+ parser: parser,
2730
+ userData: {}
2731
+ };
2732
+
2733
+ addUnknownExtensionsToUserData( extensions, result, json );
2734
+
2735
+ assignExtrasToUserData( result, json );
2736
+
2737
+ return Promise.all( parser._invokeAll( function ( ext ) {
2738
+
2739
+ return ext.afterRoot && ext.afterRoot( result );
2740
+
2741
+ } ) ).then( function () {
2742
+
2743
+ for ( const scene of result.scenes ) {
2744
+
2745
+ scene.updateMatrixWorld();
2746
+
2747
+ }
2748
+
2749
+ onLoad( result );
2750
+
2751
+ } );
2752
+
2753
+ } ).catch( onError );
2754
+
2755
+ }
2756
+
2757
+ /**
2758
+ * Marks the special nodes/meshes in json for efficient parse.
2759
+ *
2760
+ * @private
2761
+ */
2762
+ _markDefs() {
2763
+
2764
+ const nodeDefs = this.json.nodes || [];
2765
+ const skinDefs = this.json.skins || [];
2766
+ const meshDefs = this.json.meshes || [];
2767
+
2768
+ // Nothing in the node definition indicates whether it is a Bone or an
2769
+ // Object3D. Use the skins' joint references to mark bones.
2770
+ for ( let skinIndex = 0, skinLength = skinDefs.length; skinIndex < skinLength; skinIndex ++ ) {
2771
+
2772
+ const joints = skinDefs[ skinIndex ].joints;
2773
+
2774
+ for ( let i = 0, il = joints.length; i < il; i ++ ) {
2775
+
2776
+ nodeDefs[ joints[ i ] ].isBone = true;
2777
+
2778
+ }
2779
+
2780
+ }
2781
+
2782
+ // Iterate over all nodes, marking references to shared resources,
2783
+ // as well as skeleton joints.
2784
+ for ( let nodeIndex = 0, nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex ++ ) {
2785
+
2786
+ const nodeDef = nodeDefs[ nodeIndex ];
2787
+
2788
+ if ( nodeDef.mesh !== undefined ) {
2789
+
2790
+ this._addNodeRef( this.meshCache, nodeDef.mesh );
2791
+
2792
+ // Nothing in the mesh definition indicates whether it is
2793
+ // a SkinnedMesh or Mesh. Use the node's mesh reference
2794
+ // to mark SkinnedMesh if node has skin.
2795
+ if ( nodeDef.skin !== undefined ) {
2796
+
2797
+ meshDefs[ nodeDef.mesh ].isSkinnedMesh = true;
2798
+
2799
+ }
2800
+
2801
+ }
2802
+
2803
+ if ( nodeDef.camera !== undefined ) {
2804
+
2805
+ this._addNodeRef( this.cameraCache, nodeDef.camera );
2806
+
2807
+ }
2808
+
2809
+ }
2810
+
2811
+ }
2812
+
2813
+ /**
2814
+ * Counts references to shared node / Object3D resources. These resources
2815
+ * can be reused, or "instantiated", at multiple nodes in the scene
2816
+ * hierarchy. Mesh, Camera, and Light instances are instantiated and must
2817
+ * be marked. Non-scenegraph resources (like Materials, Geometries, and
2818
+ * Textures) can be reused directly and are not marked here.
2819
+ *
2820
+ * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
2821
+ *
2822
+ * @private
2823
+ * @param {Object} cache
2824
+ * @param {Object3D} index
2825
+ */
2826
+ _addNodeRef( cache, index ) {
2827
+
2828
+ if ( index === undefined ) return;
2829
+
2830
+ if ( cache.refs[ index ] === undefined ) {
2831
+
2832
+ cache.refs[ index ] = cache.uses[ index ] = 0;
2833
+
2834
+ }
2835
+
2836
+ cache.refs[ index ] ++;
2837
+
2838
+ }
2839
+
2840
+ /**
2841
+ * Returns a reference to a shared resource, cloning it if necessary.
2842
+ *
2843
+ * @private
2844
+ * @param {Object} cache
2845
+ * @param {number} index
2846
+ * @param {Object} object
2847
+ * @return {Object}
2848
+ */
2849
+ _getNodeRef( cache, index, object ) {
2850
+
2851
+ if ( cache.refs[ index ] <= 1 ) return object;
2852
+
2853
+ const ref = object.clone();
2854
+
2855
+ // Propagates mappings to the cloned object, prevents mappings on the
2856
+ // original object from being lost.
2857
+ const updateMappings = ( original, clone ) => {
2858
+
2859
+ const mappings = this.associations.get( original );
2860
+ if ( mappings != null ) {
2861
+
2862
+ this.associations.set( clone, mappings );
2863
+
2864
+ }
2865
+
2866
+ for ( const [ i, child ] of original.children.entries() ) {
2867
+
2868
+ updateMappings( child, clone.children[ i ] );
2869
+
2870
+ }
2871
+
2872
+ };
2873
+
2874
+ updateMappings( object, ref );
2875
+
2876
+ ref.name += '_instance_' + ( cache.uses[ index ] ++ );
2877
+
2878
+ return ref;
2879
+
2880
+ }
2881
+
2882
+ _invokeOne( func ) {
2883
+
2884
+ const extensions = Object.values( this.plugins );
2885
+ extensions.push( this );
2886
+
2887
+ for ( let i = 0; i < extensions.length; i ++ ) {
2888
+
2889
+ const result = func( extensions[ i ] );
2890
+
2891
+ if ( result ) return result;
2892
+
2893
+ }
2894
+
2895
+ return null;
2896
+
2897
+ }
2898
+
2899
+ _invokeAll( func ) {
2900
+
2901
+ const extensions = Object.values( this.plugins );
2902
+ extensions.unshift( this );
2903
+
2904
+ const pending = [];
2905
+
2906
+ for ( let i = 0; i < extensions.length; i ++ ) {
2907
+
2908
+ const result = func( extensions[ i ] );
2909
+
2910
+ if ( result ) pending.push( result );
2911
+
2912
+ }
2913
+
2914
+ return pending;
2915
+
2916
+ }
2917
+
2918
+ /**
2919
+ * Requests the specified dependency asynchronously, with caching.
2920
+ *
2921
+ * @private
2922
+ * @param {string} type
2923
+ * @param {number} index
2924
+ * @return {Promise<Object3D|Material|Texture|AnimationClip|ArrayBuffer|Object>}
2925
+ */
2926
+ getDependency( type, index ) {
2927
+
2928
+ const cacheKey = type + ':' + index;
2929
+ let dependency = this.cache.get( cacheKey );
2930
+
2931
+ if ( ! dependency ) {
2932
+
2933
+ switch ( type ) {
2934
+
2935
+ case 'scene':
2936
+ dependency = this.loadScene( index );
2937
+ break;
2938
+
2939
+ case 'node':
2940
+ dependency = this._invokeOne( function ( ext ) {
2941
+
2942
+ return ext.loadNode && ext.loadNode( index );
2943
+
2944
+ } );
2945
+ break;
2946
+
2947
+ case 'mesh':
2948
+ dependency = this._invokeOne( function ( ext ) {
2949
+
2950
+ return ext.loadMesh && ext.loadMesh( index );
2951
+
2952
+ } );
2953
+ break;
2954
+
2955
+ case 'accessor':
2956
+ dependency = this.loadAccessor( index );
2957
+ break;
2958
+
2959
+ case 'bufferView':
2960
+ dependency = this._invokeOne( function ( ext ) {
2961
+
2962
+ return ext.loadBufferView && ext.loadBufferView( index );
2963
+
2964
+ } );
2965
+ break;
2966
+
2967
+ case 'buffer':
2968
+ dependency = this.loadBuffer( index );
2969
+ break;
2970
+
2971
+ case 'material':
2972
+ dependency = this._invokeOne( function ( ext ) {
2973
+
2974
+ return ext.loadMaterial && ext.loadMaterial( index );
2975
+
2976
+ } );
2977
+ break;
2978
+
2979
+ case 'texture':
2980
+ dependency = this._invokeOne( function ( ext ) {
2981
+
2982
+ return ext.loadTexture && ext.loadTexture( index );
2983
+
2984
+ } );
2985
+ break;
2986
+
2987
+ case 'skin':
2988
+ dependency = this.loadSkin( index );
2989
+ break;
2990
+
2991
+ case 'animation':
2992
+ dependency = this._invokeOne( function ( ext ) {
2993
+
2994
+ return ext.loadAnimation && ext.loadAnimation( index );
2995
+
2996
+ } );
2997
+ break;
2998
+
2999
+ case 'camera':
3000
+ dependency = this.loadCamera( index );
3001
+ break;
3002
+
3003
+ default:
3004
+ dependency = this._invokeOne( function ( ext ) {
3005
+
3006
+ return ext != this && ext.getDependency && ext.getDependency( type, index );
3007
+
3008
+ } );
3009
+
3010
+ if ( ! dependency ) {
3011
+
3012
+ throw new Error( 'Unknown type: ' + type );
3013
+
3014
+ }
3015
+
3016
+ break;
3017
+
3018
+ }
3019
+
3020
+ this.cache.add( cacheKey, dependency );
3021
+
3022
+ }
3023
+
3024
+ return dependency;
3025
+
3026
+ }
3027
+
3028
+ /**
3029
+ * Requests all dependencies of the specified type asynchronously, with caching.
3030
+ *
3031
+ * @private
3032
+ * @param {string} type
3033
+ * @return {Promise<Array<Object>>}
3034
+ */
3035
+ getDependencies( type ) {
3036
+
3037
+ let dependencies = this.cache.get( type );
3038
+
3039
+ if ( ! dependencies ) {
3040
+
3041
+ const parser = this;
3042
+ const defs = this.json[ type + ( type === 'mesh' ? 'es' : 's' ) ] || [];
3043
+
3044
+ dependencies = Promise.all( defs.map( function ( def, index ) {
3045
+
3046
+ return parser.getDependency( type, index );
3047
+
3048
+ } ) );
3049
+
3050
+ this.cache.add( type, dependencies );
3051
+
3052
+ }
3053
+
3054
+ return dependencies;
3055
+
3056
+ }
3057
+
3058
+ /**
3059
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
3060
+ *
3061
+ * @private
3062
+ * @param {number} bufferIndex
3063
+ * @return {Promise<ArrayBuffer>}
3064
+ */
3065
+ loadBuffer( bufferIndex ) {
3066
+
3067
+ const bufferDef = this.json.buffers[ bufferIndex ];
3068
+ const loader = this.fileLoader;
3069
+
3070
+ if ( bufferDef.type && bufferDef.type !== 'arraybuffer' ) {
3071
+
3072
+ throw new Error( 'THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.' );
3073
+
3074
+ }
3075
+
3076
+ // If present, GLB container is required to be the first buffer.
3077
+ if ( bufferDef.uri === undefined && bufferIndex === 0 ) {
3078
+
3079
+ return Promise.resolve( this.extensions[ EXTENSIONS.KHR_BINARY_GLTF ].body );
3080
+
3081
+ }
3082
+
3083
+ const options = this.options;
3084
+
3085
+ return new Promise( function ( resolve, reject ) {
3086
+
3087
+ loader.load( LoaderUtils.resolveURL( bufferDef.uri, options.path ), resolve, undefined, function () {
3088
+
3089
+ reject( new Error( 'THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".' ) );
3090
+
3091
+ } );
3092
+
3093
+ } );
3094
+
3095
+ }
3096
+
3097
+ /**
3098
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
3099
+ *
3100
+ * @private
3101
+ * @param {number} bufferViewIndex
3102
+ * @return {Promise<ArrayBuffer>}
3103
+ */
3104
+ loadBufferView( bufferViewIndex ) {
3105
+
3106
+ const bufferViewDef = this.json.bufferViews[ bufferViewIndex ];
3107
+
3108
+ return this.getDependency( 'buffer', bufferViewDef.buffer ).then( function ( buffer ) {
3109
+
3110
+ const byteLength = bufferViewDef.byteLength || 0;
3111
+ const byteOffset = bufferViewDef.byteOffset || 0;
3112
+ return buffer.slice( byteOffset, byteOffset + byteLength );
3113
+
3114
+ } );
3115
+
3116
+ }
3117
+
3118
+ /**
3119
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
3120
+ *
3121
+ * @private
3122
+ * @param {number} accessorIndex
3123
+ * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
3124
+ */
3125
+ loadAccessor( accessorIndex ) {
3126
+
3127
+ const parser = this;
3128
+ const json = this.json;
3129
+
3130
+ const accessorDef = this.json.accessors[ accessorIndex ];
3131
+
3132
+ if ( accessorDef.bufferView === undefined && accessorDef.sparse === undefined ) {
3133
+
3134
+ const itemSize = WEBGL_TYPE_SIZES[ accessorDef.type ];
3135
+ const TypedArray = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
3136
+ const normalized = accessorDef.normalized === true;
3137
+
3138
+ const array = new TypedArray( accessorDef.count * itemSize );
3139
+ return Promise.resolve( new BufferAttribute( array, itemSize, normalized ) );
3140
+
3141
+ }
3142
+
3143
+ const pendingBufferViews = [];
3144
+
3145
+ if ( accessorDef.bufferView !== undefined ) {
3146
+
3147
+ pendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.bufferView ) );
3148
+
3149
+ } else {
3150
+
3151
+ pendingBufferViews.push( null );
3152
+
3153
+ }
3154
+
3155
+ if ( accessorDef.sparse !== undefined ) {
3156
+
3157
+ pendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.sparse.indices.bufferView ) );
3158
+ pendingBufferViews.push( this.getDependency( 'bufferView', accessorDef.sparse.values.bufferView ) );
3159
+
3160
+ }
3161
+
3162
+ return Promise.all( pendingBufferViews ).then( function ( bufferViews ) {
3163
+
3164
+ const bufferView = bufferViews[ 0 ];
3165
+
3166
+ const itemSize = WEBGL_TYPE_SIZES[ accessorDef.type ];
3167
+ const TypedArray = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
3168
+
3169
+ // For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.
3170
+ const elementBytes = TypedArray.BYTES_PER_ELEMENT;
3171
+ const itemBytes = elementBytes * itemSize;
3172
+ const byteOffset = accessorDef.byteOffset || 0;
3173
+ const byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[ accessorDef.bufferView ].byteStride : undefined;
3174
+ const normalized = accessorDef.normalized === true;
3175
+ let array, bufferAttribute;
3176
+
3177
+ // The buffer is not interleaved if the stride is the item size in bytes.
3178
+ if ( byteStride && byteStride !== itemBytes ) {
3179
+
3180
+ // Each "slice" of the buffer, as defined by 'count' elements of 'byteStride' bytes, gets its own InterleavedBuffer
3181
+ // This makes sure that IBA.count reflects accessor.count properly
3182
+ const ibSlice = Math.floor( byteOffset / byteStride );
3183
+ const ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count;
3184
+ let ib = parser.cache.get( ibCacheKey );
3185
+
3186
+ if ( ! ib ) {
3187
+
3188
+ array = new TypedArray( bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes );
3189
+
3190
+ // Integer parameters to IB/IBA are in array elements, not bytes.
3191
+ ib = new InterleavedBuffer( array, byteStride / elementBytes );
3192
+
3193
+ parser.cache.add( ibCacheKey, ib );
3194
+
3195
+ }
3196
+
3197
+ bufferAttribute = new InterleavedBufferAttribute( ib, itemSize, ( byteOffset % byteStride ) / elementBytes, normalized );
3198
+
3199
+ } else {
3200
+
3201
+ if ( bufferView === null ) {
3202
+
3203
+ array = new TypedArray( accessorDef.count * itemSize );
3204
+
3205
+ } else {
3206
+
3207
+ array = new TypedArray( bufferView, byteOffset, accessorDef.count * itemSize );
3208
+
3209
+ }
3210
+
3211
+ bufferAttribute = new BufferAttribute( array, itemSize, normalized );
3212
+
3213
+ }
3214
+
3215
+ // https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#sparse-accessors
3216
+ if ( accessorDef.sparse !== undefined ) {
3217
+
3218
+ const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR;
3219
+ const TypedArrayIndices = WEBGL_COMPONENT_TYPES[ accessorDef.sparse.indices.componentType ];
3220
+
3221
+ const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0;
3222
+ const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0;
3223
+
3224
+ const sparseIndices = new TypedArrayIndices( bufferViews[ 1 ], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices );
3225
+ const sparseValues = new TypedArray( bufferViews[ 2 ], byteOffsetValues, accessorDef.sparse.count * itemSize );
3226
+
3227
+ if ( bufferView !== null ) {
3228
+
3229
+ // Avoid modifying the original ArrayBuffer, if the bufferView wasn't initialized with zeroes.
3230
+ bufferAttribute = new BufferAttribute( bufferAttribute.array.slice(), bufferAttribute.itemSize, bufferAttribute.normalized );
3231
+
3232
+ }
3233
+
3234
+ // Ignore normalized since we copy from sparse
3235
+ bufferAttribute.normalized = false;
3236
+
3237
+ for ( let i = 0, il = sparseIndices.length; i < il; i ++ ) {
3238
+
3239
+ const index = sparseIndices[ i ];
3240
+
3241
+ bufferAttribute.setX( index, sparseValues[ i * itemSize ] );
3242
+ if ( itemSize >= 2 ) bufferAttribute.setY( index, sparseValues[ i * itemSize + 1 ] );
3243
+ if ( itemSize >= 3 ) bufferAttribute.setZ( index, sparseValues[ i * itemSize + 2 ] );
3244
+ if ( itemSize >= 4 ) bufferAttribute.setW( index, sparseValues[ i * itemSize + 3 ] );
3245
+ if ( itemSize >= 5 ) throw new Error( 'THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.' );
3246
+
3247
+ }
3248
+
3249
+ bufferAttribute.normalized = normalized;
3250
+
3251
+ }
3252
+
3253
+ return bufferAttribute;
3254
+
3255
+ } );
3256
+
3257
+ }
3258
+
3259
+ /**
3260
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
3261
+ *
3262
+ * @private
3263
+ * @param {number} textureIndex
3264
+ * @return {Promise<?Texture>}
3265
+ */
3266
+ loadTexture( textureIndex ) {
3267
+
3268
+ const json = this.json;
3269
+ const options = this.options;
3270
+ const textureDef = json.textures[ textureIndex ];
3271
+ const sourceIndex = textureDef.source;
3272
+ const sourceDef = json.images[ sourceIndex ];
3273
+
3274
+ let loader = this.textureLoader;
3275
+
3276
+ if ( sourceDef.uri ) {
3277
+
3278
+ const handler = options.manager.getHandler( sourceDef.uri );
3279
+ if ( handler !== null ) loader = handler;
3280
+
3281
+ }
3282
+
3283
+ return this.loadTextureImage( textureIndex, sourceIndex, loader );
3284
+
3285
+ }
3286
+
3287
+ loadTextureImage( textureIndex, sourceIndex, loader ) {
3288
+
3289
+ const parser = this;
3290
+ const json = this.json;
3291
+
3292
+ const textureDef = json.textures[ textureIndex ];
3293
+ const sourceDef = json.images[ sourceIndex ];
3294
+
3295
+ const cacheKey = ( sourceDef.uri || sourceDef.bufferView ) + ':' + textureDef.sampler;
3296
+
3297
+ if ( this.textureCache[ cacheKey ] ) {
3298
+
3299
+ // See https://github.com/mrdoob/three.js/issues/21559.
3300
+ return this.textureCache[ cacheKey ];
3301
+
3302
+ }
3303
+
3304
+ const promise = this.loadImageSource( sourceIndex, loader ).then( function ( texture ) {
3305
+
3306
+ texture.flipY = false;
3307
+
3308
+ texture.name = textureDef.name || sourceDef.name || '';
3309
+
3310
+ if ( texture.name === '' && typeof sourceDef.uri === 'string' && sourceDef.uri.startsWith( 'data:image/' ) === false ) {
3311
+
3312
+ texture.name = sourceDef.uri;
3313
+
3314
+ }
3315
+
3316
+ const samplers = json.samplers || {};
3317
+ const sampler = samplers[ textureDef.sampler ] || {};
3318
+
3319
+ texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ] || LinearFilter;
3320
+ texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ] || LinearMipmapLinearFilter;
3321
+ texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ] || RepeatWrapping;
3322
+ texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ] || RepeatWrapping;
3323
+ texture.generateMipmaps = ! texture.isCompressedTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
3324
+
3325
+ parser.associations.set( texture, { textures: textureIndex } );
3326
+
3327
+ return texture;
3328
+
3329
+ } ).catch( function () {
3330
+
3331
+ return null;
3332
+
3333
+ } );
3334
+
3335
+ this.textureCache[ cacheKey ] = promise;
3336
+
3337
+ return promise;
3338
+
3339
+ }
3340
+
3341
+ loadImageSource( sourceIndex, loader ) {
3342
+
3343
+ const parser = this;
3344
+ const json = this.json;
3345
+ const options = this.options;
3346
+
3347
+ if ( this.sourceCache[ sourceIndex ] !== undefined ) {
3348
+
3349
+ return this.sourceCache[ sourceIndex ].then( ( texture ) => texture.clone() );
3350
+
3351
+ }
3352
+
3353
+ const sourceDef = json.images[ sourceIndex ];
3354
+
3355
+ const URL = self.URL || self.webkitURL;
3356
+
3357
+ let sourceURI = sourceDef.uri || '';
3358
+ let isObjectURL = false;
3359
+
3360
+ if ( sourceDef.bufferView !== undefined ) {
3361
+
3362
+ // Load binary image data from bufferView, if provided.
3363
+
3364
+ sourceURI = parser.getDependency( 'bufferView', sourceDef.bufferView ).then( function ( bufferView ) {
3365
+
3366
+ isObjectURL = true;
3367
+ const blob = new Blob( [ bufferView ], { type: sourceDef.mimeType } );
3368
+ sourceURI = URL.createObjectURL( blob );
3369
+ return sourceURI;
3370
+
3371
+ } );
3372
+
3373
+ } else if ( sourceDef.uri === undefined ) {
3374
+
3375
+ throw new Error( 'THREE.GLTFLoader: Image ' + sourceIndex + ' is missing URI and bufferView' );
3376
+
3377
+ }
3378
+
3379
+ const promise = Promise.resolve( sourceURI ).then( function ( sourceURI ) {
3380
+
3381
+ return new Promise( function ( resolve, reject ) {
3382
+
3383
+ let onLoad = resolve;
3384
+
3385
+ if ( loader.isImageBitmapLoader === true ) {
3386
+
3387
+ onLoad = function ( imageBitmap ) {
3388
+
3389
+ const texture = new Texture( imageBitmap );
3390
+ texture.needsUpdate = true;
3391
+
3392
+ resolve( texture );
3393
+
3394
+ };
3395
+
3396
+ }
3397
+
3398
+ loader.load( LoaderUtils.resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
3399
+
3400
+ } );
3401
+
3402
+ } ).then( function ( texture ) {
3403
+
3404
+ // Clean up resources and configure Texture.
3405
+
3406
+ if ( isObjectURL === true ) {
3407
+
3408
+ URL.revokeObjectURL( sourceURI );
3409
+
3410
+ }
3411
+
3412
+ assignExtrasToUserData( texture, sourceDef );
3413
+
3414
+ texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType( sourceDef.uri );
3415
+
3416
+ return texture;
3417
+
3418
+ } ).catch( function ( error ) {
3419
+
3420
+ console.error( 'THREE.GLTFLoader: Couldn\'t load texture', sourceURI );
3421
+ throw error;
3422
+
3423
+ } );
3424
+
3425
+ this.sourceCache[ sourceIndex ] = promise;
3426
+ return promise;
3427
+
3428
+ }
3429
+
3430
+ /**
3431
+ * Asynchronously assigns a texture to the given material parameters.
3432
+ *
3433
+ * @private
3434
+ * @param {Object} materialParams
3435
+ * @param {string} mapName
3436
+ * @param {Object} mapDef
3437
+ * @param {string} [colorSpace]
3438
+ * @return {Promise<Texture>}
3439
+ */
3440
+ assignTexture( materialParams, mapName, mapDef, colorSpace ) {
3441
+
3442
+ const parser = this;
3443
+
3444
+ return this.getDependency( 'texture', mapDef.index ).then( function ( texture ) {
3445
+
3446
+ if ( ! texture ) return null;
3447
+
3448
+ if ( mapDef.texCoord !== undefined && mapDef.texCoord > 0 ) {
3449
+
3450
+ texture = texture.clone();
3451
+ texture.channel = mapDef.texCoord;
3452
+
3453
+ }
3454
+
3455
+ if ( parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ] ) {
3456
+
3457
+ const transform = mapDef.extensions !== undefined ? mapDef.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ] : undefined;
3458
+
3459
+ if ( transform ) {
3460
+
3461
+ const gltfReference = parser.associations.get( texture );
3462
+ texture = parser.extensions[ EXTENSIONS.KHR_TEXTURE_TRANSFORM ].extendTexture( texture, transform );
3463
+ parser.associations.set( texture, gltfReference );
3464
+
3465
+ }
3466
+
3467
+ }
3468
+
3469
+ if ( colorSpace !== undefined ) {
3470
+
3471
+ texture.colorSpace = colorSpace;
3472
+
3473
+ }
3474
+
3475
+ materialParams[ mapName ] = texture;
3476
+
3477
+ return texture;
3478
+
3479
+ } );
3480
+
3481
+ }
3482
+
3483
+ /**
3484
+ * Assigns final material to a Mesh, Line, or Points instance. The instance
3485
+ * already has a material (generated from the glTF material options alone)
3486
+ * but reuse of the same glTF material may require multiple threejs materials
3487
+ * to accommodate different primitive types, defines, etc. New materials will
3488
+ * be created if necessary, and reused from a cache.
3489
+ *
3490
+ * @private
3491
+ * @param {Object3D} mesh Mesh, Line, or Points instance.
3492
+ */
3493
+ assignFinalMaterial( mesh ) {
3494
+
3495
+ const geometry = mesh.geometry;
3496
+ let material = mesh.material;
3497
+
3498
+ const useDerivativeTangents = geometry.attributes.tangent === undefined;
3499
+ const useVertexColors = geometry.attributes.color !== undefined;
3500
+ const useFlatShading = geometry.attributes.normal === undefined;
3501
+
3502
+ if ( mesh.isPoints ) {
3503
+
3504
+ const cacheKey = 'PointsMaterial:' + material.uuid;
3505
+
3506
+ let pointsMaterial = this.cache.get( cacheKey );
3507
+
3508
+ if ( ! pointsMaterial ) {
3509
+
3510
+ pointsMaterial = new PointsMaterial();
3511
+ Material.prototype.copy.call( pointsMaterial, material );
3512
+ pointsMaterial.color.copy( material.color );
3513
+ pointsMaterial.map = material.map;
3514
+ pointsMaterial.sizeAttenuation = false; // glTF spec says points should be 1px
3515
+
3516
+ this.cache.add( cacheKey, pointsMaterial );
3517
+
3518
+ }
3519
+
3520
+ material = pointsMaterial;
3521
+
3522
+ } else if ( mesh.isLine ) {
3523
+
3524
+ const cacheKey = 'LineBasicMaterial:' + material.uuid;
3525
+
3526
+ let lineMaterial = this.cache.get( cacheKey );
3527
+
3528
+ if ( ! lineMaterial ) {
3529
+
3530
+ lineMaterial = new LineBasicMaterial();
3531
+ Material.prototype.copy.call( lineMaterial, material );
3532
+ lineMaterial.color.copy( material.color );
3533
+ lineMaterial.map = material.map;
3534
+
3535
+ this.cache.add( cacheKey, lineMaterial );
3536
+
3537
+ }
3538
+
3539
+ material = lineMaterial;
3540
+
3541
+ }
3542
+
3543
+ // Clone the material if it will be modified
3544
+ if ( useDerivativeTangents || useVertexColors || useFlatShading ) {
3545
+
3546
+ let cacheKey = 'ClonedMaterial:' + material.uuid + ':';
3547
+
3548
+ if ( useDerivativeTangents ) cacheKey += 'derivative-tangents:';
3549
+ if ( useVertexColors ) cacheKey += 'vertex-colors:';
3550
+ if ( useFlatShading ) cacheKey += 'flat-shading:';
3551
+
3552
+ let cachedMaterial = this.cache.get( cacheKey );
3553
+
3554
+ if ( ! cachedMaterial ) {
3555
+
3556
+ cachedMaterial = material.clone();
3557
+
3558
+ if ( useVertexColors ) cachedMaterial.vertexColors = true;
3559
+ if ( useFlatShading ) cachedMaterial.flatShading = true;
3560
+
3561
+ if ( useDerivativeTangents ) {
3562
+
3563
+ // https://github.com/mrdoob/three.js/issues/11438#issuecomment-507003995
3564
+ if ( cachedMaterial.normalScale ) cachedMaterial.normalScale.y *= - 1;
3565
+ if ( cachedMaterial.clearcoatNormalScale ) cachedMaterial.clearcoatNormalScale.y *= - 1;
3566
+
3567
+ }
3568
+
3569
+ this.cache.add( cacheKey, cachedMaterial );
3570
+
3571
+ this.associations.set( cachedMaterial, this.associations.get( material ) );
3572
+
3573
+ }
3574
+
3575
+ material = cachedMaterial;
3576
+
3577
+ }
3578
+
3579
+ mesh.material = material;
3580
+
3581
+ }
3582
+
3583
+ getMaterialType( /* materialIndex */ ) {
3584
+
3585
+ return MeshStandardMaterial;
3586
+
3587
+ }
3588
+
3589
+ /**
3590
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
3591
+ *
3592
+ * @private
3593
+ * @param {number} materialIndex
3594
+ * @return {Promise<Material>}
3595
+ */
3596
+ loadMaterial( materialIndex ) {
3597
+
3598
+ const parser = this;
3599
+ const json = this.json;
3600
+ const extensions = this.extensions;
3601
+ const materialDef = json.materials[ materialIndex ];
3602
+
3603
+ let materialType;
3604
+ const materialParams = {};
3605
+ const materialExtensions = materialDef.extensions || {};
3606
+
3607
+ const pending = [];
3608
+
3609
+ if ( materialExtensions[ EXTENSIONS.KHR_MATERIALS_UNLIT ] ) {
3610
+
3611
+ const kmuExtension = extensions[ EXTENSIONS.KHR_MATERIALS_UNLIT ];
3612
+ materialType = kmuExtension.getMaterialType();
3613
+ pending.push( kmuExtension.extendParams( materialParams, materialDef, parser ) );
3614
+
3615
+ } else {
3616
+
3617
+ // Specification:
3618
+ // https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#metallic-roughness-material
3619
+
3620
+ const metallicRoughness = materialDef.pbrMetallicRoughness || {};
3621
+
3622
+ materialParams.color = new Color( 1.0, 1.0, 1.0 );
3623
+ materialParams.opacity = 1.0;
3624
+
3625
+ if ( Array.isArray( metallicRoughness.baseColorFactor ) ) {
3626
+
3627
+ const array = metallicRoughness.baseColorFactor;
3628
+
3629
+ materialParams.color.setRGB( array[ 0 ], array[ 1 ], array[ 2 ], LinearSRGBColorSpace );
3630
+ materialParams.opacity = array[ 3 ];
3631
+
3632
+ }
3633
+
3634
+ if ( metallicRoughness.baseColorTexture !== undefined ) {
3635
+
3636
+ pending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture, SRGBColorSpace ) );
3637
+
3638
+ }
3639
+
3640
+ materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;
3641
+ materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;
3642
+
3643
+ if ( metallicRoughness.metallicRoughnessTexture !== undefined ) {
3644
+
3645
+ pending.push( parser.assignTexture( materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture ) );
3646
+ pending.push( parser.assignTexture( materialParams, 'roughnessMap', metallicRoughness.metallicRoughnessTexture ) );
3647
+
3648
+ }
3649
+
3650
+ materialType = this._invokeOne( function ( ext ) {
3651
+
3652
+ return ext.getMaterialType && ext.getMaterialType( materialIndex );
3653
+
3654
+ } );
3655
+
3656
+ pending.push( Promise.all( this._invokeAll( function ( ext ) {
3657
+
3658
+ return ext.extendMaterialParams && ext.extendMaterialParams( materialIndex, materialParams );
3659
+
3660
+ } ) ) );
3661
+
3662
+ }
3663
+
3664
+ if ( materialDef.doubleSided === true ) {
3665
+
3666
+ materialParams.side = DoubleSide;
3667
+
3668
+ }
3669
+
3670
+ const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE;
3671
+
3672
+ if ( alphaMode === ALPHA_MODES.BLEND ) {
3673
+
3674
+ materialParams.transparent = true;
3675
+
3676
+ // See: https://github.com/mrdoob/three.js/issues/17706
3677
+ materialParams.depthWrite = false;
3678
+
3679
+ } else {
3680
+
3681
+ materialParams.transparent = false;
3682
+
3683
+ if ( alphaMode === ALPHA_MODES.MASK ) {
3684
+
3685
+ materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5;
3686
+
3687
+ }
3688
+
3689
+ }
3690
+
3691
+ if ( materialDef.normalTexture !== undefined && materialType !== MeshBasicMaterial ) {
3692
+
3693
+ pending.push( parser.assignTexture( materialParams, 'normalMap', materialDef.normalTexture ) );
3694
+
3695
+ materialParams.normalScale = new Vector2( 1, 1 );
3696
+
3697
+ if ( materialDef.normalTexture.scale !== undefined ) {
3698
+
3699
+ const scale = materialDef.normalTexture.scale;
3700
+
3701
+ materialParams.normalScale.set( scale, scale );
3702
+
3703
+ }
3704
+
3705
+ }
3706
+
3707
+ if ( materialDef.occlusionTexture !== undefined && materialType !== MeshBasicMaterial ) {
3708
+
3709
+ pending.push( parser.assignTexture( materialParams, 'aoMap', materialDef.occlusionTexture ) );
3710
+
3711
+ if ( materialDef.occlusionTexture.strength !== undefined ) {
3712
+
3713
+ materialParams.aoMapIntensity = materialDef.occlusionTexture.strength;
3714
+
3715
+ }
3716
+
3717
+ }
3718
+
3719
+ if ( materialDef.emissiveFactor !== undefined && materialType !== MeshBasicMaterial ) {
3720
+
3721
+ const emissiveFactor = materialDef.emissiveFactor;
3722
+ materialParams.emissive = new Color().setRGB( emissiveFactor[ 0 ], emissiveFactor[ 1 ], emissiveFactor[ 2 ], LinearSRGBColorSpace );
3723
+
3724
+ }
3725
+
3726
+ if ( materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial ) {
3727
+
3728
+ pending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture, SRGBColorSpace ) );
3729
+
3730
+ }
3731
+
3732
+ return Promise.all( pending ).then( function () {
3733
+
3734
+ const material = new materialType( materialParams );
3735
+
3736
+ if ( materialDef.name ) material.name = materialDef.name;
3737
+
3738
+ assignExtrasToUserData( material, materialDef );
3739
+
3740
+ parser.associations.set( material, { materials: materialIndex } );
3741
+
3742
+ if ( materialDef.extensions ) addUnknownExtensionsToUserData( extensions, material, materialDef );
3743
+
3744
+ return material;
3745
+
3746
+ } );
3747
+
3748
+ }
3749
+
3750
+ /**
3751
+ * When Object3D instances are targeted by animation, they need unique names.
3752
+ *
3753
+ * @private
3754
+ * @param {string} originalName
3755
+ * @return {string}
3756
+ */
3757
+ createUniqueName( originalName ) {
3758
+
3759
+ const sanitizedName = PropertyBinding.sanitizeNodeName( originalName || '' );
3760
+
3761
+ if ( sanitizedName in this.nodeNamesUsed ) {
3762
+
3763
+ return sanitizedName + '_' + ( ++ this.nodeNamesUsed[ sanitizedName ] );
3764
+
3765
+ } else {
3766
+
3767
+ this.nodeNamesUsed[ sanitizedName ] = 0;
3768
+
3769
+ return sanitizedName;
3770
+
3771
+ }
3772
+
3773
+ }
3774
+
3775
+ /**
3776
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
3777
+ *
3778
+ * Creates BufferGeometries from primitives.
3779
+ *
3780
+ * @private
3781
+ * @param {Array<GLTF.Primitive>} primitives
3782
+ * @return {Promise<Array<BufferGeometry>>}
3783
+ */
3784
+ loadGeometries( primitives ) {
3785
+
3786
+ const parser = this;
3787
+ const extensions = this.extensions;
3788
+ const cache = this.primitiveCache;
3789
+
3790
+ function createDracoPrimitive( primitive ) {
3791
+
3792
+ return extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ]
3793
+ .decodePrimitive( primitive, parser )
3794
+ .then( function ( geometry ) {
3795
+
3796
+ return addPrimitiveAttributes( geometry, primitive, parser );
3797
+
3798
+ } );
3799
+
3800
+ }
3801
+
3802
+ const pending = [];
3803
+
3804
+ for ( let i = 0, il = primitives.length; i < il; i ++ ) {
3805
+
3806
+ const primitive = primitives[ i ];
3807
+ const cacheKey = createPrimitiveKey( primitive );
3808
+
3809
+ // See if we've already created this geometry
3810
+ const cached = cache[ cacheKey ];
3811
+
3812
+ if ( cached ) {
3813
+
3814
+ // Use the cached geometry if it exists
3815
+ pending.push( cached.promise );
3816
+
3817
+ } else {
3818
+
3819
+ let geometryPromise;
3820
+
3821
+ if ( primitive.extensions && primitive.extensions[ EXTENSIONS.KHR_DRACO_MESH_COMPRESSION ] ) {
3822
+
3823
+ // Use DRACO geometry if available
3824
+ geometryPromise = createDracoPrimitive( primitive );
3825
+
3826
+ } else {
3827
+
3828
+ // Otherwise create a new geometry
3829
+ geometryPromise = addPrimitiveAttributes( new BufferGeometry(), primitive, parser );
3830
+
3831
+ }
3832
+
3833
+ // Convert strip/fan primitives to triangles
3834
+
3835
+ if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ) {
3836
+
3837
+ geometryPromise = geometryPromise.then( geometry => toTrianglesDrawMode( geometry, TriangleStripDrawMode ) );
3838
+
3839
+ } else if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ) {
3840
+
3841
+ geometryPromise = geometryPromise.then( geometry => toTrianglesDrawMode( geometry, TriangleFanDrawMode ) );
3842
+
3843
+ }
3844
+
3845
+ // Cache this geometry
3846
+ cache[ cacheKey ] = { primitive: primitive, promise: geometryPromise };
3847
+
3848
+ pending.push( geometryPromise );
3849
+
3850
+ }
3851
+
3852
+ }
3853
+
3854
+ return Promise.all( pending );
3855
+
3856
+ }
3857
+
3858
+ /**
3859
+ * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
3860
+ *
3861
+ * @private
3862
+ * @param {number} meshIndex
3863
+ * @return {Promise<Group|Mesh|SkinnedMesh|Line|Points>}
3864
+ */
3865
+ loadMesh( meshIndex ) {
3866
+
3867
+ const parser = this;
3868
+ const json = this.json;
3869
+ const extensions = this.extensions;
3870
+
3871
+ const meshDef = json.meshes[ meshIndex ];
3872
+ const primitives = meshDef.primitives;
3873
+
3874
+ const pending = [];
3875
+
3876
+ for ( let i = 0, il = primitives.length; i < il; i ++ ) {
3877
+
3878
+ const material = primitives[ i ].material === undefined
3879
+ ? createDefaultMaterial( this.cache )
3880
+ : this.getDependency( 'material', primitives[ i ].material );
3881
+
3882
+ pending.push( material );
3883
+
3884
+ }
3885
+
3886
+ pending.push( parser.loadGeometries( primitives ) );
3887
+
3888
+ return Promise.all( pending ).then( async function ( results ) {
3889
+
3890
+ const materials = results.slice( 0, results.length - 1 );
3891
+ const geometries = results[ results.length - 1 ];
3892
+
3893
+ const meshes = [];
3894
+
3895
+ for ( let i = 0, il = geometries.length; i < il; i ++ ) {
3896
+
3897
+ const geometry = geometries[ i ];
3898
+ const primitive = primitives[ i ];
3899
+
3900
+ // 1. create Mesh
3901
+
3902
+ let mesh;
3903
+
3904
+ const material = materials[ i ];
3905
+
3906
+ if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||
3907
+ primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||
3908
+ primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN ||
3909
+ primitive.mode === undefined ) {
3910
+
3911
+ const needsSkinning = meshDef.isSkinnedMesh === true;
3912
+ const hasSkinningAttributes = geometry.hasAttribute( 'skinIndex' ) && geometry.hasAttribute( 'skinWeight' );
3913
+
3914
+ if ( needsSkinning && hasSkinningAttributes === false ) {
3915
+
3916
+ console.warn( 'THREE.GLTFLoader: Missing skinIndex or skinWeight attributes. Skinning disabled.' );
3917
+
3918
+ }
3919
+
3920
+ // .isSkinnedMesh isn't in glTF spec. See ._markDefs()
3921
+ mesh = ( needsSkinning && hasSkinningAttributes )
3922
+ ? new SkinnedMesh( geometry, material )
3923
+ : new Mesh( geometry, material );
3924
+
3925
+ if ( mesh.isSkinnedMesh === true ) {
3926
+
3927
+ // normalize skin weights to fix malformed assets (see #15319)
3928
+ mesh.normalizeSkinWeights();
3929
+
3930
+ }
3931
+
3932
+ } else if ( primitive.mode === WEBGL_CONSTANTS.LINES ) {
3933
+
3934
+ mesh = new LineSegments( geometry, material );
3935
+
3936
+ } else if ( primitive.mode === WEBGL_CONSTANTS.LINE_STRIP ) {
3937
+
3938
+ mesh = new Line( geometry, material );
3939
+
3940
+ } else if ( primitive.mode === WEBGL_CONSTANTS.LINE_LOOP ) {
3941
+
3942
+ mesh = new LineLoop( geometry, material );
3943
+
3944
+ } else if ( primitive.mode === WEBGL_CONSTANTS.POINTS ) {
3945
+
3946
+ mesh = new Points( geometry, material );
3947
+
3948
+ } else {
3949
+
3950
+ throw new Error( 'THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode );
3951
+
3952
+ }
3953
+
3954
+ if ( Object.keys( mesh.geometry.morphAttributes ).length > 0 ) {
3955
+
3956
+ updateMorphTargets( mesh, meshDef );
3957
+
3958
+ }
3959
+
3960
+ mesh.name = parser.createUniqueName( meshDef.name || ( 'mesh_' + meshIndex ) );
3961
+
3962
+ assignExtrasToUserData( mesh, meshDef );
3963
+
3964
+ if ( primitive.extensions ) addUnknownExtensionsToUserData( extensions, mesh, primitive );
3965
+
3966
+ parser.assignFinalMaterial( mesh );
3967
+
3968
+ meshes.push( mesh );
3969
+
3970
+ }
3971
+
3972
+ for ( let i = 0, il = meshes.length; i < il; i ++ ) {
3973
+
3974
+ parser.associations.set( meshes[ i ], {
3975
+ meshes: meshIndex,
3976
+ primitives: i
3977
+ } );
3978
+
3979
+ }
3980
+
3981
+ if ( meshes.length === 1 ) {
3982
+
3983
+ if ( meshDef.extensions ) addUnknownExtensionsToUserData( extensions, meshes[ 0 ], meshDef );
3984
+
3985
+ return meshes[ 0 ];
3986
+
3987
+ }
3988
+
3989
+ const group = new Group();
3990
+
3991
+ if ( meshDef.extensions ) addUnknownExtensionsToUserData( extensions, group, meshDef );
3992
+
3993
+ parser.associations.set( group, { meshes: meshIndex } );
3994
+
3995
+ for ( let i = 0, il = meshes.length; i < il; i ++ ) {
3996
+
3997
+ group.add( meshes[ i ] );
3998
+
3999
+ }
4000
+
4001
+ return group;
4002
+
4003
+ } );
4004
+
4005
+ }
4006
+
4007
+ /**
4008
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
4009
+ *
4010
+ * @private
4011
+ * @param {number} cameraIndex
4012
+ * @return {Promise<Camera>|undefined}
4013
+ */
4014
+ loadCamera( cameraIndex ) {
4015
+
4016
+ let camera;
4017
+ const cameraDef = this.json.cameras[ cameraIndex ];
4018
+ const params = cameraDef[ cameraDef.type ];
4019
+
4020
+ if ( ! params ) {
4021
+
4022
+ console.warn( 'THREE.GLTFLoader: Missing camera parameters.' );
4023
+ return;
4024
+
4025
+ }
4026
+
4027
+ if ( cameraDef.type === 'perspective' ) {
4028
+
4029
+ camera = new PerspectiveCamera( MathUtils.radToDeg( params.yfov ), params.aspectRatio || 1, params.znear || 1, params.zfar || 2e6 );
4030
+
4031
+ } else if ( cameraDef.type === 'orthographic' ) {
4032
+
4033
+ camera = new OrthographicCamera( - params.xmag, params.xmag, params.ymag, - params.ymag, params.znear, params.zfar );
4034
+
4035
+ }
4036
+
4037
+ if ( cameraDef.name ) camera.name = this.createUniqueName( cameraDef.name );
4038
+
4039
+ assignExtrasToUserData( camera, cameraDef );
4040
+
4041
+ return Promise.resolve( camera );
4042
+
4043
+ }
4044
+
4045
+ /**
4046
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
4047
+ *
4048
+ * @private
4049
+ * @param {number} skinIndex
4050
+ * @return {Promise<Skeleton>}
4051
+ */
4052
+ loadSkin( skinIndex ) {
4053
+
4054
+ const skinDef = this.json.skins[ skinIndex ];
4055
+
4056
+ const pending = [];
4057
+
4058
+ for ( let i = 0, il = skinDef.joints.length; i < il; i ++ ) {
4059
+
4060
+ pending.push( this._loadNodeShallow( skinDef.joints[ i ] ) );
4061
+
4062
+ }
4063
+
4064
+ if ( skinDef.inverseBindMatrices !== undefined ) {
4065
+
4066
+ pending.push( this.getDependency( 'accessor', skinDef.inverseBindMatrices ) );
4067
+
4068
+ } else {
4069
+
4070
+ pending.push( null );
4071
+
4072
+ }
4073
+
4074
+ return Promise.all( pending ).then( function ( results ) {
4075
+
4076
+ const inverseBindMatrices = results.pop();
4077
+ const jointNodes = results;
4078
+
4079
+ // Note that bones (joint nodes) may or may not be in the
4080
+ // scene graph at this time.
4081
+
4082
+ const bones = [];
4083
+ const boneInverses = [];
4084
+
4085
+ for ( let i = 0, il = jointNodes.length; i < il; i ++ ) {
4086
+
4087
+ const jointNode = jointNodes[ i ];
4088
+
4089
+ if ( jointNode ) {
4090
+
4091
+ bones.push( jointNode );
4092
+
4093
+ const mat = new Matrix4();
4094
+
4095
+ if ( inverseBindMatrices !== null ) {
4096
+
4097
+ mat.fromArray( inverseBindMatrices.array, i * 16 );
4098
+
4099
+ }
4100
+
4101
+ boneInverses.push( mat );
4102
+
4103
+ } else {
4104
+
4105
+ console.warn( 'THREE.GLTFLoader: Joint "%s" could not be found.', skinDef.joints[ i ] );
4106
+
4107
+ }
4108
+
4109
+ }
4110
+
4111
+ return new Skeleton( bones, boneInverses );
4112
+
4113
+ } );
4114
+
4115
+ }
4116
+
4117
+ /**
4118
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
4119
+ *
4120
+ * @private
4121
+ * @param {number} animationIndex
4122
+ * @return {Promise<AnimationClip>}
4123
+ */
4124
+ loadAnimation( animationIndex ) {
4125
+
4126
+ const json = this.json;
4127
+ const parser = this;
4128
+
4129
+ const animationDef = json.animations[ animationIndex ];
4130
+ const animationName = animationDef.name ? animationDef.name : 'animation_' + animationIndex;
4131
+
4132
+ const pendingNodes = [];
4133
+ const pendingInputAccessors = [];
4134
+ const pendingOutputAccessors = [];
4135
+ const pendingSamplers = [];
4136
+ const pendingTargets = [];
4137
+
4138
+ for ( let i = 0, il = animationDef.channels.length; i < il; i ++ ) {
4139
+
4140
+ const channel = animationDef.channels[ i ];
4141
+ const sampler = animationDef.samplers[ channel.sampler ];
4142
+ const target = channel.target;
4143
+ const name = target.node;
4144
+ const input = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.input ] : sampler.input;
4145
+ const output = animationDef.parameters !== undefined ? animationDef.parameters[ sampler.output ] : sampler.output;
4146
+
4147
+ if ( target.node === undefined ) continue;
4148
+
4149
+ pendingNodes.push( this.getDependency( 'node', name ) );
4150
+ pendingInputAccessors.push( this.getDependency( 'accessor', input ) );
4151
+ pendingOutputAccessors.push( this.getDependency( 'accessor', output ) );
4152
+ pendingSamplers.push( sampler );
4153
+ pendingTargets.push( target );
4154
+
4155
+ }
4156
+
4157
+ return Promise.all( [
4158
+
4159
+ Promise.all( pendingNodes ),
4160
+ Promise.all( pendingInputAccessors ),
4161
+ Promise.all( pendingOutputAccessors ),
4162
+ Promise.all( pendingSamplers ),
4163
+ Promise.all( pendingTargets )
4164
+
4165
+ ] ).then( function ( dependencies ) {
4166
+
4167
+ const nodes = dependencies[ 0 ];
4168
+ const inputAccessors = dependencies[ 1 ];
4169
+ const outputAccessors = dependencies[ 2 ];
4170
+ const samplers = dependencies[ 3 ];
4171
+ const targets = dependencies[ 4 ];
4172
+
4173
+ const tracks = [];
4174
+
4175
+ for ( let i = 0, il = nodes.length; i < il; i ++ ) {
4176
+
4177
+ const node = nodes[ i ];
4178
+ const inputAccessor = inputAccessors[ i ];
4179
+ const outputAccessor = outputAccessors[ i ];
4180
+ const sampler = samplers[ i ];
4181
+ const target = targets[ i ];
4182
+
4183
+ if ( node === undefined ) continue;
4184
+
4185
+ if ( node.updateMatrix ) {
4186
+
4187
+ node.updateMatrix();
4188
+
4189
+ }
4190
+
4191
+ const createdTracks = parser._createAnimationTracks( node, inputAccessor, outputAccessor, sampler, target );
4192
+
4193
+ if ( createdTracks ) {
4194
+
4195
+ for ( let k = 0; k < createdTracks.length; k ++ ) {
4196
+
4197
+ tracks.push( createdTracks[ k ] );
4198
+
4199
+ }
4200
+
4201
+ }
4202
+
4203
+ }
4204
+
4205
+ const animation = new AnimationClip( animationName, undefined, tracks );
4206
+
4207
+ assignExtrasToUserData( animation, animationDef );
4208
+
4209
+ return animation;
4210
+
4211
+ } );
4212
+
4213
+ }
4214
+
4215
+ createNodeMesh( nodeIndex ) {
4216
+
4217
+ const json = this.json;
4218
+ const parser = this;
4219
+ const nodeDef = json.nodes[ nodeIndex ];
4220
+
4221
+ if ( nodeDef.mesh === undefined ) return null;
4222
+
4223
+ return parser.getDependency( 'mesh', nodeDef.mesh ).then( function ( mesh ) {
4224
+
4225
+ const node = parser._getNodeRef( parser.meshCache, nodeDef.mesh, mesh );
4226
+
4227
+ // if weights are provided on the node, override weights on the mesh.
4228
+ if ( nodeDef.weights !== undefined ) {
4229
+
4230
+ node.traverse( function ( o ) {
4231
+
4232
+ if ( ! o.isMesh ) return;
4233
+
4234
+ for ( let i = 0, il = nodeDef.weights.length; i < il; i ++ ) {
4235
+
4236
+ o.morphTargetInfluences[ i ] = nodeDef.weights[ i ];
4237
+
4238
+ }
4239
+
4240
+ } );
4241
+
4242
+ }
4243
+
4244
+ return node;
4245
+
4246
+ } );
4247
+
4248
+ }
4249
+
4250
+ /**
4251
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
4252
+ *
4253
+ * @private
4254
+ * @param {number} nodeIndex
4255
+ * @return {Promise<Object3D>}
4256
+ */
4257
+ loadNode( nodeIndex ) {
4258
+
4259
+ const json = this.json;
4260
+ const parser = this;
4261
+
4262
+ const nodeDef = json.nodes[ nodeIndex ];
4263
+
4264
+ const nodePending = parser._loadNodeShallow( nodeIndex );
4265
+
4266
+ const childPending = [];
4267
+ const childrenDef = nodeDef.children || [];
4268
+
4269
+ for ( let i = 0, il = childrenDef.length; i < il; i ++ ) {
4270
+
4271
+ childPending.push( parser.getDependency( 'node', childrenDef[ i ] ) );
4272
+
4273
+ }
4274
+
4275
+ const skeletonPending = nodeDef.skin === undefined
4276
+ ? Promise.resolve( null )
4277
+ : parser.getDependency( 'skin', nodeDef.skin );
4278
+
4279
+ return Promise.all( [
4280
+ nodePending,
4281
+ Promise.all( childPending ),
4282
+ skeletonPending
4283
+ ] ).then( function ( results ) {
4284
+
4285
+ const node = results[ 0 ];
4286
+ const children = results[ 1 ];
4287
+ const skeleton = results[ 2 ];
4288
+
4289
+ if ( skeleton !== null ) {
4290
+
4291
+ // This full traverse should be fine because
4292
+ // child glTF nodes have not been added to this node yet.
4293
+ node.traverse( function ( mesh ) {
4294
+
4295
+ if ( ! mesh.isSkinnedMesh ) return;
4296
+
4297
+ mesh.bind( skeleton, _identityMatrix );
4298
+
4299
+ } );
4300
+
4301
+ }
4302
+
4303
+ for ( let i = 0, il = children.length; i < il; i ++ ) {
4304
+
4305
+ node.add( children[ i ] );
4306
+
4307
+ }
4308
+
4309
+ // Reconstruct pivot from container pattern created by GLTFExporter
4310
+ // The container has position+pivot, rotation, scale; child has -pivot offset and mesh
4311
+ if ( node.userData.pivot !== undefined && children.length > 0 ) {
4312
+
4313
+ const pivot = node.userData.pivot;
4314
+ const pivotChild = children[ 0 ];
4315
+
4316
+ // Set pivot on container and adjust transforms
4317
+ node.pivot = new Vector3().fromArray( pivot );
4318
+
4319
+ // Adjust container position: stored as position + pivot, so subtract pivot
4320
+ node.position.x -= pivot[ 0 ];
4321
+ node.position.y -= pivot[ 1 ];
4322
+ node.position.z -= pivot[ 2 ];
4323
+
4324
+ // Remove the child's -pivot offset since pivot now handles it
4325
+ pivotChild.position.set( 0, 0, 0 );
4326
+
4327
+ delete node.userData.pivot;
4328
+
4329
+ }
4330
+
4331
+ return node;
4332
+
4333
+ } );
4334
+
4335
+ }
4336
+
4337
+ // ._loadNodeShallow() parses a single node.
4338
+ // skin and child nodes are created and added in .loadNode() (no '_' prefix).
4339
+ _loadNodeShallow( nodeIndex ) {
4340
+
4341
+ const json = this.json;
4342
+ const extensions = this.extensions;
4343
+ const parser = this;
4344
+
4345
+ // This method is called from .loadNode() and .loadSkin().
4346
+ // Cache a node to avoid duplication.
4347
+
4348
+ if ( this.nodeCache[ nodeIndex ] !== undefined ) {
4349
+
4350
+ return this.nodeCache[ nodeIndex ];
4351
+
4352
+ }
4353
+
4354
+ const nodeDef = json.nodes[ nodeIndex ];
4355
+
4356
+ // reserve node's name before its dependencies, so the root has the intended name.
4357
+ const nodeName = nodeDef.name ? parser.createUniqueName( nodeDef.name ) : '';
4358
+
4359
+ const pending = [];
4360
+
4361
+ const meshPromise = parser._invokeOne( function ( ext ) {
4362
+
4363
+ return ext.createNodeMesh && ext.createNodeMesh( nodeIndex );
4364
+
4365
+ } );
4366
+
4367
+ if ( meshPromise ) {
4368
+
4369
+ pending.push( meshPromise );
4370
+
4371
+ }
4372
+
4373
+ if ( nodeDef.camera !== undefined ) {
4374
+
4375
+ pending.push( parser.getDependency( 'camera', nodeDef.camera ).then( function ( camera ) {
4376
+
4377
+ return parser._getNodeRef( parser.cameraCache, nodeDef.camera, camera );
4378
+
4379
+ } ) );
4380
+
4381
+ }
4382
+
4383
+ parser._invokeAll( function ( ext ) {
4384
+
4385
+ return ext.createNodeAttachment && ext.createNodeAttachment( nodeIndex );
4386
+
4387
+ } ).forEach( function ( promise ) {
4388
+
4389
+ pending.push( promise );
4390
+
4391
+ } );
4392
+
4393
+ this.nodeCache[ nodeIndex ] = Promise.all( pending ).then( function ( objects ) {
4394
+
4395
+ let node;
4396
+
4397
+ // .isBone isn't in glTF spec. See ._markDefs
4398
+ if ( nodeDef.isBone === true ) {
4399
+
4400
+ node = new Bone();
4401
+
4402
+ } else if ( objects.length > 1 ) {
4403
+
4404
+ node = new Group();
4405
+
4406
+ } else if ( objects.length === 1 ) {
4407
+
4408
+ node = objects[ 0 ];
4409
+
4410
+ } else {
4411
+
4412
+ node = new Object3D();
4413
+
4414
+ }
4415
+
4416
+ if ( node !== objects[ 0 ] ) {
4417
+
4418
+ for ( let i = 0, il = objects.length; i < il; i ++ ) {
4419
+
4420
+ node.add( objects[ i ] );
4421
+
4422
+ }
4423
+
4424
+ }
4425
+
4426
+ if ( nodeDef.name ) {
4427
+
4428
+ node.userData.name = nodeDef.name;
4429
+ node.name = nodeName;
4430
+
4431
+ }
4432
+
4433
+ assignExtrasToUserData( node, nodeDef );
4434
+
4435
+ if ( nodeDef.extensions ) addUnknownExtensionsToUserData( extensions, node, nodeDef );
4436
+
4437
+ if ( nodeDef.matrix !== undefined ) {
4438
+
4439
+ const matrix = new Matrix4();
4440
+ matrix.fromArray( nodeDef.matrix );
4441
+ node.applyMatrix4( matrix );
4442
+
4443
+ } else {
4444
+
4445
+ if ( nodeDef.translation !== undefined ) {
4446
+
4447
+ node.position.fromArray( nodeDef.translation );
4448
+
4449
+ }
4450
+
4451
+ if ( nodeDef.rotation !== undefined ) {
4452
+
4453
+ node.quaternion.fromArray( nodeDef.rotation );
4454
+
4455
+ }
4456
+
4457
+ if ( nodeDef.scale !== undefined ) {
4458
+
4459
+ node.scale.fromArray( nodeDef.scale );
4460
+
4461
+ }
4462
+
4463
+ }
4464
+
4465
+ if ( ! parser.associations.has( node ) ) {
4466
+
4467
+ parser.associations.set( node, {} );
4468
+
4469
+ } else if ( nodeDef.mesh !== undefined && parser.meshCache.refs[ nodeDef.mesh ] > 1 ) {
4470
+
4471
+ const mapping = parser.associations.get( node );
4472
+ parser.associations.set( node, { ...mapping } );
4473
+
4474
+ }
4475
+
4476
+ parser.associations.get( node ).nodes = nodeIndex;
4477
+
4478
+ return node;
4479
+
4480
+ } );
4481
+
4482
+ return this.nodeCache[ nodeIndex ];
4483
+
4484
+ }
4485
+
4486
+ /**
4487
+ * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
4488
+ *
4489
+ * @private
4490
+ * @param {number} sceneIndex
4491
+ * @return {Promise<Group>}
4492
+ */
4493
+ loadScene( sceneIndex ) {
4494
+
4495
+ const extensions = this.extensions;
4496
+ const sceneDef = this.json.scenes[ sceneIndex ];
4497
+ const parser = this;
4498
+
4499
+ // Loader returns Group, not Scene.
4500
+ // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172
4501
+ const scene = new Group();
4502
+ if ( sceneDef.name ) scene.name = parser.createUniqueName( sceneDef.name );
4503
+
4504
+ assignExtrasToUserData( scene, sceneDef );
4505
+
4506
+ if ( sceneDef.extensions ) addUnknownExtensionsToUserData( extensions, scene, sceneDef );
4507
+
4508
+ const nodeIds = sceneDef.nodes || [];
4509
+
4510
+ const pending = [];
4511
+
4512
+ for ( let i = 0, il = nodeIds.length; i < il; i ++ ) {
4513
+
4514
+ pending.push( parser.getDependency( 'node', nodeIds[ i ] ) );
4515
+
4516
+ }
4517
+
4518
+ return Promise.all( pending ).then( function ( nodes ) {
4519
+
4520
+ for ( let i = 0, il = nodes.length; i < il; i ++ ) {
4521
+
4522
+ const node = nodes[ i ];
4523
+
4524
+ // If the node already has a parent, it means it's being reused across multiple scenes.
4525
+ // Clone it to avoid the second scene's add() removing it from the first scene.
4526
+ // See: https://github.com/mrdoob/three.js/issues/27993
4527
+ if ( node.parent !== null ) {
4528
+
4529
+ scene.add( clone( node ) );
4530
+
4531
+ } else {
4532
+
4533
+ scene.add( node );
4534
+
4535
+ }
4536
+
4537
+ }
4538
+
4539
+ // Removes dangling associations, associations that reference a node that
4540
+ // didn't make it into the scene.
4541
+ const reduceAssociations = ( node ) => {
4542
+
4543
+ const reducedAssociations = new Map();
4544
+
4545
+ for ( const [ key, value ] of parser.associations ) {
4546
+
4547
+ if ( key instanceof Material || key instanceof Texture ) {
4548
+
4549
+ reducedAssociations.set( key, value );
4550
+
4551
+ }
4552
+
4553
+ }
4554
+
4555
+ node.traverse( ( node ) => {
4556
+
4557
+ const mappings = parser.associations.get( node );
4558
+
4559
+ if ( mappings != null ) {
4560
+
4561
+ reducedAssociations.set( node, mappings );
4562
+
4563
+ }
4564
+
4565
+ } );
4566
+
4567
+ return reducedAssociations;
4568
+
4569
+ };
4570
+
4571
+ parser.associations = reduceAssociations( scene );
4572
+
4573
+ return scene;
4574
+
4575
+ } );
4576
+
4577
+ }
4578
+
4579
+ _createAnimationTracks( node, inputAccessor, outputAccessor, sampler, target ) {
4580
+
4581
+ const tracks = [];
4582
+
4583
+ const targetName = node.name ? node.name : node.uuid;
4584
+ const targetNames = [];
4585
+
4586
+ function collectMorphTargets( object ) {
4587
+
4588
+ if ( object.morphTargetInfluences ) {
4589
+
4590
+ targetNames.push( object.name ? object.name : object.uuid );
4591
+
4592
+ }
4593
+
4594
+ }
4595
+
4596
+
4597
+ if ( PATH_PROPERTIES[ target.path ] === PATH_PROPERTIES.weights ) {
4598
+
4599
+ collectMorphTargets( node );
4600
+
4601
+ // for multi-primitive meshes, the node is a Group containing the sub-meshes
4602
+
4603
+ if ( node.isGroup ) {
4604
+
4605
+ node.children.forEach( collectMorphTargets );
4606
+
4607
+ }
4608
+
4609
+ } else {
4610
+
4611
+ targetNames.push( targetName );
4612
+
4613
+ }
4614
+
4615
+ let TypedKeyframeTrack;
4616
+
4617
+ switch ( PATH_PROPERTIES[ target.path ] ) {
4618
+
4619
+ case PATH_PROPERTIES.weights:
4620
+
4621
+ TypedKeyframeTrack = NumberKeyframeTrack;
4622
+ break;
4623
+
4624
+ case PATH_PROPERTIES.rotation:
4625
+
4626
+ TypedKeyframeTrack = QuaternionKeyframeTrack;
4627
+ break;
4628
+
4629
+ case PATH_PROPERTIES.translation:
4630
+ case PATH_PROPERTIES.scale:
4631
+
4632
+ TypedKeyframeTrack = VectorKeyframeTrack;
4633
+ break;
4634
+
4635
+ default:
4636
+
4637
+ switch ( outputAccessor.itemSize ) {
4638
+
4639
+ case 1:
4640
+ TypedKeyframeTrack = NumberKeyframeTrack;
4641
+ break;
4642
+ case 2:
4643
+ case 3:
4644
+ default:
4645
+ TypedKeyframeTrack = VectorKeyframeTrack;
4646
+ break;
4647
+
4648
+ }
4649
+
4650
+ break;
4651
+
4652
+ }
4653
+
4654
+ const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : InterpolateLinear;
4655
+
4656
+
4657
+ const outputArray = this._getArrayFromAccessor( outputAccessor );
4658
+
4659
+ for ( let j = 0, jl = targetNames.length; j < jl; j ++ ) {
4660
+
4661
+ const track = new TypedKeyframeTrack(
4662
+ targetNames[ j ] + '.' + PATH_PROPERTIES[ target.path ],
4663
+ inputAccessor.array,
4664
+ outputArray,
4665
+ interpolation
4666
+ );
4667
+
4668
+ // Override interpolation with custom factory method.
4669
+ if ( sampler.interpolation === 'CUBICSPLINE' ) {
4670
+
4671
+ this._createCubicSplineTrackInterpolant( track );
4672
+
4673
+ }
4674
+
4675
+ tracks.push( track );
4676
+
4677
+ }
4678
+
4679
+ return tracks;
4680
+
4681
+ }
4682
+
4683
+ _getArrayFromAccessor( accessor ) {
4684
+
4685
+ let outputArray = accessor.array;
4686
+
4687
+ if ( accessor.normalized ) {
4688
+
4689
+ const scale = getNormalizedComponentScale( outputArray.constructor );
4690
+ const scaled = new Float32Array( outputArray.length );
4691
+
4692
+ for ( let j = 0, jl = outputArray.length; j < jl; j ++ ) {
4693
+
4694
+ scaled[ j ] = outputArray[ j ] * scale;
4695
+
4696
+ }
4697
+
4698
+ outputArray = scaled;
4699
+
4700
+ }
4701
+
4702
+ return outputArray;
4703
+
4704
+ }
4705
+
4706
+ _createCubicSplineTrackInterpolant( track ) {
4707
+
4708
+ track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline( result ) {
4709
+
4710
+ // A CUBICSPLINE keyframe in glTF has three output values for each input value,
4711
+ // representing inTangent, splineVertex, and outTangent. As a result, track.getValueSize()
4712
+ // must be divided by three to get the interpolant's sampleSize argument.
4713
+
4714
+ const interpolantType = ( this instanceof QuaternionKeyframeTrack ) ? GLTFCubicSplineQuaternionInterpolant : GLTFCubicSplineInterpolant;
4715
+
4716
+ return new interpolantType( this.times, this.values, this.getValueSize() / 3, result );
4717
+
4718
+ };
4719
+
4720
+ // Mark as CUBICSPLINE. `track.getInterpolation()` doesn't support custom interpolants.
4721
+ track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true;
4722
+
4723
+ }
4724
+
4725
+ }
4726
+
4727
+ /**
4728
+ *
4729
+ * @private
4730
+ * @param {BufferGeometry} geometry
4731
+ * @param {GLTF.Primitive} primitiveDef
4732
+ * @param {GLTFParser} parser
4733
+ */
4734
+ function computeBounds( geometry, primitiveDef, parser ) {
4735
+
4736
+ const attributes = primitiveDef.attributes;
4737
+
4738
+ const box = new Box3();
4739
+
4740
+ if ( attributes.POSITION !== undefined ) {
4741
+
4742
+ const accessor = parser.json.accessors[ attributes.POSITION ];
4743
+
4744
+ const min = accessor.min;
4745
+ const max = accessor.max;
4746
+
4747
+ // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
4748
+
4749
+ if ( min !== undefined && max !== undefined ) {
4750
+
4751
+ box.set(
4752
+ new Vector3( min[ 0 ], min[ 1 ], min[ 2 ] ),
4753
+ new Vector3( max[ 0 ], max[ 1 ], max[ 2 ] )
4754
+ );
4755
+
4756
+ if ( accessor.normalized ) {
4757
+
4758
+ const boxScale = getNormalizedComponentScale( WEBGL_COMPONENT_TYPES[ accessor.componentType ] );
4759
+ box.min.multiplyScalar( boxScale );
4760
+ box.max.multiplyScalar( boxScale );
4761
+
4762
+ }
4763
+
4764
+ } else {
4765
+
4766
+ console.warn( 'THREE.GLTFLoader: Missing min/max properties for accessor POSITION.' );
4767
+
4768
+ return;
4769
+
4770
+ }
4771
+
4772
+ } else {
4773
+
4774
+ return;
4775
+
4776
+ }
4777
+
4778
+ const targets = primitiveDef.targets;
4779
+
4780
+ if ( targets !== undefined ) {
4781
+
4782
+ const maxDisplacement = new Vector3();
4783
+ const vector = new Vector3();
4784
+
4785
+ for ( let i = 0, il = targets.length; i < il; i ++ ) {
4786
+
4787
+ const target = targets[ i ];
4788
+
4789
+ if ( target.POSITION !== undefined ) {
4790
+
4791
+ const accessor = parser.json.accessors[ target.POSITION ];
4792
+ const min = accessor.min;
4793
+ const max = accessor.max;
4794
+
4795
+ // glTF requires 'min' and 'max', but VRM (which extends glTF) currently ignores that requirement.
4796
+
4797
+ if ( min !== undefined && max !== undefined ) {
4798
+
4799
+ // we need to get max of absolute components because target weight is [-1,1]
4800
+ vector.setX( Math.max( Math.abs( min[ 0 ] ), Math.abs( max[ 0 ] ) ) );
4801
+ vector.setY( Math.max( Math.abs( min[ 1 ] ), Math.abs( max[ 1 ] ) ) );
4802
+ vector.setZ( Math.max( Math.abs( min[ 2 ] ), Math.abs( max[ 2 ] ) ) );
4803
+
4804
+
4805
+ if ( accessor.normalized ) {
4806
+
4807
+ const boxScale = getNormalizedComponentScale( WEBGL_COMPONENT_TYPES[ accessor.componentType ] );
4808
+ vector.multiplyScalar( boxScale );
4809
+
4810
+ }
4811
+
4812
+ // Note: this assumes that the sum of all weights is at most 1. This isn't quite correct - it's more conservative
4813
+ // to assume that each target can have a max weight of 1. However, for some use cases - notably, when morph targets
4814
+ // are used to implement key-frame animations and as such only two are active at a time - this results in very large
4815
+ // boxes. So for now we make a box that's sometimes a touch too small but is hopefully mostly of reasonable size.
4816
+ maxDisplacement.max( vector );
4817
+
4818
+ } else {
4819
+
4820
+ console.warn( 'THREE.GLTFLoader: Missing min/max properties for accessor POSITION.' );
4821
+
4822
+ }
4823
+
4824
+ }
4825
+
4826
+ }
4827
+
4828
+ // As per comment above this box isn't conservative, but has a reasonable size for a very large number of morph targets.
4829
+ box.expandByVector( maxDisplacement );
4830
+
4831
+ }
4832
+
4833
+ geometry.boundingBox = box;
4834
+
4835
+ const sphere = new Sphere();
4836
+
4837
+ box.getCenter( sphere.center );
4838
+ sphere.radius = box.min.distanceTo( box.max ) / 2;
4839
+
4840
+ geometry.boundingSphere = sphere;
4841
+
4842
+ }
4843
+
4844
+ /**
4845
+ *
4846
+ * @private
4847
+ * @param {BufferGeometry} geometry
4848
+ * @param {GLTF.Primitive} primitiveDef
4849
+ * @param {GLTFParser} parser
4850
+ * @return {Promise<BufferGeometry>}
4851
+ */
4852
+ function addPrimitiveAttributes( geometry, primitiveDef, parser ) {
4853
+
4854
+ const attributes = primitiveDef.attributes;
4855
+
4856
+ const pending = [];
4857
+
4858
+ function assignAttributeAccessor( accessorIndex, attributeName ) {
4859
+
4860
+ return parser.getDependency( 'accessor', accessorIndex )
4861
+ .then( function ( accessor ) {
4862
+
4863
+ geometry.setAttribute( attributeName, accessor );
4864
+
4865
+ } );
4866
+
4867
+ }
4868
+
4869
+ for ( const gltfAttributeName in attributes ) {
4870
+
4871
+ const threeAttributeName = ATTRIBUTES[ gltfAttributeName ] || gltfAttributeName.toLowerCase();
4872
+
4873
+ // Skip attributes already provided by e.g. Draco extension.
4874
+ if ( threeAttributeName in geometry.attributes ) continue;
4875
+
4876
+ pending.push( assignAttributeAccessor( attributes[ gltfAttributeName ], threeAttributeName ) );
4877
+
4878
+ }
4879
+
4880
+ if ( primitiveDef.indices !== undefined && ! geometry.index ) {
4881
+
4882
+ const accessor = parser.getDependency( 'accessor', primitiveDef.indices ).then( function ( accessor ) {
4883
+
4884
+ geometry.setIndex( accessor );
4885
+
4886
+ } );
4887
+
4888
+ pending.push( accessor );
4889
+
4890
+ }
4891
+
4892
+ if ( ColorManagement.workingColorSpace !== LinearSRGBColorSpace && 'COLOR_0' in attributes ) {
4893
+
4894
+ console.warn( `THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ColorManagement.workingColorSpace}" not supported.` );
4895
+
4896
+ }
4897
+
4898
+ assignExtrasToUserData( geometry, primitiveDef );
4899
+
4900
+ computeBounds( geometry, primitiveDef, parser );
4901
+
4902
+ return Promise.all( pending ).then( function () {
4903
+
4904
+ return primitiveDef.targets !== undefined
4905
+ ? addMorphTargets( geometry, primitiveDef.targets, parser )
4906
+ : geometry;
4907
+
4908
+ } );
4909
+
4910
+ }
4911
+
4912
+ /**
4913
+ * Loader result of `GLTFLoader`.
4914
+ *
4915
+ * @typedef {Object} GLTFLoader~LoadObject
4916
+ * @property {Array<AnimationClip>} animations - An array of animation clips.
4917
+ * @property {Object} asset - Meta data about the loaded asset.
4918
+ * @property {Array<Camera>} cameras - An array of cameras.
4919
+ * @property {GLTFParser} parser - A reference to the internal parser.
4920
+ * @property {Group} scene - The default scene.
4921
+ * @property {Array<Group>} scenes - glTF assets might define multiple scenes.
4922
+ * @property {Object} userData - Additional data.
4923
+ **/
4924
+
4925
+ export { GLTFLoader };