@needle-tools/three 0.169.20-experimental.0 → 0.183.2-canary.0

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 (1051) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +5 -6
  3. package/build/three.cjs +54184 -56703
  4. package/build/three.core.js +59506 -0
  5. package/build/three.core.min.js +6 -0
  6. package/build/three.module.js +11645 -73000
  7. package/build/three.module.min.js +2 -2
  8. package/build/three.tsl.js +648 -0
  9. package/build/three.tsl.min.js +6 -0
  10. package/build/three.webgpu.js +53912 -51652
  11. package/build/three.webgpu.min.js +2 -2
  12. package/build/three.webgpu.nodes.js +53888 -51806
  13. package/build/three.webgpu.nodes.min.js +2 -2
  14. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  15. package/examples/fonts/MPLUSRounded1c/OFL.txt +91 -0
  16. package/examples/jsm/Addons.js +5 -15
  17. package/examples/jsm/animation/AnimationClipCreator.js +58 -6
  18. package/examples/jsm/animation/CCDIKSolver.js +152 -45
  19. package/examples/jsm/capabilities/WebGL.js +28 -29
  20. package/examples/jsm/capabilities/WebGPU.js +19 -17
  21. package/examples/jsm/controls/ArcballControls.js +474 -178
  22. package/examples/jsm/controls/DragControls.js +100 -58
  23. package/examples/jsm/controls/FirstPersonControls.js +116 -6
  24. package/examples/jsm/controls/FlyControls.js +50 -2
  25. package/examples/jsm/controls/MapControls.js +96 -8
  26. package/examples/jsm/controls/OrbitControls.js +496 -57
  27. package/examples/jsm/controls/PointerLockControls.js +115 -22
  28. package/examples/jsm/controls/TrackballControls.js +166 -14
  29. package/examples/jsm/controls/TransformControls.js +336 -26
  30. package/examples/jsm/csm/CSM.js +232 -18
  31. package/examples/jsm/csm/CSMFrustum.js +61 -4
  32. package/examples/jsm/csm/CSMHelper.js +50 -0
  33. package/examples/jsm/csm/CSMShader.js +13 -1
  34. package/examples/jsm/csm/CSMShadowNode.js +599 -0
  35. package/examples/jsm/curves/CurveExtras.js +303 -31
  36. package/examples/jsm/curves/NURBSCurve.js +91 -16
  37. package/examples/jsm/curves/NURBSSurface.js +52 -6
  38. package/examples/jsm/curves/NURBSUtils.js +102 -112
  39. package/examples/jsm/curves/NURBSVolume.js +24 -4
  40. package/examples/jsm/effects/AnaglyphEffect.js +134 -7
  41. package/examples/jsm/effects/AsciiEffect.js +69 -22
  42. package/examples/jsm/effects/OutlineEffect.js +61 -111
  43. package/examples/jsm/effects/ParallaxBarrierEffect.js +30 -0
  44. package/examples/jsm/effects/StereoEffect.js +31 -0
  45. package/examples/jsm/environments/ColorEnvironment.js +59 -0
  46. package/examples/jsm/environments/DebugEnvironment.js +50 -0
  47. package/examples/jsm/environments/RoomEnvironment.js +83 -42
  48. package/examples/jsm/exporters/DRACOExporter.js +56 -14
  49. package/examples/jsm/exporters/EXRExporter.js +40 -9
  50. package/examples/jsm/exporters/GLTFExporter.js +502 -169
  51. package/examples/jsm/exporters/OBJExporter.js +21 -1
  52. package/examples/jsm/exporters/PLYExporter.js +44 -12
  53. package/examples/jsm/exporters/STLExporter.js +27 -5
  54. package/examples/jsm/exporters/USDZExporter.js +781 -291
  55. package/examples/jsm/geometries/BoxLineGeometry.js +23 -0
  56. package/examples/jsm/geometries/ConvexGeometry.js +19 -0
  57. package/examples/jsm/geometries/DecalGeometry.js +91 -30
  58. package/examples/jsm/geometries/ParametricFunctions.js +100 -0
  59. package/examples/jsm/geometries/ParametricGeometry.js +38 -5
  60. package/examples/jsm/geometries/RoundedBoxGeometry.js +68 -7
  61. package/examples/jsm/geometries/TeapotGeometry.js +23 -38
  62. package/examples/jsm/geometries/TextGeometry.js +48 -29
  63. package/examples/jsm/gpgpu/BitonicSort.js +715 -0
  64. package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
  65. package/examples/jsm/helpers/LightProbeHelper.js +36 -0
  66. package/examples/jsm/helpers/LightProbeHelperGPU.js +38 -1
  67. package/examples/jsm/helpers/OctreeHelper.js +36 -0
  68. package/examples/jsm/helpers/PositionalAudioHelper.js +60 -0
  69. package/examples/jsm/helpers/RapierHelper.js +59 -0
  70. package/examples/jsm/helpers/RectAreaLightHelper.js +36 -3
  71. package/examples/jsm/helpers/TextureHelper.js +28 -0
  72. package/examples/jsm/helpers/TextureHelperGPU.js +214 -0
  73. package/examples/jsm/helpers/VertexNormalsHelper.js +61 -2
  74. package/examples/jsm/helpers/VertexTangentsHelper.js +47 -2
  75. package/examples/jsm/helpers/ViewHelper.js +181 -9
  76. package/examples/jsm/inspector/Inspector.js +487 -0
  77. package/examples/jsm/inspector/RendererInspector.js +425 -0
  78. package/examples/jsm/inspector/tabs/Console.js +238 -0
  79. package/examples/jsm/inspector/tabs/Parameters.js +348 -0
  80. package/examples/jsm/inspector/tabs/Performance.js +268 -0
  81. package/examples/jsm/inspector/tabs/Viewer.js +166 -0
  82. package/examples/jsm/inspector/ui/Graph.js +95 -0
  83. package/examples/jsm/inspector/ui/Item.js +170 -0
  84. package/examples/jsm/inspector/ui/List.js +75 -0
  85. package/examples/jsm/inspector/ui/Profiler.js +1975 -0
  86. package/examples/jsm/inspector/ui/Style.js +1613 -0
  87. package/examples/jsm/inspector/ui/Tab.js +233 -0
  88. package/examples/jsm/inspector/ui/Values.js +439 -0
  89. package/examples/jsm/inspector/ui/utils.js +56 -0
  90. package/examples/jsm/interactive/HTMLMesh.js +43 -12
  91. package/examples/jsm/interactive/InteractiveGroup.js +170 -52
  92. package/examples/jsm/interactive/SelectionBox.js +106 -9
  93. package/examples/jsm/interactive/SelectionHelper.js +76 -30
  94. package/examples/jsm/libs/demuxer_mp4.js +109 -0
  95. package/examples/jsm/libs/meshopt_decoder.module.js +76 -58
  96. package/examples/jsm/libs/motion-controllers.module.js +1 -1
  97. package/examples/jsm/lighting/TiledLighting.js +42 -0
  98. package/examples/jsm/lights/LightProbeGenerator.js +44 -7
  99. package/examples/jsm/lights/RectAreaLightTexturesLib.js +50 -14
  100. package/examples/jsm/lights/RectAreaLightUniformsLib.js +16 -0
  101. package/examples/jsm/lines/Line2.js +41 -4
  102. package/examples/jsm/lines/LineGeometry.js +80 -2
  103. package/examples/jsm/lines/LineMaterial.js +105 -5
  104. package/examples/jsm/lines/LineSegments2.js +54 -4
  105. package/examples/jsm/lines/LineSegmentsGeometry.js +65 -8
  106. package/examples/jsm/lines/Wireframe.js +41 -4
  107. package/examples/jsm/lines/WireframeGeometry2.js +27 -2
  108. package/examples/jsm/lines/webgpu/Line2.js +28 -2
  109. package/examples/jsm/lines/webgpu/LineSegments2.js +59 -24
  110. package/examples/jsm/lines/webgpu/Wireframe.js +86 -0
  111. package/examples/jsm/loaders/3DMLoader.js +78 -6
  112. package/examples/jsm/loaders/3MFLoader.js +148 -7
  113. package/examples/jsm/loaders/AMFLoader.js +34 -14
  114. package/examples/jsm/loaders/BVHLoader.js +59 -12
  115. package/examples/jsm/loaders/ColladaLoader.js +61 -4027
  116. package/examples/jsm/loaders/DDSLoader.js +68 -1
  117. package/examples/jsm/loaders/DRACOLoader.js +146 -22
  118. package/examples/jsm/loaders/EXRLoader.js +255 -34
  119. package/examples/jsm/loaders/FBXLoader.js +80 -42
  120. package/examples/jsm/loaders/FontLoader.js +83 -6
  121. package/examples/jsm/loaders/GCodeLoader.js +71 -14
  122. package/examples/jsm/loaders/GLTFLoader.js +381 -263
  123. package/examples/jsm/loaders/HDRCubeTextureLoader.js +52 -3
  124. package/examples/jsm/loaders/HDRLoader.js +485 -0
  125. package/examples/jsm/loaders/IESLoader.js +42 -0
  126. package/examples/jsm/loaders/KMZLoader.js +39 -6
  127. package/examples/jsm/loaders/KTX2Loader.js +124 -48
  128. package/examples/jsm/loaders/KTXLoader.js +31 -10
  129. package/examples/jsm/loaders/LDrawLoader.js +192 -145
  130. package/examples/jsm/loaders/LUT3dlLoader.js +47 -10
  131. package/examples/jsm/loaders/LUTCubeLoader.js +46 -9
  132. package/examples/jsm/loaders/LUTImageLoader.js +79 -38
  133. package/examples/jsm/loaders/LWOLoader.js +54 -59
  134. package/examples/jsm/loaders/LottieLoader.js +54 -1
  135. package/examples/jsm/loaders/MD2Loader.js +37 -1
  136. package/examples/jsm/loaders/MDDLoader.js +57 -12
  137. package/examples/jsm/loaders/MTLLoader.js +60 -35
  138. package/examples/jsm/loaders/MaterialXLoader.js +268 -34
  139. package/examples/jsm/loaders/NRRDLoader.js +40 -8
  140. package/examples/jsm/loaders/OBJLoader.js +51 -2
  141. package/examples/jsm/loaders/PCDLoader.js +173 -21
  142. package/examples/jsm/loaders/PDBLoader.js +41 -2
  143. package/examples/jsm/loaders/PLYLoader.js +70 -39
  144. package/examples/jsm/loaders/PVRLoader.js +25 -6
  145. package/examples/jsm/loaders/RGBELoader.js +6 -438
  146. package/examples/jsm/loaders/STLLoader.js +48 -38
  147. package/examples/jsm/loaders/SVGLoader.js +119 -25
  148. package/examples/jsm/loaders/TDSLoader.js +92 -74
  149. package/examples/jsm/loaders/TGALoader.js +23 -2
  150. package/examples/jsm/loaders/TIFFLoader.js +23 -0
  151. package/examples/jsm/loaders/TTFLoader.js +50 -3
  152. package/examples/jsm/loaders/USDLoader.js +279 -0
  153. package/examples/jsm/loaders/USDZLoader.js +4 -858
  154. package/examples/jsm/loaders/UltraHDRLoader.js +338 -166
  155. package/examples/jsm/loaders/VOXLoader.js +688 -87
  156. package/examples/jsm/loaders/VRMLLoader.js +121 -12
  157. package/examples/jsm/loaders/VTKLoader.js +77 -25
  158. package/examples/jsm/loaders/XYZLoader.js +36 -0
  159. package/examples/jsm/loaders/collada/ColladaComposer.js +2950 -0
  160. package/examples/jsm/loaders/collada/ColladaParser.js +1962 -0
  161. package/examples/jsm/loaders/lwo/IFFParser.js +77 -77
  162. package/examples/jsm/loaders/usd/USDAParser.js +822 -0
  163. package/examples/jsm/loaders/usd/USDCParser.js +1852 -0
  164. package/examples/jsm/loaders/usd/USDComposer.js +4041 -0
  165. package/examples/jsm/materials/LDrawConditionalLineMaterial.js +183 -0
  166. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +154 -0
  167. package/examples/jsm/materials/WoodNodeMaterial.js +533 -0
  168. package/examples/jsm/math/Capsule.js +91 -14
  169. package/examples/jsm/math/ColorConverter.js +22 -0
  170. package/examples/jsm/math/ColorSpaces.js +74 -2
  171. package/examples/jsm/math/ConvexHull.js +517 -93
  172. package/examples/jsm/math/ImprovedNoise.js +32 -15
  173. package/examples/jsm/math/Lut.js +113 -0
  174. package/examples/jsm/math/MeshSurfaceSampler.js +78 -13
  175. package/examples/jsm/math/OBB.js +141 -29
  176. package/examples/jsm/math/Octree.js +283 -7
  177. package/examples/jsm/math/SimplexNoise.js +68 -42
  178. package/examples/jsm/misc/ConvexObjectBreaker.js +45 -25
  179. package/examples/jsm/misc/GPUComputationRenderer.js +96 -20
  180. package/examples/jsm/misc/Gyroscope.js +12 -0
  181. package/examples/jsm/misc/MD2Character.js +117 -2
  182. package/examples/jsm/misc/MD2CharacterComplex.js +175 -11
  183. package/examples/jsm/misc/MorphAnimMesh.js +44 -0
  184. package/examples/jsm/misc/MorphBlendMesh.js +103 -0
  185. package/examples/jsm/misc/ProgressiveLightMap.js +100 -54
  186. package/examples/jsm/misc/ProgressiveLightMapGPU.js +322 -0
  187. package/examples/jsm/misc/RollerCoaster.js +57 -0
  188. package/examples/jsm/misc/TubePainter.js +437 -40
  189. package/examples/jsm/misc/Volume.js +123 -76
  190. package/examples/jsm/misc/VolumeSlice.js +95 -49
  191. package/examples/jsm/modifiers/CurveModifier.js +66 -38
  192. package/examples/jsm/modifiers/CurveModifierGPU.js +42 -19
  193. package/examples/jsm/modifiers/EdgeSplitModifier.js +20 -0
  194. package/examples/jsm/modifiers/SimplifyModifier.js +24 -10
  195. package/examples/jsm/modifiers/TessellateModifier.js +35 -2
  196. package/examples/jsm/objects/GroundedSkybox.js +25 -6
  197. package/examples/jsm/objects/Lensflare.js +94 -2
  198. package/examples/jsm/objects/LensflareMesh.js +64 -10
  199. package/examples/jsm/objects/MarchingCubes.js +90 -5
  200. package/examples/jsm/objects/Reflector.js +76 -2
  201. package/examples/jsm/objects/ReflectorForSSRPass.js +41 -0
  202. package/examples/jsm/objects/Refractor.js +62 -0
  203. package/examples/jsm/objects/ShadowMesh.js +54 -4
  204. package/examples/jsm/objects/Sky.js +106 -16
  205. package/examples/jsm/objects/SkyMesh.js +211 -38
  206. package/examples/jsm/objects/Water.js +49 -8
  207. package/examples/jsm/objects/Water2.js +49 -7
  208. package/examples/jsm/objects/Water2Mesh.js +50 -9
  209. package/examples/jsm/objects/WaterMesh.js +136 -43
  210. package/examples/jsm/physics/AmmoPhysics.js +60 -7
  211. package/examples/jsm/physics/JoltPhysics.js +65 -12
  212. package/examples/jsm/physics/RapierPhysics.js +217 -21
  213. package/examples/jsm/postprocessing/AfterimagePass.js +110 -29
  214. package/examples/jsm/postprocessing/BloomPass.js +128 -26
  215. package/examples/jsm/postprocessing/BokehPass.js +99 -22
  216. package/examples/jsm/postprocessing/ClearPass.js +54 -3
  217. package/examples/jsm/postprocessing/CubeTexturePass.js +82 -21
  218. package/examples/jsm/postprocessing/DotScreenPass.js +59 -10
  219. package/examples/jsm/postprocessing/EffectComposer.js +140 -6
  220. package/examples/jsm/postprocessing/FXAAPass.js +40 -0
  221. package/examples/jsm/postprocessing/FilmPass.js +54 -5
  222. package/examples/jsm/postprocessing/GTAOPass.js +202 -57
  223. package/examples/jsm/postprocessing/GlitchPass.js +86 -34
  224. package/examples/jsm/postprocessing/HalftonePass.js +65 -10
  225. package/examples/jsm/postprocessing/LUTPass.js +38 -8
  226. package/examples/jsm/postprocessing/MaskPass.js +91 -0
  227. package/examples/jsm/postprocessing/OutlinePass.js +272 -135
  228. package/examples/jsm/postprocessing/OutputPass.js +65 -14
  229. package/examples/jsm/postprocessing/Pass.js +100 -4
  230. package/examples/jsm/postprocessing/RenderPass.js +94 -0
  231. package/examples/jsm/postprocessing/RenderPixelatedPass.js +124 -45
  232. package/examples/jsm/postprocessing/RenderTransitionPass.js +120 -21
  233. package/examples/jsm/postprocessing/SAOPass.js +128 -55
  234. package/examples/jsm/postprocessing/SMAAPass.js +106 -75
  235. package/examples/jsm/postprocessing/SSAARenderPass.js +118 -35
  236. package/examples/jsm/postprocessing/SSAOPass.js +173 -60
  237. package/examples/jsm/postprocessing/SSRPass.js +268 -53
  238. package/examples/jsm/postprocessing/SavePass.js +69 -16
  239. package/examples/jsm/postprocessing/ShaderPass.js +65 -7
  240. package/examples/jsm/postprocessing/TAARenderPass.js +79 -24
  241. package/examples/jsm/postprocessing/TexturePass.js +72 -8
  242. package/examples/jsm/postprocessing/UnrealBloomPass.js +168 -59
  243. package/examples/jsm/renderers/CSS2DRenderer.js +98 -5
  244. package/examples/jsm/renderers/CSS3DRenderer.js +111 -7
  245. package/examples/jsm/renderers/Projector.js +288 -32
  246. package/examples/jsm/renderers/SVGRenderer.js +323 -61
  247. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +3 -1
  248. package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
  249. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +5 -1
  250. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +12 -5
  251. package/examples/jsm/shaders/AfterimageShader.js +8 -3
  252. package/examples/jsm/shaders/BasicShader.js +8 -1
  253. package/examples/jsm/shaders/BleachBypassShader.js +10 -3
  254. package/examples/jsm/shaders/BlendShader.js +8 -1
  255. package/examples/jsm/shaders/BokehShader.js +9 -3
  256. package/examples/jsm/shaders/BokehShader2.js +11 -4
  257. package/examples/jsm/shaders/BrightnessContrastShader.js +10 -4
  258. package/examples/jsm/shaders/ColorCorrectionShader.js +8 -1
  259. package/examples/jsm/shaders/ColorifyShader.js +8 -1
  260. package/examples/jsm/shaders/ConvolutionShader.js +9 -38
  261. package/examples/jsm/shaders/CopyShader.js +8 -1
  262. package/examples/jsm/shaders/DOFMipMapShader.js +10 -3
  263. package/examples/jsm/shaders/DepthLimitedBlurShader.js +10 -1
  264. package/examples/jsm/shaders/DigitalGlitch.js +10 -7
  265. package/examples/jsm/shaders/DotScreenShader.js +8 -3
  266. package/examples/jsm/shaders/ExposureShader.js +8 -1
  267. package/examples/jsm/shaders/FXAAShader.js +233 -221
  268. package/examples/jsm/shaders/FilmShader.js +13 -0
  269. package/examples/jsm/shaders/FocusShader.js +8 -3
  270. package/examples/jsm/shaders/FreiChenShader.js +10 -3
  271. package/examples/jsm/shaders/GTAOShader.js +55 -45
  272. package/examples/jsm/shaders/GammaCorrectionShader.js +11 -2
  273. package/examples/jsm/shaders/HalftoneShader.js +24 -4
  274. package/examples/jsm/shaders/HorizontalBlurShader.js +12 -3
  275. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +9 -2
  276. package/examples/jsm/shaders/HueSaturationShader.js +10 -3
  277. package/examples/jsm/shaders/KaleidoShader.js +11 -4
  278. package/examples/jsm/shaders/LuminosityHighPassShader.js +8 -4
  279. package/examples/jsm/shaders/LuminosityShader.js +8 -2
  280. package/examples/jsm/shaders/MirrorShader.js +10 -4
  281. package/examples/jsm/shaders/NormalMapShader.js +7 -2
  282. package/examples/jsm/shaders/OutputShader.js +19 -1
  283. package/examples/jsm/shaders/PoissonDenoiseShader.js +30 -17
  284. package/examples/jsm/shaders/RGBShiftShader.js +8 -1
  285. package/examples/jsm/shaders/SAOShader.js +27 -5
  286. package/examples/jsm/shaders/SMAAShader.js +24 -1
  287. package/examples/jsm/shaders/SSAOShader.js +37 -6
  288. package/examples/jsm/shaders/SSRShader.js +32 -6
  289. package/examples/jsm/shaders/SepiaShader.js +8 -3
  290. package/examples/jsm/shaders/SobelOperatorShader.js +9 -3
  291. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +13 -8
  292. package/examples/jsm/shaders/TechnicolorShader.js +10 -4
  293. package/examples/jsm/shaders/ToonShader.js +29 -6
  294. package/examples/jsm/shaders/TriangleBlurShader.js +9 -4
  295. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +19 -6
  296. package/examples/jsm/shaders/VelocityShader.js +8 -1
  297. package/examples/jsm/shaders/VerticalBlurShader.js +9 -2
  298. package/examples/jsm/shaders/VerticalTiltShiftShader.js +8 -1
  299. package/examples/jsm/shaders/VignetteShader.js +8 -3
  300. package/examples/jsm/shaders/VolumeShader.js +11 -2
  301. package/examples/jsm/shaders/WaterRefractionShader.js +11 -0
  302. package/examples/jsm/textures/FlakesTexture.js +14 -0
  303. package/examples/jsm/transpiler/AST.js +436 -31
  304. package/examples/jsm/transpiler/GLSLDecoder.js +380 -135
  305. package/examples/jsm/transpiler/Linker.js +327 -0
  306. package/examples/jsm/transpiler/ShaderToyDecoder.js +3 -1
  307. package/examples/jsm/transpiler/TSLEncoder.js +363 -97
  308. package/examples/jsm/transpiler/Transpiler.js +50 -1
  309. package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
  310. package/examples/jsm/transpiler/WGSLEncoder.js +839 -0
  311. package/examples/jsm/tsl/display/AfterImageNode.js +244 -0
  312. package/examples/jsm/tsl/display/AnaglyphPassNode.js +549 -0
  313. package/examples/jsm/tsl/display/AnamorphicNode.js +282 -0
  314. package/examples/jsm/tsl/display/BilateralBlurNode.js +364 -0
  315. package/{src/nodes → examples/jsm/tsl}/display/BleachBypass.js +11 -4
  316. package/examples/jsm/tsl/display/BloomNode.js +534 -0
  317. package/examples/jsm/tsl/display/CRT.js +150 -0
  318. package/examples/jsm/tsl/display/ChromaticAberrationNode.js +207 -0
  319. package/examples/jsm/tsl/display/DenoiseNode.js +334 -0
  320. package/examples/jsm/tsl/display/DepthOfFieldNode.js +554 -0
  321. package/examples/jsm/tsl/display/DotScreenNode.js +104 -0
  322. package/examples/jsm/tsl/display/FXAANode.js +365 -0
  323. package/examples/jsm/tsl/display/FilmNode.js +101 -0
  324. package/examples/jsm/tsl/display/GTAONode.js +571 -0
  325. package/examples/jsm/tsl/display/GaussianBlurNode.js +389 -0
  326. package/examples/jsm/tsl/display/GodraysNode.js +624 -0
  327. package/examples/jsm/tsl/display/LensflareNode.js +279 -0
  328. package/examples/jsm/tsl/display/Lut3DNode.js +109 -0
  329. package/examples/jsm/tsl/display/MotionBlur.js +33 -0
  330. package/examples/jsm/tsl/display/OutlineNode.js +762 -0
  331. package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +89 -0
  332. package/examples/jsm/tsl/display/PixelationPassNode.js +335 -0
  333. package/examples/jsm/tsl/display/RGBShiftNode.js +96 -0
  334. package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
  335. package/examples/jsm/tsl/display/SMAANode.js +768 -0
  336. package/{src/nodes → examples/jsm/tsl}/display/SSAAPassNode.js +120 -49
  337. package/examples/jsm/tsl/display/SSGINode.js +642 -0
  338. package/examples/jsm/tsl/display/SSRNode.js +656 -0
  339. package/examples/jsm/tsl/display/SSSNode.js +490 -0
  340. package/{src/nodes → examples/jsm/tsl}/display/Sepia.js +9 -2
  341. package/examples/jsm/tsl/display/Shape.js +29 -0
  342. package/{src/nodes → examples/jsm/tsl}/display/SobelOperatorNode.js +61 -19
  343. package/examples/jsm/tsl/display/StereoCompositePassNode.js +192 -0
  344. package/{src/nodes → examples/jsm/tsl}/display/StereoPassNode.js +48 -12
  345. package/examples/jsm/tsl/display/TRAANode.js +726 -0
  346. package/examples/jsm/tsl/display/TransitionNode.js +141 -0
  347. package/examples/jsm/tsl/display/boxBlur.js +65 -0
  348. package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
  349. package/examples/jsm/tsl/display/hashBlur.js +54 -0
  350. package/examples/jsm/tsl/display/radialBlur.js +68 -0
  351. package/examples/jsm/tsl/lighting/TiledLightsNode.js +442 -0
  352. package/examples/jsm/tsl/math/Bayer.js +73 -0
  353. package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
  354. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
  355. package/examples/jsm/tsl/utils/Raymarching.js +70 -0
  356. package/examples/jsm/utils/BufferGeometryUtils.js +91 -29
  357. package/examples/jsm/utils/CameraUtils.js +15 -6
  358. package/examples/jsm/utils/GeometryCompressionUtils.js +23 -30
  359. package/examples/jsm/utils/GeometryUtils.js +32 -27
  360. package/examples/jsm/utils/LDrawUtils.js +14 -5
  361. package/examples/jsm/utils/SceneOptimizer.js +458 -0
  362. package/examples/jsm/utils/SceneUtils.js +53 -3
  363. package/examples/jsm/utils/ShadowMapViewer.js +72 -33
  364. package/examples/jsm/utils/ShadowMapViewerGPU.js +61 -29
  365. package/examples/jsm/utils/SkeletonUtils.js +48 -0
  366. package/examples/jsm/utils/SortUtils.js +17 -5
  367. package/examples/jsm/utils/UVsDebug.js +12 -4
  368. package/examples/jsm/utils/{TextureUtils.js → WebGLTextureUtils.js} +16 -0
  369. package/examples/jsm/utils/{TextureUtilsGPU.js → WebGPUTextureUtils.js} +20 -2
  370. package/examples/jsm/utils/WorkerPool.js +67 -2
  371. package/examples/jsm/webxr/ARButton.js +19 -0
  372. package/examples/jsm/webxr/OculusHandModel.js +84 -0
  373. package/examples/jsm/webxr/OculusHandPointerModel.js +148 -22
  374. package/examples/jsm/webxr/Text2D.js +20 -6
  375. package/examples/jsm/webxr/VRButton.js +31 -0
  376. package/examples/jsm/webxr/XRButton.js +23 -0
  377. package/examples/jsm/webxr/XRControllerModelFactory.js +94 -3
  378. package/examples/jsm/webxr/XREstimatedLight.js +35 -4
  379. package/examples/jsm/webxr/XRHandMeshModel.js +37 -0
  380. package/examples/jsm/webxr/XRHandModelFactory.js +96 -6
  381. package/examples/jsm/webxr/XRHandPrimitiveModel.js +44 -0
  382. package/examples/jsm/webxr/XRPlanes.js +18 -0
  383. package/package.json +29 -37
  384. package/src/Three.Core.js +198 -0
  385. package/src/Three.Legacy.js +0 -21
  386. package/src/Three.TSL.js +641 -0
  387. package/src/Three.WebGPU.Nodes.js +14 -186
  388. package/src/Three.WebGPU.js +16 -186
  389. package/src/Three.js +2 -197
  390. package/src/animation/AnimationAction.js +263 -31
  391. package/src/animation/AnimationClip.js +162 -7
  392. package/src/animation/AnimationMixer.js +105 -15
  393. package/src/animation/AnimationObjectGroup.js +45 -21
  394. package/src/animation/AnimationUtils.js +163 -24
  395. package/src/animation/KeyframeTrack.js +191 -17
  396. package/src/animation/PropertyBinding.js +91 -16
  397. package/src/animation/PropertyMixer.js +72 -5
  398. package/src/animation/tracks/BooleanKeyframeTrack.js +33 -6
  399. package/src/animation/tracks/ColorKeyframeTrack.js +26 -5
  400. package/src/animation/tracks/NumberKeyframeTrack.js +26 -2
  401. package/src/animation/tracks/QuaternionKeyframeTrack.js +30 -1
  402. package/src/animation/tracks/StringKeyframeTrack.js +33 -2
  403. package/src/animation/tracks/VectorKeyframeTrack.js +26 -2
  404. package/src/audio/Audio.js +386 -8
  405. package/src/audio/AudioAnalyser.js +58 -1
  406. package/src/audio/AudioContext.js +15 -0
  407. package/src/audio/AudioListener.js +94 -13
  408. package/src/audio/PositionalAudio.js +107 -0
  409. package/src/cameras/ArrayCamera.js +37 -0
  410. package/src/cameras/Camera.js +61 -0
  411. package/src/cameras/CubeCamera.js +86 -0
  412. package/src/cameras/OrthographicCamera.js +110 -1
  413. package/src/cameras/PerspectiveCamera.js +174 -35
  414. package/src/cameras/StereoCamera.js +48 -2
  415. package/src/constants.js +1546 -11
  416. package/src/core/BufferAttribute.js +417 -3
  417. package/src/core/BufferGeometry.js +407 -22
  418. package/src/core/Clock.js +69 -8
  419. package/src/core/EventDispatcher.js +52 -8
  420. package/src/core/GLBufferAttribute.js +113 -2
  421. package/src/core/InstancedBufferAttribute.js +29 -0
  422. package/src/core/InstancedBufferGeometry.js +20 -0
  423. package/src/core/InstancedInterleavedBuffer.js +26 -0
  424. package/src/core/InterleavedBuffer.js +141 -7
  425. package/src/core/InterleavedBufferAttribute.js +200 -2
  426. package/src/core/Layers.js +71 -10
  427. package/src/core/Object3D.js +673 -26
  428. package/src/core/Raycaster.js +136 -2
  429. package/src/core/RenderTarget.js +256 -27
  430. package/src/core/RenderTarget3D.js +48 -0
  431. package/src/core/Timer.js +184 -0
  432. package/src/core/Uniform.js +29 -0
  433. package/src/core/UniformsGroup.js +84 -2
  434. package/src/extras/Controls.js +89 -1
  435. package/src/extras/DataUtils.js +50 -9
  436. package/src/extras/Earcut.js +18 -779
  437. package/src/extras/ImageUtils.js +22 -14
  438. package/src/extras/PMREMGenerator.js +316 -67
  439. package/src/extras/ShapeUtils.js +24 -2
  440. package/src/extras/TextureUtils.js +101 -15
  441. package/src/extras/core/Curve.js +156 -55
  442. package/src/extras/core/CurvePath.js +63 -22
  443. package/src/extras/core/Interpolations.js +34 -2
  444. package/src/extras/core/Path.js +134 -1
  445. package/src/extras/core/Shape.js +66 -3
  446. package/src/extras/core/ShapePath.js +80 -4
  447. package/src/extras/curves/ArcCurve.js +22 -0
  448. package/src/extras/curves/CatmullRomCurve3.js +89 -18
  449. package/src/extras/curves/CubicBezierCurve.js +67 -0
  450. package/src/extras/curves/CubicBezierCurve3.js +50 -0
  451. package/src/extras/curves/EllipseCurve.js +102 -0
  452. package/src/extras/curves/LineCurve.js +36 -0
  453. package/src/extras/curves/LineCurve3.js +36 -0
  454. package/src/extras/curves/QuadraticBezierCurve.js +59 -0
  455. package/src/extras/curves/QuadraticBezierCurve3.js +43 -0
  456. package/src/extras/curves/SplineCurve.js +48 -0
  457. package/src/extras/lib/earcut.js +685 -0
  458. package/src/geometries/BoxGeometry.js +39 -0
  459. package/src/geometries/CapsuleGeometry.js +196 -11
  460. package/src/geometries/CircleGeometry.js +41 -0
  461. package/src/geometries/ConeGeometry.js +39 -0
  462. package/src/geometries/CylinderGeometry.js +42 -2
  463. package/src/geometries/DodecahedronGeometry.js +33 -0
  464. package/src/geometries/EdgesGeometry.js +30 -2
  465. package/src/geometries/ExtrudeGeometry.js +148 -52
  466. package/src/geometries/IcosahedronGeometry.js +33 -0
  467. package/src/geometries/LatheGeometry.js +44 -3
  468. package/src/geometries/OctahedronGeometry.js +33 -0
  469. package/src/geometries/PlaneGeometry.js +35 -0
  470. package/src/geometries/PolyhedronGeometry.js +30 -1
  471. package/src/geometries/RingGeometry.js +37 -0
  472. package/src/geometries/ShapeGeometry.js +38 -0
  473. package/src/geometries/SphereGeometry.js +38 -0
  474. package/src/geometries/TetrahedronGeometry.js +33 -0
  475. package/src/geometries/TorusGeometry.js +44 -3
  476. package/src/geometries/TorusKnotGeometry.js +39 -0
  477. package/src/geometries/TubeGeometry.js +50 -0
  478. package/src/geometries/WireframeGeometry.js +32 -0
  479. package/src/helpers/ArrowHelper.js +62 -5
  480. package/src/helpers/AxesHelper.js +28 -0
  481. package/src/helpers/Box3Helper.js +28 -0
  482. package/src/helpers/BoxHelper.js +43 -7
  483. package/src/helpers/CameraHelper.js +103 -27
  484. package/src/helpers/DirectionalLightHelper.js +55 -0
  485. package/src/helpers/GridHelper.js +26 -0
  486. package/src/helpers/HemisphereLightHelper.js +42 -0
  487. package/src/helpers/PlaneHelper.js +33 -0
  488. package/src/helpers/PointLightHelper.js +43 -24
  489. package/src/helpers/PolarGridHelper.js +30 -0
  490. package/src/helpers/SkeletonHelper.js +73 -7
  491. package/src/helpers/SpotLightHelper.js +43 -0
  492. package/src/lights/AmbientLight.js +25 -0
  493. package/src/lights/DirectionalLight.js +70 -0
  494. package/src/lights/DirectionalLightShadow.js +15 -0
  495. package/src/lights/HemisphereLight.js +42 -0
  496. package/src/lights/Light.js +37 -11
  497. package/src/lights/LightProbe.js +37 -9
  498. package/src/lights/LightShadow.js +202 -7
  499. package/src/lights/PointLight.js +74 -0
  500. package/src/lights/PointLightShadow.js +15 -80
  501. package/src/lights/RectAreaLight.js +59 -0
  502. package/src/lights/SpotLight.js +124 -1
  503. package/src/lights/SpotLightShadow.js +33 -3
  504. package/src/lights/webgpu/IESSpotLight.js +22 -0
  505. package/src/lights/webgpu/ProjectorLight.js +46 -0
  506. package/src/loaders/AnimationLoader.js +34 -2
  507. package/src/loaders/AudioLoader.js +34 -2
  508. package/src/loaders/BufferGeometryLoader.js +38 -13
  509. package/src/loaders/Cache.js +75 -2
  510. package/src/loaders/CompressedTextureLoader.js +36 -3
  511. package/src/loaders/CubeTextureLoader.js +45 -0
  512. package/src/loaders/DataTextureLoader.js +45 -4
  513. package/src/loaders/FileLoader.js +85 -5
  514. package/src/loaders/ImageBitmapLoader.js +113 -11
  515. package/src/loaders/ImageLoader.js +85 -8
  516. package/src/loaders/Loader.js +150 -0
  517. package/src/loaders/LoaderUtils.js +18 -36
  518. package/src/loaders/LoadingManager.js +187 -0
  519. package/src/loaders/MaterialLoader.js +62 -3
  520. package/src/loaders/ObjectLoader.js +131 -31
  521. package/src/loaders/TextureLoader.js +33 -0
  522. package/src/loaders/nodes/NodeLoader.js +68 -4
  523. package/src/loaders/nodes/NodeMaterialLoader.js +45 -0
  524. package/src/loaders/nodes/NodeObjectLoader.js +61 -0
  525. package/src/materials/LineBasicMaterial.js +74 -1
  526. package/src/materials/LineDashedMaterial.js +52 -1
  527. package/src/materials/Material.js +502 -8
  528. package/src/materials/MeshBasicMaterial.js +168 -2
  529. package/src/materials/MeshDepthMaterial.js +94 -0
  530. package/src/materials/MeshDistanceMaterial.js +76 -0
  531. package/src/materials/MeshLambertMaterial.js +283 -0
  532. package/src/materials/MeshMatcapMaterial.js +164 -0
  533. package/src/materials/MeshNormalMaterial.js +114 -0
  534. package/src/materials/MeshPhongMaterial.js +298 -0
  535. package/src/materials/MeshPhysicalMaterial.js +296 -4
  536. package/src/materials/MeshStandardMaterial.js +300 -2
  537. package/src/materials/MeshToonMaterial.js +219 -0
  538. package/src/materials/PointsMaterial.js +89 -0
  539. package/src/materials/RawShaderMaterial.js +25 -0
  540. package/src/materials/ShaderMaterial.js +234 -6
  541. package/src/materials/ShadowMaterial.js +54 -0
  542. package/src/materials/SpriteMaterial.js +82 -0
  543. package/src/materials/nodes/Line2NodeMaterial.js +158 -53
  544. package/src/materials/nodes/LineBasicNodeMaterial.js +17 -2
  545. package/src/materials/nodes/LineDashedNodeMaterial.js +81 -6
  546. package/src/materials/nodes/MeshBasicNodeMaterial.js +59 -2
  547. package/src/materials/nodes/MeshLambertNodeMaterial.js +35 -0
  548. package/src/materials/nodes/MeshMatcapNodeMaterial.js +23 -3
  549. package/src/materials/nodes/MeshNormalNodeMaterial.js +27 -4
  550. package/src/materials/nodes/MeshPhongNodeMaterial.js +64 -1
  551. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +276 -3
  552. package/src/materials/nodes/MeshSSSNodeMaterial.js +98 -10
  553. package/src/materials/nodes/MeshStandardNodeMaterial.js +83 -4
  554. package/src/materials/nodes/MeshToonNodeMaterial.js +28 -0
  555. package/src/materials/nodes/NodeMaterial.js +789 -74
  556. package/src/materials/nodes/NodeMaterials.js +0 -1
  557. package/src/materials/nodes/PointsNodeMaterial.js +180 -11
  558. package/src/materials/nodes/ShadowNodeMaterial.js +38 -0
  559. package/src/materials/nodes/SpriteNodeMaterial.js +86 -23
  560. package/src/materials/nodes/VolumeNodeMaterial.js +57 -84
  561. package/src/materials/nodes/manager/NodeMaterialObserver.js +329 -12
  562. package/src/math/Box2.js +177 -0
  563. package/src/math/Box3.js +271 -0
  564. package/src/math/Color.js +355 -11
  565. package/src/math/ColorManagement.js +158 -92
  566. package/src/math/Cylindrical.js +65 -6
  567. package/src/math/Euler.js +139 -5
  568. package/src/math/Frustum.js +108 -9
  569. package/src/math/FrustumArray.js +258 -0
  570. package/src/math/Interpolant.js +87 -8
  571. package/src/math/Line3.js +221 -2
  572. package/src/math/MathUtils.js +408 -20
  573. package/src/math/Matrix2.js +70 -0
  574. package/src/math/Matrix3.js +229 -4
  575. package/src/math/Matrix4.js +489 -94
  576. package/src/math/Plane.js +164 -2
  577. package/src/math/Quaternion.js +322 -90
  578. package/src/math/Ray.js +162 -0
  579. package/src/math/Sphere.js +175 -0
  580. package/src/math/Spherical.js +73 -11
  581. package/src/math/SphericalHarmonics3.js +112 -14
  582. package/src/math/Triangle.js +206 -2
  583. package/src/math/Vector2.js +396 -10
  584. package/src/math/Vector3.js +550 -15
  585. package/src/math/Vector4.js +415 -9
  586. package/src/math/interpolants/BezierInterpolant.js +108 -0
  587. package/src/math/interpolants/CubicInterpolant.js +10 -1
  588. package/src/math/interpolants/DiscreteInterpolant.js +10 -2
  589. package/src/math/interpolants/LinearInterpolant.js +13 -0
  590. package/src/math/interpolants/QuaternionLinearInterpolant.js +10 -1
  591. package/src/nodes/Nodes.js +91 -88
  592. package/src/nodes/TSL.js +32 -38
  593. package/src/nodes/accessors/AccessorsUtils.js +37 -9
  594. package/src/nodes/accessors/Arrays.js +68 -0
  595. package/src/nodes/accessors/BatchNode.js +49 -14
  596. package/src/nodes/accessors/Bitangent.js +82 -13
  597. package/src/nodes/accessors/BufferAttributeNode.js +269 -8
  598. package/src/nodes/accessors/BufferNode.js +91 -2
  599. package/src/nodes/accessors/BuiltinNode.js +63 -0
  600. package/src/nodes/accessors/Camera.js +400 -10
  601. package/src/nodes/accessors/ClippingNode.js +149 -45
  602. package/src/nodes/accessors/CubeTextureNode.js +137 -7
  603. package/src/nodes/accessors/InstanceNode.js +245 -40
  604. package/src/nodes/accessors/InstancedMeshNode.js +50 -0
  605. package/src/nodes/accessors/Lights.js +88 -0
  606. package/src/nodes/accessors/MaterialNode.js +355 -13
  607. package/src/nodes/accessors/MaterialProperties.js +57 -1
  608. package/src/nodes/accessors/MaterialReferenceNode.js +52 -14
  609. package/src/nodes/accessors/ModelNode.js +117 -5
  610. package/src/nodes/accessors/ModelViewProjectionNode.js +10 -39
  611. package/src/nodes/accessors/MorphNode.js +73 -26
  612. package/src/nodes/accessors/Normal.js +174 -19
  613. package/src/nodes/accessors/Object3DNode.js +146 -12
  614. package/src/nodes/accessors/PointUVNode.js +25 -0
  615. package/src/nodes/accessors/Position.js +119 -7
  616. package/src/nodes/accessors/ReferenceBaseNode.js +190 -4
  617. package/src/nodes/accessors/ReferenceNode.js +223 -8
  618. package/src/nodes/accessors/ReflectVector.js +29 -3
  619. package/src/nodes/accessors/RendererReferenceNode.js +45 -2
  620. package/src/nodes/accessors/SceneProperties.js +53 -0
  621. package/src/nodes/accessors/SkinningNode.js +180 -43
  622. package/src/nodes/accessors/StorageBufferNode.js +278 -26
  623. package/src/nodes/accessors/StorageTextureNode.js +205 -12
  624. package/src/nodes/accessors/Tangent.js +48 -10
  625. package/src/nodes/accessors/TangentUtils.js +46 -0
  626. package/src/nodes/accessors/Texture3DNode.js +104 -11
  627. package/src/nodes/accessors/TextureBicubic.js +31 -4
  628. package/src/nodes/accessors/TextureNode.js +564 -52
  629. package/src/nodes/accessors/TextureSizeNode.js +42 -1
  630. package/src/nodes/accessors/UV.js +9 -1
  631. package/src/nodes/accessors/UniformArrayNode.js +226 -34
  632. package/src/nodes/accessors/UserDataNode.js +46 -2
  633. package/src/nodes/accessors/VelocityNode.js +93 -3
  634. package/src/nodes/accessors/VertexColorNode.js +39 -4
  635. package/src/nodes/code/CodeNode.js +101 -8
  636. package/src/nodes/code/ExpressionNode.js +29 -2
  637. package/src/nodes/code/FunctionCallNode.js +98 -10
  638. package/src/nodes/code/FunctionNode.js +69 -2
  639. package/src/nodes/core/ArrayNode.js +174 -0
  640. package/src/nodes/core/AssignNode.js +80 -9
  641. package/src/nodes/core/AttributeNode.js +47 -4
  642. package/src/nodes/core/BypassNode.js +47 -3
  643. package/src/nodes/core/ConstNode.js +32 -0
  644. package/src/nodes/core/ContextNode.js +220 -14
  645. package/src/nodes/core/IndexNode.js +72 -7
  646. package/src/nodes/core/InputNode.js +50 -1
  647. package/src/nodes/core/InspectorNode.js +128 -0
  648. package/src/nodes/core/IsolateNode.js +133 -0
  649. package/src/nodes/core/LightingModel.js +65 -5
  650. package/src/nodes/core/MRTNode.js +113 -2
  651. package/src/nodes/core/Node.js +595 -36
  652. package/src/nodes/core/NodeAttribute.js +38 -0
  653. package/src/nodes/core/NodeBuilder.js +1840 -121
  654. package/src/nodes/core/NodeCache.js +41 -2
  655. package/src/nodes/core/NodeCode.js +31 -0
  656. package/src/nodes/core/NodeError.js +28 -0
  657. package/src/nodes/core/NodeFrame.js +153 -24
  658. package/src/nodes/core/NodeFunction.js +48 -1
  659. package/src/nodes/core/NodeFunctionInput.js +44 -0
  660. package/src/nodes/core/NodeParser.js +13 -1
  661. package/src/nodes/core/NodeUniform.js +53 -1
  662. package/src/nodes/core/NodeUtils.js +201 -51
  663. package/src/nodes/core/NodeVar.js +47 -1
  664. package/src/nodes/core/NodeVarying.js +47 -1
  665. package/src/nodes/core/OutputStructNode.js +54 -12
  666. package/src/nodes/core/ParameterNode.js +60 -2
  667. package/src/nodes/core/PropertyNode.js +286 -7
  668. package/src/nodes/core/StackNode.js +337 -20
  669. package/src/nodes/core/StackTrace.js +139 -0
  670. package/src/nodes/core/StructNode.js +134 -0
  671. package/src/nodes/core/StructType.js +13 -0
  672. package/src/nodes/core/StructTypeNode.js +126 -6
  673. package/src/nodes/core/SubBuildNode.js +89 -0
  674. package/src/nodes/core/TempNode.js +31 -5
  675. package/src/nodes/core/UniformGroupNode.js +85 -7
  676. package/src/nodes/core/UniformNode.js +163 -16
  677. package/src/nodes/core/VarNode.js +317 -10
  678. package/src/nodes/core/VaryingNode.js +115 -13
  679. package/src/nodes/core/constants.js +40 -0
  680. package/src/nodes/display/BlendModes.js +171 -0
  681. package/src/nodes/display/BumpMapNode.js +38 -2
  682. package/src/nodes/display/ColorAdjustment.js +118 -6
  683. package/src/nodes/display/ColorSpaceFunctions.js +22 -6
  684. package/src/nodes/display/ColorSpaceNode.js +97 -47
  685. package/src/nodes/display/FrontFacingNode.js +64 -7
  686. package/src/nodes/display/NormalMapNode.js +101 -54
  687. package/src/nodes/display/PassNode.js +690 -33
  688. package/src/nodes/display/RenderOutputNode.js +94 -4
  689. package/src/nodes/display/ScreenNode.js +138 -27
  690. package/src/nodes/display/ToneMappingFunctions.js +62 -10
  691. package/src/nodes/display/ToneMappingNode.js +88 -8
  692. package/src/nodes/display/ToonOutlinePassNode.js +84 -4
  693. package/src/nodes/display/ViewportDepthNode.js +227 -10
  694. package/src/nodes/display/ViewportDepthTextureNode.js +39 -5
  695. package/src/nodes/display/ViewportSharedTextureNode.js +35 -1
  696. package/src/nodes/display/ViewportTextureNode.js +171 -7
  697. package/src/nodes/fog/Fog.js +97 -0
  698. package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
  699. package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +52 -0
  700. package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
  701. package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
  702. package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
  703. package/src/nodes/functions/BSDF/LTC.js +45 -1
  704. package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +1 -1
  705. package/src/nodes/functions/BasicLightingModel.js +28 -6
  706. package/src/nodes/functions/PhongLightingModel.js +36 -6
  707. package/src/nodes/functions/PhysicalLightingModel.js +336 -91
  708. package/src/nodes/functions/ShadowMaskModel.js +30 -3
  709. package/src/nodes/functions/ToonLightingModel.js +21 -2
  710. package/src/nodes/functions/VolumetricLightingModel.js +183 -0
  711. package/src/nodes/functions/material/getAlphaHashThreshold.js +68 -0
  712. package/src/nodes/functions/material/getGeometryRoughness.js +10 -4
  713. package/src/nodes/functions/material/getParallaxCorrectNormal.js +37 -0
  714. package/src/nodes/geometry/RangeNode.js +97 -8
  715. package/src/nodes/gpgpu/AtomicFunctionNode.js +198 -23
  716. package/src/nodes/gpgpu/BarrierNode.js +52 -3
  717. package/src/nodes/gpgpu/ComputeBuiltinNode.js +135 -6
  718. package/src/nodes/gpgpu/ComputeNode.js +212 -16
  719. package/src/nodes/gpgpu/SubgroupFunctionNode.js +455 -0
  720. package/src/nodes/gpgpu/WorkgroupInfoNode.js +143 -9
  721. package/src/nodes/lighting/AONode.js +18 -0
  722. package/src/nodes/lighting/AmbientLightNode.js +10 -0
  723. package/src/nodes/lighting/AnalyticLightNode.js +186 -399
  724. package/src/nodes/lighting/BasicEnvironmentNode.js +19 -0
  725. package/src/nodes/lighting/BasicLightMapNode.js +17 -0
  726. package/src/nodes/lighting/DirectionalLightNode.js +12 -11
  727. package/src/nodes/lighting/EnvironmentNode.js +59 -19
  728. package/src/nodes/lighting/HemisphereLightNode.js +33 -2
  729. package/src/nodes/lighting/IESSpotLightNode.js +13 -1
  730. package/src/nodes/lighting/IrradianceNode.js +17 -0
  731. package/src/nodes/lighting/LightProbeNode.js +20 -0
  732. package/src/nodes/lighting/LightUtils.js +11 -3
  733. package/src/nodes/lighting/LightingContextNode.js +52 -4
  734. package/src/nodes/lighting/LightingNode.js +15 -6
  735. package/src/nodes/lighting/LightsNode.js +238 -35
  736. package/src/nodes/lighting/PointLightNode.js +60 -25
  737. package/src/nodes/lighting/PointShadowNode.js +325 -0
  738. package/src/nodes/lighting/ProjectorLightNode.js +91 -0
  739. package/src/nodes/lighting/RectAreaLightNode.js +50 -14
  740. package/src/nodes/lighting/ShadowBaseNode.js +81 -0
  741. package/src/nodes/lighting/ShadowFilterNode.js +264 -0
  742. package/src/nodes/lighting/ShadowNode.js +867 -0
  743. package/src/nodes/lighting/SpotLightNode.js +99 -18
  744. package/src/nodes/materialx/MaterialXNodes.js +131 -2
  745. package/src/nodes/materialx/lib/mx_noise.js +166 -2
  746. package/src/nodes/math/BitcastNode.js +156 -0
  747. package/src/nodes/math/BitcountNode.js +433 -0
  748. package/src/nodes/math/ConditionalNode.js +110 -21
  749. package/src/nodes/math/Hash.js +8 -0
  750. package/src/nodes/math/MathNode.js +820 -97
  751. package/src/nodes/math/MathUtils.js +47 -1
  752. package/src/nodes/math/OperatorNode.js +517 -84
  753. package/src/nodes/math/PackFloatNode.js +98 -0
  754. package/src/nodes/math/TriNoise3D.js +17 -7
  755. package/src/nodes/math/UnpackFloatNode.js +96 -0
  756. package/src/nodes/parsers/GLSLNodeFunction.js +16 -0
  757. package/src/nodes/parsers/GLSLNodeParser.js +11 -0
  758. package/src/nodes/pmrem/PMREMNode.js +180 -23
  759. package/src/nodes/pmrem/PMREMUtils.js +114 -5
  760. package/src/nodes/procedural/Checker.js +8 -0
  761. package/src/nodes/shapes/Shapes.js +33 -0
  762. package/src/nodes/tsl/TSLBase.js +10 -4
  763. package/src/nodes/tsl/TSLCore.js +732 -160
  764. package/src/nodes/utils/ArrayElementNode.js +55 -4
  765. package/src/nodes/utils/ConvertNode.js +31 -0
  766. package/src/nodes/utils/CubeMapNode.js +79 -2
  767. package/src/nodes/utils/DebugNode.js +83 -0
  768. package/src/nodes/utils/Discard.js +18 -2
  769. package/src/nodes/utils/EquirectUV.js +27 -0
  770. package/src/nodes/utils/EventNode.js +118 -0
  771. package/src/nodes/utils/FlipNode.js +38 -0
  772. package/src/nodes/utils/FunctionOverloadingNode.js +91 -22
  773. package/src/nodes/utils/JoinNode.js +57 -4
  774. package/src/nodes/utils/LoopNode.js +193 -55
  775. package/src/nodes/utils/MatcapUV.js +22 -0
  776. package/src/nodes/utils/MaxMipLevelNode.js +49 -1
  777. package/src/nodes/utils/MemberNode.js +120 -0
  778. package/src/nodes/utils/Oscillators.js +41 -0
  779. package/src/nodes/utils/Packing.js +30 -1
  780. package/src/nodes/utils/PostProcessingUtils.js +154 -0
  781. package/src/nodes/utils/RTTNode.js +165 -9
  782. package/src/nodes/utils/ReflectorNode.js +407 -21
  783. package/src/nodes/utils/RemapNode.js +81 -2
  784. package/src/nodes/utils/RotateNode.js +41 -1
  785. package/src/nodes/utils/SampleNode.js +91 -0
  786. package/src/nodes/utils/SetNode.js +44 -1
  787. package/src/nodes/utils/SplitNode.js +66 -3
  788. package/src/nodes/utils/SpriteSheetUV.js +35 -0
  789. package/src/nodes/utils/SpriteUtils.js +16 -0
  790. package/src/nodes/utils/StorageArrayElementNode.js +56 -3
  791. package/src/nodes/utils/Timer.js +26 -0
  792. package/src/nodes/utils/TriplanarTextures.js +65 -0
  793. package/src/nodes/utils/UVUtils.js +48 -0
  794. package/src/nodes/utils/ViewportUtils.js +12 -0
  795. package/src/objects/BatchedMesh.js +798 -309
  796. package/src/objects/Bone.js +24 -0
  797. package/src/objects/ClippingGroup.js +68 -0
  798. package/src/objects/Group.js +24 -0
  799. package/src/objects/InstancedMesh.js +131 -2
  800. package/src/objects/LOD.js +99 -5
  801. package/src/objects/Line.js +90 -7
  802. package/src/objects/LineLoop.js +20 -0
  803. package/src/objects/LineSegments.js +20 -1
  804. package/src/objects/Mesh.js +84 -0
  805. package/src/objects/Points.js +60 -0
  806. package/src/objects/Skeleton.js +120 -5
  807. package/src/objects/SkinnedMesh.js +102 -6
  808. package/src/objects/Sprite.js +65 -1
  809. package/src/renderers/WebGL3DRenderTarget.js +26 -0
  810. package/src/renderers/WebGLArrayRenderTarget.js +26 -0
  811. package/src/renderers/WebGLCubeRenderTarget.js +41 -5
  812. package/src/renderers/WebGLRenderTarget.js +19 -0
  813. package/src/renderers/WebGLRenderer.js +1016 -278
  814. package/src/renderers/common/Animation.js +123 -14
  815. package/src/renderers/common/Attributes.js +41 -1
  816. package/src/renderers/common/Backend.js +623 -44
  817. package/src/renderers/common/Background.js +99 -16
  818. package/src/renderers/common/BindGroup.js +37 -2
  819. package/src/renderers/common/Binding.js +46 -0
  820. package/src/renderers/common/Bindings.js +211 -20
  821. package/src/renderers/common/BlendMode.js +143 -0
  822. package/src/renderers/common/Buffer.js +89 -0
  823. package/src/renderers/common/BufferUtils.js +25 -0
  824. package/src/renderers/common/BundleGroup.js +57 -0
  825. package/src/renderers/common/CanvasTarget.js +341 -0
  826. package/src/renderers/common/ChainMap.js +73 -10
  827. package/src/renderers/common/ClippingContext.js +172 -87
  828. package/src/renderers/common/Color4.js +40 -0
  829. package/src/renderers/common/ComputePipeline.js +24 -0
  830. package/src/renderers/common/Constants.js +2 -1
  831. package/src/renderers/common/CubeRenderTarget.js +77 -7
  832. package/src/renderers/common/DataMap.js +37 -1
  833. package/src/renderers/common/Geometries.js +163 -14
  834. package/src/renderers/common/IndirectStorageBufferAttribute.js +38 -0
  835. package/src/renderers/common/Info.js +81 -36
  836. package/src/renderers/common/InspectorBase.js +146 -0
  837. package/src/renderers/common/Lighting.js +57 -0
  838. package/src/renderers/common/Pipeline.js +22 -0
  839. package/src/renderers/common/Pipelines.js +150 -7
  840. package/src/renderers/common/PostProcessing.js +22 -84
  841. package/src/renderers/common/ProgrammableStage.js +60 -2
  842. package/src/renderers/common/QuadMesh.js +63 -6
  843. package/src/renderers/common/RenderBundle.js +14 -8
  844. package/src/renderers/common/RenderBundles.js +40 -10
  845. package/src/renderers/common/RenderContext.js +219 -4
  846. package/src/renderers/common/RenderContexts.js +54 -17
  847. package/src/renderers/common/RenderList.js +233 -24
  848. package/src/renderers/common/RenderLists.js +46 -6
  849. package/src/renderers/common/RenderObject.js +548 -46
  850. package/src/renderers/common/RenderObjectPipeline.js +40 -0
  851. package/src/renderers/common/RenderObjects.js +133 -15
  852. package/src/renderers/common/RenderPipeline.js +216 -6
  853. package/src/renderers/common/Renderer.js +2155 -332
  854. package/src/renderers/common/RendererUtils.js +200 -0
  855. package/src/renderers/common/SampledTexture.js +99 -39
  856. package/src/renderers/common/Sampler.js +148 -1
  857. package/src/renderers/common/Storage3DTexture.js +100 -0
  858. package/src/renderers/common/StorageArrayTexture.js +84 -0
  859. package/src/renderers/common/StorageBuffer.js +38 -2
  860. package/src/renderers/common/StorageBufferAttribute.js +31 -2
  861. package/src/renderers/common/StorageInstancedBufferAttribute.js +31 -2
  862. package/src/renderers/common/StorageTexture.js +65 -0
  863. package/src/renderers/common/Textures.js +273 -57
  864. package/src/renderers/common/TimestampQueryPool.js +163 -0
  865. package/src/renderers/common/Uniform.js +233 -3
  866. package/src/renderers/common/UniformBuffer.js +19 -0
  867. package/src/renderers/common/UniformsGroup.js +235 -26
  868. package/src/renderers/common/XRManager.js +1677 -0
  869. package/src/renderers/common/XRRenderTarget.js +91 -0
  870. package/src/renderers/common/extras/PMREMGenerator.js +371 -108
  871. package/src/renderers/common/nodes/NodeBuilderState.js +100 -6
  872. package/src/renderers/common/nodes/NodeLibrary.js +95 -17
  873. package/src/renderers/common/nodes/NodeManager.js +852 -0
  874. package/src/renderers/common/nodes/NodeSampledTexture.js +84 -8
  875. package/src/renderers/common/nodes/NodeSampler.js +41 -1
  876. package/src/renderers/common/nodes/NodeStorageBuffer.js +48 -3
  877. package/src/renderers/common/nodes/NodeUniform.js +285 -2
  878. package/src/renderers/common/nodes/NodeUniformBuffer.js +81 -0
  879. package/src/renderers/common/nodes/NodeUniformsGroup.js +31 -18
  880. package/src/renderers/shaders/DFGLUTData.js +49 -0
  881. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +2 -2
  882. package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +1 -5
  883. package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +1 -5
  884. package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -5
  885. package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +8 -10
  886. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +4 -24
  887. package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -12
  888. package/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.js +8 -0
  889. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -1
  890. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +7 -11
  891. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +1 -1
  892. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +5 -2
  893. package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +6 -0
  894. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +6 -2
  895. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
  896. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +154 -59
  897. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +1 -1
  898. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
  899. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +1 -1
  900. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +1 -1
  901. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +2 -2
  902. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +20 -4
  903. package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +1 -1
  904. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +230 -181
  905. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
  906. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  907. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +7 -7
  908. package/src/renderers/shaders/ShaderChunk.js +3 -3
  909. package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
  910. package/src/renderers/shaders/ShaderLib/depth.glsl.js +14 -2
  911. package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
  912. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -1
  913. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
  914. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -1
  915. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
  916. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
  917. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
  918. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
  919. package/src/renderers/shaders/ShaderLib.js +7 -5
  920. package/src/renderers/shaders/UniformsLib.js +2 -7
  921. package/src/renderers/shaders/UniformsUtils.js +21 -2
  922. package/src/renderers/webgl/WebGLAttributes.js +4 -0
  923. package/src/renderers/webgl/WebGLBackground.js +30 -5
  924. package/src/renderers/webgl/WebGLBindingStates.js +99 -27
  925. package/src/renderers/webgl/WebGLBufferRenderer.js +2 -6
  926. package/src/renderers/webgl/WebGLCapabilities.js +7 -14
  927. package/src/renderers/webgl/WebGLEnvironments.js +228 -0
  928. package/src/renderers/webgl/WebGLExtensions.js +2 -25
  929. package/src/renderers/webgl/WebGLGeometries.js +10 -35
  930. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +2 -6
  931. package/src/renderers/webgl/WebGLInfo.js +3 -1
  932. package/src/renderers/webgl/WebGLLights.js +18 -1
  933. package/src/renderers/webgl/WebGLMaterials.js +12 -0
  934. package/src/renderers/webgl/WebGLObjects.js +3 -1
  935. package/src/renderers/webgl/WebGLOutput.js +267 -0
  936. package/src/renderers/webgl/WebGLProgram.js +87 -148
  937. package/src/renderers/webgl/WebGLPrograms.js +53 -51
  938. package/src/renderers/webgl/WebGLRenderLists.js +15 -0
  939. package/src/renderers/webgl/WebGLShadowMap.js +204 -28
  940. package/src/renderers/webgl/WebGLState.js +88 -56
  941. package/src/renderers/webgl/WebGLTextures.js +293 -59
  942. package/src/renderers/webgl/WebGLUniforms.js +40 -3
  943. package/src/renderers/webgl/WebGLUniformsGroups.js +5 -3
  944. package/src/renderers/webgl/WebGLUtils.js +7 -5
  945. package/src/renderers/webgl-fallback/WebGLBackend.js +1416 -293
  946. package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +5 -10
  947. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +785 -92
  948. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +62 -1
  949. package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +28 -0
  950. package/src/renderers/webgl-fallback/utils/WebGLConstants.js +3 -3
  951. package/src/renderers/webgl-fallback/utils/WebGLExtensions.js +45 -0
  952. package/src/renderers/webgl-fallback/utils/WebGLState.js +584 -20
  953. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +468 -80
  954. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +396 -0
  955. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +72 -24
  956. package/src/renderers/webgpu/WebGPUBackend.js +1517 -428
  957. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +31 -4
  958. package/src/renderers/webgpu/WebGPURenderer.js +55 -4
  959. package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +23 -16
  960. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +37 -42
  961. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +1335 -241
  962. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +32 -4
  963. package/src/renderers/webgpu/nodes/WGSLNodeParser.js +11 -0
  964. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +144 -20
  965. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +460 -116
  966. package/src/renderers/webgpu/utils/WebGPUConstants.js +17 -4
  967. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +283 -69
  968. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +225 -178
  969. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +583 -191
  970. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +310 -0
  971. package/src/renderers/webgpu/utils/WebGPUUtils.js +150 -28
  972. package/src/renderers/webxr/WebXRController.js +87 -2
  973. package/src/renderers/webxr/WebXRDepthSensing.js +52 -7
  974. package/src/renderers/webxr/WebXRManager.js +275 -15
  975. package/src/scenes/Fog.js +60 -0
  976. package/src/scenes/FogExp2.js +51 -0
  977. package/src/scenes/Scene.js +88 -0
  978. package/src/textures/CanvasTexture.js +28 -0
  979. package/src/textures/CompressedArrayTexture.js +57 -0
  980. package/src/textures/CompressedCubeTexture.js +29 -0
  981. package/src/textures/CompressedTexture.js +64 -6
  982. package/src/textures/CubeDepthTexture.js +76 -0
  983. package/src/textures/CubeTexture.js +52 -4
  984. package/src/textures/Data3DTexture.js +79 -2
  985. package/src/textures/DataArrayTexture.js +93 -0
  986. package/src/textures/DataTexture.js +65 -0
  987. package/src/textures/DepthTexture.js +59 -11
  988. package/src/textures/ExternalTexture.js +56 -0
  989. package/src/textures/FramebufferTexture.js +62 -0
  990. package/src/textures/Source.js +106 -4
  991. package/src/textures/Texture.js +488 -6
  992. package/src/textures/VideoFrameTexture.js +72 -0
  993. package/src/textures/VideoTexture.js +78 -6
  994. package/src/utils.js +322 -3
  995. package/examples/jsm/animation/MMDAnimationHelper.js +0 -1207
  996. package/examples/jsm/animation/MMDPhysics.js +0 -1406
  997. package/examples/jsm/cameras/CinematicCamera.js +0 -208
  998. package/examples/jsm/effects/PeppersGhostEffect.js +0 -153
  999. package/examples/jsm/exporters/MMDExporter.js +0 -217
  1000. package/examples/jsm/geometries/InstancedPointsGeometry.js +0 -174
  1001. package/examples/jsm/geometries/ParametricGeometries.js +0 -254
  1002. package/examples/jsm/libs/mmdparser.module.js +0 -11530
  1003. package/examples/jsm/loaders/GLTFLoaderAnimationPointer.js +0 -729
  1004. package/examples/jsm/loaders/MMDLoader.js +0 -2295
  1005. package/examples/jsm/loaders/RGBMLoader.js +0 -1081
  1006. package/examples/jsm/materials/MeshGouraudMaterial.js +0 -432
  1007. package/examples/jsm/materials/MeshPostProcessingMaterial.js +0 -144
  1008. package/examples/jsm/misc/Timer.js +0 -128
  1009. package/examples/jsm/objects/InstancedPoints.js +0 -21
  1010. package/examples/jsm/shaders/GodRaysShader.js +0 -321
  1011. package/examples/jsm/shaders/MMDToonShader.js +0 -134
  1012. package/src/materials/nodes/InstancedPointsNodeMaterial.js +0 -156
  1013. package/src/nodes/accessors/InstancedPointsMaterialNode.js +0 -24
  1014. package/src/nodes/accessors/SceneNode.js +0 -55
  1015. package/src/nodes/code/ScriptableNode.js +0 -505
  1016. package/src/nodes/code/ScriptableValueNode.js +0 -170
  1017. package/src/nodes/core/CacheNode.js +0 -50
  1018. package/src/nodes/core/UniformGroup.js +0 -13
  1019. package/src/nodes/display/AfterImageNode.js +0 -158
  1020. package/src/nodes/display/AnaglyphPassNode.js +0 -67
  1021. package/src/nodes/display/AnamorphicNode.js +0 -151
  1022. package/src/nodes/display/BlendMode.js +0 -54
  1023. package/src/nodes/display/BloomNode.js +0 -341
  1024. package/src/nodes/display/DenoiseNode.js +0 -204
  1025. package/src/nodes/display/DepthOfFieldNode.js +0 -124
  1026. package/src/nodes/display/DotScreenNode.js +0 -66
  1027. package/src/nodes/display/FXAANode.js +0 -332
  1028. package/src/nodes/display/FilmNode.js +0 -56
  1029. package/src/nodes/display/GTAONode.js +0 -331
  1030. package/src/nodes/display/GaussianBlurNode.js +0 -213
  1031. package/src/nodes/display/Lut3DNode.js +0 -57
  1032. package/src/nodes/display/MotionBlur.js +0 -25
  1033. package/src/nodes/display/ParallaxBarrierPassNode.js +0 -58
  1034. package/src/nodes/display/PixelationPassNode.js +0 -213
  1035. package/src/nodes/display/PosterizeNode.js +0 -33
  1036. package/src/nodes/display/RGBShiftNode.js +0 -53
  1037. package/src/nodes/display/StereoCompositePassNode.js +0 -110
  1038. package/src/nodes/display/TransitionNode.js +0 -80
  1039. package/src/nodes/fog/FogExp2Node.js +0 -35
  1040. package/src/nodes/fog/FogNode.js +0 -50
  1041. package/src/nodes/fog/FogRangeNode.js +0 -36
  1042. package/src/nodes/functions/BSDF/DFGApprox.js +0 -30
  1043. package/src/nodes/utils/EquirectUVNode.js +0 -36
  1044. package/src/nodes/utils/MatcapUVNode.js +0 -33
  1045. package/src/nodes/utils/OscNode.js +0 -85
  1046. package/src/nodes/utils/SpriteSheetUVNode.js +0 -45
  1047. package/src/nodes/utils/TimerNode.js +0 -97
  1048. package/src/nodes/utils/TriplanarTexturesNode.js +0 -64
  1049. package/src/renderers/common/nodes/Nodes.js +0 -534
  1050. package/src/renderers/webgl/WebGLCubeMaps.js +0 -99
  1051. package/src/renderers/webgl/WebGLCubeUVMaps.js +0 -136
