@plastic-software/three 0.174.0 → 0.175.1

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 (567) hide show
  1. package/build/three.cjs +10744 -1476
  2. package/build/three.core.js +9633 -1096
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +918 -189
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +4 -2
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +2658 -1697
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +2654 -1709
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +1 -1
  13. package/examples/jsm/animation/AnimationClipCreator.js +57 -6
  14. package/examples/jsm/animation/CCDIKSolver.js +93 -39
  15. package/examples/jsm/capabilities/WebGL.js +28 -3
  16. package/examples/jsm/capabilities/WebGPU.js +16 -6
  17. package/examples/jsm/controls/ArcballControls.js +424 -154
  18. package/examples/jsm/controls/DragControls.js +93 -2
  19. package/examples/jsm/controls/FirstPersonControls.js +113 -4
  20. package/examples/jsm/controls/FlyControls.js +49 -2
  21. package/examples/jsm/controls/MapControls.js +42 -9
  22. package/examples/jsm/controls/OrbitControls.js +345 -42
  23. package/examples/jsm/controls/PointerLockControls.js +111 -9
  24. package/examples/jsm/controls/TrackballControls.js +159 -8
  25. package/examples/jsm/controls/TransformControls.js +252 -6
  26. package/examples/jsm/csm/CSM.js +226 -15
  27. package/examples/jsm/csm/CSMFrustum.js +52 -0
  28. package/examples/jsm/csm/CSMHelper.js +47 -0
  29. package/examples/jsm/csm/CSMShader.js +10 -1
  30. package/examples/jsm/csm/CSMShadowNode.js +156 -13
  31. package/examples/jsm/curves/CurveExtras.js +289 -31
  32. package/examples/jsm/curves/NURBSCurve.js +57 -14
  33. package/examples/jsm/curves/NURBSSurface.js +50 -6
  34. package/examples/jsm/curves/NURBSUtils.js +96 -112
  35. package/examples/jsm/curves/NURBSVolume.js +22 -4
  36. package/examples/jsm/effects/AnaglyphEffect.js +30 -0
  37. package/examples/jsm/effects/AsciiEffect.js +60 -15
  38. package/examples/jsm/effects/OutlineEffect.js +59 -111
  39. package/examples/jsm/effects/ParallaxBarrierEffect.js +28 -0
  40. package/examples/jsm/effects/PeppersGhostEffect.js +21 -2
  41. package/examples/jsm/effects/StereoEffect.js +29 -0
  42. package/examples/jsm/environments/DebugEnvironment.js +49 -0
  43. package/examples/jsm/environments/RoomEnvironment.js +23 -4
  44. package/examples/jsm/exporters/DRACOExporter.js +53 -13
  45. package/examples/jsm/exporters/EXRExporter.js +37 -8
  46. package/examples/jsm/exporters/GLTFExporter.js +171 -48
  47. package/examples/jsm/exporters/KTX2Exporter.js +20 -0
  48. package/examples/jsm/exporters/OBJExporter.js +18 -0
  49. package/examples/jsm/exporters/PLYExporter.js +39 -9
  50. package/examples/jsm/exporters/STLExporter.js +25 -5
  51. package/examples/jsm/exporters/USDZExporter.js +70 -3
  52. package/examples/jsm/geometries/BoxLineGeometry.js +22 -0
  53. package/examples/jsm/geometries/ConvexGeometry.js +18 -0
  54. package/examples/jsm/geometries/DecalGeometry.js +20 -9
  55. package/examples/jsm/geometries/ParametricFunctions.js +97 -0
  56. package/examples/jsm/geometries/ParametricGeometry.js +37 -5
  57. package/examples/jsm/geometries/RoundedBoxGeometry.js +21 -0
  58. package/examples/jsm/geometries/TeapotGeometry.js +22 -38
  59. package/examples/jsm/geometries/TextGeometry.js +44 -16
  60. package/examples/jsm/helpers/LightProbeHelper.js +35 -0
  61. package/examples/jsm/helpers/LightProbeHelperGPU.js +36 -0
  62. package/examples/jsm/helpers/OctreeHelper.js +35 -0
  63. package/examples/jsm/helpers/PositionalAudioHelper.js +59 -0
  64. package/examples/jsm/helpers/RectAreaLightHelper.js +35 -3
  65. package/examples/jsm/helpers/TextureHelper.js +27 -0
  66. package/examples/jsm/helpers/TextureHelperGPU.js +28 -0
  67. package/examples/jsm/helpers/VertexNormalsHelper.js +58 -2
  68. package/examples/jsm/helpers/VertexTangentsHelper.js +46 -2
  69. package/examples/jsm/helpers/ViewHelper.js +75 -1
  70. package/examples/jsm/interactive/HTMLMesh.js +25 -0
  71. package/examples/jsm/interactive/InteractiveGroup.js +65 -5
  72. package/examples/jsm/interactive/SelectionBox.js +74 -9
  73. package/examples/jsm/interactive/SelectionHelper.js +71 -29
  74. package/examples/jsm/libs/motion-controllers.module.js +1 -1
  75. package/examples/jsm/lighting/TiledLighting.js +23 -0
  76. package/examples/jsm/lights/LightProbeGenerator.js +26 -1
  77. package/examples/jsm/lights/RectAreaLightTexturesLib.js +48 -13
  78. package/examples/jsm/lights/RectAreaLightUniformsLib.js +15 -0
  79. package/examples/jsm/lines/Line2.js +36 -0
  80. package/examples/jsm/lines/LineGeometry.js +52 -0
  81. package/examples/jsm/lines/LineMaterial.js +95 -0
  82. package/examples/jsm/lines/LineSegments2.js +51 -2
  83. package/examples/jsm/lines/LineSegmentsGeometry.js +62 -8
  84. package/examples/jsm/lines/Wireframe.js +38 -2
  85. package/examples/jsm/lines/WireframeGeometry2.js +24 -0
  86. package/examples/jsm/lines/webgpu/Line2.js +25 -1
  87. package/examples/jsm/lines/webgpu/LineSegments2.js +44 -6
  88. package/examples/jsm/lines/webgpu/Wireframe.js +30 -2
  89. package/examples/jsm/loaders/3DMLoader.js +71 -2
  90. package/examples/jsm/loaders/3MFLoader.js +41 -3
  91. package/examples/jsm/loaders/AMFLoader.js +31 -12
  92. package/examples/jsm/loaders/BVHLoader.js +57 -11
  93. package/examples/jsm/loaders/ColladaLoader.js +35 -0
  94. package/examples/jsm/loaders/DDSLoader.js +24 -0
  95. package/examples/jsm/loaders/DRACOLoader.js +73 -1
  96. package/examples/jsm/loaders/EXRLoader.js +40 -8
  97. package/examples/jsm/loaders/FBXLoader.js +42 -14
  98. package/examples/jsm/loaders/FontLoader.js +60 -2
  99. package/examples/jsm/loaders/GCodeLoader.js +33 -5
  100. package/examples/jsm/loaders/GLTFLoader.js +218 -5
  101. package/examples/jsm/loaders/HDRCubeTextureLoader.js +48 -0
  102. package/examples/jsm/loaders/IESLoader.js +41 -0
  103. package/examples/jsm/loaders/KMZLoader.js +32 -0
  104. package/examples/jsm/loaders/KTX2Loader.js +86 -18
  105. package/examples/jsm/loaders/KTXLoader.js +26 -6
  106. package/examples/jsm/loaders/LDrawLoader.js +115 -5
  107. package/examples/jsm/loaders/LUT3dlLoader.js +46 -10
  108. package/examples/jsm/loaders/LUTCubeLoader.js +45 -9
  109. package/examples/jsm/loaders/LUTImageLoader.js +78 -38
  110. package/examples/jsm/loaders/LWOLoader.js +46 -7
  111. package/examples/jsm/loaders/LottieLoader.js +37 -0
  112. package/examples/jsm/loaders/MD2Loader.js +36 -1
  113. package/examples/jsm/loaders/MDDLoader.js +56 -12
  114. package/examples/jsm/loaders/MTLLoader.js +38 -33
  115. package/examples/jsm/loaders/MaterialXLoader.js +33 -0
  116. package/examples/jsm/loaders/NRRDLoader.js +36 -5
  117. package/examples/jsm/loaders/OBJLoader.js +48 -1
  118. package/examples/jsm/loaders/PCDLoader.js +47 -0
  119. package/examples/jsm/loaders/PDBLoader.js +40 -2
  120. package/examples/jsm/loaders/PLYLoader.js +62 -32
  121. package/examples/jsm/loaders/PVRLoader.js +23 -5
  122. package/examples/jsm/loaders/RGBELoader.js +38 -5
  123. package/examples/jsm/loaders/RGBMLoader.js +67 -1
  124. package/examples/jsm/loaders/STLLoader.js +47 -38
  125. package/examples/jsm/loaders/SVGLoader.js +113 -20
  126. package/examples/jsm/loaders/TDSLoader.js +81 -61
  127. package/examples/jsm/loaders/TGALoader.js +22 -0
  128. package/examples/jsm/loaders/TIFFLoader.js +22 -0
  129. package/examples/jsm/loaders/TTFLoader.js +36 -2
  130. package/examples/jsm/loaders/USDZLoader.js +34 -1
  131. package/examples/jsm/loaders/UltraHDRLoader.js +58 -12
  132. package/examples/jsm/loaders/VOXLoader.js +57 -0
  133. package/examples/jsm/loaders/VRMLLoader.js +32 -1
  134. package/examples/jsm/loaders/VTKLoader.js +38 -0
  135. package/examples/jsm/loaders/XYZLoader.js +35 -0
  136. package/examples/jsm/materials/LDrawConditionalLineMaterial.js +39 -0
  137. package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +39 -0
  138. package/examples/jsm/materials/MeshPostProcessingMaterial.js +24 -2
  139. package/examples/jsm/math/Capsule.js +89 -14
  140. package/examples/jsm/math/ColorConverter.js +21 -0
  141. package/examples/jsm/math/ColorSpaces.js +53 -0
  142. package/examples/jsm/math/ConvexHull.js +514 -92
  143. package/examples/jsm/math/ImprovedNoise.js +14 -2
  144. package/examples/jsm/math/Lut.js +111 -0
  145. package/examples/jsm/math/MeshSurfaceSampler.js +76 -13
  146. package/examples/jsm/math/OBB.js +139 -46
  147. package/examples/jsm/math/Octree.js +132 -5
  148. package/examples/jsm/math/SimplexNoise.js +66 -42
  149. package/examples/jsm/misc/ConvexObjectBreaker.js +43 -25
  150. package/examples/jsm/misc/GPUComputationRenderer.js +92 -17
  151. package/examples/jsm/misc/Gyroscope.js +11 -0
  152. package/examples/jsm/misc/MD2Character.js +115 -2
  153. package/examples/jsm/misc/MD2CharacterComplex.js +170 -8
  154. package/examples/jsm/misc/MorphAnimMesh.js +43 -0
  155. package/examples/jsm/misc/MorphBlendMesh.js +102 -0
  156. package/examples/jsm/misc/ProgressiveLightMap.js +40 -15
  157. package/examples/jsm/misc/ProgressiveLightMapGPU.js +33 -13
  158. package/examples/jsm/misc/RollerCoaster.js +52 -0
  159. package/examples/jsm/misc/Timer.js +79 -2
  160. package/examples/jsm/misc/TubePainter.js +53 -0
  161. package/examples/jsm/misc/Volume.js +108 -72
  162. package/examples/jsm/misc/VolumeSlice.js +88 -45
  163. package/examples/jsm/modifiers/CurveModifier.js +57 -34
  164. package/examples/jsm/modifiers/CurveModifierGPU.js +36 -17
  165. package/examples/jsm/modifiers/EdgeSplitModifier.js +18 -0
  166. package/examples/jsm/modifiers/SimplifyModifier.js +20 -8
  167. package/examples/jsm/modifiers/TessellateModifier.js +33 -2
  168. package/examples/jsm/objects/GroundedSkybox.js +23 -5
  169. package/examples/jsm/objects/Lensflare.js +91 -2
  170. package/examples/jsm/objects/LensflareMesh.js +53 -2
  171. package/examples/jsm/objects/MarchingCubes.js +88 -5
  172. package/examples/jsm/objects/Reflector.js +70 -0
  173. package/examples/jsm/objects/ReflectorForSSRPass.js +39 -0
  174. package/examples/jsm/objects/Refractor.js +61 -0
  175. package/examples/jsm/objects/ShadowMesh.js +53 -4
  176. package/examples/jsm/objects/Sky.js +26 -9
  177. package/examples/jsm/objects/SkyMesh.js +60 -9
  178. package/examples/jsm/objects/Water.js +44 -5
  179. package/examples/jsm/objects/Water2.js +42 -3
  180. package/examples/jsm/objects/Water2Mesh.js +38 -3
  181. package/examples/jsm/objects/WaterMesh.js +94 -7
  182. package/examples/jsm/physics/AmmoPhysics.js +47 -0
  183. package/examples/jsm/physics/JoltPhysics.js +48 -0
  184. package/examples/jsm/physics/RapierPhysics.js +56 -0
  185. package/examples/jsm/postprocessing/AfterimagePass.js +90 -38
  186. package/examples/jsm/postprocessing/BloomPass.js +125 -24
  187. package/examples/jsm/postprocessing/BokehPass.js +98 -22
  188. package/examples/jsm/postprocessing/ClearPass.js +53 -3
  189. package/examples/jsm/postprocessing/CubeTexturePass.js +81 -21
  190. package/examples/jsm/postprocessing/DotScreenPass.js +58 -10
  191. package/examples/jsm/postprocessing/EffectComposer.js +131 -0
  192. package/examples/jsm/postprocessing/FilmPass.js +53 -5
  193. package/examples/jsm/postprocessing/GTAOPass.js +191 -48
  194. package/examples/jsm/postprocessing/GlitchPass.js +84 -33
  195. package/examples/jsm/postprocessing/HalftonePass.js +64 -10
  196. package/examples/jsm/postprocessing/LUTPass.js +37 -8
  197. package/examples/jsm/postprocessing/MaskPass.js +90 -0
  198. package/examples/jsm/postprocessing/OutlinePass.js +266 -133
  199. package/examples/jsm/postprocessing/OutputPass.js +53 -14
  200. package/examples/jsm/postprocessing/Pass.js +98 -4
  201. package/examples/jsm/postprocessing/RenderPass.js +83 -0
  202. package/examples/jsm/postprocessing/RenderPixelatedPass.js +123 -45
  203. package/examples/jsm/postprocessing/RenderTransitionPass.js +119 -21
  204. package/examples/jsm/postprocessing/SAOPass.js +126 -53
  205. package/examples/jsm/postprocessing/SMAAPass.js +103 -71
  206. package/examples/jsm/postprocessing/SSAARenderPass.js +117 -35
  207. package/examples/jsm/postprocessing/SSAOPass.js +160 -47
  208. package/examples/jsm/postprocessing/SSRPass.js +230 -49
  209. package/examples/jsm/postprocessing/SavePass.js +68 -16
  210. package/examples/jsm/postprocessing/ShaderPass.js +64 -7
  211. package/examples/jsm/postprocessing/TAARenderPass.js +78 -24
  212. package/examples/jsm/postprocessing/TexturePass.js +71 -8
  213. package/examples/jsm/postprocessing/UnrealBloomPass.js +113 -37
  214. package/examples/jsm/renderers/CSS2DRenderer.js +77 -1
  215. package/examples/jsm/renderers/CSS3DRenderer.js +99 -3
  216. package/examples/jsm/renderers/Projector.js +18 -2
  217. package/examples/jsm/renderers/SVGRenderer.js +124 -0
  218. package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +9 -5
  219. package/examples/jsm/shaders/AfterimageShader.js +6 -4
  220. package/examples/jsm/shaders/BasicShader.js +6 -2
  221. package/examples/jsm/shaders/BleachBypassShader.js +8 -4
  222. package/examples/jsm/shaders/BlendShader.js +6 -2
  223. package/examples/jsm/shaders/BokehShader.js +7 -4
  224. package/examples/jsm/shaders/BokehShader2.js +7 -3
  225. package/examples/jsm/shaders/BrightnessContrastShader.js +8 -5
  226. package/examples/jsm/shaders/ColorCorrectionShader.js +6 -2
  227. package/examples/jsm/shaders/ColorifyShader.js +6 -2
  228. package/examples/jsm/shaders/ConvolutionShader.js +7 -39
  229. package/examples/jsm/shaders/CopyShader.js +6 -2
  230. package/examples/jsm/shaders/DOFMipMapShader.js +8 -4
  231. package/examples/jsm/shaders/DepthLimitedBlurShader.js +7 -1
  232. package/examples/jsm/shaders/DigitalGlitch.js +7 -7
  233. package/examples/jsm/shaders/DotScreenShader.js +6 -4
  234. package/examples/jsm/shaders/ExposureShader.js +6 -2
  235. package/examples/jsm/shaders/FXAAShader.js +15 -7
  236. package/examples/jsm/shaders/FilmShader.js +10 -0
  237. package/examples/jsm/shaders/FocusShader.js +6 -4
  238. package/examples/jsm/shaders/FreiChenShader.js +7 -3
  239. package/examples/jsm/shaders/GTAOShader.js +33 -39
  240. package/examples/jsm/shaders/GammaCorrectionShader.js +8 -2
  241. package/examples/jsm/shaders/GodRaysShader.js +14 -5
  242. package/examples/jsm/shaders/HalftoneShader.js +11 -5
  243. package/examples/jsm/shaders/HorizontalBlurShader.js +9 -3
  244. package/examples/jsm/shaders/HorizontalTiltShiftShader.js +6 -2
  245. package/examples/jsm/shaders/HueSaturationShader.js +7 -3
  246. package/examples/jsm/shaders/KaleidoShader.js +8 -4
  247. package/examples/jsm/shaders/LuminosityHighPassShader.js +6 -5
  248. package/examples/jsm/shaders/LuminosityShader.js +6 -3
  249. package/examples/jsm/shaders/MirrorShader.js +7 -4
  250. package/examples/jsm/shaders/NormalMapShader.js +5 -3
  251. package/examples/jsm/shaders/OutputShader.js +11 -0
  252. package/examples/jsm/shaders/PoissonDenoiseShader.js +21 -15
  253. package/examples/jsm/shaders/RGBShiftShader.js +5 -1
  254. package/examples/jsm/shaders/SAOShader.js +8 -2
  255. package/examples/jsm/shaders/SMAAShader.js +23 -1
  256. package/examples/jsm/shaders/SSAOShader.js +23 -5
  257. package/examples/jsm/shaders/SSRShader.js +25 -1
  258. package/examples/jsm/shaders/SepiaShader.js +6 -4
  259. package/examples/jsm/shaders/SobelOperatorShader.js +5 -2
  260. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +10 -8
  261. package/examples/jsm/shaders/TechnicolorShader.js +7 -4
  262. package/examples/jsm/shaders/ToonShader.js +29 -7
  263. package/examples/jsm/shaders/TriangleBlurShader.js +6 -4
  264. package/examples/jsm/shaders/UnpackDepthRGBAShader.js +6 -3
  265. package/examples/jsm/shaders/VelocityShader.js +6 -2
  266. package/examples/jsm/shaders/VerticalBlurShader.js +6 -2
  267. package/examples/jsm/shaders/VerticalTiltShiftShader.js +5 -1
  268. package/examples/jsm/shaders/VignetteShader.js +6 -4
  269. package/examples/jsm/shaders/VolumeShader.js +7 -1
  270. package/examples/jsm/shaders/WaterRefractionShader.js +8 -0
  271. package/examples/jsm/textures/FlakesTexture.js +12 -0
  272. package/examples/jsm/transpiler/Transpiler.js +31 -0
  273. package/examples/jsm/tsl/display/AfterImageNode.js +1 -1
  274. package/examples/jsm/tsl/display/BloomNode.js +1 -1
  275. package/examples/jsm/tsl/display/PixelationPassNode.js +4 -4
  276. package/examples/jsm/tsl/display/SSRNode.js +1 -1
  277. package/examples/jsm/tsl/lighting/TiledLightsNode.js +29 -3
  278. package/examples/jsm/tsl/math/Bayer.js +14 -1
  279. package/examples/jsm/tsl/utils/Raymarching.js +4 -2
  280. package/examples/jsm/utils/BufferGeometryUtils.js +88 -29
  281. package/examples/jsm/utils/CameraUtils.js +10 -7
  282. package/examples/jsm/utils/GeometryCompressionUtils.js +20 -30
  283. package/examples/jsm/utils/GeometryUtils.js +12 -13
  284. package/examples/jsm/utils/LDrawUtils.js +11 -4
  285. package/examples/jsm/utils/SceneOptimizer.js +66 -20
  286. package/examples/jsm/utils/SceneUtils.js +50 -3
  287. package/examples/jsm/utils/ShadowMapViewer.js +47 -24
  288. package/examples/jsm/utils/ShadowMapViewerGPU.js +47 -24
  289. package/examples/jsm/utils/SkeletonUtils.js +45 -0
  290. package/examples/jsm/utils/SortUtils.js +14 -5
  291. package/examples/jsm/utils/UVsDebug.js +9 -4
  292. package/examples/jsm/utils/WebGLTextureUtils.js +13 -0
  293. package/examples/jsm/utils/WebGPUTextureUtils.js +14 -0
  294. package/examples/jsm/utils/WorkerPool.js +65 -2
  295. package/examples/jsm/webxr/ARButton.js +18 -0
  296. package/examples/jsm/webxr/OculusHandModel.js +83 -0
  297. package/examples/jsm/webxr/OculusHandPointerModel.js +125 -0
  298. package/examples/jsm/webxr/Text2D.js +11 -0
  299. package/examples/jsm/webxr/VRButton.js +30 -0
  300. package/examples/jsm/webxr/XRButton.js +22 -0
  301. package/examples/jsm/webxr/XRControllerModelFactory.js +87 -3
  302. package/examples/jsm/webxr/XREstimatedLight.js +33 -3
  303. package/examples/jsm/webxr/XRHandMeshModel.js +35 -0
  304. package/examples/jsm/webxr/XRHandModelFactory.js +92 -0
  305. package/examples/jsm/webxr/XRHandPrimitiveModel.js +42 -0
  306. package/examples/jsm/webxr/XRPlanes.js +17 -0
  307. package/package.json +1 -1
  308. package/src/Three.TSL.js +3 -1
  309. package/src/animation/AnimationAction.js +262 -30
  310. package/src/animation/AnimationClip.js +141 -2
  311. package/src/animation/AnimationMixer.js +99 -15
  312. package/src/animation/AnimationObjectGroup.js +41 -18
  313. package/src/animation/AnimationUtils.js +168 -18
  314. package/src/animation/KeyframeTrack.js +144 -10
  315. package/src/animation/PropertyBinding.js +77 -3
  316. package/src/animation/PropertyMixer.js +72 -5
  317. package/src/animation/tracks/BooleanKeyframeTrack.js +33 -6
  318. package/src/animation/tracks/ColorKeyframeTrack.js +26 -5
  319. package/src/animation/tracks/NumberKeyframeTrack.js +26 -2
  320. package/src/animation/tracks/QuaternionKeyframeTrack.js +30 -1
  321. package/src/animation/tracks/StringKeyframeTrack.js +33 -2
  322. package/src/animation/tracks/VectorKeyframeTrack.js +26 -2
  323. package/src/audio/AudioAnalyser.js +1 -1
  324. package/src/audio/AudioListener.js +2 -2
  325. package/src/audio/PositionalAudio.js +5 -5
  326. package/src/constants.js +1432 -5
  327. package/src/core/BufferAttribute.js +413 -3
  328. package/src/core/BufferGeometry.js +337 -1
  329. package/src/core/Clock.js +60 -0
  330. package/src/core/GLBufferAttribute.js +99 -0
  331. package/src/core/InstancedBufferAttribute.js +29 -0
  332. package/src/core/InstancedBufferGeometry.js +20 -0
  333. package/src/core/InstancedInterleavedBuffer.js +26 -0
  334. package/src/core/InterleavedBuffer.js +137 -3
  335. package/src/core/InterleavedBufferAttribute.js +197 -0
  336. package/src/core/Layers.js +71 -10
  337. package/src/core/Object3D.js +23 -0
  338. package/src/core/Raycaster.js +134 -1
  339. package/src/core/RenderTarget.js +166 -7
  340. package/src/core/RenderTarget3D.js +25 -0
  341. package/src/core/RenderTargetArray.js +18 -0
  342. package/src/core/Uniform.js +29 -0
  343. package/src/core/UniformsGroup.js +84 -2
  344. package/src/extras/Controls.js +16 -1
  345. package/src/extras/Earcut.js +3 -781
  346. package/src/extras/ImageUtils.js +3 -2
  347. package/src/extras/PMREMGenerator.js +22 -17
  348. package/src/extras/core/Curve.js +1 -1
  349. package/src/extras/core/Path.js +1 -1
  350. package/src/extras/lib/earcut.js +685 -0
  351. package/src/geometries/ConeGeometry.js +2 -2
  352. package/src/geometries/CylinderGeometry.js +2 -2
  353. package/src/geometries/ExtrudeGeometry.js +71 -39
  354. package/src/geometries/LatheGeometry.js +1 -1
  355. package/src/lights/LightShadow.js +1 -1
  356. package/src/lights/webgpu/IESSpotLight.js +1 -1
  357. package/src/loaders/AnimationLoader.js +31 -0
  358. package/src/loaders/AudioLoader.js +31 -0
  359. package/src/loaders/BufferGeometryLoader.js +34 -0
  360. package/src/loaders/Cache.js +45 -0
  361. package/src/loaders/CompressedTextureLoader.js +36 -3
  362. package/src/loaders/CubeTextureLoader.js +45 -0
  363. package/src/loaders/DataTextureLoader.js +44 -3
  364. package/src/loaders/FileLoader.js +57 -1
  365. package/src/loaders/ImageBitmapLoader.js +57 -0
  366. package/src/loaders/ImageLoader.js +30 -0
  367. package/src/loaders/Loader.js +4 -6
  368. package/src/loaders/LoaderUtils.js +18 -36
  369. package/src/loaders/LoadingManager.js +142 -0
  370. package/src/loaders/MaterialLoader.js +57 -0
  371. package/src/loaders/ObjectLoader.js +58 -1
  372. package/src/loaders/TextureLoader.js +33 -0
  373. package/src/loaders/nodes/NodeLoader.js +6 -2
  374. package/src/loaders/nodes/NodeMaterialLoader.js +1 -1
  375. package/src/loaders/nodes/NodeObjectLoader.js +3 -3
  376. package/src/materials/LineBasicMaterial.js +74 -1
  377. package/src/materials/LineDashedMaterial.js +52 -0
  378. package/src/materials/Material.js +18 -3
  379. package/src/materials/MeshBasicMaterial.js +165 -0
  380. package/src/materials/MeshDepthMaterial.js +93 -0
  381. package/src/materials/MeshDistanceMaterial.js +76 -0
  382. package/src/materials/MeshLambertMaterial.js +273 -0
  383. package/src/materials/MeshMatcapMaterial.js +142 -0
  384. package/src/materials/MeshNormalMaterial.js +113 -0
  385. package/src/materials/MeshPhongMaterial.js +288 -0
  386. package/src/materials/MeshPhysicalMaterial.js +292 -1
  387. package/src/materials/MeshStandardMaterial.js +297 -0
  388. package/src/materials/MeshToonMaterial.js +218 -0
  389. package/src/materials/PointsMaterial.js +89 -0
  390. package/src/materials/RawShaderMaterial.js +25 -0
  391. package/src/materials/ShaderMaterial.js +215 -6
  392. package/src/materials/ShadowMaterial.js +54 -0
  393. package/src/materials/SpriteMaterial.js +82 -0
  394. package/src/materials/nodes/Line2NodeMaterial.js +1 -1
  395. package/src/materials/nodes/LineBasicNodeMaterial.js +2 -2
  396. package/src/materials/nodes/LineDashedNodeMaterial.js +2 -2
  397. package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
  398. package/src/materials/nodes/MeshLambertNodeMaterial.js +2 -2
  399. package/src/materials/nodes/MeshMatcapNodeMaterial.js +2 -2
  400. package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
  401. package/src/materials/nodes/MeshPhongNodeMaterial.js +2 -2
  402. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -2
  403. package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
  404. package/src/materials/nodes/MeshStandardNodeMaterial.js +2 -2
  405. package/src/materials/nodes/MeshToonNodeMaterial.js +2 -2
  406. package/src/materials/nodes/NodeMaterial.js +7 -3
  407. package/src/materials/nodes/PointsNodeMaterial.js +1 -1
  408. package/src/materials/nodes/ShadowNodeMaterial.js +11 -2
  409. package/src/materials/nodes/SpriteNodeMaterial.js +1 -1
  410. package/src/materials/nodes/VolumeNodeMaterial.js +10 -1
  411. package/src/math/Color.js +1 -1
  412. package/src/math/MathUtils.js +223 -0
  413. package/src/nodes/Nodes.js +1 -0
  414. package/src/nodes/accessors/BatchNode.js +8 -8
  415. package/src/nodes/accessors/BuiltinNode.js +1 -1
  416. package/src/nodes/accessors/CubeTextureNode.js +1 -1
  417. package/src/nodes/accessors/InstanceNode.js +5 -5
  418. package/src/nodes/accessors/InstancedMeshNode.js +1 -1
  419. package/src/nodes/accessors/MorphNode.js +27 -23
  420. package/src/nodes/accessors/Normal.js +1 -1
  421. package/src/nodes/accessors/Object3DNode.js +12 -12
  422. package/src/nodes/accessors/ReferenceBaseNode.js +2 -2
  423. package/src/nodes/accessors/ReferenceNode.js +1 -1
  424. package/src/nodes/accessors/SkinningNode.js +46 -37
  425. package/src/nodes/accessors/StorageBufferNode.js +1 -1
  426. package/src/nodes/accessors/StorageTextureNode.js +3 -3
  427. package/src/nodes/accessors/Texture3DNode.js +1 -1
  428. package/src/nodes/accessors/TextureNode.js +25 -5
  429. package/src/nodes/accessors/TextureSizeNode.js +1 -1
  430. package/src/nodes/accessors/UniformArrayNode.js +2 -2
  431. package/src/nodes/code/CodeNode.js +4 -4
  432. package/src/nodes/code/ExpressionNode.js +4 -4
  433. package/src/nodes/code/FunctionCallNode.js +23 -3
  434. package/src/nodes/code/ScriptableNode.js +4 -4
  435. package/src/nodes/code/ScriptableValueNode.js +2 -2
  436. package/src/nodes/core/AssignNode.js +1 -1
  437. package/src/nodes/core/AttributeNode.js +1 -1
  438. package/src/nodes/core/BypassNode.js +1 -1
  439. package/src/nodes/core/CacheNode.js +1 -1
  440. package/src/nodes/core/ContextNode.js +1 -1
  441. package/src/nodes/core/InputNode.js +2 -2
  442. package/src/nodes/core/Node.js +14 -2
  443. package/src/nodes/core/NodeBuilder.js +86 -14
  444. package/src/nodes/core/StackNode.js +5 -5
  445. package/src/nodes/core/StructNode.js +1 -1
  446. package/src/nodes/core/StructTypeNode.js +2 -2
  447. package/src/nodes/core/VarNode.js +2 -8
  448. package/src/nodes/core/VaryingNode.js +3 -3
  449. package/src/nodes/display/BlendModes.js +4 -4
  450. package/src/nodes/display/BumpMapNode.js +1 -1
  451. package/src/nodes/display/NormalMapNode.js +1 -1
  452. package/src/nodes/display/PosterizeNode.js +1 -1
  453. package/src/nodes/display/ScreenNode.js +3 -3
  454. package/src/nodes/display/ViewportDepthNode.js +2 -2
  455. package/src/nodes/display/ViewportDepthTextureNode.js +2 -2
  456. package/src/nodes/display/ViewportSharedTextureNode.js +2 -2
  457. package/src/nodes/display/ViewportTextureNode.js +4 -4
  458. package/src/nodes/functions/ShadowMaskModel.js +4 -4
  459. package/src/nodes/functions/material/getParallaxCorrectNormal.js +6 -6
  460. package/src/nodes/geometry/RangeNode.js +1 -1
  461. package/src/nodes/gpgpu/AtomicFunctionNode.js +16 -40
  462. package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
  463. package/src/nodes/gpgpu/ComputeNode.js +30 -2
  464. package/src/nodes/lighting/AnalyticLightNode.js +9 -1
  465. package/src/nodes/lighting/LightsNode.js +3 -3
  466. package/src/nodes/lighting/ShadowNode.js +1 -1
  467. package/src/nodes/math/ConditionalNode.js +20 -3
  468. package/src/nodes/math/MathNode.js +83 -78
  469. package/src/nodes/math/OperatorNode.js +171 -82
  470. package/src/nodes/pmrem/PMREMNode.js +4 -4
  471. package/src/nodes/pmrem/PMREMUtils.js +2 -2
  472. package/src/nodes/tsl/TSLBase.js +2 -1
  473. package/src/nodes/tsl/TSLCore.js +115 -12
  474. package/src/nodes/utils/ArrayElementNode.js +3 -1
  475. package/src/nodes/utils/CubeMapNode.js +3 -3
  476. package/src/nodes/utils/DebugNode.js +70 -0
  477. package/src/nodes/utils/EquirectUVNode.js +2 -2
  478. package/src/nodes/utils/JoinNode.js +27 -2
  479. package/src/nodes/utils/LoopNode.js +58 -28
  480. package/src/nodes/utils/MaxMipLevelNode.js +1 -1
  481. package/src/nodes/utils/ReflectorNode.js +2 -2
  482. package/src/nodes/utils/RemapNode.js +6 -6
  483. package/src/nodes/utils/RotateNode.js +1 -1
  484. package/src/nodes/utils/SpriteSheetUVNode.js +3 -3
  485. package/src/nodes/utils/StorageArrayElementNode.js +1 -1
  486. package/src/nodes/utils/TriplanarTexturesNode.js +3 -3
  487. package/src/objects/BatchedMesh.js +4 -4
  488. package/src/objects/InstancedMesh.js +2 -2
  489. package/src/objects/LOD.js +1 -1
  490. package/src/objects/Skeleton.js +1 -1
  491. package/src/renderers/WebGL3DRenderTarget.js +25 -0
  492. package/src/renderers/WebGLArrayRenderTarget.js +25 -0
  493. package/src/renderers/WebGLCubeRenderTarget.js +39 -1
  494. package/src/renderers/WebGLRenderTarget.js +19 -0
  495. package/src/renderers/WebGLRenderer.js +617 -79
  496. package/src/renderers/common/Animation.js +2 -2
  497. package/src/renderers/common/Attributes.js +2 -2
  498. package/src/renderers/common/Backend.js +12 -3
  499. package/src/renderers/common/Background.js +1 -0
  500. package/src/renderers/common/Color4.js +1 -1
  501. package/src/renderers/common/CubeRenderTarget.js +13 -0
  502. package/src/renderers/common/PostProcessing.js +2 -0
  503. package/src/renderers/common/QuadMesh.js +2 -0
  504. package/src/renderers/common/RenderList.js +2 -2
  505. package/src/renderers/common/RenderObject.js +1 -1
  506. package/src/renderers/common/RenderObjects.js +2 -2
  507. package/src/renderers/common/Renderer.js +52 -31
  508. package/src/renderers/common/XRManager.js +333 -10
  509. package/src/renderers/common/extras/PMREMGenerator.js +6 -0
  510. package/src/renderers/common/nodes/NodeBuilderState.js +3 -3
  511. package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +10 -1
  512. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +8 -1
  513. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +5 -1
  514. package/src/renderers/shaders/ShaderChunk/common.glsl.js +82 -0
  515. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +22 -2
  516. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +12 -1
  517. package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +8 -2
  518. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +31 -11
  519. package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +5 -1
  520. package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +1 -1
  521. package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +1 -1
  522. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +2 -1
  523. package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -1
  524. package/src/renderers/shaders/ShaderChunk/triplanar_fragment.glsl.js +20 -0
  525. package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +52 -7
  526. package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +25 -6
  527. package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +19 -7
  528. package/src/renderers/shaders/ShaderChunk.js +2 -0
  529. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -0
  530. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -0
  531. package/src/renderers/shaders/UniformsLib.js +6 -5
  532. package/src/renderers/shaders/UniformsUtils.js +1 -3
  533. package/src/renderers/webgl/WebGLBackground.js +4 -2
  534. package/src/renderers/webgl/WebGLMaterials.js +12 -0
  535. package/src/renderers/webgl/WebGLProgram.js +25 -5
  536. package/src/renderers/webgl/WebGLPrograms.js +21 -7
  537. package/src/renderers/webgl/WebGLState.js +9 -9
  538. package/src/renderers/webgl-fallback/WebGLBackend.js +25 -26
  539. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +3 -12
  540. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +67 -19
  541. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +1 -1
  542. package/src/renderers/webgpu/WebGPUBackend.js +128 -87
  543. package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -11
  544. package/src/renderers/webgpu/WebGPURenderer.js +17 -11
  545. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +4 -4
  546. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +5 -3
  547. package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
  548. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1 -1
  549. package/src/renderers/webxr/WebXRController.js +87 -2
  550. package/src/renderers/webxr/WebXRDepthSensing.js +49 -0
  551. package/src/renderers/webxr/WebXRManager.js +173 -1
  552. package/src/scenes/Scene.js +2 -1
  553. package/src/textures/CanvasTexture.js +28 -0
  554. package/src/textures/CompressedArrayTexture.js +57 -0
  555. package/src/textures/CompressedCubeTexture.js +29 -0
  556. package/src/textures/CompressedTexture.js +64 -6
  557. package/src/textures/CubeTexture.js +52 -4
  558. package/src/textures/Data3DTexture.js +77 -0
  559. package/src/textures/DataArrayTexture.js +93 -0
  560. package/src/textures/DataTexture.js +65 -0
  561. package/src/textures/DepthTexture.js +59 -9
  562. package/src/textures/FramebufferTexture.js +62 -0
  563. package/src/textures/Source.js +69 -0
  564. package/src/textures/Texture.js +5 -5
  565. package/src/textures/VideoFrameTexture.js +43 -6
  566. package/src/textures/VideoTexture.js +49 -4
  567. package/examples/jsm/geometries/ParametricGeometries.js +0 -254
