@unikia/upe-renderer 0.0.0-stage → 0.187.11

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