@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,3918 @@
1
+ import NodeUniform from './NodeUniform.js';
2
+ import NodeAttribute from './NodeAttribute.js';
3
+ import NodeVarying from './NodeVarying.js';
4
+ import NodeVar from './NodeVar.js';
5
+ import NodeCode from './NodeCode.js';
6
+ import NodeCache from './NodeCache.js';
7
+ import ParameterNode from './ParameterNode.js';
8
+ import StructType from './StructType.js';
9
+ import FunctionNode from '../code/FunctionNode.js';
10
+ import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
11
+ import { getTypeFromLength, getTextureType, isArrayAsParameter, mergeContext } from './NodeUtils.js';
12
+ import { NodeUpdateType, defaultBuildStages, shaderStages } from './constants.js';
13
+
14
+ import {
15
+ NumberNodeUniform, Vector2NodeUniform, Vector3NodeUniform, Vector4NodeUniform,
16
+ ColorNodeUniform, Matrix2NodeUniform, Matrix3NodeUniform, Matrix4NodeUniform
17
+ } from '../../renderers/common/nodes/NodeUniform.js';
18
+
19
+ import { stack } from './StackNode.js';
20
+ import { getCurrentStack, setCurrentStack } from '../tsl/TSLBase.js';
21
+
22
+ import CubeRenderTarget from '../../renderers/common/CubeRenderTarget.js';
23
+
24
+ import BindGroup from '../../renderers/common/BindGroup.js';
25
+
26
+ import { REVISION, IntType, UnsignedIntType, LinearFilter, LinearMipmapNearestFilter, NearestMipmapLinearFilter, LinearMipmapLinearFilter, NormalBlending } from '../../constants.js';
27
+ import { RenderTarget } from '../../core/RenderTarget.js';
28
+ import { Color } from '../../math/Color.js';
29
+ import { Vector2 } from '../../math/Vector2.js';
30
+ import { Vector3 } from '../../math/Vector3.js';
31
+ import { Vector4 } from '../../math/Vector4.js';
32
+ import { Float16BufferAttribute } from '../../core/BufferAttribute.js';
33
+ import { warn, error, yieldToMain } from '../../utils.js';
34
+
35
+ let _id = 0;
36
+
37
+ const _functionNodeCache = new WeakMap();
38
+ const _layoutDefaultsCache = new WeakMap();
39
+
40
+ // Inputs of a layout function call. They can be destructured as an array or as an object.
41
+ const _createLayoutInputs = ( layout, values ) => {
42
+
43
+ const inputs = {
44
+ [ Symbol.iterator ]() {
45
+
46
+ let index = 0;
47
+ const values = Object.values( this );
48
+ return {
49
+ next: () => ( {
50
+ value: values[ index ],
51
+ done: index ++ >= values.length
52
+ } )
53
+ };
54
+
55
+ }
56
+ };
57
+
58
+ layout.inputs.forEach( ( input, i ) => {
59
+
60
+ inputs[ input.name ] = values[ i ];
61
+
62
+ } );
63
+
64
+ return inputs;
65
+
66
+ };
67
+
68
+ const typeFromArray = new Map( [
69
+ [ Int8Array, 'int' ],
70
+ [ Int16Array, 'int' ],
71
+ [ Int32Array, 'int' ],
72
+ [ Uint8Array, 'uint' ],
73
+ [ Uint16Array, 'uint' ],
74
+ [ Uint32Array, 'uint' ],
75
+ [ Float32Array, 'float' ]
76
+ ] );
77
+
78
+ const _toFloat = ( value ) => {
79
+
80
+ if ( /e/g.test( value ) ) {
81
+
82
+ return String( value ).replace( /\+/g, '' );
83
+
84
+ } else {
85
+
86
+ value = Number( value );
87
+
88
+ return value + ( value % 1 ? '' : '.0' );
89
+
90
+ }
91
+
92
+ };
93
+
94
+ const _componentTypeRanks = { bool: 0, uint: 1, int: 2, float: 3 };
95
+
96
+ /**
97
+ * Data of a node in a shader stage. All common properties are declared upfront,
98
+ * so the objects share a single shape.
99
+ *
100
+ * @private
101
+ */
102
+ class NodeData {
103
+
104
+ constructor() {
105
+
106
+ this.properties = undefined;
107
+ this.type = undefined;
108
+ this.typeFromOutput = undefined;
109
+ this.buildStages = undefined;
110
+ this.usageCount = undefined;
111
+ this.readUsageCount = undefined;
112
+ this.writeUsageCount = undefined;
113
+ this.stack = undefined;
114
+ this.stages = undefined;
115
+ this.snippet = undefined;
116
+ this.propertyName = undefined;
117
+ this.generated = undefined;
118
+ this.flowBlock = undefined;
119
+ this.assign = undefined;
120
+ this.forceDeclaration = undefined;
121
+ this.variable = undefined;
122
+ this.cacheVariable = undefined;
123
+ this.uniform = undefined;
124
+ this.subBuilds = undefined;
125
+ this.subBuildsCache = undefined;
126
+
127
+ }
128
+
129
+ }
130
+
131
+ const _componentTypeCache = new Map();
132
+ const _typeLengthCache = new Map();
133
+ const _isVectorCache = new Map();
134
+ const _isMatrixCache = new Map();
135
+ const _isIntegerCache = new Map();
136
+
137
+ const _checkWriteUsage = ( data ) => {
138
+
139
+ if ( data.writeUsageCount > 0 ) return true;
140
+
141
+ if ( data.subBuildsCache !== undefined ) {
142
+
143
+ for ( const subBuild in data.subBuildsCache ) {
144
+
145
+ if ( _checkWriteUsage( data.subBuildsCache[ subBuild ] ) ) {
146
+
147
+ return true;
148
+
149
+ }
150
+
151
+ }
152
+
153
+ }
154
+
155
+ return false;
156
+
157
+ };
158
+
159
+ const _hasContextOverrides = ( context, baseContext ) => {
160
+
161
+ for ( const key in context ) {
162
+
163
+ if ( key !== 'nodeBlock' && key !== 'nodeLoop' && context[ key ] !== baseContext[ key ] ) return true;
164
+
165
+ }
166
+
167
+ return false;
168
+
169
+ };
170
+
171
+ /**
172
+ * Base class for builders which generate a shader program based
173
+ * on a 3D object and its node material definition.
174
+ */
175
+ class NodeBuilder {
176
+
177
+ /**
178
+ * Constructs a new node builder.
179
+ *
180
+ * @param {Object3D} object - The 3D object.
181
+ * @param {Renderer} renderer - The current renderer.
182
+ * @param {NodeParser} parser - A reference to a node parser.
183
+ */
184
+ constructor( object, renderer, parser ) {
185
+
186
+ /**
187
+ * The 3D object.
188
+ *
189
+ * @type {Object3D}
190
+ */
191
+ this.object = object;
192
+
193
+ /**
194
+ * The material of the 3D object.
195
+ *
196
+ * @type {?Material}
197
+ */
198
+ this.material = ( object && object.material ) || null;
199
+
200
+ /**
201
+ * The geometry of the 3D object.
202
+ *
203
+ * @type {?BufferGeometry}
204
+ */
205
+ this.geometry = ( object && object.geometry ) || null;
206
+
207
+ /**
208
+ * The compute node, if building for compute.
209
+ *
210
+ * @type {?ComputeNode}
211
+ * @default null
212
+ */
213
+ this.compute = null;
214
+
215
+ /**
216
+ * The current renderer.
217
+ *
218
+ * @type {Renderer}
219
+ */
220
+ this.renderer = renderer;
221
+
222
+ /**
223
+ * A reference to a node parser.
224
+ *
225
+ * @type {NodeParser}
226
+ */
227
+ this.parser = parser;
228
+
229
+ /**
230
+ * The scene the 3D object belongs to.
231
+ *
232
+ * @type {?Scene}
233
+ * @default null
234
+ */
235
+ this.scene = null;
236
+
237
+ /**
238
+ * The camera the 3D object is rendered with.
239
+ *
240
+ * @type {?Camera}
241
+ * @default null
242
+ */
243
+ this.camera = null;
244
+
245
+ /**
246
+ * A list of all nodes the builder is processing
247
+ * for this 3D object.
248
+ *
249
+ * @type {Set<Node>}
250
+ */
251
+ this.nodes = new Set();
252
+
253
+ /**
254
+ * A list of all nodes the builder is processing in sequential order.
255
+ *
256
+ * This is used to determine the update order of nodes, which is important for
257
+ * {@link NodeUpdateType#UPDATE_BEFORE} and {@link NodeUpdateType#UPDATE_AFTER}.
258
+ *
259
+ * @type {Set<Node>}
260
+ */
261
+ this.sequentialNodes = new Set();
262
+
263
+ /**
264
+ * A list of all nodes which {@link Node#update} method should be executed.
265
+ *
266
+ * @type {Array<Node>}
267
+ */
268
+ this.updateNodes = [];
269
+
270
+ /**
271
+ * A list of all nodes which {@link Node#updateBefore} method should be executed.
272
+ *
273
+ * @type {Array<Node>}
274
+ */
275
+ this.updateBeforeNodes = [];
276
+
277
+ /**
278
+ * A list of all nodes which {@link Node#updateAfter} method should be executed.
279
+ *
280
+ * @type {Array<Node>}
281
+ */
282
+ this.updateAfterNodes = [];
283
+
284
+ /**
285
+ * A dictionary that assigns each node to a unique hash.
286
+ *
287
+ * @type {Object<number,Node>}
288
+ */
289
+ this.hashNodes = {};
290
+
291
+ /**
292
+ * A reference to a node material observer.
293
+ *
294
+ * @type {?NodeMaterialObserver}
295
+ * @default null
296
+ */
297
+ this.observer = null;
298
+
299
+ /**
300
+ * A reference to the current lights node.
301
+ *
302
+ * @type {?LightsNode}
303
+ * @default null
304
+ */
305
+ this.lightsNode = null;
306
+
307
+ /**
308
+ * A reference to the current environment node.
309
+ *
310
+ * @type {?Node}
311
+ * @default null
312
+ */
313
+ this.environmentNode = null;
314
+
315
+ /**
316
+ * A reference to the current fog node.
317
+ *
318
+ * @type {?Node}
319
+ * @default null
320
+ */
321
+ this.fogNode = null;
322
+
323
+ /**
324
+ * The current clipping context.
325
+ *
326
+ * @type {?ClippingContext}
327
+ */
328
+ this.clippingContext = null;
329
+
330
+ /**
331
+ * Whether the built material uses hardware clipping or not.
332
+ *
333
+ * @type {boolean}
334
+ * @default false
335
+ */
336
+ this.hardwareClipping = false;
337
+
338
+ /**
339
+ * Whether the build embeds data of the 3D object it is built for, like its buffers,
340
+ * instead of binding the data of the rendered object. Such builds can't be shared
341
+ * with other objects, so the renderer doesn't cache them.
342
+ *
343
+ * @type {boolean}
344
+ * @default false
345
+ */
346
+ this.objectSpecific = false;
347
+
348
+ /**
349
+ * The generated vertex shader.
350
+ *
351
+ * @type {?string}
352
+ */
353
+ this.vertexShader = null;
354
+
355
+ /**
356
+ * The generated fragment shader.
357
+ *
358
+ * @type {?string}
359
+ */
360
+ this.fragmentShader = null;
361
+
362
+ /**
363
+ * The generated compute shader.
364
+ *
365
+ * @type {?string}
366
+ */
367
+ this.computeShader = null;
368
+
369
+ /**
370
+ * Nodes used in the primary flow of code generation.
371
+ *
372
+ * @type {Object<string,Array<Node>>}
373
+ */
374
+ this.flowNodes = { vertex: [], fragment: [], compute: [] };
375
+
376
+ /**
377
+ * Nodes code from `.flowNodes`.
378
+ *
379
+ * @type {Object<string,string>}
380
+ */
381
+ this.flowCode = { vertex: '', fragment: '', compute: '' };
382
+
383
+ /**
384
+ * This dictionary holds the node uniforms of the builder.
385
+ * The uniforms are maintained in an array for each shader stage.
386
+ *
387
+ * @type {Object}
388
+ */
389
+ this.uniforms = { vertex: [], fragment: [], compute: [], index: 0 };
390
+
391
+ /**
392
+ * This dictionary holds the output structs of the builder.
393
+ * The structs are maintained in an array for each shader stage.
394
+ *
395
+ * @type {Object}
396
+ */
397
+ this.structs = { vertex: [], fragment: [], compute: [], index: 0 };
398
+
399
+ /**
400
+ * This dictionary holds the types of the builder.
401
+ *
402
+ * @type {Object}
403
+ */
404
+ this.types = { vertex: [], fragment: [], compute: [], index: 0 };
405
+
406
+ /**
407
+ * This dictionary holds the bindings for each shader stage.
408
+ *
409
+ * @type {Object}
410
+ */
411
+ this.bindings = { vertex: {}, fragment: {}, compute: {} };
412
+
413
+ /**
414
+ * This dictionary maintains the binding indices per bind group.
415
+ *
416
+ * @type {Object}
417
+ */
418
+ this.bindingsIndexes = {};
419
+
420
+ /**
421
+ * Reference to the array of bind groups.
422
+ *
423
+ * @type {?Array<BindGroup>}
424
+ */
425
+ this.bindGroups = null;
426
+
427
+ /**
428
+ * This array holds the node attributes of this builder
429
+ * created via {@link AttributeNode}.
430
+ *
431
+ * @type {Array<NodeAttribute>}
432
+ */
433
+ this.attributes = [];
434
+
435
+ /**
436
+ * This array holds the node attributes of this builder
437
+ * created via {@link BufferAttributeNode}.
438
+ *
439
+ * @type {Array<NodeAttribute>}
440
+ */
441
+ this.bufferAttributes = [];
442
+
443
+ /**
444
+ * This array holds the node varyings of this builder.
445
+ *
446
+ * @type {Array<NodeVarying>}
447
+ */
448
+ this.varyings = [];
449
+
450
+ /**
451
+ * This dictionary holds the (native) node codes of this builder.
452
+ * The codes are maintained in an array for each shader stage.
453
+ *
454
+ * @type {Object<string,Array<NodeCode>>}
455
+ */
456
+ this.codes = {};
457
+
458
+ /**
459
+ * This dictionary holds the node variables of this builder.
460
+ * The variables are maintained in an array for each shader stage.
461
+ * This dictionary is also used to count the number of variables
462
+ * according to their type (const, vars).
463
+ *
464
+ * @type {Object<string,Array<NodeVar>|number>}
465
+ */
466
+ this.vars = {};
467
+
468
+ /**
469
+ * This dictionary holds the declarations for each shader stage.
470
+ *
471
+ * @type {Object}
472
+ */
473
+ this.declarations = {};
474
+
475
+ /**
476
+ * Current code flow.
477
+ * All code generated in this stack will be stored in `.flow`.
478
+ *
479
+ * @type {{code: string}}
480
+ */
481
+ this.flow = { code: '' };
482
+
483
+ /**
484
+ * A chain of nodes.
485
+ * Used to check recursive calls in node-graph.
486
+ *
487
+ * @type {Array<Node>}
488
+ */
489
+ this.chaining = [];
490
+
491
+ /**
492
+ * The current stack.
493
+ * This reflects the current process in the code block hierarchy,
494
+ * it is useful to know if the current process is inside a conditional for example.
495
+ *
496
+ * @type {StackNode}
497
+ */
498
+ this.stack = stack();
499
+
500
+ /**
501
+ * List of stack nodes.
502
+ * The current stack hierarchy is stored in an array.
503
+ *
504
+ * @type {Array<StackNode>}
505
+ */
506
+ this.stacks = [];
507
+
508
+ /**
509
+ * A tab value. Used for shader string generation.
510
+ *
511
+ * @type {string}
512
+ * @default '\t'
513
+ */
514
+ this.tab = '\t';
515
+
516
+ /**
517
+ * Reference to the current function node.
518
+ *
519
+ * @type {?FunctionNode}
520
+ * @default null
521
+ */
522
+ this.currentFunctionNode = null;
523
+
524
+ /**
525
+ * The builder's context.
526
+ *
527
+ * @type {Object}
528
+ */
529
+ this.context = {
530
+ material: this.material
531
+ };
532
+
533
+ /**
534
+ * The builder's cache.
535
+ *
536
+ * @type {NodeCache}
537
+ */
538
+ this.cache = new NodeCache();
539
+
540
+ /**
541
+ * Since the {@link NodeBuilder#cache} might be temporarily
542
+ * overwritten by other caches, this member retains the reference
543
+ * to the builder's own cache.
544
+ *
545
+ * @type {NodeCache}
546
+ * @default this.cache
547
+ */
548
+ this.globalCache = this.cache;
549
+
550
+ this.flowsData = new WeakMap();
551
+
552
+ /**
553
+ * The current shader stage.
554
+ *
555
+ * @type {?('vertex'|'fragment'|'compute'|'any')}
556
+ */
557
+ this.shaderStage = null;
558
+
559
+ /**
560
+ * The current build stage.
561
+ *
562
+ * @type {?('setup'|'analyze'|'generate')}
563
+ */
564
+ this.buildStage = null;
565
+
566
+ /**
567
+ * The sub-build layers.
568
+ *
569
+ * @type {Array<SubBuildNode>}
570
+ * @default []
571
+ */
572
+ this.subBuildLayers = [];
573
+
574
+
575
+ /**
576
+ * The active stack nodes.
577
+ *
578
+ * @type {Array<StackNode>}
579
+ */
580
+ this.activeStacks = [];
581
+
582
+ /**
583
+ * The current sub-build TSL function(Fn).
584
+ *
585
+ * @type {?string}
586
+ * @default null
587
+ */
588
+ this.subBuildFn = null;
589
+
590
+ /**
591
+ * The current TSL function(Fn) call node.
592
+ *
593
+ * @type {?Node}
594
+ * @default null
595
+ */
596
+ this.fnCall = null;
597
+
598
+ /**
599
+ * The block of generated code the builder is in, e.g. a loop body or a conditional branch.
600
+ * Every generated block is a new object linked to its parent, `null` outside of any block.
601
+ *
602
+ * @type {?{parent: ?Object}}
603
+ * @default null
604
+ */
605
+ this.flowBlock = null;
606
+
607
+ Object.defineProperty( this, 'id', { value: _id ++ } );
608
+
609
+ }
610
+
611
+ /**
612
+ * Whether the material is using flat shading or not.
613
+ *
614
+ * @returns {boolean} Whether the material is using flat shading or not.
615
+ */
616
+ isFlatShading() {
617
+
618
+ return this.material.flatShading === true || this.geometry.hasAttribute( 'normal' ) === false;
619
+
620
+ }
621
+
622
+ /**
623
+ * Whether the material is opaque or not.
624
+ *
625
+ * @return {boolean} Whether the material is opaque or not.
626
+ */
627
+ isOpaque() {
628
+
629
+ const material = this.material;
630
+
631
+ return material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false;
632
+
633
+ }
634
+
635
+ /**
636
+ * Factory method for creating an instance of {@link RenderTarget} with the given
637
+ * dimensions and options.
638
+ *
639
+ * @param {number} width - The width of the render target.
640
+ * @param {number} height - The height of the render target.
641
+ * @param {Object} options - The options of the render target.
642
+ * @return {RenderTarget} The render target.
643
+ */
644
+ createRenderTarget( width, height, options ) {
645
+
646
+ return new RenderTarget( width, height, options );
647
+
648
+ }
649
+
650
+ /**
651
+ * Factory method for creating an instance of {@link CubeRenderTarget} with the given
652
+ * dimensions and options.
653
+ *
654
+ * @param {number} size - The size of the cube render target.
655
+ * @param {Object} options - The options of the cube render target.
656
+ * @return {CubeRenderTarget} The cube render target.
657
+ */
658
+ createCubeRenderTarget( size, options ) {
659
+
660
+ return new CubeRenderTarget( size, options );
661
+
662
+ }
663
+
664
+ /**
665
+ * Whether the given node is included in the internal array of nodes or not.
666
+ *
667
+ * @param {Node} node - The node to test.
668
+ * @return {boolean} Whether the given node is included in the internal array of nodes or not.
669
+ */
670
+ includes( node ) {
671
+
672
+ return this.nodes.has( node );
673
+
674
+ }
675
+
676
+ /**
677
+ * Returns the type of the color output based on the renderer's render target.
678
+ *
679
+ * @param {number} [index=0] - The index of the render target texture.
680
+ * @return {string} The type.
681
+ */
682
+ getOutputType( index = 0 ) {
683
+
684
+ const renderTarget = this.renderer.getRenderTarget();
685
+
686
+ if ( renderTarget !== null && renderTarget.textures[ index ] !== undefined ) {
687
+
688
+ return getTextureType( renderTarget.textures[ index ] );
689
+
690
+ }
691
+
692
+ return 'vec4';
693
+
694
+ }
695
+
696
+ /**
697
+ * Returns the output struct name which is required by
698
+ * {@link OutputStructNode}.
699
+ *
700
+ * @abstract
701
+ * @return {string} The name of the output struct.
702
+ */
703
+ getOutputStructName() {}
704
+
705
+ /**
706
+ * Returns a bind group for the given group name and binding.
707
+ *
708
+ * @private
709
+ * @param {string} groupName - The group name.
710
+ * @param {Array<NodeUniformsGroup>} bindings - List of bindings.
711
+ * @return {BindGroup} The bind group
712
+ */
713
+ _getBindGroup( groupName, bindings ) {
714
+
715
+ const groupNode = bindings[ 0 ].groupNode;
716
+
717
+ let sharedGroup = groupNode.shared;
718
+
719
+ if ( sharedGroup ) {
720
+
721
+ for ( let i = 1; i < bindings.length; i ++ ) {
722
+
723
+ if ( groupNode !== bindings[ i ].groupNode ) {
724
+
725
+ sharedGroup = false;
726
+
727
+ }
728
+
729
+ }
730
+
731
+ }
732
+
733
+ //
734
+
735
+ let bindGroup = new BindGroup( groupName, bindings );
736
+
737
+ if ( sharedGroup && this.renderer._bindings !== undefined ) {
738
+
739
+ bindGroup = this.renderer._bindings.getSharedBindGroup( bindGroup );
740
+
741
+ }
742
+
743
+ return bindGroup;
744
+
745
+ }
746
+
747
+ /**
748
+ * Returns an array of node uniform groups for the given group name and shader stage.
749
+ *
750
+ * @param {string} groupName - The group name.
751
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
752
+ * @return {Array<NodeUniformsGroup>} The array of node uniform groups.
753
+ */
754
+ getBindGroupArray( groupName, shaderStage ) {
755
+
756
+ const bindings = this.bindings[ shaderStage ];
757
+
758
+ let bindGroup = bindings[ groupName ];
759
+
760
+ if ( bindGroup === undefined ) {
761
+
762
+ if ( this.bindingsIndexes[ groupName ] === undefined ) {
763
+
764
+ this.bindingsIndexes[ groupName ] = { binding: 0, group: Object.keys( this.bindingsIndexes ).length };
765
+
766
+ }
767
+
768
+ bindings[ groupName ] = bindGroup = [];
769
+
770
+ }
771
+
772
+ return bindGroup;
773
+
774
+ }
775
+
776
+ /**
777
+ * Returns a list bindings of all shader stages separated by groups.
778
+ *
779
+ * @return {Array<BindGroup>} The list of bindings.
780
+ */
781
+ getBindings() {
782
+
783
+ let bindingsGroups = this.bindGroups;
784
+
785
+ if ( bindingsGroups === null ) {
786
+
787
+ const groups = {};
788
+ const bindings = this.bindings;
789
+
790
+ for ( const shaderStage of shaderStages ) {
791
+
792
+ for ( const groupName in bindings[ shaderStage ] ) {
793
+
794
+ const uniforms = bindings[ shaderStage ][ groupName ];
795
+
796
+ const groupUniforms = groups[ groupName ] || ( groups[ groupName ] = [] );
797
+
798
+ for ( const uniform of uniforms ) {
799
+
800
+ if ( groupUniforms.includes( uniform ) === false ) {
801
+
802
+ groupUniforms.push( uniform );
803
+
804
+ }
805
+
806
+ }
807
+
808
+ }
809
+
810
+ }
811
+
812
+ bindingsGroups = [];
813
+
814
+ for ( const groupName in groups ) {
815
+
816
+ const group = groups[ groupName ];
817
+
818
+ const bindingsGroup = this._getBindGroup( groupName, group );
819
+
820
+ bindingsGroups.push( bindingsGroup );
821
+
822
+ }
823
+
824
+ this.bindGroups = bindingsGroups;
825
+
826
+ }
827
+
828
+ return bindingsGroups;
829
+
830
+ }
831
+
832
+ /**
833
+ * Sorts the bind groups and updates {@link NodeBuilder#bindingsIndexes}.
834
+ */
835
+ sortBindingGroups() {
836
+
837
+ const bindingsGroups = this.getBindings();
838
+
839
+ bindingsGroups.sort( ( a, b ) => ( a.bindings[ 0 ].groupNode.order - b.bindings[ 0 ].groupNode.order ) );
840
+
841
+ for ( let i = 0; i < bindingsGroups.length; i ++ ) {
842
+
843
+ const bindingGroup = bindingsGroups[ i ];
844
+ this.bindingsIndexes[ bindingGroup.name ].group = i;
845
+
846
+ }
847
+
848
+ }
849
+
850
+ /**
851
+ * The builder maintains each node in a hash-based dictionary.
852
+ * This method sets the given node (value) with the given hash (key) into this dictionary.
853
+ *
854
+ * @param {Node} node - The node to add.
855
+ * @param {number} hash - The hash of the node.
856
+ */
857
+ setHashNode( node, hash ) {
858
+
859
+ this.hashNodes[ hash ] = node;
860
+
861
+ }
862
+
863
+ /**
864
+ * Adds a node to this builder.
865
+ *
866
+ * @param {Node} node - The node to add.
867
+ */
868
+ addNode( node ) {
869
+
870
+ if ( this.nodes.has( node ) === false ) {
871
+
872
+ this.nodes.add( node );
873
+
874
+ this.setHashNode( node, node.getHash( this ) );
875
+
876
+ }
877
+
878
+ }
879
+
880
+ /**
881
+ * It is used to add Nodes that will be used as FRAME and RENDER events,
882
+ * and need to follow a certain sequence in the calls to work correctly.
883
+ * This function should be called after 'setup()' in the 'build()' process to ensure that the child nodes are processed first.
884
+ *
885
+ * @param {Node} node - The node to add.
886
+ */
887
+ addSequentialNode( node ) {
888
+
889
+ const updateBeforeType = node.updateBeforeType;
890
+ const updateAfterType = node.updateAfterType;
891
+
892
+ if ( updateBeforeType !== NodeUpdateType.NONE || updateAfterType !== NodeUpdateType.NONE ) {
893
+
894
+ this.sequentialNodes.add( node );
895
+
896
+ }
897
+
898
+ }
899
+
900
+ /**
901
+ * Checks the update types of nodes
902
+ */
903
+ buildUpdateNodes() {
904
+
905
+ for ( const node of this.nodes ) {
906
+
907
+ const updateType = node.updateType;
908
+
909
+ if ( updateType !== NodeUpdateType.NONE ) {
910
+
911
+ this.updateNodes.push( node );
912
+
913
+ }
914
+
915
+ }
916
+
917
+ for ( const node of this.sequentialNodes ) {
918
+
919
+ const updateBeforeType = node.updateBeforeType;
920
+ const updateAfterType = node.updateAfterType;
921
+
922
+ if ( updateBeforeType !== NodeUpdateType.NONE ) {
923
+
924
+ this.updateBeforeNodes.push( node );
925
+
926
+ }
927
+
928
+ if ( updateAfterType !== NodeUpdateType.NONE ) {
929
+
930
+ this.updateAfterNodes.push( node );
931
+
932
+ }
933
+
934
+ }
935
+
936
+ }
937
+
938
+ /**
939
+ * A reference the current node which is the
940
+ * last node in the chain of nodes.
941
+ *
942
+ * @type {Node}
943
+ */
944
+ get currentNode() {
945
+
946
+ return this.chaining[ this.chaining.length - 1 ];
947
+
948
+ }
949
+
950
+ /**
951
+ * A reference to the render pipeline.
952
+ *
953
+ * @type {RenderPipeline}
954
+ */
955
+ get renderPipeline() {
956
+
957
+ return this.context.renderPipeline;
958
+
959
+ }
960
+
961
+ /**
962
+ * Whether the given texture is filtered or not.
963
+ *
964
+ * @param {Texture} texture - The texture to check.
965
+ * @return {boolean} Whether the given texture is filtered or not.
966
+ */
967
+ isFilteredTexture( texture ) {
968
+
969
+ return ( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
970
+ texture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter );
971
+
972
+ }
973
+
974
+ /**
975
+ * Returns the maximum number of bytes available for uniform buffers.
976
+ *
977
+ * @return {number} The maximum number of bytes available for uniform buffers.
978
+ */
979
+ getUniformBufferLimit() {
980
+
981
+ return this.renderer.backend.capabilities.getUniformBufferLimit();
982
+
983
+ }
984
+
985
+ /**
986
+ * Adds the given node to the internal node chain.
987
+ * This is used to check recursive calls in node-graph.
988
+ *
989
+ * @param {Node} node - The node to add.
990
+ */
991
+ addChain( node ) {
992
+
993
+ /*
994
+ if ( this.chaining.indexOf( node ) !== - 1 ) {
995
+
996
+ warn( 'Recursive node: ', node );
997
+
998
+ }
999
+ */
1000
+
1001
+ this.chaining.push( node );
1002
+
1003
+ }
1004
+
1005
+ /**
1006
+ * Removes the given node from the internal node chain.
1007
+ *
1008
+ * @param {Node} node - The node to remove.
1009
+ */
1010
+ removeChain( node ) {
1011
+
1012
+ const lastChain = this.chaining.pop();
1013
+
1014
+ if ( lastChain !== node ) {
1015
+
1016
+ throw new Error( 'THREE.NodeBuilder: Invalid node chaining!' );
1017
+
1018
+ }
1019
+
1020
+ }
1021
+
1022
+ /**
1023
+ * Returns the native shader method name for a given generic name. E.g.
1024
+ * the method name `textureDimensions` matches the WGSL name but must be
1025
+ * resolved to `textureSize` in GLSL.
1026
+ *
1027
+ * @abstract
1028
+ * @param {string} method - The method name to resolve.
1029
+ * @return {string} The resolved method name.
1030
+ */
1031
+ getMethod( method ) {
1032
+
1033
+ return method;
1034
+
1035
+ }
1036
+
1037
+ /**
1038
+ * Returns the native snippet for a ternary operation. E.g. GLSL would output
1039
+ * a ternary op as `cond ? x : y` whereas WGSL would output it as `select(y, x, cond)`
1040
+ *
1041
+ * @abstract
1042
+ * @param {string} condSnippet - The condition determining which expression gets resolved.
1043
+ * @param {string} ifSnippet - The expression to resolve to if the condition is true.
1044
+ * @param {string} elseSnippet - The expression to resolve to if the condition is false.
1045
+ * @return {string} The resolved method name.
1046
+ */
1047
+ getTernary( /* condSnippet, ifSnippet, elseSnippet*/ ) {
1048
+
1049
+ return null;
1050
+
1051
+ }
1052
+
1053
+ /**
1054
+ * Returns the native snippet for a per-component vector select. The default
1055
+ * implementation uses {@link NodeBuilder#getTernary}; renderers can
1056
+ * override this when their ternary operation does not accept vectors.
1057
+ *
1058
+ * @param {string} condSnippet - The per-component boolean (`bvecN`) condition.
1059
+ * @param {string} ifSnippet - The vector expression selected where `condSnippet` is `true`.
1060
+ * @param {string} elseSnippet - The vector expression selected where `condSnippet` is `false`.
1061
+ * @param {string} type - The (vector) type of `ifSnippet`/`elseSnippet`.
1062
+ * @return {string} The resolved method name.
1063
+ */
1064
+ getVectorSelect( condSnippet, ifSnippet, elseSnippet /*, type*/ ) {
1065
+
1066
+ return this.getTernary( condSnippet, ifSnippet, elseSnippet );
1067
+
1068
+ }
1069
+
1070
+ /**
1071
+ * Returns a node for the given hash, see {@link NodeBuilder#setHashNode}.
1072
+ *
1073
+ * @param {number} hash - The hash of the node.
1074
+ * @return {Node} The found node.
1075
+ */
1076
+ getNodeFromHash( hash ) {
1077
+
1078
+ return this.hashNodes[ hash ];
1079
+
1080
+ }
1081
+
1082
+ /**
1083
+ * Adds the Node to a target flow so that it can generate code in the 'generate' process.
1084
+ *
1085
+ * @param {('vertex'|'fragment'|'compute')} shaderStage - The shader stage.
1086
+ * @param {Node} node - The node to add.
1087
+ * @return {Node} The node.
1088
+ */
1089
+ addFlow( shaderStage, node ) {
1090
+
1091
+ this.flowNodes[ shaderStage ].push( node );
1092
+
1093
+ return node;
1094
+
1095
+ }
1096
+
1097
+ /**
1098
+ * Sets builder's context.
1099
+ *
1100
+ * @param {Object} context - The context to set.
1101
+ */
1102
+ setContext( context ) {
1103
+
1104
+ this.context = context;
1105
+
1106
+ }
1107
+
1108
+ /**
1109
+ * Returns the builder's current context.
1110
+ *
1111
+ * @return {Object} The builder's current context.
1112
+ */
1113
+ getContext() {
1114
+
1115
+ return this.context;
1116
+
1117
+ }
1118
+
1119
+ /**
1120
+ * Adds context data to the builder's current context.
1121
+ *
1122
+ * @param {Object} context - The context to add.
1123
+ * @return {Object} The previous context.
1124
+ */
1125
+ addContext( context ) {
1126
+
1127
+ const previousContext = this.getContext();
1128
+
1129
+ this.setContext( mergeContext( this.context, context ) );
1130
+
1131
+ return previousContext;
1132
+
1133
+ }
1134
+
1135
+ /**
1136
+ * Gets a context used in shader construction that can be shared across different materials.
1137
+ * This is necessary since the renderer cache can reuse shaders generated in one material and use them in another.
1138
+ *
1139
+ * @return {Object} The builder's current context without material.
1140
+ */
1141
+ getSharedContext() {
1142
+
1143
+ const context = { ...this.context };
1144
+
1145
+ delete context.material;
1146
+ delete context.getUV;
1147
+ delete context.getOutput;
1148
+ delete context.getTextureLevel;
1149
+ delete context.getAO;
1150
+ delete context.getGI;
1151
+ delete context.getShadow;
1152
+ delete context.nodeLoop;
1153
+ delete context.nodeBlock;
1154
+
1155
+ return context;
1156
+
1157
+ }
1158
+
1159
+ /**
1160
+ * Sets builder's cache.
1161
+ *
1162
+ * @param {NodeCache} cache - The cache to set.
1163
+ */
1164
+ setCache( cache ) {
1165
+
1166
+ this.cache = cache;
1167
+
1168
+ }
1169
+
1170
+ /**
1171
+ * Returns the builder's current cache.
1172
+ *
1173
+ * @return {NodeCache} The builder's current cache.
1174
+ */
1175
+ getCache() {
1176
+
1177
+ return this.cache;
1178
+
1179
+ }
1180
+
1181
+ /**
1182
+ * Returns a cache for the given node.
1183
+ *
1184
+ * @param {Node} node - The node.
1185
+ * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not.
1186
+ * @return {NodeCache} The cache.
1187
+ */
1188
+ getCacheFromNode( node, parent = true ) {
1189
+
1190
+ const data = this.getDataFromNode( node );
1191
+ if ( data.cache === undefined ) data.cache = new NodeCache( parent ? this.getCache() : null );
1192
+
1193
+ return data.cache;
1194
+
1195
+ }
1196
+
1197
+ /**
1198
+ * Whether the requested feature is available or not.
1199
+ *
1200
+ * @abstract
1201
+ * @param {string} name - The requested feature.
1202
+ * @return {boolean} Whether the requested feature is supported or not.
1203
+ */
1204
+ isAvailable( /*name*/ ) {
1205
+
1206
+ return false;
1207
+
1208
+ }
1209
+
1210
+ /**
1211
+ * Returns the vertexIndex input variable as a native shader string.
1212
+ *
1213
+ * @abstract
1214
+ * @return {string} The instanceIndex shader string.
1215
+ */
1216
+ getVertexIndex() {
1217
+
1218
+ warn( 'Abstract function.' );
1219
+
1220
+ }
1221
+
1222
+ /**
1223
+ * Contextually returns either the vertex stage instance index builtin
1224
+ * or the linearized index of an compute invocation within a grid of workgroups.
1225
+ *
1226
+ * @abstract
1227
+ * @return {string} The instanceIndex shader string.
1228
+ */
1229
+ getInstanceIndex() {
1230
+
1231
+ warn( 'Abstract function.' );
1232
+
1233
+ }
1234
+
1235
+ /**
1236
+ * Returns the drawIndex input variable as a native shader string.
1237
+ * Only relevant for WebGL and its `WEBGL_multi_draw` extension.
1238
+ *
1239
+ * @abstract
1240
+ * @return {?string} The drawIndex shader string.
1241
+ */
1242
+ getDrawIndex() {
1243
+
1244
+ warn( 'Abstract function.' );
1245
+
1246
+ }
1247
+
1248
+ /**
1249
+ * Returns the frontFacing input variable as a native shader string.
1250
+ *
1251
+ * @abstract
1252
+ * @return {string} The frontFacing shader string.
1253
+ */
1254
+ getFrontFacing() {
1255
+
1256
+ warn( 'Abstract function.' );
1257
+
1258
+ }
1259
+
1260
+ /**
1261
+ * Returns the fragCoord input variable as a native shader string.
1262
+ *
1263
+ * @abstract
1264
+ * @return {string} The fragCoord shader string.
1265
+ */
1266
+ getFragCoord() {
1267
+
1268
+ warn( 'Abstract function.' );
1269
+
1270
+ }
1271
+
1272
+ /**
1273
+ * Returns a builtin representing the size of a subgroup within the current shader.
1274
+ *
1275
+ * @abstract
1276
+ * @return {string} The subgroup size shader string.
1277
+ */
1278
+ getSubgroupSize() {
1279
+
1280
+ warn( 'Abstract function.' );
1281
+
1282
+ }
1283
+
1284
+ /**
1285
+ * Returns a builtin representing the index of an invocation within its subgroup.
1286
+ *
1287
+ * @abstract
1288
+ * @return {string} The invocation subgroup index shader string.
1289
+ */
1290
+ getInvocationSubgroupIndex() {
1291
+
1292
+ warn( 'Abstract function.' );
1293
+
1294
+ }
1295
+
1296
+ /**
1297
+ * Returns a builtin representing the index of the current invocation's subgroup within its workgroup.
1298
+ *
1299
+ * @abstract
1300
+ * @return {string} The subgroup index shader string.
1301
+ */
1302
+ getSubgroupIndex() {
1303
+
1304
+ warn( 'Abstract function.' );
1305
+
1306
+ }
1307
+
1308
+ /**
1309
+ * Enables subgroups.
1310
+ *
1311
+ * @abstract
1312
+ */
1313
+ enableSubGroups() {
1314
+
1315
+ warn( 'Abstract function.' );
1316
+
1317
+ }
1318
+
1319
+ /**
1320
+ * Enables 16 bit floats.
1321
+ *
1322
+ * @abstract
1323
+ */
1324
+ enableShaderF16() {
1325
+
1326
+ warn( 'Abstract function.' );
1327
+
1328
+ }
1329
+
1330
+ /**
1331
+ * Enables dual source blending.
1332
+ *
1333
+ * @abstract
1334
+ */
1335
+ enableDualSourceBlending() {
1336
+
1337
+ warn( 'Abstract function.' );
1338
+
1339
+ }
1340
+
1341
+ /**
1342
+ * Whether to flip texture data along its vertical axis or not. WebGL needs
1343
+ * this method evaluate to `true`, WebGPU to `false`.
1344
+ *
1345
+ * @abstract
1346
+ * @return {boolean} Whether to flip texture data along its vertical axis or not.
1347
+ */
1348
+ isFlipY() {
1349
+
1350
+ return false;
1351
+
1352
+ }
1353
+
1354
+ /**
1355
+ * Returns whether the builder is currently in an assignment context.
1356
+ *
1357
+ * @return {boolean} Whether the builder is in an assignment context.
1358
+ */
1359
+ isContextAssign() {
1360
+
1361
+ return this.context.assign === true;
1362
+
1363
+ }
1364
+
1365
+ /**
1366
+ * Calling this method increases the usage count for the given node by one.
1367
+ *
1368
+ * @param {Node} node - The node to increase the usage count for.
1369
+ * @return {number} The updated usage count.
1370
+ */
1371
+ increaseUsage( node ) {
1372
+
1373
+ const nodeData = this.getDataFromNode( node );
1374
+ nodeData.usageCount = nodeData.usageCount === undefined ? 1 : nodeData.usageCount + 1;
1375
+
1376
+ if ( this.isContextAssign() ) {
1377
+
1378
+ nodeData.writeUsageCount = nodeData.writeUsageCount === undefined ? 1 : nodeData.writeUsageCount + 1;
1379
+
1380
+ } else {
1381
+
1382
+ nodeData.readUsageCount = nodeData.readUsageCount === undefined ? 1 : nodeData.readUsageCount + 1;
1383
+
1384
+ }
1385
+
1386
+ return nodeData.usageCount;
1387
+
1388
+ }
1389
+
1390
+ /**
1391
+ * Returns whether the given node has been written to in any shader stage.
1392
+ *
1393
+ * @param {Node} node - The node to check.
1394
+ * @return {boolean} Whether the node has been written to.
1395
+ */
1396
+ hasWriteUsage( node ) {
1397
+
1398
+ const refNode = node.getShared( this );
1399
+ const cache = refNode.isGlobal( this ) ? this.globalCache : this.cache;
1400
+ const nodeData = cache.getData( refNode );
1401
+
1402
+ if ( nodeData !== undefined ) {
1403
+
1404
+ for ( const shaderStage in nodeData ) {
1405
+
1406
+ if ( _checkWriteUsage( nodeData[ shaderStage ] ) ) {
1407
+
1408
+ return true;
1409
+
1410
+ }
1411
+
1412
+ }
1413
+
1414
+ }
1415
+
1416
+ return false;
1417
+
1418
+ }
1419
+
1420
+ /**
1421
+ * Generates a texture sample shader string for the given texture data.
1422
+ *
1423
+ * @abstract
1424
+ * @param {Texture} texture - The texture.
1425
+ * @param {string} textureProperty - The texture property name.
1426
+ * @param {string} uvSnippet - Snippet defining the texture coordinates.
1427
+ * @return {string} The generated shader string.
1428
+ */
1429
+ generateTexture( /* texture, textureProperty, uvSnippet */ ) {
1430
+
1431
+ warn( 'Abstract function.' );
1432
+
1433
+ }
1434
+
1435
+ /**
1436
+ * Generates a texture LOD shader string for the given texture data.
1437
+ *
1438
+ * @abstract
1439
+ * @param {Texture} texture - The texture.
1440
+ * @param {string} textureProperty - The texture property name.
1441
+ * @param {string} uvSnippet - Snippet defining the texture coordinates.
1442
+ * @param {?string} depthSnippet - Snippet defining the 0-based texture array index to sample.
1443
+ * @param {string} levelSnippet - Snippet defining the mip level.
1444
+ * @return {string} The generated shader string.
1445
+ */
1446
+ generateTextureLod( /* texture, textureProperty, uvSnippet, depthSnippet, levelSnippet */ ) {
1447
+
1448
+ warn( 'Abstract function.' );
1449
+
1450
+ }
1451
+
1452
+ /**
1453
+ * Generates a texture size shader string for the given texture data.
1454
+ *
1455
+ * @abstract
1456
+ * @param {Texture} texture - The texture.
1457
+ * @param {string} textureProperty - The texture property name.
1458
+ * @param {string} levelSnippet - Snippet defining the mip level.
1459
+ * @return {string} The generated shader string.
1460
+ */
1461
+ generateTextureSize( /* texture, textureProperty, levelSnippet */ ) {
1462
+
1463
+ warn( 'Abstract function.' );
1464
+
1465
+ }
1466
+
1467
+ /**
1468
+ * Generates the array declaration string.
1469
+ *
1470
+ * @param {string} type - The type.
1471
+ * @param {?number} [count] - The count.
1472
+ * @return {string} The generated value as a shader string.
1473
+ */
1474
+ generateArrayDeclaration( type, count ) {
1475
+
1476
+ return this.getType( type ) + '[ ' + count + ' ]';
1477
+
1478
+ }
1479
+
1480
+ /**
1481
+ * Generates the array shader string for the given type and value.
1482
+ *
1483
+ * @param {string} type - The type.
1484
+ * @param {?number} [count] - The count.
1485
+ * @param {?Array<Node>} [values=null] - The default values.
1486
+ * @return {string} The generated value as a shader string.
1487
+ */
1488
+ generateArray( type, count, values = null ) {
1489
+
1490
+ let snippet = this.generateArrayDeclaration( type, count ) + '( ';
1491
+
1492
+ for ( let i = 0; i < count; i ++ ) {
1493
+
1494
+ const value = values ? values[ i ] : null;
1495
+
1496
+ if ( value !== null ) {
1497
+
1498
+ snippet += value.build( this, type );
1499
+
1500
+ } else {
1501
+
1502
+ snippet += this.generateConst( type );
1503
+
1504
+ }
1505
+
1506
+ if ( i < count - 1 ) snippet += ', ';
1507
+
1508
+ }
1509
+
1510
+ snippet += ' )';
1511
+
1512
+ return snippet;
1513
+
1514
+ }
1515
+
1516
+ /**
1517
+ * Generates the struct shader string.
1518
+ *
1519
+ * @param {string} type - The type.
1520
+ * @param {Array<Object>} [membersLayout] - The count.
1521
+ * @param {?Array<Node>} [values=null] - The default values.
1522
+ * @return {string} The generated value as a shader string.
1523
+ */
1524
+ generateStruct( type, membersLayout, values = null ) {
1525
+
1526
+ const snippets = [];
1527
+
1528
+ for ( const member of membersLayout ) {
1529
+
1530
+ const { name, type } = member;
1531
+
1532
+ if ( values && values[ name ] && values[ name ].isNode ) {
1533
+
1534
+ snippets.push( values[ name ].build( this, type ) );
1535
+
1536
+ } else {
1537
+
1538
+ snippets.push( this.generateConst( type ) );
1539
+
1540
+ }
1541
+
1542
+ }
1543
+
1544
+ return type + '( ' + snippets.join( ', ' ) + ' )';
1545
+
1546
+ }
1547
+
1548
+ /**
1549
+ * Generates the shader string for the given type and value.
1550
+ *
1551
+ * @param {string} type - The type.
1552
+ * @param {?any} [value=null] - The value.
1553
+ * @return {string} The generated value as a shader string.
1554
+ */
1555
+ generateConst( type, value = null ) {
1556
+
1557
+ if ( value === null ) {
1558
+
1559
+ if ( type === 'float' || type === 'int' || type === 'uint' ) value = 0;
1560
+ else if ( type === 'bool' ) value = false;
1561
+ else if ( type === 'color' ) value = new Color();
1562
+ else if ( type === 'vec2' || type === 'uvec2' || type === 'ivec2' || type === 'bvec2' ) value = new Vector2();
1563
+ else if ( type === 'vec3' || type === 'uvec3' || type === 'ivec3' || type === 'bvec3' ) value = new Vector3();
1564
+ else if ( type === 'vec4' || type === 'uvec4' || type === 'ivec4' || type === 'bvec4' ) value = new Vector4();
1565
+
1566
+ }
1567
+
1568
+ if ( type === 'float' ) return _toFloat( value );
1569
+ if ( type === 'int' ) return `${ Math.trunc( value ) }`;
1570
+ if ( type === 'uint' ) return value >= 0 ? `${ Math.trunc( value ) }u` : '0u';
1571
+ if ( type === 'bool' ) return value ? 'true' : 'false';
1572
+ if ( type === 'color' ) return `${ this.getType( 'vec3' ) }( ${ _toFloat( value.r ) }, ${ _toFloat( value.g ) }, ${ _toFloat( value.b ) } )`;
1573
+
1574
+ const typeLength = this.getTypeLength( type );
1575
+
1576
+ const componentType = this.getComponentType( type );
1577
+
1578
+ const generateConst = value => this.generateConst( componentType, value );
1579
+
1580
+ if ( typeLength === 2 ) {
1581
+
1582
+ return `${ this.getType( type ) }( ${ generateConst( value.x ) }, ${ generateConst( value.y ) } )`;
1583
+
1584
+ } else if ( typeLength === 3 ) {
1585
+
1586
+ return `${ this.getType( type ) }( ${ generateConst( value.x ) }, ${ generateConst( value.y ) }, ${ generateConst( value.z ) } )`;
1587
+
1588
+ } else if ( typeLength === 4 && type !== 'mat2' ) {
1589
+
1590
+ return `${ this.getType( type ) }( ${ generateConst( value.x ) }, ${ generateConst( value.y ) }, ${ generateConst( value.z ) }, ${ generateConst( value.w ) } )`;
1591
+
1592
+ } else if ( typeLength >= 4 && value && ( value.isMatrix2 || value.isMatrix3 || value.isMatrix4 ) ) {
1593
+
1594
+ return `${ this.getType( type ) }( ${ value.elements.map( generateConst ).join( ', ' ) } )`;
1595
+
1596
+ } else if ( typeLength > 4 ) {
1597
+
1598
+ return `${ this.getType( type ) }()`;
1599
+
1600
+ }
1601
+
1602
+ throw new Error( `THREE.NodeBuilder: Type '${type}' not found in generate constant attempt.` );
1603
+
1604
+ }
1605
+
1606
+ /**
1607
+ * It might be necessary to convert certain data types to different ones
1608
+ * so this method can be used to hide the conversion.
1609
+ *
1610
+ * @param {string} type - The type.
1611
+ * @return {string} The updated type.
1612
+ */
1613
+ getType( type ) {
1614
+
1615
+ if ( type === 'color' ) return 'vec3';
1616
+
1617
+ return type;
1618
+
1619
+ }
1620
+
1621
+ /**
1622
+ * Whether the given attribute name is defined in the geometry or not.
1623
+ *
1624
+ * @param {string} name - The attribute name.
1625
+ * @return {boolean} Whether the given attribute name is defined in the geometry.
1626
+ */
1627
+ hasGeometryAttribute( name ) {
1628
+
1629
+ return this.geometry && this.geometry.getAttribute( name ) !== undefined;
1630
+
1631
+ }
1632
+
1633
+ /**
1634
+ * Returns a node attribute for the given name and type.
1635
+ *
1636
+ * @param {string} name - The attribute's name.
1637
+ * @param {string} type - The attribute's type.
1638
+ * @return {NodeAttribute} The node attribute.
1639
+ */
1640
+ getAttribute( name, type ) {
1641
+
1642
+ const attributes = this.attributes;
1643
+
1644
+ // find attribute
1645
+
1646
+ for ( const attribute of attributes ) {
1647
+
1648
+ if ( attribute.name === name ) {
1649
+
1650
+ return attribute;
1651
+
1652
+ }
1653
+
1654
+ }
1655
+
1656
+ // create a new if no exist
1657
+
1658
+ const attribute = new NodeAttribute( name, type );
1659
+
1660
+ this.registerDeclaration( attribute );
1661
+
1662
+ attributes.push( attribute );
1663
+
1664
+ return attribute;
1665
+
1666
+ }
1667
+
1668
+ /**
1669
+ * Returns for the given node and shader stage the property name for the shader.
1670
+ *
1671
+ * @param {Node} node - The node.
1672
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
1673
+ * @return {string} The property name.
1674
+ */
1675
+ getPropertyName( node/*, shaderStage*/ ) {
1676
+
1677
+ return node.name;
1678
+
1679
+ }
1680
+
1681
+ /**
1682
+ * Whether the given type is a scalar type or not.
1683
+ *
1684
+ * @param {string} type - The type to check.
1685
+ * @return {boolean} Whether the given type is a scalar type or not.
1686
+ */
1687
+ isScalar( type ) {
1688
+
1689
+ return type === 'float' || type === 'bool' || type === 'int' || type === 'uint';
1690
+
1691
+ }
1692
+
1693
+ /**
1694
+ * Returns whether the given name is a reserved keyword of the backend's
1695
+ * shading language. Backends override this method to provide their
1696
+ * language-specific keywords.
1697
+ *
1698
+ * @param {string} name - The name to test.
1699
+ * @return {boolean} Whether the name is a reserved keyword or not.
1700
+ */
1701
+ isReservedKeyword( /* name */ ) {
1702
+
1703
+ return false;
1704
+
1705
+ }
1706
+
1707
+ /**
1708
+ * Whether the given type is a vector type or not.
1709
+ *
1710
+ * @param {string} type - The type to check.
1711
+ * @return {boolean} Whether the given type is a vector type or not.
1712
+ */
1713
+ isVector( type ) {
1714
+
1715
+ let result = _isVectorCache.get( type );
1716
+ if ( result === undefined ) _isVectorCache.set( type, result = /vec\d/.test( type ) );
1717
+ return result;
1718
+
1719
+ }
1720
+
1721
+ /**
1722
+ * Whether the given type is a matrix type or not.
1723
+ *
1724
+ * @param {string} type - The type to check.
1725
+ * @return {boolean} Whether the given type is a matrix type or not.
1726
+ */
1727
+ isMatrix( type ) {
1728
+
1729
+ let result = _isMatrixCache.get( type );
1730
+ if ( result === undefined ) _isMatrixCache.set( type, result = /mat\d/.test( type ) );
1731
+ return result;
1732
+
1733
+ }
1734
+
1735
+ /**
1736
+ * Whether the given type is a reference type or not.
1737
+ *
1738
+ * @param {string} type - The type to check.
1739
+ * @return {boolean} Whether the given type is a reference type or not.
1740
+ */
1741
+ isReference( type ) {
1742
+
1743
+ return type === 'void' || type === 'property' || type === 'sampler' || type === 'samplerComparison' || type === 'texture' || type === 'cubeTexture' || type === 'storageTexture' || type === 'depthTexture' || type === 'texture3D';
1744
+
1745
+ }
1746
+
1747
+ /**
1748
+ * Checks if the given texture requires a manual conversion to the working color space.
1749
+ *
1750
+ * @abstract
1751
+ * @param {Texture} texture - The texture to check.
1752
+ * @return {boolean} Whether the given texture requires a conversion to working color space or not.
1753
+ */
1754
+ needsToWorkingColorSpace( /*texture*/ ) {
1755
+
1756
+ return false;
1757
+
1758
+ }
1759
+
1760
+ /**
1761
+ * Returns the component type of a given texture.
1762
+ *
1763
+ * @param {Texture} texture - The texture.
1764
+ * @return {string} The component type.
1765
+ */
1766
+ getComponentTypeFromTexture( texture ) {
1767
+
1768
+ const type = texture.type;
1769
+
1770
+ if ( texture.isDepthTexture === true ) return 'float';
1771
+
1772
+ if ( type === IntType ) return 'int';
1773
+ if ( type === UnsignedIntType ) return 'uint';
1774
+
1775
+ return 'float';
1776
+
1777
+ }
1778
+
1779
+ /**
1780
+ * Returns the element type for a given type.
1781
+ *
1782
+ * @param {string} type - The type.
1783
+ * @return {string} The element type.
1784
+ */
1785
+ getElementType( type ) {
1786
+
1787
+ if ( type === 'mat2' ) return 'vec2';
1788
+ if ( type === 'mat3' ) return 'vec3';
1789
+ if ( type === 'mat4' ) return 'vec4';
1790
+
1791
+ return this.getComponentType( type );
1792
+
1793
+ }
1794
+
1795
+ /**
1796
+ * Returns the component type for a given type.
1797
+ *
1798
+ * @param {string} type - The type.
1799
+ * @return {string} The component type.
1800
+ */
1801
+ getComponentType( type ) {
1802
+
1803
+ type = this.getVectorType( type );
1804
+
1805
+ if ( type === 'float' || type === 'bool' || type === 'int' || type === 'uint' ) return type;
1806
+
1807
+ let result = _componentTypeCache.get( type );
1808
+
1809
+ if ( result === undefined ) {
1810
+
1811
+ const componentType = /(b|i|u|)(vec|mat)([2-4])/.exec( type );
1812
+
1813
+ if ( componentType === null ) result = null;
1814
+ else if ( componentType[ 1 ] === 'b' ) result = 'bool';
1815
+ else if ( componentType[ 1 ] === 'i' ) result = 'int';
1816
+ else if ( componentType[ 1 ] === 'u' ) result = 'uint';
1817
+ else result = 'float';
1818
+
1819
+ _componentTypeCache.set( type, result );
1820
+
1821
+ }
1822
+
1823
+ return result;
1824
+
1825
+ }
1826
+
1827
+ /**
1828
+ * Returns the vector type for a given type.
1829
+ *
1830
+ * @param {string} type - The type.
1831
+ * @return {string} The vector type.
1832
+ */
1833
+ getVectorType( type ) {
1834
+
1835
+ if ( type === 'color' ) return 'vec3';
1836
+ if ( type === 'texture' || type === 'cubeTexture' || type === 'storageTexture' || type === 'texture3D' ) return 'vec4';
1837
+
1838
+ return type;
1839
+
1840
+ }
1841
+
1842
+ /**
1843
+ * Returns the data type for the given the length and component type.
1844
+ *
1845
+ * @param {number} length - The length.
1846
+ * @param {string} [componentType='float'] - The component type.
1847
+ * @return {string} The type.
1848
+ */
1849
+ getTypeFromLength( length, componentType = 'float' ) {
1850
+
1851
+ if ( length === 1 ) return componentType;
1852
+
1853
+ let baseType = getTypeFromLength( length );
1854
+ const prefix = componentType === 'float' ? '' : componentType[ 0 ];
1855
+
1856
+ // fix edge case for mat2x2 being same size as vec4
1857
+ if ( /mat2/.test( componentType ) === true ) {
1858
+
1859
+ baseType = baseType.replace( 'vec', 'mat' );
1860
+
1861
+ }
1862
+
1863
+ return prefix + baseType;
1864
+
1865
+ }
1866
+
1867
+ /**
1868
+ * Returns the type for a given typed array.
1869
+ *
1870
+ * @param {TypedArray} array - The typed array.
1871
+ * @return {string} The type.
1872
+ */
1873
+ getTypeFromArray( array ) {
1874
+
1875
+ return typeFromArray.get( array.constructor );
1876
+
1877
+ }
1878
+
1879
+ /**
1880
+ * Returns the type is an integer type.
1881
+ *
1882
+ * @param {string} type - The type.
1883
+ * @return {boolean} Whether the type is an integer type or not.
1884
+ */
1885
+ isInteger( type ) {
1886
+
1887
+ let result = _isIntegerCache.get( type );
1888
+ if ( result === undefined ) _isIntegerCache.set( type, result = /int|uint|(i|u)vec/.test( type ) );
1889
+ return result;
1890
+
1891
+ }
1892
+
1893
+ /**
1894
+ * Returns the type for a given buffer attribute.
1895
+ *
1896
+ * @param {BufferAttribute} attribute - The buffer attribute.
1897
+ * @return {string} The type.
1898
+ */
1899
+ getTypeFromAttribute( attribute ) {
1900
+
1901
+ let dataAttribute = attribute;
1902
+
1903
+ if ( attribute.isInterleavedBufferAttribute ) dataAttribute = attribute.data;
1904
+
1905
+ const array = dataAttribute.array;
1906
+ const itemSize = attribute.itemSize;
1907
+ const normalized = attribute.normalized;
1908
+
1909
+ let arrayType;
1910
+
1911
+ if ( ! ( attribute instanceof Float16BufferAttribute ) && normalized !== true ) {
1912
+
1913
+ arrayType = this.getTypeFromArray( array );
1914
+
1915
+ }
1916
+
1917
+ return this.getTypeFromLength( itemSize, arrayType );
1918
+
1919
+ }
1920
+
1921
+ /**
1922
+ * Returns the length for the given data type.
1923
+ *
1924
+ * @param {string} type - The data type.
1925
+ * @return {number} The length.
1926
+ */
1927
+ getTypeLength( type ) {
1928
+
1929
+ const vecType = this.getVectorType( type );
1930
+
1931
+ let length = _typeLengthCache.get( vecType );
1932
+
1933
+ if ( length === undefined ) {
1934
+
1935
+ length = this._getTypeLength( vecType );
1936
+
1937
+ _typeLengthCache.set( vecType, length );
1938
+
1939
+ }
1940
+
1941
+ return length;
1942
+
1943
+ }
1944
+
1945
+ _getTypeLength( type ) {
1946
+
1947
+ const vecType = type;
1948
+ const vecNum = /vec([2-4])/.exec( vecType );
1949
+
1950
+ if ( vecNum !== null ) return Number( vecNum[ 1 ] );
1951
+ if ( vecType === 'float' || vecType === 'bool' || vecType === 'int' || vecType === 'uint' ) return 1;
1952
+ if ( /mat2/.test( type ) === true ) return 4;
1953
+ if ( /mat3/.test( type ) === true ) return 9;
1954
+ if ( /mat4/.test( type ) === true ) return 16;
1955
+
1956
+ return 0;
1957
+
1958
+ }
1959
+
1960
+ /**
1961
+ * Returns the vector type for a given matrix type.
1962
+ *
1963
+ * @param {string} type - The matrix type.
1964
+ * @return {string} The vector type.
1965
+ */
1966
+ getVectorFromMatrix( type ) {
1967
+
1968
+ return type.replace( 'mat', 'vec' );
1969
+
1970
+ }
1971
+
1972
+ /**
1973
+ * For a given type this method changes the component type to the
1974
+ * given value. E.g. `vec4` should be changed to the new component type
1975
+ * `uint` which results in `uvec4`.
1976
+ *
1977
+ * @param {string} type - The type.
1978
+ * @param {string} newComponentType - The new component type.
1979
+ * @return {string} The new type.
1980
+ */
1981
+ changeComponentType( type, newComponentType ) {
1982
+
1983
+ return this.getTypeFromLength( this.getTypeLength( type ), newComponentType );
1984
+
1985
+ }
1986
+
1987
+ /**
1988
+ * Returns the common component type of the input nodes. Explicit types are
1989
+ * promoted first, then weak constants adopt that type, being truncated like other
1990
+ * integer constants. Only weak constants out of the integer range promote it.
1991
+ * Inputs consisting only of weak constants default to float.
1992
+ *
1993
+ * @param {...?Node} nodes - The input nodes.
1994
+ * @return {string} The promoted component type.
1995
+ */
1996
+ getPromotedComponentType( ...nodes ) {
1997
+
1998
+ let type = null;
1999
+ let hasWeak = false;
2000
+ let fitsUint = true;
2001
+ let fitsInt = true;
2002
+
2003
+ for ( const node of nodes ) {
2004
+
2005
+ if ( node === null ) continue;
2006
+
2007
+ if ( node.isWeak === true ) {
2008
+
2009
+ const value = Math.trunc( node.value );
2010
+
2011
+ hasWeak = true;
2012
+ fitsUint = fitsUint && value >= 0 && value <= 0xffffffff;
2013
+ fitsInt = fitsInt && value >= - 0x80000000 && value <= 0x7fffffff;
2014
+
2015
+ } else {
2016
+
2017
+ const componentType = this.getComponentType( node.getNodeType( this ) );
2018
+
2019
+ if ( type === null || _componentTypeRanks[ componentType ] > _componentTypeRanks[ type ] ) type = componentType;
2020
+
2021
+ }
2022
+
2023
+ }
2024
+
2025
+ if ( type === null || ( type === 'bool' && hasWeak ) ) return 'float';
2026
+ if ( type === 'uint' && fitsUint === false ) return fitsInt ? 'int' : 'float';
2027
+ if ( type === 'int' && fitsInt === false ) return 'float';
2028
+
2029
+ return type;
2030
+
2031
+ }
2032
+
2033
+ /**
2034
+ * Returns the integer type pendant for the given type.
2035
+ *
2036
+ * @param {string} type - The type.
2037
+ * @return {string} The integer type.
2038
+ */
2039
+ getIntegerType( type ) {
2040
+
2041
+ const componentType = this.getComponentType( type );
2042
+
2043
+ if ( componentType === 'int' || componentType === 'uint' ) return type;
2044
+
2045
+ return this.changeComponentType( type, 'int' );
2046
+
2047
+ }
2048
+
2049
+ /**
2050
+ * Adds an active stack to the internal stack.
2051
+ *
2052
+ * @param {StackNode} stack - The stack node to add.
2053
+ */
2054
+ setActiveStack( stack ) {
2055
+
2056
+ this.activeStacks.push( stack );
2057
+
2058
+ }
2059
+
2060
+ /**
2061
+ * Removes the active stack from the internal stack.
2062
+ *
2063
+ * @param {StackNode} stack - The stack node to remove.
2064
+ */
2065
+ removeActiveStack( stack ) {
2066
+
2067
+ if ( this.activeStacks[ this.activeStacks.length - 1 ] === stack ) {
2068
+
2069
+ this.activeStacks.pop();
2070
+
2071
+ } else {
2072
+
2073
+ throw new Error( 'THREE.NodeBuilder: Invalid active stack removal.' );
2074
+
2075
+ }
2076
+
2077
+ }
2078
+
2079
+ /**
2080
+ * Returns the active stack.
2081
+ *
2082
+ * @return {StackNode} The active stack.
2083
+ */
2084
+ getActiveStack() {
2085
+
2086
+ return this.activeStacks[ this.activeStacks.length - 1 ];
2087
+
2088
+ }
2089
+
2090
+ /**
2091
+ * Returns the base stack.
2092
+ *
2093
+ * @return {StackNode} The base stack.
2094
+ */
2095
+ getBaseStack() {
2096
+
2097
+ return this.activeStacks[ 0 ];
2098
+
2099
+ }
2100
+
2101
+ /**
2102
+ * Creates a block that repeats its code, e.g. a loop body, used in the current context.
2103
+ * The block keeps its parent block, the context and its position in the active stack.
2104
+ *
2105
+ * @return {Object} The code block.
2106
+ */
2107
+ createBlock() {
2108
+
2109
+ const stack = this.getActiveStack();
2110
+
2111
+ return {
2112
+ parent: this.context.nodeBlock || null,
2113
+ context: this.context,
2114
+ stack,
2115
+ node: stack !== undefined ? stack._currentNode : undefined
2116
+ };
2117
+
2118
+ }
2119
+
2120
+ /**
2121
+ * Declares a node outside of the stacks of this build, e.g. created outside of a function, before the outermost
2122
+ * block that would repeat it, e.g. a loop body. Blocks set up in another build or with context overrides of the
2123
+ * current one are kept, since the node could have another value in them.
2124
+ *
2125
+ * @param {Node} node - The node to declare.
2126
+ * @return {StackNode|undefined} The stack where the node was declared.
2127
+ */
2128
+ declareBeforeBlock( node ) {
2129
+
2130
+ if ( this.flowBlock !== null ) return;
2131
+
2132
+ let block;
2133
+
2134
+ for ( let nodeBlock = this.context.nodeBlock; nodeBlock; nodeBlock = nodeBlock.parent ) {
2135
+
2136
+ if ( this.activeStacks.includes( nodeBlock.stack ) === false || _hasContextOverrides( this.context, nodeBlock.context ) ) break;
2137
+
2138
+ block = nodeBlock;
2139
+
2140
+ }
2141
+
2142
+ if ( block === undefined || this.activeStacks.some( activeStack => activeStack.nodes.includes( node ) ) ) return;
2143
+
2144
+ block.stack.addToStackBefore( node, block.node );
2145
+
2146
+ return block.stack;
2147
+
2148
+ }
2149
+
2150
+ /**
2151
+ * Adds a stack node to the internal stack.
2152
+ *
2153
+ * @return {StackNode} The added stack node.
2154
+ */
2155
+ addStack() {
2156
+
2157
+ this.stack = stack( this.stack );
2158
+
2159
+ const previousStack = getCurrentStack();
2160
+
2161
+ this.stacks.push( previousStack );
2162
+ setCurrentStack( this.stack );
2163
+
2164
+ return this.stack;
2165
+
2166
+ }
2167
+
2168
+ /**
2169
+ * Removes the last stack node from the internal stack.
2170
+ *
2171
+ * @return {StackNode} The removed stack node.
2172
+ */
2173
+ removeStack() {
2174
+
2175
+ const lastStack = this.stack;
2176
+
2177
+ for ( const node of lastStack.nodes ) {
2178
+
2179
+ const nodeData = this.getDataFromNode( node );
2180
+ nodeData.stack = lastStack;
2181
+
2182
+ }
2183
+
2184
+ this.stack = lastStack.parent;
2185
+
2186
+ setCurrentStack( this.stacks.pop() );
2187
+
2188
+ return lastStack;
2189
+
2190
+ }
2191
+
2192
+ /**
2193
+ * The builder maintains (cached) data for each node during the building process. This method
2194
+ * can be used to get these data for a specific shader stage and cache.
2195
+ *
2196
+ * @param {Node} node - The node to get the data for.
2197
+ * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage.
2198
+ * @param {?NodeCache} cache - An optional cache.
2199
+ * @return {Object} The node data.
2200
+ */
2201
+ getDataFromNode( node, shaderStage = this.shaderStage, cache = null ) {
2202
+
2203
+ cache = cache === null ? ( node.isGlobal( this ) ? this.globalCache : this.cache ) : cache;
2204
+
2205
+ let nodeData = cache.getData( node );
2206
+
2207
+ if ( nodeData === undefined ) {
2208
+
2209
+ nodeData = {};
2210
+
2211
+ cache.setData( node, nodeData );
2212
+
2213
+ }
2214
+
2215
+ if ( nodeData[ shaderStage ] === undefined ) nodeData[ shaderStage ] = new NodeData();
2216
+
2217
+ //
2218
+
2219
+ let data = nodeData[ shaderStage ];
2220
+
2221
+ if ( this.subBuildLayers.length === 0 ) return data;
2222
+
2223
+ const subBuilds = nodeData.any ? nodeData.any.subBuilds : null;
2224
+ const subBuild = this.getClosestSubBuild( subBuilds );
2225
+
2226
+ if ( subBuild ) {
2227
+
2228
+ if ( data.subBuildsCache === undefined ) data.subBuildsCache = {};
2229
+
2230
+ data = data.subBuildsCache[ subBuild ] || ( data.subBuildsCache[ subBuild ] = new NodeData() );
2231
+ data.subBuilds = subBuilds;
2232
+
2233
+ }
2234
+
2235
+ return data;
2236
+
2237
+ }
2238
+
2239
+ /**
2240
+ * Returns the properties for the given node and shader stage.
2241
+ *
2242
+ * Properties are typically used within a build stage to reference a node's
2243
+ * child node or nodes manually assigned to the properties in a separate build stage.
2244
+ * A typical usage pattern for defining nodes manually would be assigning dependency nodes
2245
+ * to the current node's properties in the setup stage and building those properties in the generate stage.
2246
+ *
2247
+ * @param {Node} node - The node to get the properties for.
2248
+ * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage='any'] - The shader stage.
2249
+ * @return {Object} The node properties.
2250
+ */
2251
+ getNodeProperties( node, shaderStage = 'any' ) {
2252
+
2253
+ const nodeData = this.getDataFromNode( node, shaderStage );
2254
+
2255
+ return nodeData.properties || ( nodeData.properties = { outputNode: null } );
2256
+
2257
+ }
2258
+
2259
+ /**
2260
+ * Returns an instance of {@link NodeAttribute} for the given buffer attribute node.
2261
+ *
2262
+ * @param {BufferAttributeNode} node - The buffer attribute node.
2263
+ * @param {string} type - The node type.
2264
+ * @param {?string} [name=null] - The name of the buffer attribute.
2265
+ * @return {NodeAttribute} The node attribute.
2266
+ */
2267
+ getBufferAttributeFromNode( node, type, name = null ) {
2268
+
2269
+ const nodeData = this.getDataFromNode( node, 'vertex' );
2270
+
2271
+ let bufferAttribute = nodeData.bufferAttribute;
2272
+
2273
+ if ( bufferAttribute === undefined ) {
2274
+
2275
+ const index = this.uniforms.index ++;
2276
+
2277
+ if ( name === null ) {
2278
+
2279
+ name = 'nodeAttribute' + index;
2280
+
2281
+ }
2282
+
2283
+ bufferAttribute = new NodeAttribute( name, type, node );
2284
+
2285
+ this.bufferAttributes.push( bufferAttribute );
2286
+
2287
+ nodeData.bufferAttribute = bufferAttribute;
2288
+
2289
+ }
2290
+
2291
+ return bufferAttribute;
2292
+
2293
+ }
2294
+
2295
+ /**
2296
+ * Returns an instance of {@link StructType} for the given struct name and shader stage
2297
+ * or null if not found.
2298
+ *
2299
+ * @param {string} name - The name of the struct.
2300
+ * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage.
2301
+ * @return {?StructType} The struct type or null if not found.
2302
+ */
2303
+ getStructTypeNode( name, shaderStage = this.shaderStage ) {
2304
+
2305
+ return this.types[ shaderStage ][ name ] || null;
2306
+
2307
+ }
2308
+
2309
+ /**
2310
+ * Returns an instance of {@link StructType} for the given output struct node.
2311
+ *
2312
+ * @param {OutputStructNode} node - The output struct node.
2313
+ * @param {Array<Object>} membersLayout - The output struct types.
2314
+ * @param {?string} [name=null] - The name of the struct.
2315
+ * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage.
2316
+ * @return {StructType} The struct type attribute.
2317
+ */
2318
+ getStructTypeFromNode( node, membersLayout, name = null, shaderStage = this.shaderStage ) {
2319
+
2320
+ const nodeData = this.getDataFromNode( node, shaderStage, this.globalCache );
2321
+
2322
+ let structType = nodeData.structType;
2323
+
2324
+ if ( structType === undefined ) {
2325
+
2326
+ const index = this.structs.index ++;
2327
+
2328
+ if ( name === null ) name = 'StructType' + index;
2329
+
2330
+ structType = new StructType( name, membersLayout );
2331
+
2332
+ this.structs[ shaderStage ].push( structType );
2333
+ this.types[ shaderStage ][ name ] = node;
2334
+
2335
+ nodeData.structType = structType;
2336
+
2337
+ }
2338
+
2339
+ return structType;
2340
+
2341
+ }
2342
+
2343
+ /**
2344
+ * Returns an instance of {@link StructType} for the given output struct node.
2345
+ *
2346
+ * @param {OutputStructNode} node - The output struct node.
2347
+ * @param {Array<Object>} membersLayout - The output struct types.
2348
+ * @return {StructType} The struct type attribute.
2349
+ */
2350
+ getOutputStructTypeFromNode( node, membersLayout ) {
2351
+
2352
+ const structType = this.getStructTypeFromNode( node, membersLayout, 'OutputType', 'fragment' );
2353
+ structType.output = true;
2354
+
2355
+ return structType;
2356
+
2357
+ }
2358
+
2359
+ /**
2360
+ * Returns an instance of {@link NodeUniform} for the given uniform node.
2361
+ *
2362
+ * @param {UniformNode} node - The uniform node.
2363
+ * @param {string} type - The uniform type.
2364
+ * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage.
2365
+ * @param {?string} name - The name of the uniform.
2366
+ * @return {NodeUniform} The node uniform.
2367
+ */
2368
+ getUniformFromNode( node, type, shaderStage = this.shaderStage, name = null ) {
2369
+
2370
+ const nodeData = this.getDataFromNode( node, shaderStage, this.globalCache );
2371
+
2372
+ let nodeUniform = nodeData.uniform;
2373
+
2374
+ if ( nodeUniform === undefined ) {
2375
+
2376
+ const index = this.uniforms.index ++;
2377
+
2378
+ nodeUniform = new NodeUniform( name || ( 'nodeUniform' + index ), type, node );
2379
+
2380
+ this.uniforms[ shaderStage ].push( nodeUniform );
2381
+
2382
+ this.registerDeclaration( nodeUniform );
2383
+
2384
+ nodeData.uniform = nodeUniform;
2385
+
2386
+ }
2387
+
2388
+ return nodeUniform;
2389
+
2390
+ }
2391
+
2392
+ /**
2393
+ * Returns an instance of {@link NodeVar} for the given variable node.
2394
+ *
2395
+ * @param {VarNode} node - The variable node.
2396
+ * @param {?string} name - The variable's name.
2397
+ * @param {string} [type=node.getNodeType( this )] - The variable's type.
2398
+ * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage.
2399
+ * @param {boolean} [readOnly=false] - Whether the variable is read-only or not.
2400
+ * @param {boolean} [local=false] - Whether the variable is declared locally in the flow instead of the variable section.
2401
+ * @param {string} [property='variable'] - The node data property that holds the variable. Allows a node to own more than one variable.
2402
+ *
2403
+ * @return {NodeVar} The node variable.
2404
+ */
2405
+ getVarFromNode( node, name = null, type = node.getNodeType( this ), shaderStage = this.shaderStage, readOnly = false, local = false, property = 'variable' ) {
2406
+
2407
+ const nodeData = this.getDataFromNode( node, shaderStage );
2408
+ const subBuildVariable = this.getSubBuildProperty( property, nodeData.subBuilds );
2409
+
2410
+ let nodeVar = nodeData[ subBuildVariable ];
2411
+
2412
+ if ( nodeVar === undefined ) {
2413
+
2414
+ const idNS = readOnly ? '_const' : '_var';
2415
+
2416
+ const vars = this.vars[ shaderStage ] || ( this.vars[ shaderStage ] = [] );
2417
+ const id = this.vars[ idNS ] || ( this.vars[ idNS ] = 0 );
2418
+
2419
+ if ( name === null ) {
2420
+
2421
+ name = ( readOnly ? 'nodeConst' : 'nodeVar' ) + id;
2422
+
2423
+ this.vars[ idNS ] ++;
2424
+
2425
+ }
2426
+
2427
+ //
2428
+
2429
+ if ( subBuildVariable !== property ) {
2430
+
2431
+ name = this.getSubBuildProperty( name, nodeData.subBuilds );
2432
+
2433
+ }
2434
+
2435
+ //
2436
+
2437
+ const count = node.getArrayCount( this );
2438
+
2439
+ nodeVar = new NodeVar( name, type, readOnly, count, local );
2440
+
2441
+ if ( ! readOnly && ! local ) {
2442
+
2443
+ vars.push( nodeVar );
2444
+
2445
+ }
2446
+
2447
+ this.registerDeclaration( nodeVar );
2448
+
2449
+ nodeData[ subBuildVariable ] = nodeVar;
2450
+
2451
+ }
2452
+
2453
+ return nodeVar;
2454
+
2455
+ }
2456
+
2457
+ /**
2458
+ * Returns whether a Node or its flow is deterministic, useful for use in `const`.
2459
+ *
2460
+ * @param {Node} node - The varying node.
2461
+ * @return {boolean} Returns true if deterministic.
2462
+ */
2463
+ isDeterministic( node ) {
2464
+
2465
+ if ( node.isVarNode && node.assignable ) {
2466
+
2467
+ node = node.node;
2468
+
2469
+ }
2470
+
2471
+ if ( node.isMathNode ) {
2472
+
2473
+ return this.isDeterministic( node.aNode ) &&
2474
+ ( node.bNode ? this.isDeterministic( node.bNode ) : true ) &&
2475
+ ( node.cNode ? this.isDeterministic( node.cNode ) : true );
2476
+
2477
+ } else if ( node.isOperatorNode ) {
2478
+
2479
+ return this.isDeterministic( node.aNode ) &&
2480
+ ( node.bNode ? this.isDeterministic( node.bNode ) : true );
2481
+
2482
+ } else if ( node.isArrayNode ) {
2483
+
2484
+ if ( node.values !== null ) {
2485
+
2486
+ for ( const n of node.values ) {
2487
+
2488
+ if ( ! this.isDeterministic( n ) ) {
2489
+
2490
+ return false;
2491
+
2492
+ }
2493
+
2494
+ }
2495
+
2496
+ }
2497
+
2498
+ return true;
2499
+
2500
+ } else if ( node.isConstNode ) {
2501
+
2502
+ return true;
2503
+
2504
+ }
2505
+
2506
+ return false;
2507
+
2508
+ }
2509
+
2510
+ /**
2511
+ * Returns an instance of {@link NodeVarying} for the given varying node.
2512
+ *
2513
+ * @param {(VaryingNode|PropertyNode)} node - The varying node.
2514
+ * @param {?string} name - The varying's name.
2515
+ * @param {string} [type=node.getNodeType( this )] - The varying's type.
2516
+ * @param {?string} interpolationType - The interpolation type of the varying.
2517
+ * @param {?string} interpolationSampling - The interpolation sampling type of the varying.
2518
+ * @return {NodeVar} The node varying.
2519
+ */
2520
+ getVaryingFromNode( node, name = null, type = node.getNodeType( this ), interpolationType = null, interpolationSampling = null ) {
2521
+
2522
+ const nodeData = this.getDataFromNode( node, 'any' );
2523
+ const subBuildVarying = this.getSubBuildProperty( 'varying', nodeData.subBuilds );
2524
+
2525
+ let nodeVarying = nodeData[ subBuildVarying ];
2526
+
2527
+ if ( nodeVarying === undefined ) {
2528
+
2529
+ const varyings = this.varyings;
2530
+ const index = varyings.length;
2531
+
2532
+ if ( name === null ) name = 'nodeVarying' + index;
2533
+
2534
+ //
2535
+
2536
+ if ( subBuildVarying !== 'varying' ) {
2537
+
2538
+ name = this.getSubBuildProperty( name, nodeData.subBuilds );
2539
+
2540
+ }
2541
+
2542
+ //
2543
+
2544
+ nodeVarying = new NodeVarying( name, type, interpolationType, interpolationSampling );
2545
+
2546
+ varyings.push( nodeVarying );
2547
+
2548
+ this.registerDeclaration( nodeVarying );
2549
+
2550
+ nodeData[ subBuildVarying ] = nodeVarying;
2551
+
2552
+ }
2553
+
2554
+ return nodeVarying;
2555
+
2556
+ }
2557
+
2558
+ /**
2559
+ * Registers a node declaration in the current shader stage.
2560
+ *
2561
+ * @param {Object} node - The node to be registered.
2562
+ */
2563
+ registerDeclaration( node ) {
2564
+
2565
+ const shaderStage = this.shaderStage;
2566
+ const declarations = this.declarations[ shaderStage ] || ( this.declarations[ shaderStage ] = {} );
2567
+ const checkKeywords = this.renderer.debug.diagnostics.keywords;
2568
+
2569
+ const baseName = node.name;
2570
+
2571
+ let name = baseName;
2572
+ let declarationName = this.getDeclarationName( node );
2573
+ let index = 1;
2574
+
2575
+ // Automatically renames the property if the name is already in use or reserved.
2576
+
2577
+ while ( ( checkKeywords && this.isReservedKeyword( name ) ) || declarations[ declarationName ] !== undefined ) {
2578
+
2579
+ name = baseName + '_' + index ++;
2580
+ node.name = name;
2581
+ declarationName = this.getDeclarationName( node );
2582
+
2583
+ }
2584
+
2585
+ if ( name !== baseName ) {
2586
+
2587
+ warn( `TSL: Declaration name '${ baseName }' of '${ node.type }' is a reserved keyword or already in use. Renamed to '${ name }'.` );
2588
+
2589
+ }
2590
+
2591
+ declarations[ declarationName ] = node;
2592
+
2593
+ }
2594
+
2595
+ /**
2596
+ * Returns the identifier the given node declares in the shader. It is used
2597
+ * by {@link NodeBuilder#registerDeclaration} to detect name collisions.
2598
+ *
2599
+ * @param {Object} node - The node.
2600
+ * @return {string} The declaration name.
2601
+ */
2602
+ getDeclarationName( node ) {
2603
+
2604
+ return this.getPropertyName( node );
2605
+
2606
+ }
2607
+
2608
+ /**
2609
+ * Returns an instance of {@link NodeCode} for the given code node.
2610
+ *
2611
+ * @param {CodeNode} node - The code node.
2612
+ * @param {string} type - The node type.
2613
+ * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage.
2614
+ * @return {NodeCode} The node code.
2615
+ */
2616
+ getCodeFromNode( node, type, shaderStage = this.shaderStage ) {
2617
+
2618
+ const nodeData = this.getDataFromNode( node );
2619
+
2620
+ let nodeCode = nodeData.code;
2621
+
2622
+ if ( nodeCode === undefined ) {
2623
+
2624
+ const codes = this.codes[ shaderStage ] || ( this.codes[ shaderStage ] = [] );
2625
+ const index = codes.length;
2626
+
2627
+ nodeCode = new NodeCode( 'nodeCode' + index, type );
2628
+
2629
+ codes.push( nodeCode );
2630
+
2631
+ nodeData.code = nodeCode;
2632
+
2633
+ }
2634
+
2635
+ return nodeCode;
2636
+
2637
+ }
2638
+
2639
+ /**
2640
+ * Add a inline-code to the current flow.
2641
+ *
2642
+ * @param {string} code - The code to add.
2643
+ * @param {?Node} [node= null] - The node that generated the code.
2644
+ * @return {NodeBuilder} A reference to this node builder.
2645
+ */
2646
+ addLineFlowCode( code /*, node = null */ ) {
2647
+
2648
+ if ( code === '' ) return this;
2649
+
2650
+ code = this.tab + code;
2651
+
2652
+ if ( code.trimEnd().endsWith( ';' ) === false ) {
2653
+
2654
+ code = code + ';\n';
2655
+
2656
+ }
2657
+
2658
+ this.flow.code += code;
2659
+
2660
+ return this;
2661
+
2662
+ }
2663
+
2664
+ /**
2665
+ * Adds a code to the current code flow.
2666
+ *
2667
+ * @param {string} code - Shader code.
2668
+ * @return {NodeBuilder} A reference to this node builder.
2669
+ */
2670
+ addFlowCode( code ) {
2671
+
2672
+ this.flow.code += code;
2673
+
2674
+ return this;
2675
+
2676
+ }
2677
+
2678
+ /**
2679
+ * Add tab in the code that will be generated so that other snippets respect the current tabulation.
2680
+ * Typically used in codes with If,Else.
2681
+ *
2682
+ * @return {NodeBuilder} A reference to this node builder.
2683
+ */
2684
+ addFlowTab() {
2685
+
2686
+ this.tab += '\t';
2687
+
2688
+ return this;
2689
+
2690
+ }
2691
+
2692
+ /**
2693
+ * Removes a tab.
2694
+ *
2695
+ * @return {NodeBuilder} A reference to this node builder.
2696
+ */
2697
+ removeFlowTab() {
2698
+
2699
+ this.tab = this.tab.slice( 0, - 1 );
2700
+
2701
+ return this;
2702
+
2703
+ }
2704
+
2705
+ /**
2706
+ * Gets the current flow data based on a Node.
2707
+ *
2708
+ * @param {Node} node - Node that the flow was started.
2709
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
2710
+ * @return {Object} The flow data.
2711
+ */
2712
+ getFlowData( node/*, shaderStage*/ ) {
2713
+
2714
+ return this.flowsData.get( node );
2715
+
2716
+ }
2717
+
2718
+ /**
2719
+ * Executes the node flow based on a root node to generate the final shader code.
2720
+ *
2721
+ * @param {Node} node - The node to execute.
2722
+ * @return {Object} The code flow.
2723
+ */
2724
+ flowNode( node ) {
2725
+
2726
+ const output = node.getNodeType( this );
2727
+
2728
+ const flowData = this.flowChildNode( node, output );
2729
+
2730
+ this.flowsData.set( node, flowData );
2731
+
2732
+ return flowData;
2733
+
2734
+ }
2735
+
2736
+ /**
2737
+ * Includes a node in the current function node.
2738
+ *
2739
+ * @param {Node} node - The node to include.
2740
+ * @returns {void}
2741
+ */
2742
+ addInclude( node ) {
2743
+
2744
+ if ( this.currentFunctionNode !== null && this.currentFunctionNode.includes.includes( node ) === false ) {
2745
+
2746
+ this.currentFunctionNode.includes.push( node );
2747
+
2748
+ }
2749
+
2750
+ }
2751
+
2752
+ /**
2753
+ * Returns the native shader operator name for a given generic name.
2754
+ * It is a similar type of method like {@link NodeBuilder#getMethod}.
2755
+ *
2756
+ * @param {ShaderNodeInternal} shaderNode - The shader node to build the function node with.
2757
+ * @return {FunctionNode} The build function node.
2758
+ */
2759
+ buildFunctionNode( shaderNode ) {
2760
+
2761
+ const backend = this.renderer.backend;
2762
+
2763
+ let cache = _functionNodeCache.get( backend );
2764
+
2765
+ if ( cache === undefined ) {
2766
+
2767
+ cache = new WeakMap();
2768
+ _functionNodeCache.set( backend, cache );
2769
+
2770
+ }
2771
+
2772
+ let fn = cache.get( shaderNode );
2773
+
2774
+ if ( fn === undefined ) {
2775
+
2776
+ fn = new FunctionNode();
2777
+
2778
+ const previous = this.currentFunctionNode;
2779
+
2780
+ this.currentFunctionNode = fn;
2781
+
2782
+ fn.code = this.buildFunctionCode( shaderNode );
2783
+
2784
+ this.currentFunctionNode = previous;
2785
+
2786
+ cache.set( shaderNode, fn );
2787
+
2788
+ }
2789
+
2790
+ return fn;
2791
+
2792
+ }
2793
+
2794
+ /**
2795
+ * Generates a code flow based on a TSL function: Fn().
2796
+ *
2797
+ * @param {ShaderNodeInternal} shaderNode - A function code will be generated based on the input.
2798
+ * @return {Object}
2799
+ */
2800
+ flowShaderNode( shaderNode ) {
2801
+
2802
+ const layout = shaderNode.layout;
2803
+
2804
+ const inputs = _createLayoutInputs( layout, layout.inputs.map( input => new ParameterNode( input.type, input.name ) ) );
2805
+
2806
+ //
2807
+
2808
+ shaderNode.layout = null;
2809
+
2810
+ const callNode = shaderNode.call( inputs );
2811
+ const flowData = this.flowStagesNode( callNode, layout.type );
2812
+
2813
+ shaderNode.layout = layout;
2814
+
2815
+ return flowData;
2816
+
2817
+ }
2818
+
2819
+ /**
2820
+ * Returns the inputs of a call to a TSL function with layout. Missing inputs are completed
2821
+ * with the default values of the function parameters, found by running the function once
2822
+ * with all inputs and once without the missing ones, and comparing both node graphs.
2823
+ *
2824
+ * @private
2825
+ * @param {ShaderNodeInternal} shaderNode - The shader node of the function.
2826
+ * @param {?Array} rawInputs - The inputs of the call.
2827
+ * @return {?Array} The inputs of the call, or `null` if the defaults can't be resolved and the function must be expanded inline.
2828
+ */
2829
+ _getLayoutInputs( shaderNode, rawInputs ) {
2830
+
2831
+ const inputs = shaderNode.layout.inputs;
2832
+
2833
+ const firstInput = rawInputs !== null && rawInputs.length > 0 ? rawInputs[ 0 ] : null;
2834
+ const object = firstInput !== null && firstInput !== undefined && isArrayAsParameter( rawInputs ) === false ? firstInput : null;
2835
+ const provided = inputs.map( ( input, i ) => object !== null ? object[ input.name ] !== undefined : rawInputs !== null && rawInputs[ i ] !== undefined );
2836
+
2837
+ if ( provided.every( Boolean ) ) return rawInputs !== null ? rawInputs : [];
2838
+
2839
+ if ( shaderNode.once ) return null;
2840
+
2841
+ // The defaults only depend on which inputs are missing, so they are shared by all builders.
2842
+
2843
+ let cache = _layoutDefaultsCache.get( shaderNode );
2844
+
2845
+ if ( cache === undefined ) {
2846
+
2847
+ cache = new Map();
2848
+ _layoutDefaultsCache.set( shaderNode, cache );
2849
+
2850
+ }
2851
+
2852
+ const key = provided.map( Number ).join( '' );
2853
+
2854
+ let defaults = cache.get( key );
2855
+
2856
+ if ( defaults === undefined ) {
2857
+
2858
+ defaults = this._resolveLayoutDefaults( shaderNode, provided );
2859
+ cache.set( key, defaults );
2860
+
2861
+ }
2862
+
2863
+ if ( defaults === null ) return null;
2864
+
2865
+ if ( object !== null ) {
2866
+
2867
+ const completed = { ...object };
2868
+
2869
+ inputs.forEach( ( input, i ) => {
2870
+
2871
+ if ( provided[ i ] === false ) completed[ input.name ] = defaults[ i ];
2872
+
2873
+ } );
2874
+
2875
+ return [ completed ];
2876
+
2877
+ }
2878
+
2879
+ return provided.map( ( isProvided, i ) => isProvided ? rawInputs[ i ] : defaults[ i ] );
2880
+
2881
+ }
2882
+
2883
+ /**
2884
+ * Resolves the default values of the missing inputs of a TSL function with layout.
2885
+ *
2886
+ * @private
2887
+ * @param {ShaderNodeInternal} shaderNode - The shader node of the function.
2888
+ * @param {Array<boolean>} provided - Whether each input of the layout was provided.
2889
+ * @return {?Array<Node>} The default value of each missing input, or `null` if they could not be resolved.
2890
+ */
2891
+ _resolveLayoutDefaults( shaderNode, provided ) {
2892
+
2893
+ const layout = shaderNode.layout;
2894
+ const parameters = layout.inputs.map( input => new ParameterNode( input.type, input.name ) );
2895
+
2896
+ const fullGraph = this._getLayoutCallGraph( shaderNode, _createLayoutInputs( layout, parameters ) );
2897
+ const partialGraph = this._getLayoutCallGraph( shaderNode, _createLayoutInputs( layout, parameters.map( ( parameter, i ) => provided[ i ] ? parameter : undefined ) ) );
2898
+
2899
+ // Walk both graphs together: where the full graph uses the parameter of a missing input,
2900
+ // the partial graph uses its default value.
2901
+
2902
+ const missing = new Map();
2903
+ parameters.forEach( ( parameter, i ) => {
2904
+
2905
+ if ( provided[ i ] === false ) missing.set( parameter, i );
2906
+
2907
+ } );
2908
+
2909
+ const defaults = [];
2910
+ const visited = new Map();
2911
+
2912
+ const walk = ( a, b ) => {
2913
+
2914
+ if ( a === b ) return true;
2915
+ if ( ! a || ! b || a.isNode !== true || b.isNode !== true ) return false;
2916
+
2917
+ const index = missing.get( a );
2918
+
2919
+ if ( index !== undefined ) {
2920
+
2921
+ if ( defaults[ index ] === undefined ) defaults[ index ] = b;
2922
+
2923
+ return defaults[ index ] === b;
2924
+
2925
+ }
2926
+
2927
+ if ( visited.has( a ) ) return visited.get( a ) === b;
2928
+ if ( a.constructor !== b.constructor ) return false;
2929
+
2930
+ visited.set( a, b );
2931
+
2932
+ const childrenA = [ ...a.getChildren() ];
2933
+ const childrenB = [ ...b.getChildren() ];
2934
+
2935
+ if ( childrenA.length !== childrenB.length ) return false;
2936
+
2937
+ for ( let i = 0; i < childrenA.length; i ++ ) {
2938
+
2939
+ if ( walk( childrenA[ i ], childrenB[ i ] ) === false ) return false;
2940
+
2941
+ }
2942
+
2943
+ return true;
2944
+
2945
+ };
2946
+
2947
+ // The default values are evaluated when the parameters are destructured, before the body,
2948
+ // so the nodes they add to the stack come first. Align the body statements from the end.
2949
+
2950
+ const extra = partialGraph.nodes.length - fullGraph.nodes.length;
2951
+
2952
+ if ( extra < 0 ) return null;
2953
+
2954
+ visited.set( fullGraph, partialGraph );
2955
+
2956
+ if ( walk( fullGraph.outputNode, partialGraph.outputNode ) === false ) return null;
2957
+
2958
+ for ( let i = 0; i < fullGraph.nodes.length; i ++ ) {
2959
+
2960
+ if ( walk( fullGraph.nodes[ i ], partialGraph.nodes[ extra + i ] ) === false ) return null;
2961
+
2962
+ }
2963
+
2964
+ // Every missing input must have a default that does not depend on other parameters.
2965
+
2966
+ const parameterSet = new Set( parameters );
2967
+
2968
+ for ( const index of missing.values() ) {
2969
+
2970
+ const value = defaults[ index ];
2971
+
2972
+ if ( value === undefined ) return null;
2973
+
2974
+ const stack = [ value ];
2975
+ const seen = new Set();
2976
+
2977
+ while ( stack.length > 0 ) {
2978
+
2979
+ const node = stack.pop();
2980
+
2981
+ if ( parameterSet.has( node ) ) return null;
2982
+ if ( seen.has( node ) ) continue;
2983
+
2984
+ seen.add( node );
2985
+
2986
+ for ( const child of node.getChildren() ) stack.push( child );
2987
+
2988
+ }
2989
+
2990
+ }
2991
+
2992
+ return defaults;
2993
+
2994
+ }
2995
+
2996
+ /**
2997
+ * Runs a TSL function with layout as an inline call and returns the resulting stack.
2998
+ *
2999
+ * @private
3000
+ * @param {ShaderNodeInternal} shaderNode - The shader node of the function.
3001
+ * @param {Object} inputs - The inputs of the call.
3002
+ * @return {StackNode} The stack with the nodes of the call.
3003
+ */
3004
+ _getLayoutCallGraph( shaderNode, inputs ) {
3005
+
3006
+ const layout = shaderNode.layout;
3007
+
3008
+ let graph;
3009
+
3010
+ shaderNode.layout = null;
3011
+
3012
+ this.addStack();
3013
+
3014
+ try {
3015
+
3016
+ this.stack.outputNode = shaderNode.call( inputs ).call( this );
3017
+
3018
+ } finally {
3019
+
3020
+ graph = this.removeStack();
3021
+
3022
+ shaderNode.layout = layout;
3023
+
3024
+ }
3025
+
3026
+ return graph;
3027
+
3028
+ }
3029
+
3030
+ /**
3031
+ * Executes the node in a specific build stage.
3032
+ *
3033
+ * This function can be used to arbitrarily execute the specified build stage
3034
+ * outside of the standard build process. For instance, if a node's type depends
3035
+ * on properties created by the 'setup' stage, then flowBuildStage(node, 'setup')
3036
+ * can be used to execute the setup build stage and access its generated nodes
3037
+ * before the standard build process begins.
3038
+ *
3039
+ * @param {Node} node - The node to execute.
3040
+ * @param {string} buildStage - The build stage to execute the node in.
3041
+ * @param {?(Node|string)} [output=null] - Expected output type. For example 'vec3'.
3042
+ * @return {?(Node|string)} The result of the node build.
3043
+ */
3044
+ flowBuildStage( node, buildStage, output = null ) {
3045
+
3046
+ const previousBuildStage = this.getBuildStage();
3047
+
3048
+ this.setBuildStage( buildStage );
3049
+
3050
+ const result = node.build( this, output );
3051
+
3052
+ this.setBuildStage( previousBuildStage );
3053
+
3054
+ return result;
3055
+
3056
+ }
3057
+
3058
+ /**
3059
+ * Runs the node flow through all the steps of creation, 'setup', 'analyze', 'generate'.
3060
+ *
3061
+ * @param {Node} node - The node to execute.
3062
+ * @param {?string} output - Expected output type. For example 'vec3'.
3063
+ * @return {Object}
3064
+ */
3065
+ flowStagesNode( node, output = null ) {
3066
+
3067
+ const previousFlow = this.flow;
3068
+ const previousVars = this.vars;
3069
+ const previousDeclarations = this.declarations;
3070
+ const previousCache = this.cache;
3071
+ const previousBuildStage = this.buildStage;
3072
+ const previousStack = this.stack;
3073
+ const previousFlowBlock = this.flowBlock;
3074
+
3075
+ const flow = {
3076
+ code: ''
3077
+ };
3078
+
3079
+ this.flow = flow;
3080
+ this.vars = {};
3081
+ this.declarations = {};
3082
+ this.cache = new NodeCache();
3083
+ this.stack = stack();
3084
+ this.flowBlock = null;
3085
+
3086
+ for ( const buildStage of defaultBuildStages ) {
3087
+
3088
+ this.setBuildStage( buildStage );
3089
+
3090
+ flow.result = node.build( this, output );
3091
+
3092
+ }
3093
+
3094
+ flow.vars = this.getVars( this.shaderStage );
3095
+
3096
+ this.flow = previousFlow;
3097
+ this.vars = previousVars;
3098
+ this.declarations = previousDeclarations;
3099
+ this.cache = previousCache;
3100
+ this.stack = previousStack;
3101
+ this.flowBlock = previousFlowBlock;
3102
+
3103
+ this.setBuildStage( previousBuildStage );
3104
+
3105
+ return flow;
3106
+
3107
+ }
3108
+
3109
+ /**
3110
+ * Returns the native shader operator name for a given generic name.
3111
+ * It is a similar type of method like {@link NodeBuilder#getMethod}.
3112
+ *
3113
+ * @abstract
3114
+ * @param {string} op - The operator name to resolve.
3115
+ * @return {?string} The resolved operator name.
3116
+ */
3117
+ getFunctionOperator( /* op */ ) {
3118
+
3119
+ return null;
3120
+
3121
+ }
3122
+
3123
+ /**
3124
+ * Builds the given shader node.
3125
+ *
3126
+ * @abstract
3127
+ * @param {ShaderNodeInternal} shaderNode - The shader node.
3128
+ * @return {string} The function code.
3129
+ */
3130
+ buildFunctionCode( /* shaderNode */ ) {
3131
+
3132
+ warn( 'Abstract function.' );
3133
+
3134
+ }
3135
+
3136
+ /**
3137
+ * Generates a code flow based on a child Node.
3138
+ *
3139
+ * @param {Node} node - The node to execute.
3140
+ * @param {?string} output - Expected output type. For example 'vec3'.
3141
+ * @return {Object} The code flow.
3142
+ */
3143
+ flowChildNode( node, output = null ) {
3144
+
3145
+ const previousFlow = this.flow;
3146
+
3147
+ const flow = {
3148
+ code: ''
3149
+ };
3150
+
3151
+ this.flow = flow;
3152
+
3153
+ flow.result = node.build( this, output );
3154
+
3155
+ this.flow = previousFlow;
3156
+
3157
+ return flow;
3158
+
3159
+ }
3160
+
3161
+ /**
3162
+ * Executes a flow of code in a different stage.
3163
+ *
3164
+ * Some nodes like `varying()` have the ability to compute code in vertex-stage and
3165
+ * return the value in fragment-stage even if it is being executed in an input fragment.
3166
+ *
3167
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
3168
+ * @param {Node} node - The node to execute.
3169
+ * @param {?string} output - Expected output type. For example 'vec3'.
3170
+ * @param {?string} propertyName - The property name to assign the result.
3171
+ * @return {?(Object|Node)} The code flow or node.build() result.
3172
+ */
3173
+ flowNodeFromShaderStage( shaderStage, node, output = null, propertyName = null ) {
3174
+
3175
+ const previousTab = this.tab;
3176
+ const previousCache = this.cache;
3177
+ const previousShaderStage = this.shaderStage;
3178
+ const previousContext = this.context;
3179
+ const previousFlowBlock = this.flowBlock;
3180
+
3181
+ this.setShaderStage( shaderStage );
3182
+
3183
+ const context = { ...this.context };
3184
+ delete context.nodeBlock;
3185
+
3186
+ this.flowBlock = null;
3187
+ this.cache = this.globalCache;
3188
+ this.tab = '\t';
3189
+ this.context = context;
3190
+
3191
+ let result = null;
3192
+
3193
+ if ( this.buildStage === 'generate' ) {
3194
+
3195
+ const flowData = this.flowChildNode( node, output );
3196
+
3197
+ if ( propertyName !== null ) {
3198
+
3199
+ flowData.code += `${ this.tab + propertyName } = ${ flowData.result };\n`;
3200
+
3201
+ }
3202
+
3203
+ this.flowCode[ shaderStage ] = this.flowCode[ shaderStage ] + flowData.code;
3204
+
3205
+ result = flowData;
3206
+
3207
+ } else {
3208
+
3209
+ result = node.build( this );
3210
+
3211
+ }
3212
+
3213
+ this.setShaderStage( previousShaderStage );
3214
+
3215
+ this.cache = previousCache;
3216
+ this.tab = previousTab;
3217
+ this.context = previousContext;
3218
+ this.flowBlock = previousFlowBlock;
3219
+
3220
+ return result;
3221
+
3222
+ }
3223
+
3224
+ /**
3225
+ * Returns an array holding all node attributes of this node builder.
3226
+ *
3227
+ * @return {Array<NodeAttribute>} The node attributes of this builder.
3228
+ */
3229
+ getAttributesArray() {
3230
+
3231
+ return this.attributes.concat( this.bufferAttributes );
3232
+
3233
+ }
3234
+
3235
+ /**
3236
+ * Returns the attribute definitions as a shader string for the given shader stage.
3237
+ *
3238
+ * @abstract
3239
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
3240
+ * @return {string} The attribute code section.
3241
+ */
3242
+ getAttributes( /*shaderStage*/ ) {
3243
+
3244
+ warn( 'Abstract function.' );
3245
+
3246
+ }
3247
+
3248
+ /**
3249
+ * Returns the varying definitions as a shader string for the given shader stage.
3250
+ *
3251
+ * @abstract
3252
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
3253
+ * @return {string} The varying code section.
3254
+ */
3255
+ getVaryings( /*shaderStage*/ ) {
3256
+
3257
+ warn( 'Abstract function.' );
3258
+
3259
+ }
3260
+
3261
+ /**
3262
+ * Returns a single variable definition as a shader string for the given variable type and name.
3263
+ *
3264
+ * @param {string} type - The variable's type.
3265
+ * @param {string} name - The variable's name.
3266
+ * @param {?number} [count=null] - The array length.
3267
+ * @return {string} The shader string.
3268
+ */
3269
+ getVar( type, name, count = null ) {
3270
+
3271
+ return `${ count !== null ? this.generateArrayDeclaration( type, count ) : this.getType( type ) } ${ name }`;
3272
+
3273
+ }
3274
+
3275
+ /**
3276
+ * Returns a single const variable statement as a shader string for the given variable type and name.
3277
+ *
3278
+ * @param {string} type - The variable's type.
3279
+ * @param {string} name - The variable's name.
3280
+ * @param {?number} [count=null] - The array length.
3281
+ * @return {string} The shader string.
3282
+ */
3283
+ generateConstStatement( type, name, count = null ) {
3284
+
3285
+ return `const ${ this.getVar( type, name, count ) }`;
3286
+
3287
+ }
3288
+
3289
+ /**
3290
+ * Returns a single variable statement as a shader string for the given variable type and name.
3291
+ *
3292
+ * @param {string} type - The variable's type.
3293
+ * @param {string} name - The variable's name.
3294
+ * @param {?number} [count=null] - The array length.
3295
+ * @return {string} The shader string.
3296
+ */
3297
+ generateVarStatement( type, name, count = null ) {
3298
+
3299
+ return this.getVar( type, name, count );
3300
+
3301
+ }
3302
+
3303
+ /**
3304
+ * Returns a runtime read-only variable statement as a shader string.
3305
+ * Backends without a let declaration use a regular variable declaration.
3306
+ *
3307
+ * @param {string} type - The variable's type.
3308
+ * @param {string} name - The variable's name.
3309
+ * @param {?number} [count=null] - The array length.
3310
+ * @return {string} The shader string.
3311
+ */
3312
+ generateLetStatement( type, name, count = null ) {
3313
+
3314
+ return this.generateVarStatement( type, name, count );
3315
+
3316
+ }
3317
+
3318
+ /**
3319
+ * Returns the variable definitions as a shader string for the given shader stage.
3320
+ *
3321
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
3322
+ * @param {boolean} [global=false] - Whether the variables are global.
3323
+ * @return {string} The variable code section.
3324
+ */
3325
+ getVars( shaderStage, global = false ) {
3326
+
3327
+ const snippets = [];
3328
+
3329
+ const vars = this.vars[ shaderStage ];
3330
+
3331
+ if ( vars !== undefined ) {
3332
+
3333
+ for ( const variable of vars ) {
3334
+
3335
+ snippets.push( `${ this.getVar( variable.type, variable.name, variable.count ) };` );
3336
+
3337
+ }
3338
+
3339
+ }
3340
+
3341
+ return snippets.join( global ? '\n' : '\n\t' );
3342
+
3343
+ }
3344
+
3345
+ /**
3346
+ * Returns the uniform definitions as a shader string for the given shader stage.
3347
+ *
3348
+ * @abstract
3349
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
3350
+ * @return {string} The uniform code section.
3351
+ */
3352
+ getUniforms( /*shaderStage*/ ) {
3353
+
3354
+ warn( 'Abstract function.' );
3355
+
3356
+ }
3357
+
3358
+ /**
3359
+ * Returns the native code definitions as a shader string for the given shader stage.
3360
+ *
3361
+ * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage.
3362
+ * @return {string} The native code section.
3363
+ */
3364
+ getCodes( shaderStage ) {
3365
+
3366
+ const codes = this.codes[ shaderStage ];
3367
+
3368
+ let code = '';
3369
+
3370
+ if ( codes !== undefined ) {
3371
+
3372
+ for ( const nodeCode of codes ) {
3373
+
3374
+ code += nodeCode.code + '\n';
3375
+
3376
+ }
3377
+
3378
+ }
3379
+
3380
+ return code;
3381
+
3382
+ }
3383
+
3384
+ /**
3385
+ * Returns the hash of this node builder.
3386
+ *
3387
+ * @return {string} The hash.
3388
+ */
3389
+ getHash() {
3390
+
3391
+ return this.vertexShader + this.fragmentShader + this.computeShader;
3392
+
3393
+ }
3394
+
3395
+ /**
3396
+ * Sets the current shader stage.
3397
+ *
3398
+ * @param {?('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage to set.
3399
+ */
3400
+ setShaderStage( shaderStage ) {
3401
+
3402
+ this.shaderStage = shaderStage;
3403
+
3404
+ }
3405
+
3406
+ /**
3407
+ * Returns the current shader stage.
3408
+ *
3409
+ * @return {?('vertex'|'fragment'|'compute'|'any')} The current shader stage.
3410
+ */
3411
+ getShaderStage() {
3412
+
3413
+ return this.shaderStage;
3414
+
3415
+ }
3416
+
3417
+ /**
3418
+ * Sets the current build stage.
3419
+ *
3420
+ * @param {?('setup'|'analyze'|'generate')} buildStage - The build stage to set.
3421
+ */
3422
+ setBuildStage( buildStage ) {
3423
+
3424
+ this.buildStage = buildStage;
3425
+
3426
+ }
3427
+
3428
+ /**
3429
+ * Returns the current build stage.
3430
+ *
3431
+ * @return {?('setup'|'analyze'|'generate')} The current build stage.
3432
+ */
3433
+ getBuildStage() {
3434
+
3435
+ return this.buildStage;
3436
+
3437
+ }
3438
+
3439
+ /**
3440
+ * Controls the code build of the shader stages.
3441
+ *
3442
+ * @abstract
3443
+ */
3444
+ buildCode() {
3445
+
3446
+ warn( 'Abstract function.' );
3447
+
3448
+ }
3449
+
3450
+ /**
3451
+ * Returns the current sub-build layer.
3452
+ *
3453
+ * @return {SubBuildNode} The current sub-build layers.
3454
+ */
3455
+ get subBuild() {
3456
+
3457
+ return this.subBuildLayers[ this.subBuildLayers.length - 1 ] || null;
3458
+
3459
+ }
3460
+
3461
+ /**
3462
+ * Adds a sub-build layer to the node builder.
3463
+ *
3464
+ * @param {SubBuildNode} subBuild - The sub-build layer to add.
3465
+ */
3466
+ addSubBuild( subBuild ) {
3467
+
3468
+ this.subBuildLayers.push( subBuild );
3469
+
3470
+ }
3471
+
3472
+ /**
3473
+ * Removes the last sub-build layer from the node builder.
3474
+ *
3475
+ * @return {SubBuildNode} The removed sub-build layer.
3476
+ */
3477
+ removeSubBuild() {
3478
+
3479
+ return this.subBuildLayers.pop();
3480
+
3481
+ }
3482
+
3483
+ /**
3484
+ * Returns the closest sub-build layer for the given data.
3485
+ *
3486
+ * @param {Node|Set<string>|Array<string>} data - The data to get the closest sub-build layer from.
3487
+ * @return {?string} The closest sub-build name or null if none found.
3488
+ */
3489
+ getClosestSubBuild( data ) {
3490
+
3491
+ let subBuilds;
3492
+
3493
+ if ( data && data.isNode ) {
3494
+
3495
+ if ( data.isShaderCallNodeInternal ) {
3496
+
3497
+ subBuilds = data.shaderNode.subBuilds;
3498
+
3499
+ } else if ( data.isStackNode ) {
3500
+
3501
+ subBuilds = [ data.subBuild ];
3502
+
3503
+ } else {
3504
+
3505
+ subBuilds = this.getDataFromNode( data, 'any' ).subBuilds;
3506
+
3507
+ }
3508
+
3509
+ } else if ( data instanceof Set ) {
3510
+
3511
+ subBuilds = [ ...data ];
3512
+
3513
+ } else {
3514
+
3515
+ subBuilds = data;
3516
+
3517
+ }
3518
+
3519
+ if ( ! subBuilds ) return null;
3520
+
3521
+ const subBuildLayers = this.subBuildLayers;
3522
+
3523
+ for ( let i = subBuilds.length - 1; i >= 0; i -- ) {
3524
+
3525
+ const subBuild = subBuilds[ i ];
3526
+
3527
+ if ( subBuildLayers.includes( subBuild ) ) {
3528
+
3529
+ return subBuild;
3530
+
3531
+ }
3532
+
3533
+ }
3534
+
3535
+ return null;
3536
+
3537
+ }
3538
+
3539
+
3540
+ /**
3541
+ * Returns the output node of a sub-build layer.
3542
+ *
3543
+ * @param {Node} node - The node to get the output from.
3544
+ * @return {string} The output node name.
3545
+ */
3546
+ getSubBuildOutput( node ) {
3547
+
3548
+ return this.getSubBuildProperty( 'outputNode', node );
3549
+
3550
+ }
3551
+
3552
+ /**
3553
+ * Returns the sub-build property name for the given property and node.
3554
+ *
3555
+ * @param {string} [property=''] - The property name.
3556
+ * @param {?Node} [node=null] - The node to get the sub-build from.
3557
+ * @return {string} The sub-build property name.
3558
+ */
3559
+ getSubBuildProperty( property = '', node = null ) {
3560
+
3561
+ let subBuild;
3562
+
3563
+ if ( node !== null ) {
3564
+
3565
+ subBuild = this.getClosestSubBuild( node );
3566
+
3567
+ } else {
3568
+
3569
+ subBuild = this.subBuildFn;
3570
+
3571
+ }
3572
+
3573
+ let result;
3574
+
3575
+ if ( subBuild ) {
3576
+
3577
+ result = property ? ( subBuild + '_' + property ) : subBuild;
3578
+
3579
+ } else {
3580
+
3581
+ result = property;
3582
+
3583
+ }
3584
+
3585
+ return result;
3586
+
3587
+ }
3588
+
3589
+ /**
3590
+ * Prebuild the node builder.
3591
+ */
3592
+ prebuild() {
3593
+
3594
+ const { renderer, material } = this;
3595
+
3596
+ // < renderer.contextNode >
3597
+
3598
+ if ( renderer.contextNode.isContextNode === true ) {
3599
+
3600
+ this.addContext( renderer.contextNode.getFlowContextData() );
3601
+
3602
+ } else {
3603
+
3604
+ error( 'NodeBuilder: "renderer.contextNode" must be an instance of `context()`.' );
3605
+
3606
+ }
3607
+
3608
+ // < material.contextNode >
3609
+
3610
+ if ( material && material.contextNode ) {
3611
+
3612
+ if ( material.contextNode.isContextNode === true ) {
3613
+
3614
+ this.addContext( material.contextNode.getFlowContextData() );
3615
+
3616
+ } else {
3617
+
3618
+ error( 'NodeBuilder: "material.contextNode" must be an instance of `context()`.' );
3619
+
3620
+ }
3621
+
3622
+ }
3623
+
3624
+ // < nodeMaterial >
3625
+
3626
+ if ( material !== null ) {
3627
+
3628
+ let nodeMaterial = renderer.library.fromMaterial( material );
3629
+
3630
+ if ( nodeMaterial === null ) {
3631
+
3632
+ error( `NodeBuilder: Material "${ material.type }" is not compatible.` );
3633
+
3634
+ nodeMaterial = new NodeMaterial();
3635
+
3636
+ }
3637
+
3638
+ nodeMaterial.build( this );
3639
+
3640
+ } else {
3641
+
3642
+ this.addFlow( 'compute', this.compute );
3643
+
3644
+ }
3645
+
3646
+ }
3647
+
3648
+ /**
3649
+ * Central build method which controls the build for the given object.
3650
+ *
3651
+ * @return {NodeBuilder} A reference to this node builder.
3652
+ */
3653
+ build() {
3654
+
3655
+ this.prebuild();
3656
+
3657
+ // setup() -> stage 1: create possible new nodes and/or return an output reference node
3658
+ // analyze() -> stage 2: analyze nodes to possible optimization and validation
3659
+ // generate() -> stage 3: generate shader
3660
+
3661
+ for ( const buildStage of defaultBuildStages ) {
3662
+
3663
+ this.setBuildStage( buildStage );
3664
+
3665
+ if ( this.context.position && this.context.position.isNode ) {
3666
+
3667
+ this.flowNodeFromShaderStage( 'vertex', this.context.position );
3668
+
3669
+ }
3670
+
3671
+ for ( const shaderStage of shaderStages ) {
3672
+
3673
+ this.setShaderStage( shaderStage );
3674
+
3675
+ const flowNodes = this.flowNodes[ shaderStage ];
3676
+
3677
+ for ( const node of flowNodes ) {
3678
+
3679
+ if ( buildStage === 'generate' ) {
3680
+
3681
+ this.flowNode( node );
3682
+
3683
+ } else {
3684
+
3685
+ node.build( this );
3686
+
3687
+ }
3688
+
3689
+ }
3690
+
3691
+ }
3692
+
3693
+ }
3694
+
3695
+ this.setBuildStage( null );
3696
+ this.setShaderStage( null );
3697
+
3698
+ // stage 4: build code for a specific output
3699
+
3700
+ this.buildCode();
3701
+ this.buildUpdateNodes();
3702
+
3703
+ return this;
3704
+
3705
+ }
3706
+
3707
+ /**
3708
+ * Async version of build() that yields to main thread between shader stages.
3709
+ * Use this in compileAsync() to prevent blocking the main thread.
3710
+ *
3711
+ * @param {Function} [yieldFn=yieldToMain] - The function used to yield to the main thread.
3712
+ * @return {Promise<NodeBuilder>} A promise that resolves to this node builder.
3713
+ */
3714
+ async buildAsync( yieldFn = yieldToMain ) {
3715
+
3716
+ this.prebuild();
3717
+
3718
+ // setup() -> stage 1: create possible new nodes and/or return an output reference node
3719
+ // analyze() -> stage 2: analyze nodes to possible optimization and validation
3720
+ // generate() -> stage 3: generate shader
3721
+
3722
+ for ( const buildStage of defaultBuildStages ) {
3723
+
3724
+ this.setBuildStage( buildStage );
3725
+
3726
+ if ( this.context.position && this.context.position.isNode ) {
3727
+
3728
+ this.flowNodeFromShaderStage( 'vertex', this.context.position );
3729
+
3730
+ }
3731
+
3732
+ for ( const shaderStage of shaderStages ) {
3733
+
3734
+ this.setShaderStage( shaderStage );
3735
+
3736
+ const flowNodes = this.flowNodes[ shaderStage ];
3737
+
3738
+ for ( const node of flowNodes ) {
3739
+
3740
+ if ( buildStage === 'generate' ) {
3741
+
3742
+ this.flowNode( node );
3743
+
3744
+ } else {
3745
+
3746
+ node.build( this );
3747
+
3748
+ }
3749
+
3750
+ }
3751
+
3752
+ // Yield to main thread after each shader stage to prevent blocking
3753
+ await yieldFn();
3754
+
3755
+ }
3756
+
3757
+ }
3758
+
3759
+ this.setBuildStage( null );
3760
+ this.setShaderStage( null );
3761
+
3762
+ // stage 4: build code for a specific output
3763
+
3764
+ this.buildCode();
3765
+ this.buildUpdateNodes();
3766
+
3767
+ return this;
3768
+
3769
+ }
3770
+
3771
+ /**
3772
+ * Returns a uniform representation which is later used for UBO generation and rendering.
3773
+ *
3774
+ * @param {NodeUniform} uniformNode - The uniform node.
3775
+ * @param {string} type - The requested type.
3776
+ * @return {Uniform} The uniform.
3777
+ */
3778
+ getNodeUniform( uniformNode, type ) {
3779
+
3780
+ if ( type === 'float' || type === 'int' || type === 'uint' ) return new NumberNodeUniform( uniformNode );
3781
+ if ( type === 'vec2' || type === 'ivec2' || type === 'uvec2' ) return new Vector2NodeUniform( uniformNode );
3782
+ if ( type === 'vec3' || type === 'ivec3' || type === 'uvec3' ) return new Vector3NodeUniform( uniformNode );
3783
+ if ( type === 'vec4' || type === 'ivec4' || type === 'uvec4' ) return new Vector4NodeUniform( uniformNode );
3784
+ if ( type === 'color' ) return new ColorNodeUniform( uniformNode );
3785
+ if ( type === 'mat2' ) return new Matrix2NodeUniform( uniformNode );
3786
+ if ( type === 'mat3' ) return new Matrix3NodeUniform( uniformNode );
3787
+ if ( type === 'mat4' ) return new Matrix4NodeUniform( uniformNode );
3788
+
3789
+ throw new Error( `THREE.NodeBuilder: Uniform "${ type }" not implemented.` );
3790
+
3791
+ }
3792
+
3793
+ /**
3794
+ * Formats the given shader snippet from a given type into another one. E.g.
3795
+ * this method might be used to convert a simple float string `"1.0"` into a
3796
+ * `vec3` representation: `"vec3<f32>( 1.0 )"`.
3797
+ *
3798
+ * @param {string} snippet - The shader snippet.
3799
+ * @param {string} fromType - The source type.
3800
+ * @param {string} toType - The target type.
3801
+ * @return {string} The updated shader string.
3802
+ */
3803
+ format( snippet, fromType, toType ) {
3804
+
3805
+ fromType = this.getVectorType( fromType );
3806
+ toType = this.getVectorType( toType );
3807
+
3808
+ if ( fromType === toType || toType === null || this.isReference( toType ) ) {
3809
+
3810
+ return snippet;
3811
+
3812
+ }
3813
+
3814
+ const fromTypeLength = this.getTypeLength( fromType );
3815
+ const toTypeLength = this.getTypeLength( toType );
3816
+
3817
+ if ( fromTypeLength === 16 && toTypeLength === 9 ) {
3818
+
3819
+ return `${ this.getType( toType ) }( ${ snippet }[ 0 ].xyz, ${ snippet }[ 1 ].xyz, ${ snippet }[ 2 ].xyz )`;
3820
+
3821
+ }
3822
+
3823
+ if ( fromTypeLength === 9 && toTypeLength === 4 ) {
3824
+
3825
+ return `${ this.getType( toType ) }( ${ snippet }[ 0 ].xy, ${ snippet }[ 1 ].xy )`;
3826
+
3827
+ }
3828
+
3829
+
3830
+ if ( fromTypeLength > 4 ) { // fromType is matrix-like
3831
+
3832
+ // @TODO: ignore for now
3833
+
3834
+ return snippet;
3835
+
3836
+ }
3837
+
3838
+ if ( toTypeLength > 4 || toTypeLength === 0 ) { // toType is matrix-like or unknown
3839
+
3840
+ // @TODO: ignore for now
3841
+
3842
+ return snippet;
3843
+
3844
+ }
3845
+
3846
+ if ( fromTypeLength === toTypeLength ) {
3847
+
3848
+ return `${ this.getType( toType ) }( ${ snippet } )`;
3849
+
3850
+ }
3851
+
3852
+ if ( fromTypeLength > toTypeLength ) {
3853
+
3854
+ snippet = toType === 'bool' ? `all( ${ snippet } )` : `${ snippet }.${ 'xyz'.slice( 0, toTypeLength ) }`;
3855
+
3856
+ return this.format( snippet, this.getTypeFromLength( toTypeLength, this.getComponentType( fromType ) ), toType );
3857
+
3858
+ }
3859
+
3860
+ if ( toTypeLength === 4 && fromTypeLength > 1 ) { // toType is vec4-like
3861
+
3862
+ const componentType = this.getComponentType( toType );
3863
+ const vectorType = this.getTypeFromLength( 3, componentType );
3864
+
3865
+ return `${ this.getType( toType ) }( ${ this.format( snippet, fromType, vectorType ) }, ${ this.generateConst( componentType, componentType === 'bool' ? true : 1 ) } )`;
3866
+
3867
+ }
3868
+
3869
+ if ( fromTypeLength === 2 ) { // fromType is vec2-like and toType is vec3-like
3870
+
3871
+ const componentType = this.getComponentType( toType );
3872
+ const vectorType = this.getTypeFromLength( 2, componentType );
3873
+
3874
+ return `${ this.getType( toType ) }( ${ this.format( snippet, fromType, vectorType ) }, ${ this.generateConst( componentType, componentType === 'bool' ? false : 0 ) } )`;
3875
+
3876
+ }
3877
+
3878
+ if ( fromTypeLength === 1 && toTypeLength > 1 && fromType !== this.getComponentType( toType ) ) { // fromType is float-like
3879
+
3880
+ // convert a number value to vector type, e.g:
3881
+ // vec3( 1u ) -> vec3( float( 1u ) )
3882
+
3883
+ snippet = `${ this.getType( this.getComponentType( toType ) ) }( ${ snippet } )`;
3884
+
3885
+ }
3886
+
3887
+ return `${ this.getType( toType ) }( ${ snippet } )`; // fromType is float-like
3888
+
3889
+ }
3890
+
3891
+ /**
3892
+ * Returns a signature with the engine's current revision.
3893
+ *
3894
+ * @return {string} The signature.
3895
+ */
3896
+ getSignature() {
3897
+
3898
+ return `// Three.js r${ REVISION } - Node System\n`;
3899
+
3900
+ }
3901
+
3902
+ /**
3903
+ * Returns `true` if data from the previous frame are required. Relevant
3904
+ * when computing motion vectors with {@link VelocityNode}.
3905
+ *
3906
+ * @return {boolean} Whether data from the previous frame are required or not.
3907
+ */
3908
+ needsPreviousData() {
3909
+
3910
+ const mrt = this.renderer.getMRT();
3911
+
3912
+ return ( mrt !== null && mrt.has( 'velocity' ) );
3913
+
3914
+ }
3915
+
3916
+ }
3917
+
3918
+ export default NodeBuilder;