@@ -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();
@@ -73,24 +92,65 @@ const _scalePointTemp = new Vector3();
73
92
 
74
93
  const _EPS = 0.000001;
75
94
 
76
-
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 to return to its starting orientation).
100
+ *
101
+ * In addition to supporting pan, zoom and pinch gestures, Arcball controls provide focus< functionality with a double click/tap for intuitively
102
+ * moving the object's point of interest in the center of the virtual trackball. Focus allows a much better inspection and navigation in complex
103
+ * environment. 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
+ */
77
111
  class ArcballControls extends Controls {
78
112
 
79
113
  /**
114
+ * Constructs a new controls instance.
80
115
  *
81
- * @param {Camera} camera Virtual camera used in the scene
82
- * @param {?HTMLElement} [domElement=null] Renderer's dom element
83
- * @param {?Scene} [scene=null] The scene to be rendered
116
+ * @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.
117
+ * @param {?HTMLDOMElement} [domElement=null] - The HTML element used for event listeners.
118
+ * @param {?Scene} [scene=null] The scene rendered by the camera. If not given, gizmos cannot be shown.
84
119
  */
85
120
  constructor( camera, domElement = null, scene = null ) {
86
121
 
87
122
  super( camera, domElement );
88
123
 
124
+ /**
125
+ * The scene rendered by the camera. If not given, gizmos cannot be shown.
126
+ *
127
+ * @type {?Scene}
128
+ * @default null
129
+ */
89
130
  this.scene = scene;
131
+
132
+ /**
133
+ * The control's focus point.
134
+ *
135
+ * @type {Vector3}
136
+ */
90
137
  this.target = new Vector3();
91
138
  this._currentTarget = new Vector3();
139
+
140
+ /**
141
+ * The size of the gizmo relative to the screen width and height.
142
+ *
143
+ * @type {number}
144
+ * @default 0.67
145
+ */
92
146
  this.radiusFactor = 0.67;
93
147
 
148
+ /**
149
+ * Holds the mouse actions of this controls. This property is maintained by the methods
150
+ * `setMouseAction()` and `unsetMouseAction()`.
151
+ *
152
+ * @type {Array<Object>}
153
+ */
94
154
  this.mouseActions = [];
95
155
  this._mouseOp = null;
96
156
 
@@ -178,8 +238,13 @@ class ArcballControls extends Controls {
178
238
  this._timeStart = - 1; //initial time
179
239
  this._animationId = - 1;
180
240
 
181
- //focus animation
182
- this.focusAnimationTime = 500; //duration of focus animation in ms
241
+ /**
242
+ * Duration of focus animations in ms.
243
+ *
244
+ * @type {number}
245
+ * @default 500
246
+ */
247
+ this.focusAnimationTime = 500;
183
248
 
184
249
  //rotate animation
185
250
  this._timePrev = 0; //time at which previous rotate operation has been detected
@@ -191,28 +256,161 @@ class ArcballControls extends Controls {
191
256
  this._wPrev = 0; //angular velocity of the previous rotate operation
192
257
  this._wCurr = 0; //angular velocity of the current rotate operation
193
258
 
194
-
195
259
  //parameters
260
+
261
+ /**
262
+ * If set to `true`, the camera's near and far values will be adjusted every time zoom is
263
+ * performed trying to maintain the same visible portion given by initial near and far
264
+ * values. Only works with perspective cameras.
265
+ *
266
+ * @type {boolean}
267
+ * @default false
268
+ */
196
269
  this.adjustNearFar = false;
197
- this.scaleFactor = 1.1; //zoom/distance multiplier
270
+
271
+ /**
272
+ * The scaling factor used when performing zoom operation.
273
+ *
274
+ * @type {number}
275
+ * @default 1.1
276
+ */
277
+ this.scaleFactor = 1.1;
278
+
279
+ /**
280
+ * The damping inertia used if 'enableAnimations` is set to `true`.
281
+ *
282
+ * @type {number}
283
+ * @default 25
284
+ */
198
285
  this.dampingFactor = 25;
199
- this.wMax = 20; //maximum angular velocity allowed
200
- this.enableAnimations = true; //if animations should be performed
201
- this.enableGrid = false; //if grid should be showed during pan operation
202
- this.cursorZoom = false; //if wheel zoom should be cursor centered
286
+
287
+ /**
288
+ * Maximum angular velocity allowed on rotation animation start.
289
+ *
290
+ * @type {number}
291
+ * @default 20
292
+ */
293
+ this.wMax = 20;
294
+
295
+ /**
296
+ * Set to `true` to enable animations for rotation (damping) and focus operation.
297
+ *
298
+ * @type {boolean}
299
+ * @default true
300
+ */
301
+ this.enableAnimations = true;
302
+
303
+ /**
304
+ * If set to `true`, a grid will appear when panning operation is being performed
305
+ * (desktop interaction only).
306
+ *
307
+ * @type {boolean}
308
+ * @default false
309
+ */
310
+ this.enableGrid = false;
311
+
312
+ /**
313
+ * Set to `true` to make zoom become cursor centered.
314
+ *
315
+ * @type {boolean}
316
+ * @default false
317
+ */
318
+ this.cursorZoom = false;
319
+
320
+ /**
321
+ * The minimum FOV in degrees.
322
+ *
323
+ * @type {number}
324
+ * @default 5
325
+ */
203
326
  this.minFov = 5;
327
+
328
+ /**
329
+ * The maximum FOV in degrees.
330
+ *
331
+ * @type {number}
332
+ * @default 90
333
+ */
204
334
  this.maxFov = 90;
335
+
336
+ /**
337
+ * Speed of rotation.
338
+ *
339
+ * @type {number}
340
+ * @default 1
341
+ */
205
342
  this.rotateSpeed = 1;
206
343
 
344
+ /**
345
+ * Enable or disable camera panning.
346
+ *
347
+ * @type {boolean}
348
+ * @default true
349
+ */
207
350
  this.enablePan = true;
351
+
352
+ /**
353
+ * Enable or disable camera rotation.
354
+ *
355
+ * @type {boolean}
356
+ * @default true
357
+ */
208
358
  this.enableRotate = true;
359
+
360
+ /**
361
+ * Enable or disable camera zoom.
362
+ *
363
+ * @type {boolean}
364
+ * @default true
365
+ */
209
366
  this.enableZoom = true;
367
+
368
+ /**
369
+ * Enable or disable gizmos.
370
+ *
371
+ * @type {boolean}
372
+ * @default true
373
+ */
210
374
  this.enableGizmos = true;
375
+
376
+ /**
377
+ * Enable or disable camera focusing on double-tap (or click) operations.
378
+ *
379
+ * @type {boolean}
380
+ * @default true
381
+ */
211
382
  this.enableFocus = true;
212
383
 
384
+ /**
385
+ * How far you can dolly in. For perspective cameras only.
386
+ *
387
+ * @type {number}
388
+ * @default 0
389
+ */
213
390
  this.minDistance = 0;
391
+
392
+ /**
393
+ * How far you can dolly out. For perspective cameras only.
394
+ *
395
+ * @type {number}
396
+ * @default Infinity
397
+ */
214
398
  this.maxDistance = Infinity;
399
+
400
+ /**
401
+ * How far you can zoom in. For orthographic cameras only.
402
+ *
403
+ * @type {number}
404
+ * @default 0
405
+ */
215
406
  this.minZoom = 0;
407
+
408
+ /**
409
+ * How far you can zoom out. For orthographic cameras only.
410
+ *
411
+ * @type {number}
412
+ * @default Infinity
413
+ */
216
414
  this.maxZoom = Infinity;
217
415
 
218
416
  //trackball parameters
@@ -243,13 +441,15 @@ class ArcballControls extends Controls {
243
441
 
244
442
  if ( domElement !== null ) {
245
443
 
246
- this.connect();
444
+ this.connect( domElement );
247
445
 
248
446
  }
249
447
 
250
448
  }
251
449
 
252
- connect() {
450
+ connect( element ) {
451
+
452
+ super.connect( element );
253
453
 
254
454
  this.domElement.style.touchAction = 'none';
255
455
  this._devPxRatio = window.devicePixelRatio;
@@ -1044,9 +1244,11 @@ class ArcballControls extends Controls {
1044
1244
  }
1045
1245
 
1046
1246
  /**
1047
- * Set _center's x/y coordinates
1048
- * @param {number} clientX
1049
- * @param {number} clientY
1247
+ * Set _center's x/y coordinates.
1248
+ *
1249
+ * @private
1250
+ * @param {number} clientX - The x coordinate.
1251
+ * @param {number} clientY - The y coordinate.
1050
1252
  */
1051
1253
  setCenter( clientX, clientY ) {
1052
1254
 
@@ -1056,7 +1258,9 @@ class ArcballControls extends Controls {
1056
1258
  }
1057
1259
 
1058
1260
  /**
1059
- * Set default mouse actions
1261
+ * Set default mouse actions.
1262
+ *
1263
+ * @private
1060
1264
  */
1061
1265
  initializeMouseActions() {
1062
1266
 
@@ -1075,10 +1279,12 @@ class ArcballControls extends Controls {
1075
1279
  }
1076
1280
 
1077
1281
  /**
1078
- * Compare two mouse actions
1079
- * @param {Object} action1
1080
- * @param {Object} action2
1081
- * @returns {boolean} True if action1 and action 2 are the same mouse action, false otherwise
1282
+ * Compare two mouse actions.
1283
+ *
1284
+ * @private
1285
+ * @param {Object} action1 - The first mouse action.
1286
+ * @param {Object} action2 - The second mouse action.
1287
+ * @returns {boolean} `true` if action1 and action 2 are the same mouse action, `false` otherwise.
1082
1288
  */
1083
1289
  compareMouseAction( action1, action2 ) {
1084
1290
 
@@ -1103,11 +1309,12 @@ class ArcballControls extends Controls {
1103
1309
  }
1104
1310
 
1105
1311
  /**
1106
- * 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
1107
- * @param {'PAN'|'ROTATE'|'ZOOM'|'FOV'} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV')
1108
- * @param {0|1|2|'WHEEL'} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
1109
- * @param {'CTRL'|'SHIFT'|null} [key=null] The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
1110
- * @returns {boolean} True if the mouse action has been successfully added, false otherwise
1312
+ * 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.
1313
+ *
1314
+ * @param {'PAN'|'ROTATE'|'ZOOM'|'FOV'} operation - The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV').
1315
+ * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches.
1316
+ * @param {'CTRL'|'SHIFT'|null} [key=null] - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
1317
+ * @returns {boolean} `true` if the mouse action has been successfully added, `false` otherwise.
1111
1318
  */
1112
1319
  setMouseAction( operation, mouse, key = null ) {
1113
1320
 
@@ -1184,10 +1391,11 @@ class ArcballControls extends Controls {
1184
1391
  }
1185
1392
 
1186
1393
  /**
1187
- * Remove a mouse action by specifying its mouse/key combination
1188
- * @param {0|1|2|'WHEEL'} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
1189
- * @param {'CTRL'|'SHIFT'|null} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
1190
- * @returns {boolean} True if the operation has been successfully removed, false otherwise
1394
+ * Remove a mouse action by specifying its mouse/key combination.
1395
+ *
1396
+ * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches.
1397
+ * @param {'CTRL'|'SHIFT'|null} key - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
1398
+ * @returns {boolean} `true` if the operation has been successfully removed, `false` otherwise.
1191
1399
  */
1192
1400
  unsetMouseAction( mouse, key = null ) {
1193
1401
 
@@ -1207,10 +1415,12 @@ class ArcballControls extends Controls {
1207
1415
  }
1208
1416
 
1209
1417
  /**
1210
- * Return the operation associated to a mouse/keyboard combination
1211
- * @param {0|1|2|'WHEEL'} mouse Mouse button index (0, 1, 2) or 'WHEEL' for wheel notches
1212
- * @param {'CTRL'|'SHIFT'|null} key Keyboard modifier
1213
- * @returns {'PAN'|'ROTATE'|'ZOOM'|'FOV'|null} The operation if it has been found, null otherwise
1418
+ * Return the operation associated to a mouse/keyboard combination.
1419
+ *
1420
+ * @private
1421
+ * @param {0|1|2|'WHEEL'} mouse - Mouse button index (0, 1, 2) or 'WHEEL' for wheel notches.
1422
+ * @param {'CTRL'|'SHIFT'|null} key - Keyboard modifier.
1423
+ * @returns {'PAN'|'ROTATE'|'ZOOM'|'FOV'|null} The operation if it has been found, `null` otherwise.
1214
1424
  */
1215
1425
  getOpFromAction( mouse, key ) {
1216
1426
 
@@ -1247,10 +1457,12 @@ class ArcballControls extends Controls {
1247
1457
  }
1248
1458
 
1249
1459
  /**
1250
- * Get the operation associated to mouse and key combination and returns the corresponding FSA state
1251
- * @param {0|1|2} mouse Mouse button index (0, 1, 2)
1252
- * @param {'CTRL'|'SHIFT'|null} key Keyboard modifier
1253
- * @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination
1460
+ * Get the operation associated to mouse and key combination and returns the corresponding FSA state.
1461
+ *
1462
+ * @private
1463
+ * @param {0|1|2} mouse - Mouse button index (0, 1, 2)
1464
+ * @param {'CTRL'|'SHIFT'|null} key - Keyboard modifier
1465
+ * @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination.
1254
1466
  */
1255
1467
  getOpStateFromAction( mouse, key ) {
1256
1468
 
@@ -1287,10 +1499,12 @@ class ArcballControls extends Controls {
1287
1499
  }
1288
1500
 
1289
1501
  /**
1290
- * Calculate the angle between two pointers
1291
- * @param {PointerEvent} p1
1292
- * @param {PointerEvent} p2
1293
- * @returns {number} The angle between two pointers in degrees
1502
+ * Calculate the angle between two pointers.
1503
+ *
1504
+ * @private
1505
+ * @param {PointerEvent} p1 - The first pointer event.
1506
+ * @param {PointerEvent} p2 - The second pointer event.
1507
+ * @returns {number} The angle between two pointers in degrees.
1294
1508
  */
1295
1509
  getAngle( p1, p2 ) {
1296
1510
 
@@ -1299,8 +1513,10 @@ class ArcballControls extends Controls {
1299
1513
  }
1300
1514
 
1301
1515
  /**
1302
- * Update a PointerEvent inside current pointerevents array
1303
- * @param {PointerEvent} event
1516
+ * Updates a PointerEvent inside current pointerevents array.
1517
+ *
1518
+ * @private
1519
+ * @param {PointerEvent} event - The pointer event.
1304
1520
  */
1305
1521
  updateTouchEvent( event ) {
1306
1522
 
@@ -1318,8 +1534,10 @@ class ArcballControls extends Controls {
1318
1534
  }
1319
1535
 
1320
1536
  /**
1321
- * Apply a transformation matrix, to the camera and gizmos
1322
- * @param {Object} transformation Object containing matrices to apply to camera and gizmos
1537
+ * Applies a transformation matrix, to the camera and gizmos.
1538
+ *
1539
+ * @private
1540
+ * @param {Object} transformation - Object containing matrices to apply to camera and gizmos.
1323
1541
  */
1324
1542
  applyTransformMatrix( transformation ) {
1325
1543
 
@@ -1405,13 +1623,14 @@ class ArcballControls extends Controls {
1405
1623
  }
1406
1624
 
1407
1625
  /**
1408
- * Calculate the angular speed
1626
+ * Calculates the angular speed.
1409
1627
  *
1410
- * @param {number} p0 Position at t0
1411
- * @param {number} p1 Position at t1
1412
- * @param {number} t0 Initial time in milliseconds
1413
- * @param {number} t1 Ending time in milliseconds
1414
- * @returns {number}
1628
+ * @private
1629
+ * @param {number} p0 - Position at t0.
1630
+ * @param {number} p1 - Position at t1.
1631
+ * @param {number} t0 - Initial time in milliseconds.
1632
+ * @param {number} t1 - Ending time in milliseconds.
1633
+ * @returns {number} The angular speed.
1415
1634
  */
1416
1635
  calculateAngularSpeed( p0, p1, t0, t1 ) {
1417
1636
 
@@ -1428,10 +1647,12 @@ class ArcballControls extends Controls {
1428
1647
  }
1429
1648
 
1430
1649
  /**
1431
- * Calculate the distance between two pointers
1432
- * @param {PointerEvent} p0 The first pointer
1433
- * @param {PointerEvent} p1 The second pointer
1434
- * @returns {number} The distance between the two pointers
1650
+ * Calculates the distance between two pointers.
1651
+ *
1652
+ * @private
1653
+ * @param {PointerEvent} p0 - The first pointer.
1654
+ * @param {PointerEvent} p1 - The second pointer.
1655
+ * @returns {number} The distance between the two pointers.
1435
1656
  */
1436
1657
  calculatePointersDistance( p0, p1 ) {
1437
1658
 
@@ -1440,10 +1661,12 @@ class ArcballControls extends Controls {
1440
1661
  }
1441
1662
 
1442
1663
  /**
1443
- * Calculate the rotation axis as the vector perpendicular between two vectors
1444
- * @param {Vector3} vec1 The first vector
1445
- * @param {Vector3} vec2 The second vector
1446
- * @returns {Vector3} The normalized rotation axis
1664
+ * Calculates the rotation axis as the vector perpendicular between two vectors.
1665
+ *
1666
+ * @private
1667
+ * @param {Vector3} vec1 - The first vector.
1668
+ * @param {Vector3} vec2 - The second vector.
1669
+ * @returns {Vector3} The normalized rotation axis.
1447
1670
  */
1448
1671
  calculateRotationAxis( vec1, vec2 ) {
1449
1672
 
@@ -1456,9 +1679,11 @@ class ArcballControls extends Controls {
1456
1679
  }
1457
1680
 
1458
1681
  /**
1459
- * Calculate the trackball radius so that gizmo's diameter will be 2/3 of the minimum side of the camera frustum
1460
- * @param {Camera} camera
1461
- * @returns {number} The trackball radius
1682
+ * Calculates the trackball radius so that gizmo's diameter will be 2/3 of the minimum side of the camera frustum.
1683
+ *
1684
+ * @private
1685
+ * @param {Camera} camera - The camera.
1686
+ * @returns {number} The trackball radius.
1462
1687
  */
1463
1688
  calculateTbRadius( camera ) {
1464
1689
 
@@ -1479,10 +1704,12 @@ class ArcballControls extends Controls {
1479
1704
  }
1480
1705
 
1481
1706
  /**
1482
- * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in
1483
- * @param {Vector3} point The point of interest
1484
- * @param {number} size Scale factor
1485
- * @param {number} [amount=1] Amount of operation to be completed (used for focus animations, default is complete full operation)
1707
+ * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in.
1708
+ *
1709
+ * @private
1710
+ * @param {Vector3} point - The point of interest.
1711
+ * @param {number} size - Scale factor.
1712
+ * @param {number} [amount=1] - Amount of operation to be completed (used for focus animations, default is complete full operation).
1486
1713
  */
1487
1714
  focus( point, size, amount = 1 ) {
1488
1715
 
@@ -1511,7 +1738,9 @@ class ArcballControls extends Controls {
1511
1738
  }
1512
1739
 
1513
1740
  /**
1514
- * Draw a grid and add it to the scene
1741
+ * Creates a grid if necessary and adds it to the scene.
1742
+ *
1743
+ * @private
1515
1744
  */
1516
1745
  drawGrid() {
1517
1746
 
@@ -1562,9 +1791,6 @@ class ArcballControls extends Controls {
1562
1791
 
1563
1792
  }
1564
1793
 
1565
- /**
1566
- * Remove all listeners, stop animations and clean scene
1567
- */
1568
1794
  dispose() {
1569
1795
 
1570
1796
  if ( this._animationId != - 1 ) {
@@ -1581,7 +1807,7 @@ class ArcballControls extends Controls {
1581
1807
  }
1582
1808
 
1583
1809
  /**
1584
- * remove the grid from the scene
1810
+ * Removes the grid from the scene.
1585
1811
  */
1586
1812
  disposeGrid() {
1587
1813
 
@@ -1595,9 +1821,11 @@ class ArcballControls extends Controls {
1595
1821
  }
1596
1822
 
1597
1823
  /**
1598
- * Compute the easing out cubic function for ease out effect in animation
1599
- * @param {number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation)
1600
- * @returns {number} Result of easing out cubic at time t
1824
+ * Computes the easing out cubic function for ease out effect in animation.
1825
+ *
1826
+ * @private
1827
+ * @param {number} t - The absolute progress of the animation in the bound of `0` (beginning of the) and `1` (ending of animation).
1828
+ * @returns {number} Result of easing out cubic at time `t`.
1601
1829
  */
1602
1830
  easeOutCubic( t ) {
1603
1831
 
@@ -1606,8 +1834,9 @@ class ArcballControls extends Controls {
1606
1834
  }
1607
1835
 
1608
1836
  /**
1609
- * Make rotation gizmos more or less visible
1610
- * @param {boolean} isActive If true, make gizmos more visible
1837
+ * Makes rotation gizmos more or less visible.
1838
+ *
1839
+ * @param {boolean} isActive - If set to `true`, gizmos are more visible.
1611
1840
  */
1612
1841
  activateGizmos( isActive ) {
1613
1842
 
@@ -1632,12 +1861,13 @@ class ArcballControls extends Controls {
1632
1861
  }
1633
1862
 
1634
1863
  /**
1635
- * Calculate the cursor position in NDC
1864
+ * Calculates the cursor position in NDC.
1636
1865
  *
1637
- * @param {number} cursorX Cursor horizontal coordinate within the canvas
1638
- * @param {number} cursorY Cursor vertical coordinate within the canvas
1639
- * @param {HTMLElement} canvas The canvas where the renderer draws its output
1640
- * @returns {Vector2} Cursor normalized position inside the canvas
1866
+ * @private
1867
+ * @param {number} cursorX - Cursor horizontal coordinate within the canvas.
1868
+ * @param {number} cursorY - Cursor vertical coordinate within the canvas.
1869
+ * @param {HTMLElement} canvas - The canvas where the renderer draws its output.
1870
+ * @returns {Vector2} Cursor normalized position inside the canvas.
1641
1871
  */
1642
1872
  getCursorNDC( cursorX, cursorY, canvas ) {
1643
1873
 
@@ -1649,12 +1879,13 @@ class ArcballControls extends Controls {
1649
1879
  }
1650
1880
 
1651
1881
  /**
1652
- * Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas
1882
+ * Calculates the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas.
1653
1883
  *
1654
- * @param {number} cursorX Cursor horizontal coordinate within the canvas
1655
- * @param {number} cursorY Cursor vertical coordinate within the canvas
1656
- * @param {HTMLElement} canvas The canvas where the renderer draws its output
1657
- * @returns {Vector2} Cursor position inside the canvas
1884
+ * @private
1885
+ * @param {number} cursorX - Cursor horizontal coordinate within the canvas.
1886
+ * @param {number} cursorY - Cursor vertical coordinate within the canvas.
1887
+ * @param {HTMLElement} canvas - The canvas where the renderer draws its output.
1888
+ * @returns {Vector2} Cursor position inside the canvas.
1658
1889
  */
1659
1890
  getCursorPosition( cursorX, cursorY, canvas ) {
1660
1891
 
@@ -1666,8 +1897,9 @@ class ArcballControls extends Controls {
1666
1897
  }
1667
1898
 
1668
1899
  /**
1669
- * Set the camera to be controlled
1670
- * @param {Camera} camera The virtual camera to be controlled
1900
+ * Sets the camera to be controlled. Must be called in order to set a new camera to be controlled.
1901
+ *
1902
+ * @param {Camera} camera - The camera to be controlled.
1671
1903
  */
1672
1904
  setCamera( camera ) {
1673
1905
 
@@ -1709,8 +1941,9 @@ class ArcballControls extends Controls {
1709
1941
  }
1710
1942
 
1711
1943
  /**
1712
- * Set gizmos visibility
1713
- * @param {boolean} value Value of gizmos visibility
1944
+ * Sets gizmos visibility.
1945
+ *
1946
+ * @param {boolean} value - Value of gizmos visibility.
1714
1947
  */
1715
1948
  setGizmosVisible( value ) {
1716
1949
 
@@ -1720,8 +1953,9 @@ class ArcballControls extends Controls {
1720
1953
  }
1721
1954
 
1722
1955
  /**
1723
- * Set gizmos radius factor and redraws gizmos
1724
- * @param {number} value Value of radius factor
1956
+ * Sets gizmos radius factor and redraws gizmos.
1957
+ *
1958
+ * @param {number} value - Value of radius factor.
1725
1959
  */
1726
1960
  setTbRadius( value ) {
1727
1961
 
@@ -1744,9 +1978,11 @@ class ArcballControls extends Controls {
1744
1978
  }
1745
1979
 
1746
1980
  /**
1747
- * Creates the rotation gizmos matching trackball center and radius
1748
- * @param {Vector3} tbCenter The trackball center
1749
- * @param {number} tbRadius The trackball radius
1981
+ * Creates the rotation gizmos matching trackball center and radius.
1982
+ *
1983
+ * @private
1984
+ * @param {Vector3} tbCenter - The trackball center.
1985
+ * @param {number} tbRadius - The trackball radius.
1750
1986
  */
1751
1987
  makeGizmos( tbCenter, tbRadius ) {
1752
1988
 
@@ -1814,11 +2050,13 @@ class ArcballControls extends Controls {
1814
2050
  }
1815
2051
 
1816
2052
  /**
1817
- * Perform animation for focus operation
1818
- * @param {number} time Instant in which this function is called as performance.now()
1819
- * @param {Vector3} point Point of interest for focus operation
1820
- * @param {Matrix4} cameraMatrix Camera matrix
1821
- * @param {Matrix4} gizmoMatrix Gizmos matrix
2053
+ * Performs animation for focus operation.
2054
+ *
2055
+ * @private
2056
+ * @param {number} time - Instant in which this function is called as performance.now().
2057
+ * @param {Vector3} point - Point of interest for focus operation.
2058
+ * @param {Matrix4} cameraMatrix - Camera matrix.
2059
+ * @param {Matrix4} gizmoMatrix - Gizmos matrix.
1822
2060
  */
1823
2061
  onFocusAnim( time, point, cameraMatrix, gizmoMatrix ) {
1824
2062
 
@@ -1880,10 +2118,12 @@ class ArcballControls extends Controls {
1880
2118
  }
1881
2119
 
1882
2120
  /**
1883
- * Perform animation for rotation operation
1884
- * @param {number} time Instant in which this function is called as performance.now()
1885
- * @param {Vector3} rotationAxis Rotation axis
1886
- * @param {number} w0 Initial angular velocity
2121
+ * Performs animation for rotation operation.
2122
+ *
2123
+ * @private
2124
+ * @param {number} time - Instant in which this function is called as performance.now().
2125
+ * @param {Vector3} rotationAxis - Rotation axis.
2126
+ * @param {number} w0 - Initial angular velocity.
1887
2127
  */
1888
2128
  onRotationAnim( time, rotationAxis, w0 ) {
1889
2129
 
@@ -1947,11 +2187,12 @@ class ArcballControls extends Controls {
1947
2187
 
1948
2188
 
1949
2189
  /**
1950
- * Perform pan operation moving camera between two points
2190
+ * Performs pan operation moving camera between two points.
1951
2191
  *
1952
- * @param {Vector3} p0 Initial point
1953
- * @param {Vector3} p1 Ending point
1954
- * @param {boolean} [adjust=false] If movement should be adjusted considering camera distance (Perspective only)
2192
+ * @private
2193
+ * @param {Vector3} p0 - Initial point.
2194
+ * @param {Vector3} p1 - Ending point.
2195
+ * @param {boolean} [adjust=false] - If movement should be adjusted considering camera distance (Perspective only).
1955
2196
  * @returns {Object}
1956
2197
  */
1957
2198
  pan( p0, p1, adjust = false ) {
@@ -1983,7 +2224,7 @@ class ArcballControls extends Controls {
1983
2224
  }
1984
2225
 
1985
2226
  /**
1986
- * Reset trackball
2227
+ * Resets the controls.
1987
2228
  */
1988
2229
  reset() {
1989
2230
 
@@ -2020,10 +2261,12 @@ class ArcballControls extends Controls {
2020
2261
  }
2021
2262
 
2022
2263
  /**
2023
- * Rotate the camera around an axis passing by trackball's center
2024
- * @param {Vector3} axis Rotation axis
2025
- * @param {number} angle Angle in radians
2026
- * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera
2264
+ * Rotates the camera around an axis passing by trackball's center.
2265
+ *
2266
+ * @private
2267
+ * @param {Vector3} axis - Rotation axis.
2268
+ * @param {number} angle - Angle in radians.
2269
+ * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera.
2027
2270
  */
2028
2271
  rotate( axis, angle ) {
2029
2272
 
@@ -2042,6 +2285,9 @@ class ArcballControls extends Controls {
2042
2285
 
2043
2286
  }
2044
2287
 
2288
+ /**
2289
+ * Copy the current state to clipboard (as a readable JSON text).
2290
+ */
2045
2291
  copyState() {
2046
2292
 
2047
2293
  let state;
@@ -2080,6 +2326,10 @@ class ArcballControls extends Controls {
2080
2326
 
2081
2327
  }
2082
2328
 
2329
+ /**
2330
+ * Set the controls state from the clipboard, assumes that the clipboard stores a JSON
2331
+ * text as saved from `copyState()`.
2332
+ */
2083
2333
  pasteState() {
2084
2334
 
2085
2335
  const self = this;
@@ -2092,7 +2342,7 @@ class ArcballControls extends Controls {
2092
2342
  }
2093
2343
 
2094
2344
  /**
2095
- * Save the current state of the control. This can later be recover with .reset
2345
+ * Saves the current state of the control. This can later be recover with `reset()`.
2096
2346
  */
2097
2347
  saveState() {
2098
2348
 
@@ -2112,11 +2362,13 @@ class ArcballControls extends Controls {
2112
2362
  }
2113
2363
 
2114
2364
  /**
2115
- * Perform uniform scale operation around a given point
2116
- * @param {number} size Scale factor
2117
- * @param {Vector3} point Point around which scale
2118
- * @param {boolean} scaleGizmos If gizmos should be scaled (Perspective only)
2119
- * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos
2365
+ * Performs uniform scale operation around a given point.
2366
+ *
2367
+ * @private
2368
+ * @param {number} size - Scale factor.
2369
+ * @param {Vector3} point - Point around which scale.
2370
+ * @param {boolean} scaleGizmos - If gizmos should be scaled (Perspective only).
2371
+ * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos.
2120
2372
  */
2121
2373
  scale( size, point, scaleGizmos = true ) {
2122
2374
 
@@ -2228,8 +2480,10 @@ class ArcballControls extends Controls {
2228
2480
  }
2229
2481
 
2230
2482
  /**
2231
- * Set camera fov
2232
- * @param {number} value fov to be set
2483
+ * Sets camera fov.
2484
+ *
2485
+ * @private
2486
+ * @param {number} value - The FOV to be set.
2233
2487
  */
2234
2488
  setFov( value ) {
2235
2489
 
@@ -2243,10 +2497,11 @@ class ArcballControls extends Controls {
2243
2497
  }
2244
2498
 
2245
2499
  /**
2246
- * Set values in transformation object
2500
+ * Sets values in transformation object.
2247
2501
  *
2248
- * @param {Matrix4} [camera=null] Transformation to be applied to the camera
2249
- * @param {Matrix4} [gizmos=null] Transformation to be applied to gizmos
2502
+ * @private
2503
+ * @param {Matrix4} [camera=null] - Transformation to be applied to the camera.
2504
+ * @param {Matrix4} [gizmos=null] - Transformation to be applied to gizmos.
2250
2505
  */
2251
2506
  setTransformationMatrices( camera = null, gizmos = null ) {
2252
2507
 
@@ -2289,11 +2544,12 @@ class ArcballControls extends Controls {
2289
2544
  }
2290
2545
 
2291
2546
  /**
2292
- * Rotate camera around its direction axis passing by a given point by a given angle
2547
+ * Rotates camera around its direction axis passing by a given point by a given angle.
2293
2548
  *
2294
- * @param {Vector3} point The point where the rotation axis is passing trough
2295
- * @param {number} angle Angle in radians
2296
- * @returns {Object} The computed transformation matrix
2549
+ * @private
2550
+ * @param {Vector3} point - The point where the rotation axis is passing trough.
2551
+ * @param {number} angle - Angle in radians.
2552
+ * @returns {Object} The computed transformation matrix.
2297
2553
  */
2298
2554
  zRotate( point, angle ) {
2299
2555
 
@@ -2315,7 +2571,12 @@ class ArcballControls extends Controls {
2315
2571
 
2316
2572
  }
2317
2573
 
2318
-
2574
+ /**
2575
+ * Returns the raycaster that is used for user interaction. This object is shared between all
2576
+ * instances of `ArcballControls`.
2577
+ *
2578
+ * @returns {Raycaster} The internal raycaster.
2579
+ */
2319
2580
  getRaycaster() {
2320
2581
 
2321
2582
  return _raycaster;
@@ -2324,11 +2585,12 @@ class ArcballControls extends Controls {
2324
2585
 
2325
2586
 
2326
2587
  /**
2327
- * Unproject the cursor on the 3D object surface
2588
+ * Unprojects the cursor on the 3D object surface.
2328
2589
  *
2329
- * @param {Vector2} cursor Cursor coordinates in NDC
2330
- * @param {Camera} camera Virtual camera
2331
- * @returns {?Vector3} The point of intersection with the model, if exist, null otherwise
2590
+ * @private
2591
+ * @param {Vector2} cursor - Cursor coordinates in NDC.
2592
+ * @param {Camera} camera - Virtual camera.
2593
+ * @returns {?Vector3} The point of intersection with the model, if exist, null otherwise.
2332
2594
  */
2333
2595
  unprojectOnObj( cursor, camera ) {
2334
2596
 
@@ -2354,13 +2616,15 @@ class ArcballControls extends Controls {
2354
2616
  }
2355
2617
 
2356
2618
  /**
2357
- * Unproject the cursor on the trackball surface
2358
- * @param {Camera} camera The virtual camera
2359
- * @param {number} cursorX Cursor horizontal coordinate on screen
2360
- * @param {number} cursorY Cursor vertical coordinate on screen
2361
- * @param {HTMLElement} canvas The canvas where the renderer draws its output
2362
- * @param {number} tbRadius The trackball radius
2363
- * @returns {Vector3} The unprojected point on the trackball surface
2619
+ * Unproject the cursor on the trackball surface.
2620
+ *
2621
+ * @private
2622
+ * @param {Camera} camera - The virtual camera.
2623
+ * @param {number} cursorX - Cursor horizontal coordinate on screen.
2624
+ * @param {number} cursorY - Cursor vertical coordinate on screen.
2625
+ * @param {HTMLElement} canvas - The canvas where the renderer draws its output.
2626
+ * @param {number} tbRadius - The trackball radius.
2627
+ * @returns {Vector3} The unprojected point on the trackball surface.
2364
2628
  */
2365
2629
  unprojectOnTbSurface( camera, cursorX, cursorY, canvas, tbRadius ) {
2366
2630
 
@@ -2484,13 +2748,15 @@ class ArcballControls extends Controls {
2484
2748
 
2485
2749
 
2486
2750
  /**
2487
- * Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera
2488
- * @param {Camera} camera The virtual camera
2489
- * @param {number} cursorX Cursor horizontal coordinate on screen
2490
- * @param {number} cursorY Cursor vertical coordinate on screen
2491
- * @param {HTMLElement} canvas The canvas where the renderer draws its output
2492
- * @param {boolean} [initialDistance=false] If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only)
2493
- * @returns {Vector3} The unprojected point on the trackball plane
2751
+ * Unprojects the cursor on the plane passing through the center of the trackball orthogonal to the camera.
2752
+ *
2753
+ * @private
2754
+ * @param {Camera} camera - The virtual camera.
2755
+ * @param {number} cursorX - Cursor horizontal coordinate on screen.
2756
+ * @param {number} cursorY - Cursor vertical coordinate on screen.
2757
+ * @param {HTMLElement} canvas - The canvas where the renderer draws its output.
2758
+ * @param {boolean} [initialDistance=false] - If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only).
2759
+ * @returns {Vector3} The unprojected point on the trackball plane.
2494
2760
  */
2495
2761
  unprojectOnTbPlane( camera, cursorX, cursorY, canvas, initialDistance = false ) {
2496
2762
 
@@ -2564,7 +2830,9 @@ class ArcballControls extends Controls {
2564
2830
  }
2565
2831
 
2566
2832
  /**
2567
- * Update camera and gizmos state
2833
+ * Updates camera and gizmos state.
2834
+ *
2835
+ * @private
2568
2836
  */
2569
2837
  updateMatrixState() {
2570
2838
 
@@ -2587,9 +2855,11 @@ class ArcballControls extends Controls {
2587
2855
  }
2588
2856
 
2589
2857
  /**
2590
- * Update the trackball FSA
2591
- * @param {STATE} newState New state of the FSA
2592
- * @param {boolean} updateMatrices If matrices state should be updated
2858
+ * Updates the trackball FSA.
2859
+ *
2860
+ * @private
2861
+ * @param {STATE} newState - New state of the FSA.
2862
+ * @param {boolean} updateMatrices - If matrices state should be updated.
2593
2863
  */
2594
2864
  updateTbState( newState, updateMatrices ) {
2595
2865