@@ -59,9 +59,28 @@ const _transformation = {
59
59
 
60
60
  };
61
61
 
62
- //events
62
+ /**
63
+ * Fires when the camera has been transformed by the controls.
64
+ *
65
+ * @event ArcballControls#change
66
+ * @type {Object}
67
+ */
63
68
  const _changeEvent = { type: 'change' };
69
+
70
+ /**
71
+ * Fires when an interaction was initiated.
72
+ *
73
+ * @event ArcballControls#start
74
+ * @type {Object}
75
+ */
64
76
  const _startEvent = { type: 'start' };
77
+
78
+ /**
79
+ * Fires when an interaction has finished.
80
+ *
81
+ * @event ArcballControls#end
82
+ * @type {Object}
83
+ */
65
84
  const _endEvent = { type: 'end' };
66
85
 
67
86
  const _raycaster = new Raycaster();
@@ -70,23 +89,69 @@ const _offset = new Vector3();
70
89
  const _gizmoMatrixStateTemp = new Matrix4();
71
90
  const _cameraMatrixStateTemp = new Matrix4();
72
91
  const _scalePointTemp = new Vector3();
92
+
93
+ const _EPS = 0.000001;
94
+
73
95
  /**
96
+ * Arcball controls allow the camera to be controlled by a virtual trackball with full touch support and advanced navigation functionality.
97
+ * Cursor/finger positions and movements are mapped over a virtual trackball surface represented by a gizmo and mapped in intuitive and
98
+ * consistent camera movements. Dragging cursor/fingers will cause camera to orbit around the center of the trackball in a conservative
99
+ * way (returning to the starting point will make the camera return to its starting orientation).
74
100
  *
75
- * @param {Camera} camera Virtual camera used in the scene
76
- * @param {HTMLElement} domElement Renderer's dom element
77
- * @param {Scene} scene The scene to be rendered
101
+ * In addition to supporting pan, zoom and pinch gestures, double clicking/tapping focuses on a point, intuitively moving the object's
102
+ * point of interest to the center of the virtual trackball. Focus allows a much better inspection and navigation in complex environment.
103
+ * Moreover Arcball controls allow FOV manipulation (in a vertigo-style method) and z-rotation. Saving and restoring of Camera State
104
+ * is supported also through clipboard (use ctrl+c and ctrl+v shortcuts for copy and paste the state).
105
+ *
106
+ * Unlike {@link OrbitControls} and {@link TrackballControls}, `ArcballControls` doesn't require `update()` to be called externally in an
107
+ * animation loop when animations are on.
108
+ *
109
+ * @augments Controls
110
+ * @three_import import { ArcballControls } from 'three/addons/controls/ArcballControls.js';
78
111
  */
79
112
  class ArcballControls extends Controls {
80
113
 
114
+ /**
115
+ * Constructs a new controls instance.
116
+ *
117
+ * @param {Camera} camera - The camera to be controlled. The camera must not be a child of another object, unless that object is the scene itself.
118
+ * @param {?HTMLElement} [domElement=null] - The HTML element used for event listeners.
119
+ * @param {?Scene} [scene=null] The scene rendered by the camera. If not given, gizmos cannot be shown.
120
+ */
81
121
  constructor( camera, domElement = null, scene = null ) {
82
122
 
83
123
  super( camera, domElement );
84
124
 
125
+ /**
126
+ * The scene rendered by the camera. If not given, gizmos cannot be shown.
127
+ *
128
+ * @type {?Scene}
129
+ * @default null
130
+ */
85
131
  this.scene = scene;
132
+
133
+ /**
134
+ * The control's focus point.
135
+ *
136
+ * @type {Vector3}
137
+ */
86
138
  this.target = new Vector3();
87
139
  this._currentTarget = new Vector3();
140
+
141
+ /**
142
+ * The size of the gizmo relative to the screen width and height.
143
+ *
144
+ * @type {number}
145
+ * @default 0.67
146
+ */
88
147
  this.radiusFactor = 0.67;
89
148
 
149
+ /**
150
+ * Holds the mouse actions of this controls. This property is maintained by the methods
151
+ * `setMouseAction()` and `unsetMouseAction()`.
152
+ *
153
+ * @type {Array<Object>}
154
+ */
90
155
  this.mouseActions = [];
91
156
  this._mouseOp = null;
92
157
 
@@ -131,6 +196,7 @@ class ArcballControls extends Controls {
131
196
  this._farPos0 = 0;
132
197
  this._cameraMatrixState0 = new Matrix4();
133
198
  this._gizmoMatrixState0 = new Matrix4();
199
+ this._target0 = new Vector3();
134
200
 
135
201
  //pointers array
136
202
  this._button = - 1;
@@ -174,8 +240,13 @@ class ArcballControls extends Controls {
174
240
  this._timeStart = - 1; //initial time
175
241
  this._animationId = - 1;
176
242
 
177
- //focus animation
178
- this.focusAnimationTime = 500; //duration of focus animation in ms
243
+ /**
244
+ * Duration of focus animations in ms.
245
+ *
246
+ * @type {number}
247
+ * @default 500
248
+ */
249
+ this.focusAnimationTime = 500;
179
250
 
180
251
  //rotate animation
181
252
  this._timePrev = 0; //time at which previous rotate operation has been detected
@@ -187,27 +258,161 @@ class ArcballControls extends Controls {
187
258
  this._wPrev = 0; //angular velocity of the previous rotate operation
188
259
  this._wCurr = 0; //angular velocity of the current rotate operation
189
260
 
190
-
191
261
  //parameters
262
+
263
+ /**
264
+ * If set to `true`, the camera's near and far values will be adjusted every time zoom is
265
+ * performed trying to maintain the same visible portion given by initial near and far
266
+ * values. Only works with perspective cameras.
267
+ *
268
+ * @type {boolean}
269
+ * @default false
270
+ */
192
271
  this.adjustNearFar = false;
193
- this.scaleFactor = 1.1; //zoom/distance multiplier
272
+
273
+ /**
274
+ * The scaling factor used when performing zoom operation.
275
+ *
276
+ * @type {number}
277
+ * @default 1.1
278
+ */
279
+ this.scaleFactor = 1.1;
280
+
281
+ /**
282
+ * The damping inertia used if 'enableAnimations` is set to `true`.
283
+ *
284
+ * @type {number}
285
+ * @default 25
286
+ */
194
287
  this.dampingFactor = 25;
195
- this.wMax = 20; //maximum angular velocity allowed
196
- this.enableAnimations = true; //if animations should be performed
197
- this.enableGrid = false; //if grid should be showed during pan operation
198
- this.cursorZoom = false; //if wheel zoom should be cursor centered
288
+
289
+ /**
290
+ * Maximum angular velocity allowed on rotation animation start.
291
+ *
292
+ * @type {number}
293
+ * @default 20
294
+ */
295
+ this.wMax = 20;
296
+
297
+ /**
298
+ * Set to `true` to enable animations for rotation (damping) and focus operation.
299
+ *
300
+ * @type {boolean}
301
+ * @default true
302
+ */
303
+ this.enableAnimations = true;
304
+
305
+ /**
306
+ * If set to `true`, a grid will appear when panning operation is being performed
307
+ * (desktop interaction only).
308
+ *
309
+ * @type {boolean}
310
+ * @default false
311
+ */
312
+ this.enableGrid = false;
313
+
314
+ /**
315
+ * Set to `true` to make zoom become cursor centered.
316
+ *
317
+ * @type {boolean}
318
+ * @default false
319
+ */
320
+ this.cursorZoom = false;
321
+
322
+ /**
323
+ * The minimum FOV in degrees.
324
+ *
325
+ * @type {number}
326
+ * @default 5
327
+ */
199
328
  this.minFov = 5;
329
+
330
+ /**
331
+ * The maximum FOV in degrees.
332
+ *
333
+ * @type {number}
334
+ * @default 90
335
+ */
200
336
  this.maxFov = 90;
337
+
338
+ /**
339
+ * Speed of rotation.
340
+ *
341
+ * @type {number}
342
+ * @default 1
343
+ */
201
344
  this.rotateSpeed = 1;
202
345
 
346
+ /**
347
+ * Enable or disable camera panning.
348
+ *
349
+ * @type {boolean}
350
+ * @default true
351
+ */
203
352
  this.enablePan = true;
353
+
354
+ /**
355
+ * Enable or disable camera rotation.
356
+ *
357
+ * @type {boolean}
358
+ * @default true
359
+ */
204
360
  this.enableRotate = true;
361
+
362
+ /**
363
+ * Enable or disable camera zoom.
364
+ *
365
+ * @type {boolean}
366
+ * @default true
367
+ */
205
368
  this.enableZoom = true;
369
+
370
+ /**
371
+ * Enable or disable gizmos.
372
+ *
373
+ * @type {boolean}
374
+ * @default true
375
+ */
206
376
  this.enableGizmos = true;
207
377
 
378
+ /**
379
+ * Enable or disable camera focusing on double-tap (or click) operations.
380
+ *
381
+ * @type {boolean}
382
+ * @default true
383
+ */
384
+ this.enableFocus = true;
385
+
386
+ /**
387
+ * How far you can dolly in. For perspective cameras only.
388
+ *
389
+ * @type {number}
390
+ * @default 0
391
+ */
208
392
  this.minDistance = 0;
393
+
394
+ /**
395
+ * How far you can dolly out. For perspective cameras only.
396
+ *
397
+ * @type {number}
398
+ * @default Infinity
399
+ */
209
400
  this.maxDistance = Infinity;
401
+
402
+ /**
403
+ * How far you can zoom in. For orthographic cameras only.
404
+ *
405
+ * @type {number}
406
+ * @default 0
407
+ */
210
408
  this.minZoom = 0;
409
+
410
+ /**
411
+ * How far you can zoom out. For orthographic cameras only.
412
+ *
413
+ * @type {number}
414
+ * @default Infinity
415
+ */
211
416
  this.maxZoom = Infinity;
212
417
 
213
418
  //trackball parameters
@@ -238,19 +443,21 @@ class ArcballControls extends Controls {
238
443
 
239
444
  if ( domElement !== null ) {
240
445
 
241
- this.connect();
446
+ this.connect( domElement );
242
447
 
243
448
  }
244
449
 
245
450
  }
246
451
 
247
- connect() {
452
+ connect( element ) {
453
+
454
+ super.connect( element );
248
455
 
249
456
  this.domElement.style.touchAction = 'none';
250
457
  this._devPxRatio = window.devicePixelRatio;
251
458
 
252
459
  this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
253
- this.domElement.addEventListener( 'wheel', this._onWheel );
460
+ this.domElement.addEventListener( 'wheel', this._onWheel, { passive: false } );
254
461
  this.domElement.addEventListener( 'pointerdown', this._onPointerDown );
255
462
  this.domElement.addEventListener( 'pointercancel', this._onPointerCancel );
256
463
 
@@ -697,7 +904,7 @@ class ArcballControls extends Controls {
697
904
 
698
905
  onDoubleTap( event ) {
699
906
 
700
- if ( this.enabled && this.enablePan && this.scene != null ) {
907
+ if ( this.enabled && this.enablePan && this.enableFocus && this.scene != null ) {
701
908
 
702
909
  this.dispatchEvent( _startEvent );
703
910
 
@@ -1039,9 +1246,11 @@ class ArcballControls extends Controls {
1039
1246
  }
1040
1247
 
1041
1248
  /**
1042
- * Set _center's x/y coordinates
1043
- * @param {Number} clientX
1044
- * @param {Number} clientY
1249
+ * Set _center's x/y coordinates.
1250
+ *
1251
+ * @private
1252
+ * @param {number} clientX - The x coordinate.
1253
+ * @param {number} clientY - The y coordinate.
1045
1254
  */
1046
1255
  setCenter( clientX, clientY ) {
1047
1256
 
@@ -1051,7 +1260,9 @@ class ArcballControls extends Controls {
1051
1260
  }
1052
1261
 
1053
1262
  /**
1054
- * Set default mouse actions
1263
+ * Set default mouse actions.
1264
+ *
1265
+ * @private
1055
1266
  */
1056
1267
  initializeMouseActions() {
1057
1268
 
@@ -1070,10 +1281,12 @@ class ArcballControls extends Controls {
1070
1281
  }
1071
1282
 
1072
1283
  /**
1073
- * Compare two mouse actions
1074
- * @param {Object} action1
1075
- * @param {Object} action2
1076
- * @returns {Boolean} True if action1 and action 2 are the same mouse action, false otherwise
1284
+ * Compare two mouse actions.
1285
+ *
1286
+ * @private
1287
+ * @param {Object} action1 - The first mouse action.
1288
+ * @param {Object} action2 - The second mouse action.
1289
+ * @returns {boolean} `true` if action1 and action 2 are the same mouse action, `false` otherwise.
1077
1290
  */
1078
1291
  compareMouseAction( action1, action2 ) {
1079
1292
 
@@ -1098,11 +1311,12 @@ class ArcballControls extends Controls {
1098
1311
  }
1099
1312
 
1100
1313
  /**
1101
- * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one
1102
- * @param {String} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV)
1103
- * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
1104
- * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
1105
- * @returns {Boolean} True if the mouse action has been successfully added, false otherwise
1314
+ * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one.
1315
+ *
1316
+ * @param {'PAN'|'ROTATE'|'ZOOM'|'FOV'} operation - The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV').
1317
+ * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches.
1318
+ * @param {?('CTRL'|'SHIFT')} [key=null] - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
1319
+ * @returns {boolean} `true` if the mouse action has been successfully added, `false` otherwise.
1106
1320
  */
1107
1321
  setMouseAction( operation, mouse, key = null ) {
1108
1322
 
@@ -1179,10 +1393,11 @@ class ArcballControls extends Controls {
1179
1393
  }
1180
1394
 
1181
1395
  /**
1182
- * Remove a mouse action by specifying its mouse/key combination
1183
- * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
1184
- * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
1185
- * @returns {Boolean} True if the operation has been succesfully removed, false otherwise
1396
+ * Remove a mouse action by specifying its mouse/key combination.
1397
+ *
1398
+ * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches.
1399
+ * @param {?('CTRL'|'SHIFT')} key - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
1400
+ * @returns {boolean} `true` if the operation has been successfully removed, `false` otherwise.
1186
1401
  */
1187
1402
  unsetMouseAction( mouse, key = null ) {
1188
1403
 
@@ -1202,10 +1417,12 @@ class ArcballControls extends Controls {
1202
1417
  }
1203
1418
 
1204
1419
  /**
1205
- * Return the operation associated to a mouse/keyboard combination
1206
- * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
1207
- * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
1208
- * @returns The operation if it has been found, null otherwise
1420
+ * Return the operation associated to a mouse/keyboard combination.
1421
+ *
1422
+ * @private
1423
+ * @param {0|1|2|'WHEEL'} mouse - Mouse button index (0, 1, 2) or 'WHEEL' for wheel notches.
1424
+ * @param {?('CTRL'|'SHIFT')} key - Keyboard modifier.
1425
+ * @returns {?('PAN'|'ROTATE'|'ZOOM'|'FOV')} The operation if it has been found, `null` otherwise.
1209
1426
  */
1210
1427
  getOpFromAction( mouse, key ) {
1211
1428
 
@@ -1242,10 +1459,12 @@ class ArcballControls extends Controls {
1242
1459
  }
1243
1460
 
1244
1461
  /**
1245
- * Get the operation associated to mouse and key combination and returns the corresponding FSA state
1246
- * @param {Number} mouse Mouse button
1247
- * @param {String} key Keyboard modifier
1248
- * @returns The FSA state obtained from the operation associated to mouse/keyboard combination
1462
+ * Get the operation associated to mouse and key combination and returns the corresponding FSA state.
1463
+ *
1464
+ * @private
1465
+ * @param {0|1|2} mouse - Mouse button index (0, 1, 2)
1466
+ * @param {?('CTRL'|'SHIFT')} key - Keyboard modifier
1467
+ * @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination.
1249
1468
  */
1250
1469
  getOpStateFromAction( mouse, key ) {
1251
1470
 
@@ -1282,10 +1501,12 @@ class ArcballControls extends Controls {
1282
1501
  }
1283
1502
 
1284
1503
  /**
1285
- * Calculate the angle between two pointers
1286
- * @param {PointerEvent} p1
1287
- * @param {PointerEvent} p2
1288
- * @returns {Number} The angle between two pointers in degrees
1504
+ * Calculate the angle between two pointers.
1505
+ *
1506
+ * @private
1507
+ * @param {PointerEvent} p1 - The first pointer event.
1508
+ * @param {PointerEvent} p2 - The second pointer event.
1509
+ * @returns {number} The angle between two pointers in degrees.
1289
1510
  */
1290
1511
  getAngle( p1, p2 ) {
1291
1512
 
@@ -1294,8 +1515,10 @@ class ArcballControls extends Controls {
1294
1515
  }
1295
1516
 
1296
1517
  /**
1297
- * Update a PointerEvent inside current pointerevents array
1298
- * @param {PointerEvent} event
1518
+ * Updates a PointerEvent inside current pointerevents array.
1519
+ *
1520
+ * @private
1521
+ * @param {PointerEvent} event - The pointer event.
1299
1522
  */
1300
1523
  updateTouchEvent( event ) {
1301
1524
 
@@ -1313,8 +1536,10 @@ class ArcballControls extends Controls {
1313
1536
  }
1314
1537
 
1315
1538
  /**
1316
- * Apply a transformation matrix, to the camera and gizmos
1317
- * @param {Object} transformation Object containing matrices to apply to camera and gizmos
1539
+ * Applies a transformation matrix, to the camera and gizmos.
1540
+ *
1541
+ * @private
1542
+ * @param {Object} transformation - Object containing matrices to apply to camera and gizmos.
1318
1543
  */
1319
1544
  applyTransformMatrix( transformation ) {
1320
1545
 
@@ -1400,11 +1625,14 @@ class ArcballControls extends Controls {
1400
1625
  }
1401
1626
 
1402
1627
  /**
1403
- * Calculate the angular speed
1404
- * @param {Number} p0 Position at t0
1405
- * @param {Number} p1 Position at t1
1406
- * @param {Number} t0 Initial time in milliseconds
1407
- * @param {Number} t1 Ending time in milliseconds
1628
+ * Calculates the angular speed.
1629
+ *
1630
+ * @private
1631
+ * @param {number} p0 - Position at t0.
1632
+ * @param {number} p1 - Position at t1.
1633
+ * @param {number} t0 - Initial time in milliseconds.
1634
+ * @param {number} t1 - Ending time in milliseconds.
1635
+ * @returns {number} The angular speed.
1408
1636
  */
1409
1637
  calculateAngularSpeed( p0, p1, t0, t1 ) {
1410
1638
 
@@ -1421,10 +1649,12 @@ class ArcballControls extends Controls {
1421
1649
  }
1422
1650
 
1423
1651
  /**
1424
- * Calculate the distance between two pointers
1425
- * @param {PointerEvent} p0 The first pointer
1426
- * @param {PointerEvent} p1 The second pointer
1427
- * @returns {number} The distance between the two pointers
1652
+ * Calculates the distance between two pointers.
1653
+ *
1654
+ * @private
1655
+ * @param {PointerEvent} p0 - The first pointer.
1656
+ * @param {PointerEvent} p1 - The second pointer.
1657
+ * @returns {number} The distance between the two pointers.
1428
1658
  */
1429
1659
  calculatePointersDistance( p0, p1 ) {
1430
1660
 
@@ -1433,10 +1663,12 @@ class ArcballControls extends Controls {
1433
1663
  }
1434
1664
 
1435
1665
  /**
1436
- * Calculate the rotation axis as the vector perpendicular between two vectors
1437
- * @param {Vector3} vec1 The first vector
1438
- * @param {Vector3} vec2 The second vector
1439
- * @returns {Vector3} The normalized rotation axis
1666
+ * Calculates the rotation axis as the vector perpendicular between two vectors.
1667
+ *
1668
+ * @private
1669
+ * @param {Vector3} vec1 - The first vector.
1670
+ * @param {Vector3} vec2 - The second vector.
1671
+ * @returns {Vector3} The normalized rotation axis.
1440
1672
  */
1441
1673
  calculateRotationAxis( vec1, vec2 ) {
1442
1674
 
@@ -1449,9 +1681,11 @@ class ArcballControls extends Controls {
1449
1681
  }
1450
1682
 
1451
1683
  /**
1452
- * Calculate the trackball radius so that gizmo's diamater will be 2/3 of the minimum side of the camera frustum
1453
- * @param {Camera} camera
1454
- * @returns {Number} The trackball radius
1684
+ * Calculates the trackball radius so that gizmo's diameter will be 2/3 of the minimum side of the camera frustum.
1685
+ *
1686
+ * @private
1687
+ * @param {Camera} camera - The camera.
1688
+ * @returns {number} The trackball radius.
1455
1689
  */
1456
1690
  calculateTbRadius( camera ) {
1457
1691
 
@@ -1472,10 +1706,12 @@ class ArcballControls extends Controls {
1472
1706
  }
1473
1707
 
1474
1708
  /**
1475
- * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in
1476
- * @param {Vector3} point The point of interest
1477
- * @param {Number} size Scale factor
1478
- * @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation)
1709
+ * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in.
1710
+ *
1711
+ * @private
1712
+ * @param {Vector3} point - The point of interest.
1713
+ * @param {number} size - Scale factor.
1714
+ * @param {number} [amount=1] - Amount of operation to be completed (used for focus animations, default is complete full operation).
1479
1715
  */
1480
1716
  focus( point, size, amount = 1 ) {
1481
1717
 
@@ -1504,7 +1740,9 @@ class ArcballControls extends Controls {
1504
1740
  }
1505
1741
 
1506
1742
  /**
1507
- * Draw a grid and add it to the scene
1743
+ * Creates a grid if necessary and adds it to the scene.
1744
+ *
1745
+ * @private
1508
1746
  */
1509
1747
  drawGrid() {
1510
1748
 
@@ -1555,9 +1793,6 @@ class ArcballControls extends Controls {
1555
1793
 
1556
1794
  }
1557
1795
 
1558
- /**
1559
- * Remove all listeners, stop animations and clean scene
1560
- */
1561
1796
  dispose() {
1562
1797
 
1563
1798
  if ( this._animationId != - 1 ) {
@@ -1574,7 +1809,7 @@ class ArcballControls extends Controls {
1574
1809
  }
1575
1810
 
1576
1811
  /**
1577
- * remove the grid from the scene
1812
+ * Removes the grid from the scene.
1578
1813
  */
1579
1814
  disposeGrid() {
1580
1815
 
@@ -1588,9 +1823,11 @@ class ArcballControls extends Controls {
1588
1823
  }
1589
1824
 
1590
1825
  /**
1591
- * Compute the easing out cubic function for ease out effect in animation
1592
- * @param {Number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation)
1593
- * @returns {Number} Result of easing out cubic at time t
1826
+ * Computes the easing out cubic function for ease out effect in animation.
1827
+ *
1828
+ * @private
1829
+ * @param {number} t - The absolute progress of the animation in the bound of `0` (beginning of the) and `1` (ending of animation).
1830
+ * @returns {number} Result of easing out cubic at time `t`.
1594
1831
  */
1595
1832
  easeOutCubic( t ) {
1596
1833
 
@@ -1599,8 +1836,9 @@ class ArcballControls extends Controls {
1599
1836
  }
1600
1837
 
1601
1838
  /**
1602
- * Make rotation gizmos more or less visible
1603
- * @param {Boolean} isActive If true, make gizmos more visible
1839
+ * Makes rotation gizmos more or less visible.
1840
+ *
1841
+ * @param {boolean} isActive - If set to `true`, gizmos are more visible.
1604
1842
  */
1605
1843
  activateGizmos( isActive ) {
1606
1844
 
@@ -1625,11 +1863,13 @@ class ArcballControls extends Controls {
1625
1863
  }
1626
1864
 
1627
1865
  /**
1628
- * Calculate the cursor position in NDC
1629
- * @param {number} x Cursor horizontal coordinate within the canvas
1630
- * @param {number} y Cursor vertical coordinate within the canvas
1631
- * @param {HTMLElement} canvas The canvas where the renderer draws its output
1632
- * @returns {Vector2} Cursor normalized position inside the canvas
1866
+ * Calculates the cursor position in NDC.
1867
+ *
1868
+ * @private
1869
+ * @param {number} cursorX - Cursor horizontal coordinate within the canvas.
1870
+ * @param {number} cursorY - Cursor vertical coordinate within the canvas.
1871
+ * @param {HTMLElement} canvas - The canvas where the renderer draws its output.
1872
+ * @returns {Vector2} Cursor normalized position inside the canvas.
1633
1873
  */
1634
1874
  getCursorNDC( cursorX, cursorY, canvas ) {
1635
1875
 
@@ -1641,11 +1881,13 @@ class ArcballControls extends Controls {
1641
1881
  }
1642
1882
 
1643
1883
  /**
1644
- * Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas
1645
- * @param {Number} x Cursor horizontal coordinate within the canvas
1646
- * @param {Number} y Cursor vertical coordinate within the canvas
1647
- * @param {HTMLElement} canvas The canvas where the renderer draws its output
1648
- * @returns {Vector2} Cursor position inside the canvas
1884
+ * Calculates the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas.
1885
+ *
1886
+ * @private
1887
+ * @param {number} cursorX - Cursor horizontal coordinate within the canvas.
1888
+ * @param {number} cursorY - Cursor vertical coordinate within the canvas.
1889
+ * @param {HTMLElement} canvas - The canvas where the renderer draws its output.
1890
+ * @returns {Vector2} Cursor position inside the canvas.
1649
1891
  */
1650
1892
  getCursorPosition( cursorX, cursorY, canvas ) {
1651
1893
 
@@ -1657,8 +1899,9 @@ class ArcballControls extends Controls {
1657
1899
  }
1658
1900
 
1659
1901
  /**
1660
- * Set the camera to be controlled
1661
- * @param {Camera} camera The virtual camera to be controlled
1902
+ * Sets the camera to be controlled. Must be called in order to set a new camera to be controlled.
1903
+ *
1904
+ * @param {Camera} camera - The camera to be controlled.
1662
1905
  */
1663
1906
  setCamera( camera ) {
1664
1907
 
@@ -1700,8 +1943,9 @@ class ArcballControls extends Controls {
1700
1943
  }
1701
1944
 
1702
1945
  /**
1703
- * Set gizmos visibility
1704
- * @param {Boolean} value Value of gizmos visibility
1946
+ * Sets gizmos visibility.
1947
+ *
1948
+ * @param {boolean} value - Value of gizmos visibility.
1705
1949
  */
1706
1950
  setGizmosVisible( value ) {
1707
1951
 
@@ -1711,8 +1955,9 @@ class ArcballControls extends Controls {
1711
1955
  }
1712
1956
 
1713
1957
  /**
1714
- * Set gizmos radius factor and redraws gizmos
1715
- * @param {Float} value Value of radius factor
1958
+ * Sets gizmos radius factor and redraws gizmos.
1959
+ *
1960
+ * @param {number} value - Value of radius factor.
1716
1961
  */
1717
1962
  setTbRadius( value ) {
1718
1963
 
@@ -1735,9 +1980,11 @@ class ArcballControls extends Controls {
1735
1980
  }
1736
1981
 
1737
1982
  /**
1738
- * Creates the rotation gizmos matching trackball center and radius
1739
- * @param {Vector3} tbCenter The trackball center
1740
- * @param {number} tbRadius The trackball radius
1983
+ * Creates the rotation gizmos matching trackball center and radius.
1984
+ *
1985
+ * @private
1986
+ * @param {Vector3} tbCenter - The trackball center.
1987
+ * @param {number} tbRadius - The trackball radius.
1741
1988
  */
1742
1989
  makeGizmos( tbCenter, tbRadius ) {
1743
1990
 
@@ -1805,11 +2052,13 @@ class ArcballControls extends Controls {
1805
2052
  }
1806
2053
 
1807
2054
  /**
1808
- * Perform animation for focus operation
1809
- * @param {Number} time Instant in which this function is called as performance.now()
1810
- * @param {Vector3} point Point of interest for focus operation
1811
- * @param {Matrix4} cameraMatrix Camera matrix
1812
- * @param {Matrix4} gizmoMatrix Gizmos matrix
2055
+ * Performs animation for focus operation.
2056
+ *
2057
+ * @private
2058
+ * @param {number} time - Instant in which this function is called as performance.now().
2059
+ * @param {Vector3} point - Point of interest for focus operation.
2060
+ * @param {Matrix4} cameraMatrix - Camera matrix.
2061
+ * @param {Matrix4} gizmoMatrix - Gizmos matrix.
1813
2062
  */
1814
2063
  onFocusAnim( time, point, cameraMatrix, gizmoMatrix ) {
1815
2064
 
@@ -1871,10 +2120,12 @@ class ArcballControls extends Controls {
1871
2120
  }
1872
2121
 
1873
2122
  /**
1874
- * Perform animation for rotation operation
1875
- * @param {Number} time Instant in which this function is called as performance.now()
1876
- * @param {Vector3} rotationAxis Rotation axis
1877
- * @param {number} w0 Initial angular velocity
2123
+ * Performs animation for rotation operation.
2124
+ *
2125
+ * @private
2126
+ * @param {number} time - Instant in which this function is called as performance.now().
2127
+ * @param {Vector3} rotationAxis - Rotation axis.
2128
+ * @param {number} w0 - Initial angular velocity.
1878
2129
  */
1879
2130
  onRotationAnim( time, rotationAxis, w0 ) {
1880
2131
 
@@ -1938,10 +2189,13 @@ class ArcballControls extends Controls {
1938
2189
 
1939
2190
 
1940
2191
  /**
1941
- * Perform pan operation moving camera between two points
1942
- * @param {Vector3} p0 Initial point
1943
- * @param {Vector3} p1 Ending point
1944
- * @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)
2192
+ * Performs pan operation moving camera between two points.
2193
+ *
2194
+ * @private
2195
+ * @param {Vector3} p0 - Initial point.
2196
+ * @param {Vector3} p1 - Ending point.
2197
+ * @param {boolean} [adjust=false] - If movement should be adjusted considering camera distance (Perspective only).
2198
+ * @returns {Object}
1945
2199
  */
1946
2200
  pan( p0, p1, adjust = false ) {
1947
2201
 
@@ -1972,10 +2226,11 @@ class ArcballControls extends Controls {
1972
2226
  }
1973
2227
 
1974
2228
  /**
1975
- * Reset trackball
2229
+ * Resets the controls.
1976
2230
  */
1977
2231
  reset() {
1978
2232
 
2233
+ this.target.copy( this._target0 );
1979
2234
  this.object.zoom = this._zoom0;
1980
2235
 
1981
2236
  if ( this.object.isPerspectiveCamera ) {
@@ -2009,10 +2264,12 @@ class ArcballControls extends Controls {
2009
2264
  }
2010
2265
 
2011
2266
  /**
2012
- * Rotate the camera around an axis passing by trackball's center
2013
- * @param {Vector3} axis Rotation axis
2014
- * @param {number} angle Angle in radians
2015
- * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera
2267
+ * Rotates the camera around an axis passing by trackball's center.
2268
+ *
2269
+ * @private
2270
+ * @param {Vector3} axis - Rotation axis.
2271
+ * @param {number} angle - Angle in radians.
2272
+ * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera.
2016
2273
  */
2017
2274
  rotate( axis, angle ) {
2018
2275
 
@@ -2031,34 +2288,42 @@ class ArcballControls extends Controls {
2031
2288
 
2032
2289
  }
2033
2290
 
2291
+ /**
2292
+ * Copy the current state to clipboard (as a readable JSON text).
2293
+ */
2034
2294
  copyState() {
2035
2295
 
2036
2296
  let state;
2037
2297
  if ( this.object.isOrthographicCamera ) {
2038
2298
 
2039
- state = JSON.stringify( { arcballState: {
2040
-
2041
- cameraFar: this.object.far,
2042
- cameraMatrix: this.object.matrix,
2043
- cameraNear: this.object.near,
2044
- cameraUp: this.object.up,
2045
- cameraZoom: this.object.zoom,
2046
- gizmoMatrix: this._gizmos.matrix
2299
+ state = JSON.stringify( {
2300
+ arcballState: {
2301
+ cameraFar: this.object.far,
2302
+ cameraMatrix: this.object.matrix,
2303
+ cameraNear: this.object.near,
2304
+ cameraUp: this.object.up,
2305
+ cameraZoom: this.object.zoom,
2306
+ gizmoMatrix: this._gizmos.matrix,
2307
+ target: this.target
2047
2308
 
2048
- } } );
2309
+ }
2310
+ } );
2049
2311
 
2050
2312
  } else if ( this.object.isPerspectiveCamera ) {
2051
2313
 
2052
- state = JSON.stringify( { arcballState: {
2053
- cameraFar: this.object.far,
2054
- cameraFov: this.object.fov,
2055
- cameraMatrix: this.object.matrix,
2056
- cameraNear: this.object.near,
2057
- cameraUp: this.object.up,
2058
- cameraZoom: this.object.zoom,
2059
- gizmoMatrix: this._gizmos.matrix
2314
+ state = JSON.stringify( {
2315
+ arcballState: {
2316
+ cameraFar: this.object.far,
2317
+ cameraFov: this.object.fov,
2318
+ cameraMatrix: this.object.matrix,
2319
+ cameraNear: this.object.near,
2320
+ cameraUp: this.object.up,
2321
+ cameraZoom: this.object.zoom,
2322
+ gizmoMatrix: this._gizmos.matrix,
2323
+ target: this.target
2060
2324
 
2061
- } } );
2325
+ }
2326
+ } );
2062
2327
 
2063
2328
  }
2064
2329
 
@@ -2066,6 +2331,10 @@ class ArcballControls extends Controls {
2066
2331
 
2067
2332
  }
2068
2333
 
2334
+ /**
2335
+ * Set the controls state from the clipboard, assumes that the clipboard stores a JSON
2336
+ * text as saved from `copyState()`.
2337
+ */
2069
2338
  pasteState() {
2070
2339
 
2071
2340
  const self = this;
@@ -2078,10 +2347,14 @@ class ArcballControls extends Controls {
2078
2347
  }
2079
2348
 
2080
2349
  /**
2081
- * Save the current state of the control. This can later be recover with .reset
2350
+ * Saves the current state of the control. This can later be recover with `reset()`.
2082
2351
  */
2083
2352
  saveState() {
2084
2353
 
2354
+ this.object.updateMatrix();
2355
+ this._gizmos.updateMatrix();
2356
+
2357
+ this._target0.copy( this.target );
2085
2358
  this._cameraMatrixState0.copy( this.object.matrix );
2086
2359
  this._gizmoMatrixState0.copy( this._gizmos.matrix );
2087
2360
  this._nearPos = this.object.near;
@@ -2098,11 +2371,13 @@ class ArcballControls extends Controls {
2098
2371
  }
2099
2372
 
2100
2373
  /**
2101
- * Perform uniform scale operation around a given point
2102
- * @param {Number} size Scale factor
2103
- * @param {Vector3} point Point around which scale
2104
- * @param {Boolean} scaleGizmos If gizmos should be scaled (Perspective only)
2105
- * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos
2374
+ * Performs uniform scale operation around a given point.
2375
+ *
2376
+ * @private
2377
+ * @param {number} size - Scale factor.
2378
+ * @param {Vector3} point - Point around which scale.
2379
+ * @param {boolean} scaleGizmos - If gizmos should be scaled (Perspective only).
2380
+ * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos.
2106
2381
  */
2107
2382
  scale( size, point, scaleGizmos = true ) {
2108
2383
 
@@ -2214,8 +2489,10 @@ class ArcballControls extends Controls {
2214
2489
  }
2215
2490
 
2216
2491
  /**
2217
- * Set camera fov
2218
- * @param {Number} value fov to be setted
2492
+ * Sets camera fov.
2493
+ *
2494
+ * @private
2495
+ * @param {number} value - The FOV to be set.
2219
2496
  */
2220
2497
  setFov( value ) {
2221
2498
 
@@ -2229,11 +2506,13 @@ class ArcballControls extends Controls {
2229
2506
  }
2230
2507
 
2231
2508
  /**
2232
- * Set values in transformation object
2233
- * @param {Matrix4} camera Transformation to be applied to the camera
2234
- * @param {Matrix4} gizmos Transformation to be applied to gizmos
2509
+ * Sets values in transformation object.
2510
+ *
2511
+ * @private
2512
+ * @param {?Matrix4} [camera=null] - Transformation to be applied to the camera.
2513
+ * @param {?Matrix4} [gizmos=null] - Transformation to be applied to gizmos.
2235
2514
  */
2236
- setTransformationMatrices( camera = null, gizmos = null ) {
2515
+ setTransformationMatrices( camera = null, gizmos = null ) {
2237
2516
 
2238
2517
  if ( camera != null ) {
2239
2518
 
@@ -2274,10 +2553,12 @@ class ArcballControls extends Controls {
2274
2553
  }
2275
2554
 
2276
2555
  /**
2277
- * Rotate camera around its direction axis passing by a given point by a given angle
2278
- * @param {Vector3} point The point where the rotation axis is passing trough
2279
- * @param {Number} angle Angle in radians
2280
- * @returns The computed transormation matix
2556
+ * Rotates camera around its direction axis passing by a given point by a given angle.
2557
+ *
2558
+ * @private
2559
+ * @param {Vector3} point - The point where the rotation axis is passing trough.
2560
+ * @param {number} angle - Angle in radians.
2561
+ * @returns {Object} The computed transformation matrix.
2281
2562
  */
2282
2563
  zRotate( point, angle ) {
2283
2564
 
@@ -2299,7 +2580,12 @@ class ArcballControls extends Controls {
2299
2580
 
2300
2581
  }
2301
2582
 
2302
-
2583
+ /**
2584
+ * Returns the raycaster that is used for user interaction. This object is shared between all
2585
+ * instances of `ArcballControls`.
2586
+ *
2587
+ * @returns {Raycaster} The internal raycaster.
2588
+ */
2303
2589
  getRaycaster() {
2304
2590
 
2305
2591
  return _raycaster;
@@ -2308,10 +2594,12 @@ class ArcballControls extends Controls {
2308
2594
 
2309
2595
 
2310
2596
  /**
2311
- * Unproject the cursor on the 3D object surface
2312
- * @param {Vector2} cursor Cursor coordinates in NDC
2313
- * @param {Camera} camera Virtual camera
2314
- * @returns {Vector3} The point of intersection with the model, if exist, null otherwise
2597
+ * Unprojects the cursor on the 3D object surface.
2598
+ *
2599
+ * @private
2600
+ * @param {Vector2} cursor - Cursor coordinates in NDC.
2601
+ * @param {Camera} camera - Virtual camera.
2602
+ * @returns {?Vector3} The point of intersection with the model, if exist, null otherwise.
2315
2603
  */
2316
2604
  unprojectOnObj( cursor, camera ) {
2317
2605
 
@@ -2337,13 +2625,15 @@ class ArcballControls extends Controls {
2337
2625
  }
2338
2626
 
2339
2627
  /**
2340
- * Unproject the cursor on the trackball surface
2341
- * @param {Camera} camera The virtual camera
2342
- * @param {Number} cursorX Cursor horizontal coordinate on screen
2343
- * @param {Number} cursorY Cursor vertical coordinate on screen
2344
- * @param {HTMLElement} canvas The canvas where the renderer draws its output
2345
- * @param {number} tbRadius The trackball radius
2346
- * @returns {Vector3} The unprojected point on the trackball surface
2628
+ * Unproject the cursor on the trackball surface.
2629
+ *
2630
+ * @private
2631
+ * @param {Camera} camera - The virtual camera.
2632
+ * @param {number} cursorX - Cursor horizontal coordinate on screen.
2633
+ * @param {number} cursorY - Cursor vertical coordinate on screen.
2634
+ * @param {HTMLElement} canvas - The canvas where the renderer draws its output.
2635
+ * @param {number} tbRadius - The trackball radius.
2636
+ * @returns {Vector3} The unprojected point on the trackball surface.
2347
2637
  */
2348
2638
  unprojectOnTbSurface( camera, cursorX, cursorY, canvas, tbRadius ) {
2349
2639
 
@@ -2467,13 +2757,15 @@ class ArcballControls extends Controls {
2467
2757
 
2468
2758
 
2469
2759
  /**
2470
- * Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera
2471
- * @param {Camera} camera The virtual camera
2472
- * @param {Number} cursorX Cursor horizontal coordinate on screen
2473
- * @param {Number} cursorY Cursor vertical coordinate on screen
2474
- * @param {HTMLElement} canvas The canvas where the renderer draws its output
2475
- * @param {Boolean} initialDistance If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only)
2476
- * @returns {Vector3} The unprojected point on the trackball plane
2760
+ * Unprojects the cursor on the plane passing through the center of the trackball orthogonal to the camera.
2761
+ *
2762
+ * @private
2763
+ * @param {Camera} camera - The virtual camera.
2764
+ * @param {number} cursorX - Cursor horizontal coordinate on screen.
2765
+ * @param {number} cursorY - Cursor vertical coordinate on screen.
2766
+ * @param {HTMLElement} canvas - The canvas where the renderer draws its output.
2767
+ * @param {boolean} [initialDistance=false] - If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only).
2768
+ * @returns {Vector3} The unprojected point on the trackball plane.
2477
2769
  */
2478
2770
  unprojectOnTbPlane( camera, cursorX, cursorY, canvas, initialDistance = false ) {
2479
2771
 
@@ -2547,7 +2839,9 @@ class ArcballControls extends Controls {
2547
2839
  }
2548
2840
 
2549
2841
  /**
2550
- * Update camera and gizmos state
2842
+ * Updates camera and gizmos state.
2843
+ *
2844
+ * @private
2551
2845
  */
2552
2846
  updateMatrixState() {
2553
2847
 
@@ -2570,9 +2864,11 @@ class ArcballControls extends Controls {
2570
2864
  }
2571
2865
 
2572
2866
  /**
2573
- * Update the trackball FSA
2574
- * @param {STATE} newState New state of the FSA
2575
- * @param {Boolean} updateMatrices If matriices state should be updated
2867
+ * Updates the trackball FSA.
2868
+ *
2869
+ * @private
2870
+ * @param {STATE} newState - New state of the FSA.
2871
+ * @param {boolean} updateMatrices - If matrices state should be updated.
2576
2872
  */
2577
2873
  updateTbState( newState, updateMatrices ) {
2578
2874
 
@@ -2587,8 +2883,6 @@ class ArcballControls extends Controls {
2587
2883
 
2588
2884
  update() {
2589
2885
 
2590
- const EPS = 0.000001;
2591
-
2592
2886
  if ( this.target.equals( this._currentTarget ) === false ) {
2593
2887
 
2594
2888
  this._gizmos.position.copy( this.target ); //for correct radius calculation
@@ -2614,13 +2908,13 @@ class ArcballControls extends Controls {
2614
2908
  //check distance
2615
2909
  const distance = this.object.position.distanceTo( this._gizmos.position );
2616
2910
 
2617
- if ( distance > this.maxDistance + EPS || distance < this.minDistance - EPS ) {
2911
+ if ( distance > this.maxDistance + _EPS || distance < this.minDistance - _EPS ) {
2618
2912
 
2619
2913
  const newDistance = MathUtils.clamp( distance, this.minDistance, this.maxDistance );
2620
2914
  this.applyTransformMatrix( this.scale( newDistance / distance, this._gizmos.position ) );
2621
2915
  this.updateMatrixState();
2622
2916
 
2623
- }
2917
+ }
2624
2918
 
2625
2919
  //check fov
2626
2920
  if ( this.object.fov < this.minFov || this.object.fov > this.maxFov ) {
@@ -2633,7 +2927,7 @@ class ArcballControls extends Controls {
2633
2927
  const oldRadius = this._tbRadius;
2634
2928
  this._tbRadius = this.calculateTbRadius( this.object );
2635
2929
 
2636
- if ( oldRadius < this._tbRadius - EPS || oldRadius > this._tbRadius + EPS ) {
2930
+ if ( oldRadius < this._tbRadius - _EPS || oldRadius > this._tbRadius + _EPS ) {
2637
2931
 
2638
2932
  const scale = ( this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z ) / 3;
2639
2933
  const newRadius = this._tbRadius / scale;
@@ -2661,6 +2955,8 @@ class ArcballControls extends Controls {
2661
2955
 
2662
2956
  if ( state.arcballState != undefined ) {
2663
2957
 
2958
+ this.target.fromArray( state.arcballState.target );
2959
+
2664
2960
  this._cameraMatrixState.fromArray( state.arcballState.cameraMatrix.elements );
2665
2961
  this._cameraMatrixState.decompose( this.object.position, this.object.quaternion, this.object.scale );
2666
2962