three-stdlib 2.16.0 → 2.16.2

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 (1219) hide show
  1. package/BufferGeometryUtils-1a7a235c.js +655 -0
  2. package/BufferGeometryUtils-971dfde3.js +1 -0
  3. package/Nodes-4f766d71.js +471 -0
  4. package/Nodes-9aa16d74.js +1 -0
  5. package/animation/AnimationClipCreator.cjs.js +1 -0
  6. package/animation/AnimationClipCreator.js +52 -32
  7. package/animation/CCDIKSolver.cjs.js +1 -0
  8. package/animation/CCDIKSolver.js +143 -64
  9. package/animation/MMDAnimationHelper.cjs.js +1 -0
  10. package/animation/MMDAnimationHelper.js +341 -150
  11. package/animation/MMDPhysics.cjs.js +1 -0
  12. package/animation/MMDPhysics.js +361 -154
  13. package/cameras/CinematicCamera.cjs.js +1 -0
  14. package/cameras/CinematicCamera.js +77 -67
  15. package/controls/ArcballControls.cjs.js +1 -0
  16. package/controls/ArcballControls.js +1449 -544
  17. package/controls/DeviceOrientationControls.cjs.js +1 -0
  18. package/controls/DeviceOrientationControls.js +97 -52
  19. package/controls/DragControls.cjs.js +1 -0
  20. package/controls/DragControls.js +187 -85
  21. package/controls/FirstPersonControls.cjs.js +1 -0
  22. package/controls/FirstPersonControls.js +193 -123
  23. package/controls/FlyControls.cjs.js +1 -0
  24. package/controls/FlyControls.d.ts +5 -4
  25. package/controls/FlyControls.js +160 -90
  26. package/controls/OrbitControls.cjs.js +1 -0
  27. package/controls/OrbitControls.js +481 -232
  28. package/controls/PointerLockControls.cjs.js +1 -0
  29. package/controls/PointerLockControls.js +99 -63
  30. package/controls/TrackballControls.cjs.js +1 -0
  31. package/controls/TrackballControls.js +383 -211
  32. package/controls/TransformControls.cjs.js +1 -0
  33. package/controls/TransformControls.js +782 -575
  34. package/controls/experimental/CameraControls.cjs.js +1 -0
  35. package/controls/experimental/CameraControls.js +609 -329
  36. package/csm/CSM.cjs.js +1 -0
  37. package/csm/CSM.js +108 -47
  38. package/csm/CSMFrustum.cjs.js +1 -0
  39. package/csm/CSMFrustum.js +29 -14
  40. package/csm/CSMHelper.cjs.js +1 -0
  41. package/csm/CSMHelper.js +34 -20
  42. package/csm/CSMShader.cjs.js +1 -0
  43. package/csm/CSMShader.js +11 -7
  44. package/curves/CurveExtras.cjs.js +1 -0
  45. package/curves/CurveExtras.js +115 -73
  46. package/curves/NURBSCurve.cjs.js +1 -0
  47. package/curves/NURBSCurve.js +43 -15
  48. package/curves/NURBSSurface.cjs.js +1 -0
  49. package/curves/NURBSSurface.js +27 -11
  50. package/curves/NURBSUtils.cjs.js +1 -0
  51. package/curves/NURBSUtils.js +203 -54
  52. package/custom.d.cjs.js +1 -0
  53. package/{shaders/types.mjs → custom.d.js} +0 -0
  54. package/deprecated/Geometry.cjs.js +1 -0
  55. package/deprecated/Geometry.js +486 -191
  56. package/effects/AnaglyphEffect.cjs.js +1 -0
  57. package/effects/AnaglyphEffect.js +60 -95
  58. package/effects/AsciiEffect.cjs.js +1 -0
  59. package/effects/AsciiEffect.js +110 -80
  60. package/effects/OutlineEffect.cjs.js +1 -0
  61. package/effects/OutlineEffect.js +204 -121
  62. package/effects/ParallaxBarrierEffect.cjs.js +1 -0
  63. package/effects/ParallaxBarrierEffect.js +38 -39
  64. package/effects/PeppersGhostEffect.cjs.js +1 -0
  65. package/effects/PeppersGhostEffect.js +68 -19
  66. package/effects/StereoEffect.cjs.js +1 -0
  67. package/effects/StereoEffect.js +16 -12
  68. package/environments/RoomEnvironment.cjs.js +1 -0
  69. package/environments/RoomEnvironment.js +47 -52
  70. package/exporters/ColladaExporter.cjs.js +1 -0
  71. package/exporters/ColladaExporter.js +241 -115
  72. package/exporters/DRACOExporter.cjs.js +1 -0
  73. package/exporters/DRACOExporter.js +121 -67
  74. package/exporters/GLTFExporter.cjs.js +1 -0
  75. package/exporters/GLTFExporter.js +1014 -463
  76. package/exporters/MMDExporter.cjs.js +1 -0
  77. package/exporters/MMDExporter.js +102 -44
  78. package/exporters/OBJExporter.cjs.js +1 -0
  79. package/exporters/OBJExporter.js +140 -78
  80. package/exporters/PLYExporter.cjs.js +1 -0
  81. package/exporters/PLYExporter.js +154 -93
  82. package/exporters/STLExporter.cjs.js +1 -0
  83. package/exporters/STLExporter.js +81 -30
  84. package/exporters/USDZExporter.cjs.js +1 -0
  85. package/exporters/USDZExporter.js +144 -84
  86. package/geometries/BoxLineGeometry.cjs.js +1 -0
  87. package/geometries/BoxLineGeometry.js +14 -7
  88. package/geometries/ConvexGeometry.cjs.js +1 -0
  89. package/geometries/ConvexGeometry.js +23 -14
  90. package/geometries/DecalGeometry.cjs.js +1 -0
  91. package/geometries/DecalGeometry.js +162 -108
  92. package/geometries/LightningStrike.cjs.js +1 -0
  93. package/geometries/LightningStrike.js +294 -101
  94. package/geometries/ParametricGeometries.cjs.js +1 -0
  95. package/geometries/ParametricGeometries.js +76 -26
  96. package/geometries/ParametricGeometry.cjs.js +1 -0
  97. package/geometries/ParametricGeometry.js +48 -24
  98. package/geometries/RoundedBoxGeometry.cjs.js +1 -0
  99. package/geometries/RoundedBoxGeometry.js +64 -33
  100. package/geometries/TeapotGeometry.cjs.js +1 -0
  101. package/geometries/TeapotGeometry.js +174 -1434
  102. package/geometries/TextGeometry.cjs.js +1 -0
  103. package/geometries/TextGeometry.js +17 -9
  104. package/helpers/LightProbeHelper.cjs.js +1 -0
  105. package/helpers/LightProbeHelper.js +21 -53
  106. package/helpers/PositionalAudioHelper.cjs.js +1 -0
  107. package/helpers/PositionalAudioHelper.js +30 -23
  108. package/helpers/RectAreaLightHelper.cjs.js +1 -0
  109. package/helpers/RectAreaLightHelper.js +33 -17
  110. package/helpers/VertexNormalsHelper.cjs.js +1 -0
  111. package/helpers/VertexNormalsHelper.js +41 -20
  112. package/helpers/VertexTangentsHelper.cjs.js +1 -0
  113. package/helpers/VertexTangentsHelper.js +36 -18
  114. package/index.cjs.js +1 -0
  115. package/index.js +333 -969
  116. package/interactive/InteractiveGroup.cjs.js +1 -0
  117. package/interactive/InteractiveGroup.d.ts +5 -0
  118. package/interactive/InteractiveGroup.js +87 -0
  119. package/interactive/SelectionBox.cjs.js +1 -0
  120. package/interactive/SelectionBox.js +46 -31
  121. package/interactive/SelectionHelper.cjs.js +1 -0
  122. package/interactive/SelectionHelper.js +21 -16
  123. package/libs/MeshoptDecoder.cjs.js +1 -0
  124. package/libs/MeshoptDecoder.js +58 -147
  125. package/libs/MotionControllers.cjs.js +1 -0
  126. package/libs/MotionControllers.js +208 -66
  127. package/lights/LightProbeGenerator.cjs.js +1 -0
  128. package/lights/LightProbeGenerator.js +96 -40
  129. package/lights/RectAreaLightUniformsLib.cjs.js +1 -0
  130. package/lights/RectAreaLightUniformsLib.js +9 -32842
  131. package/lines/Line2.cjs.js +1 -0
  132. package/lines/Line2.js +12 -9
  133. package/lines/LineGeometry.cjs.js +1 -0
  134. package/lines/LineGeometry.js +19 -7
  135. package/lines/LineMaterial.cjs.js +1 -0
  136. package/lines/LineMaterial.js +89 -51
  137. package/lines/LineSegments2.cjs.js +1 -0
  138. package/lines/LineSegments2.js +165 -56
  139. package/lines/LineSegmentsGeometry.cjs.js +1 -0
  140. package/lines/LineSegmentsGeometry.js +71 -29
  141. package/lines/Wireframe.cjs.js +1 -0
  142. package/lines/Wireframe.js +29 -15
  143. package/lines/WireframeGeometry2.cjs.js +1 -0
  144. package/lines/WireframeGeometry2.js +9 -8
  145. package/loaders/3DMLoader.cjs.js +1 -0
  146. package/loaders/3DMLoader.js +469 -234
  147. package/loaders/3MFLoader.cjs.js +1 -0
  148. package/loaders/3MFLoader.js +555 -340
  149. package/loaders/AMFLoader.cjs.js +1 -0
  150. package/loaders/AMFLoader.js +219 -114
  151. package/loaders/AssimpLoader.cjs.js +1 -0
  152. package/loaders/AssimpLoader.js +725 -328
  153. package/loaders/BVHLoader.cjs.js +1 -0
  154. package/loaders/BVHLoader.js +200 -94
  155. package/loaders/BasisTextureLoader.cjs.js +1 -0
  156. package/loaders/BasisTextureLoader.js +357 -229
  157. package/loaders/ColladaLoader.cjs.js +1 -0
  158. package/loaders/ColladaLoader.js +1522 -932
  159. package/loaders/DDSLoader.cjs.js +1 -0
  160. package/loaders/DDSLoader.js +108 -42
  161. package/loaders/DRACOLoader.cjs.js +1 -0
  162. package/loaders/DRACOLoader.js +210 -103
  163. package/loaders/EXRLoader.cjs.js +1 -0
  164. package/loaders/EXRLoader.js +809 -461
  165. package/loaders/FBXLoader.cjs.js +1 -0
  166. package/loaders/FBXLoader.js +1397 -842
  167. package/loaders/FontLoader.cjs.js +1 -0
  168. package/loaders/FontLoader.js +66 -33
  169. package/loaders/GCodeLoader.cjs.js +1 -0
  170. package/loaders/GCodeLoader.js +111 -63
  171. package/loaders/GLTFLoader.cjs.js +1 -0
  172. package/loaders/GLTFLoader.js +1484 -771
  173. package/loaders/HDRCubeTextureLoader.cjs.js +1 -0
  174. package/loaders/HDRCubeTextureLoader.js +50 -45
  175. package/loaders/KMZLoader.cjs.js +1 -0
  176. package/loaders/KMZLoader.js +55 -42
  177. package/loaders/KTX2Loader.cjs.js +1 -0
  178. package/loaders/KTX2Loader.js +362 -229
  179. package/loaders/KTXLoader.cjs.js +1 -0
  180. package/loaders/KTXLoader.js +99 -37
  181. package/loaders/LDrawLoader.cjs.js +1 -0
  182. package/loaders/LDrawLoader.js +746 -313
  183. package/loaders/LUT3dlLoader.cjs.js +1 -0
  184. package/loaders/LUT3dlLoader.js +62 -50
  185. package/loaders/LUTCubeLoader.cjs.js +1 -0
  186. package/loaders/LUTCubeLoader.js +56 -45
  187. package/loaders/LWOLoader.cjs.js +1 -0
  188. package/loaders/LWOLoader.js +339 -227
  189. package/loaders/LottieLoader.cjs.js +1 -0
  190. package/loaders/LottieLoader.js +38 -36
  191. package/loaders/MD2Loader.cjs.js +1 -0
  192. package/loaders/MD2Loader.js +91 -248
  193. package/loaders/MDDLoader.cjs.js +1 -0
  194. package/loaders/MDDLoader.js +45 -25
  195. package/loaders/MMDLoader.cjs.js +1 -0
  196. package/loaders/MMDLoader.js +795 -359
  197. package/loaders/MTLLoader.cjs.js +1 -0
  198. package/loaders/MTLLoader.js +201 -91
  199. package/loaders/NRRDLoader.cjs.js +1 -0
  200. package/loaders/NRRDLoader.js +263 -182
  201. package/loaders/NodeMaterialLoader.cjs.js +1 -0
  202. package/loaders/NodeMaterialLoader.js +14 -121
  203. package/loaders/OBJLoader.cjs.js +1 -0
  204. package/loaders/OBJLoader.js +283 -161
  205. package/loaders/PCDLoader.cjs.js +1 -0
  206. package/loaders/PCDLoader.js +164 -145
  207. package/loaders/PDBLoader.cjs.js +1 -0
  208. package/loaders/PDBLoader.js +63 -45
  209. package/loaders/PLYLoader.cjs.js +1 -0
  210. package/loaders/PLYLoader.js +203 -106
  211. package/loaders/PRWMLoader.cjs.js +1 -0
  212. package/loaders/PRWMLoader.js +110 -73
  213. package/loaders/PVRLoader.cjs.js +1 -0
  214. package/loaders/PVRLoader.js +93 -32
  215. package/loaders/RGBELoader.cjs.js +1 -0
  216. package/loaders/RGBELoader.js +233 -96
  217. package/loaders/RGBMLoader.cjs.js +1 -0
  218. package/loaders/RGBMLoader.js +514 -344
  219. package/loaders/STLLoader.cjs.js +1 -0
  220. package/loaders/STLLoader.js +165 -59
  221. package/loaders/SVGLoader.cjs.js +1 -0
  222. package/loaders/SVGLoader.js +851 -481
  223. package/loaders/TDSLoader.cjs.js +1 -0
  224. package/loaders/TDSLoader.js +527 -137
  225. package/loaders/TGALoader.cjs.js +1 -0
  226. package/loaders/TGALoader.js +205 -94
  227. package/loaders/TTFLoader.cjs.js +1 -0
  228. package/loaders/TTFLoader.js +79 -58
  229. package/loaders/TiltLoader.cjs.js +1 -0
  230. package/loaders/TiltLoader.js +167 -129
  231. package/loaders/VOXLoader.cjs.js +1 -0
  232. package/loaders/VOXLoader.js +84 -320
  233. package/loaders/VRMLLoader.cjs.js +1 -0
  234. package/loaders/VRMLLoader.js +1268 -786
  235. package/loaders/VRMLoader.cjs.js +1 -0
  236. package/loaders/VRMLoader.js +31 -23
  237. package/loaders/VTKLoader.cjs.js +1 -0
  238. package/loaders/VTKLoader.js +407 -219
  239. package/loaders/XLoader.cjs.js +1 -0
  240. package/loaders/XLoader.js +1259 -1083
  241. package/loaders/XYZLoader.cjs.js +1 -0
  242. package/loaders/XYZLoader.js +34 -28
  243. package/loaders/lwo/IFFParser.cjs.js +1 -0
  244. package/loaders/lwo/IFFParser.js +492 -238
  245. package/loaders/lwo/LWO2Parser.cjs.js +1 -0
  246. package/loaders/lwo/LWO2Parser.js +279 -176
  247. package/loaders/lwo/LWO3Parser.cjs.js +1 -0
  248. package/loaders/lwo/LWO3Parser.js +247 -160
  249. package/math/Capsule.cjs.js +1 -0
  250. package/math/Capsule.js +43 -56
  251. package/math/ColorConverter.cjs.js +1 -0
  252. package/math/ColorConverter.js +32 -18
  253. package/math/ConvexHull.cjs.js +1 -0
  254. package/math/ConvexHull.js +357 -97
  255. package/math/ImprovedNoise.cjs.js +1 -0
  256. package/math/ImprovedNoise.js +32 -282
  257. package/math/Lut.cjs.js +1 -0
  258. package/math/Lut.js +35 -51
  259. package/math/MeshSurfaceSampler.cjs.js +1 -0
  260. package/math/MeshSurfaceSampler.js +68 -25
  261. package/math/OBB.cjs.js +1 -0
  262. package/math/OBB.js +152 -91
  263. package/math/Octree.cjs.js +1 -0
  264. package/math/Octree.js +139 -76
  265. package/math/SimplexNoise.cjs.js +1 -0
  266. package/math/SimplexNoise.js +238 -217
  267. package/misc/ConvexObjectBreaker.cjs.js +1 -0
  268. package/misc/ConvexObjectBreaker.js +185 -79
  269. package/misc/GPUComputationRenderer.cjs.js +1 -0
  270. package/misc/GPUComputationRenderer.js +194 -69
  271. package/misc/Gyroscope.cjs.js +1 -0
  272. package/misc/Gyroscope.js +22 -16
  273. package/misc/MD2Character.cjs.js +1 -0
  274. package/misc/MD2Character.js +74 -52
  275. package/misc/MD2CharacterComplex.cjs.js +1 -0
  276. package/misc/MD2CharacterComplex.js +163 -112
  277. package/misc/MorphAnimMesh.cjs.js +1 -0
  278. package/misc/MorphAnimMesh.js +28 -20
  279. package/misc/MorphBlendMesh.cjs.js +1 -0
  280. package/misc/MorphBlendMesh.js +69 -45
  281. package/misc/ProgressiveLightmap.cjs.js +1 -0
  282. package/misc/ProgressiveLightmap.js +187 -70
  283. package/misc/RollerCoaster.cjs.js +1 -0
  284. package/misc/RollerCoaster.js +135 -106
  285. package/misc/TubePainter.cjs.js +1 -0
  286. package/misc/TubePainter.js +92 -74
  287. package/misc/Volume.cjs.js +1 -0
  288. package/misc/Volume.js +270 -108
  289. package/misc/VolumeSlice.cjs.js +1 -0
  290. package/misc/VolumeSlice.js +122 -34
  291. package/misc/WebGL.cjs.js +1 -0
  292. package/misc/WebGL.js +34 -37
  293. package/modifiers/CurveModifier.cjs.js +1 -0
  294. package/modifiers/CurveModifier.js +151 -46
  295. package/modifiers/EdgeSplitModifier.cjs.js +1 -0
  296. package/modifiers/EdgeSplitModifier.js +90 -46
  297. package/modifiers/SimplifyModifier.cjs.js +1 -0
  298. package/modifiers/SimplifyModifier.js +202 -77
  299. package/modifiers/TessellateModifier.cjs.js +1 -0
  300. package/modifiers/TessellateModifier.js +90 -65
  301. package/nodes/Nodes.cjs.js +1 -0
  302. package/nodes/Nodes.js +140 -274
  303. package/nodes/ShaderNode.cjs.js +1 -0
  304. package/nodes/ShaderNode.js +196 -296
  305. package/nodes/accessors/BufferNode.cjs.js +1 -0
  306. package/nodes/accessors/BufferNode.js +8 -4
  307. package/nodes/accessors/CameraNode.cjs.js +1 -0
  308. package/nodes/accessors/CameraNode.js +25 -20
  309. package/nodes/accessors/CubeTextureNode.cjs.js +1 -0
  310. package/nodes/accessors/CubeTextureNode.js +26 -14
  311. package/nodes/accessors/MaterialNode.cjs.js +1 -0
  312. package/nodes/accessors/MaterialNode.js +53 -43
  313. package/nodes/accessors/MaterialReferenceNode.cjs.js +1 -0
  314. package/nodes/accessors/MaterialReferenceNode.js +6 -3
  315. package/nodes/accessors/ModelNode.cjs.js +1 -0
  316. package/nodes/accessors/ModelNode.js +5 -3
  317. package/nodes/accessors/ModelViewProjectionNode.cjs.js +1 -0
  318. package/nodes/accessors/ModelViewProjectionNode.js +13 -14
  319. package/nodes/accessors/NormalNode.cjs.js +1 -0
  320. package/nodes/accessors/NormalNode.js +39 -40
  321. package/nodes/accessors/Object3DNode.cjs.js +1 -0
  322. package/nodes/accessors/Object3DNode.js +50 -40
  323. package/nodes/accessors/PointUVNode.cjs.js +1 -0
  324. package/nodes/accessors/PointUVNode.js +9 -5
  325. package/nodes/accessors/PositionNode.cjs.js +1 -0
  326. package/nodes/accessors/PositionNode.js +41 -42
  327. package/nodes/accessors/ReferenceNode.cjs.js +1 -0
  328. package/nodes/accessors/ReferenceNode.js +17 -10
  329. package/nodes/accessors/ReflectNode.cjs.js +1 -0
  330. package/nodes/accessors/ReflectNode.js +26 -23
  331. package/nodes/accessors/SkinningNode.cjs.js +1 -0
  332. package/nodes/accessors/SkinningNode.js +48 -46
  333. package/nodes/accessors/TextureNode.cjs.js +1 -0
  334. package/nodes/accessors/TextureNode.js +29 -14
  335. package/nodes/accessors/UVNode.cjs.js +1 -0
  336. package/nodes/accessors/UVNode.js +11 -5
  337. package/nodes/core/ArrayUniformNode.cjs.js +1 -0
  338. package/nodes/core/ArrayUniformNode.js +7 -3
  339. package/nodes/core/AttributeNode.cjs.js +1 -0
  340. package/nodes/core/AttributeNode.js +12 -5
  341. package/nodes/core/BypassNode.cjs.js +1 -0
  342. package/nodes/core/BypassNode.js +12 -5
  343. package/nodes/core/CodeNode.cjs.js +1 -0
  344. package/nodes/core/CodeNode.js +12 -4
  345. package/nodes/core/ConstNode.cjs.js +1 -0
  346. package/nodes/core/ConstNode.js +7 -3
  347. package/nodes/core/ContextNode.cjs.js +1 -0
  348. package/nodes/core/ContextNode.js +8 -3
  349. package/nodes/core/ExpressionNode.cjs.js +1 -0
  350. package/nodes/core/ExpressionNode.js +9 -5
  351. package/nodes/core/FunctionCallNode.cjs.js +1 -0
  352. package/nodes/core/FunctionCallNode.js +15 -6
  353. package/nodes/core/FunctionNode.cjs.js +1 -0
  354. package/nodes/core/FunctionNode.js +25 -10
  355. package/nodes/core/InputNode.cjs.js +1 -0
  356. package/nodes/core/InputNode.js +23 -12
  357. package/nodes/core/Node.cjs.js +1 -0
  358. package/nodes/core/Node.js +75 -35
  359. package/nodes/core/NodeAttribute.cjs.js +1 -0
  360. package/nodes/core/NodeAttribute.js +4 -2
  361. package/nodes/core/NodeBuilder.cjs.js +1 -0
  362. package/nodes/core/NodeBuilder.js +224 -110
  363. package/nodes/core/NodeCode.cjs.js +1 -0
  364. package/nodes/core/NodeCode.js +7 -4
  365. package/nodes/core/NodeFrame.cjs.js +1 -0
  366. package/nodes/core/NodeFrame.js +12 -9
  367. package/nodes/core/NodeFunction.cjs.js +1 -0
  368. package/nodes/core/NodeFunction.js +17 -0
  369. package/nodes/core/NodeFunctionInput.cjs.js +1 -0
  370. package/nodes/core/NodeFunctionInput.js +5 -3
  371. package/nodes/core/NodeKeywords.cjs.js +1 -0
  372. package/nodes/core/NodeKeywords.js +16 -5
  373. package/nodes/core/NodeParser.cjs.js +1 -0
  374. package/nodes/core/NodeParser.js +8 -0
  375. package/nodes/core/NodeUniform.cjs.js +1 -0
  376. package/nodes/core/NodeUniform.js +7 -3
  377. package/nodes/core/NodeUtils.cjs.js +1 -0
  378. package/nodes/core/NodeUtils.js +43 -39
  379. package/nodes/core/NodeVar.cjs.js +1 -0
  380. package/nodes/core/NodeVar.js +4 -2
  381. package/nodes/core/NodeVary.cjs.js +1 -0
  382. package/nodes/core/NodeVary.js +4 -2
  383. package/nodes/core/PropertyNode.cjs.js +1 -0
  384. package/nodes/core/PropertyNode.js +10 -4
  385. package/nodes/core/TempNode.cjs.js +1 -0
  386. package/nodes/core/TempNode.js +11 -5
  387. package/nodes/core/UniformNode.cjs.js +1 -0
  388. package/nodes/core/UniformNode.js +10 -4
  389. package/nodes/core/VarNode.cjs.js +1 -0
  390. package/nodes/core/VarNode.js +11 -3
  391. package/nodes/core/VaryNode.cjs.js +1 -0
  392. package/nodes/core/VaryNode.js +15 -6
  393. package/nodes/core/constants.cjs.js +1 -0
  394. package/nodes/core/constants.js +7 -20
  395. package/nodes/display/ColorSpaceNode.cjs.js +1 -0
  396. package/nodes/display/ColorSpaceNode.js +38 -34
  397. package/nodes/display/NormalMapNode.cjs.js +1 -0
  398. package/nodes/display/NormalMapNode.js +53 -35
  399. package/nodes/fog/FogNode.cjs.js +1 -0
  400. package/nodes/fog/FogNode.js +9 -5
  401. package/nodes/fog/FogRangeNode.cjs.js +1 -0
  402. package/nodes/fog/FogRangeNode.js +9 -5
  403. package/nodes/functions/BSDFs.cjs.js +1 -0
  404. package/nodes/functions/BSDFs.js +118 -61
  405. package/nodes/functions/PhysicalMaterialFunctions.cjs.js +1 -0
  406. package/nodes/functions/PhysicalMaterialFunctions.js +57 -0
  407. package/nodes/lights/LightContextNode.cjs.js +1 -0
  408. package/nodes/lights/LightContextNode.js +23 -14
  409. package/nodes/lights/LightNode.cjs.js +1 -0
  410. package/nodes/lights/LightNode.js +31 -27
  411. package/nodes/lights/LightsNode.cjs.js +1 -0
  412. package/nodes/lights/LightsNode.js +28 -9
  413. package/nodes/loaders/NodeLoader.cjs.js +1 -0
  414. package/nodes/loaders/NodeLoader.js +42 -27
  415. package/nodes/loaders/NodeMaterialLoader.cjs.js +1 -0
  416. package/nodes/loaders/NodeMaterialLoader.js +10 -4
  417. package/nodes/loaders/NodeObjectLoader.cjs.js +1 -0
  418. package/nodes/loaders/NodeObjectLoader.js +19 -9
  419. package/nodes/materials/LineBasicNodeMaterial.cjs.js +1 -0
  420. package/nodes/materials/LineBasicNodeMaterial.js +10 -5
  421. package/nodes/materials/Materials.cjs.js +1 -0
  422. package/nodes/materials/Materials.js +17 -14
  423. package/nodes/materials/MeshBasicNodeMaterial.cjs.js +1 -0
  424. package/nodes/materials/MeshBasicNodeMaterial.js +10 -5
  425. package/nodes/materials/MeshStandardNodeMaterial.cjs.js +1 -0
  426. package/nodes/materials/MeshStandardNodeMaterial.js +8 -5
  427. package/nodes/materials/NodeMaterial.cjs.js +1 -0
  428. package/nodes/materials/NodeMaterial.js +36 -20
  429. package/nodes/materials/PointsNodeMaterial.cjs.js +1 -0
  430. package/nodes/materials/PointsNodeMaterial.js +10 -5
  431. package/nodes/math/CondNode.cjs.js +1 -0
  432. package/nodes/math/CondNode.js +23 -11
  433. package/nodes/math/MathNode.cjs.js +1 -0
  434. package/nodes/math/MathNode.js +142 -98
  435. package/nodes/math/OperatorNode.cjs.js +1 -0
  436. package/nodes/math/OperatorNode.js +46 -24
  437. package/nodes/parsers/GLSLNodeFunction.cjs.js +1 -0
  438. package/nodes/parsers/GLSLNodeFunction.js +101 -0
  439. package/nodes/parsers/GLSLNodeParser.cjs.js +1 -0
  440. package/nodes/parsers/GLSLNodeParser.js +13 -0
  441. package/nodes/parsers/WGSLNodeFunction.cjs.js +1 -0
  442. package/nodes/parsers/WGSLNodeFunction.js +71 -0
  443. package/nodes/parsers/WGSLNodeParser.cjs.js +1 -0
  444. package/nodes/parsers/WGSLNodeParser.js +13 -0
  445. package/nodes/procedural/CheckerNode.cjs.js +1 -0
  446. package/nodes/procedural/CheckerNode.js +19 -13
  447. package/nodes/utils/ArrayElementNode.cjs.js +1 -0
  448. package/nodes/utils/ArrayElementNode.js +8 -4
  449. package/nodes/utils/ConvertNode.cjs.js +1 -0
  450. package/nodes/utils/ConvertNode.js +8 -3
  451. package/nodes/utils/JoinNode.cjs.js +1 -0
  452. package/nodes/utils/JoinNode.js +11 -7
  453. package/nodes/utils/MatcapUVNode.cjs.js +1 -0
  454. package/nodes/utils/MatcapUVNode.js +11 -8
  455. package/nodes/utils/OscNode.cjs.js +1 -0
  456. package/nodes/utils/OscNode.js +33 -27
  457. package/nodes/utils/SplitNode.cjs.js +1 -0
  458. package/nodes/utils/SplitNode.js +20 -6
  459. package/nodes/utils/SpriteSheetUVNode.cjs.js +1 -0
  460. package/nodes/utils/SpriteSheetUVNode.js +23 -23
  461. package/nodes/utils/TimerNode.cjs.js +1 -0
  462. package/nodes/utils/TimerNode.js +24 -20
  463. package/objects/GroundProjectedEnv.cjs.js +1 -0
  464. package/objects/GroundProjectedEnv.js +37 -22
  465. package/objects/Lensflare.cjs.js +1 -0
  466. package/objects/Lensflare.js +156 -86
  467. package/objects/LightningStorm.cjs.js +1 -0
  468. package/objects/LightningStorm.js +102 -38
  469. package/objects/MarchingCubes.cjs.js +1 -0
  470. package/objects/MarchingCubes.js +303 -150
  471. package/objects/Reflector.cjs.js +1 -0
  472. package/objects/Reflector.js +72 -50
  473. package/objects/ReflectorForSSRPass.cjs.js +1 -0
  474. package/objects/ReflectorForSSRPass.js +131 -80
  475. package/objects/ReflectorRTT.cjs.js +1 -0
  476. package/objects/ReflectorRTT.js +7 -6
  477. package/objects/Refractor.cjs.js +1 -0
  478. package/objects/Refractor.js +106 -64
  479. package/objects/ShadowMesh.cjs.js +1 -0
  480. package/objects/ShadowMesh.js +17 -8
  481. package/objects/Sky.cjs.js +1 -0
  482. package/objects/Sky.js +80 -119
  483. package/objects/Water.cjs.js +1 -0
  484. package/objects/Water.js +127 -83
  485. package/objects/Water2.cjs.js +1 -0
  486. package/objects/Water2.js +108 -72
  487. package/offscreen/jank.cjs.js +1 -0
  488. package/offscreen/jank.js +14 -10
  489. package/offscreen/offscreen.cjs.js +1 -0
  490. package/offscreen/offscreen.js +5 -4
  491. package/offscreen/scene.cjs.js +1 -0
  492. package/offscreen/scene.js +48 -45
  493. package/package.json +3 -3
  494. package/physics/AmmoPhysics.cjs.js +1 -0
  495. package/physics/AmmoPhysics.js +71 -30
  496. package/postprocessing/AdaptiveToneMappingPass.cjs.js +1 -0
  497. package/postprocessing/AdaptiveToneMappingPass.js +123 -97
  498. package/postprocessing/AfterimagePass.cjs.js +1 -0
  499. package/postprocessing/AfterimagePass.js +49 -28
  500. package/postprocessing/BloomPass.cjs.js +1 -0
  501. package/postprocessing/BloomPass.js +69 -43
  502. package/postprocessing/BokehPass.cjs.js +1 -0
  503. package/postprocessing/BokehPass.js +69 -39
  504. package/postprocessing/ClearPass.cjs.js +1 -0
  505. package/postprocessing/ClearPass.js +25 -10
  506. package/postprocessing/CubeTexturePass.cjs.js +1 -0
  507. package/postprocessing/CubeTexturePass.js +27 -28
  508. package/postprocessing/DotScreenPass.cjs.js +1 -0
  509. package/postprocessing/DotScreenPass.js +32 -24
  510. package/postprocessing/EffectComposer.cjs.js +1 -0
  511. package/postprocessing/EffectComposer.js +86 -39
  512. package/postprocessing/FilmPass.cjs.js +1 -0
  513. package/postprocessing/FilmPass.js +30 -25
  514. package/postprocessing/GlitchPass.cjs.js +1 -0
  515. package/postprocessing/GlitchPass.js +61 -38
  516. package/postprocessing/HalftonePass.cjs.js +1 -0
  517. package/postprocessing/HalftonePass.js +39 -19
  518. package/postprocessing/LUTPass.cjs.js +1 -0
  519. package/postprocessing/LUTPass.js +38 -13
  520. package/postprocessing/MaskPass.cjs.js +1 -0
  521. package/postprocessing/MaskPass.js +38 -19
  522. package/postprocessing/OutlinePass.cjs.js +1 -0
  523. package/postprocessing/OutlinePass.js +277 -135
  524. package/postprocessing/Pass.cjs.js +1 -0
  525. package/postprocessing/Pass.js +44 -20
  526. package/postprocessing/RenderPass.cjs.js +1 -0
  527. package/postprocessing/RenderPass.js +36 -13
  528. package/postprocessing/RenderPixelatedPass.cjs.js +1 -0
  529. package/postprocessing/RenderPixelatedPass.js +58 -44
  530. package/postprocessing/SAOPass.cjs.js +1 -0
  531. package/postprocessing/SAOPass.js +189 -154
  532. package/postprocessing/SMAAPass.cjs.js +1 -0
  533. package/postprocessing/SMAAPass.js +84 -64
  534. package/postprocessing/SSAARenderPass.cjs.js +1 -0
  535. package/postprocessing/SSAARenderPass.js +69 -121
  536. package/postprocessing/SSAOPass.cjs.js +1 -0
  537. package/postprocessing/SSAOPass.js +172 -123
  538. package/postprocessing/SSRPass.cjs.js +1 -0
  539. package/postprocessing/SSRPass.js +280 -211
  540. package/postprocessing/SavePass.cjs.js +1 -0
  541. package/postprocessing/SavePass.js +25 -20
  542. package/postprocessing/ShaderPass.cjs.js +1 -0
  543. package/postprocessing/ShaderPass.js +30 -14
  544. package/postprocessing/TAARenderPass.cjs.js +1 -0
  545. package/postprocessing/TAARenderPass.js +61 -42
  546. package/postprocessing/TexturePass.cjs.js +1 -0
  547. package/postprocessing/TexturePass.js +22 -21
  548. package/postprocessing/UnrealBloomPass.cjs.js +1 -0
  549. package/postprocessing/UnrealBloomPass.js +213 -105
  550. package/renderers/CSS2DRenderer.cjs.js +1 -0
  551. package/renderers/CSS2DRenderer.js +56 -44
  552. package/renderers/CSS3DRenderer.cjs.js +1 -0
  553. package/renderers/CSS3DRenderer.js +86 -53
  554. package/renderers/Projector.cjs.js +1 -0
  555. package/renderers/Projector.js +274 -107
  556. package/renderers/SVGRenderer.cjs.js +1 -0
  557. package/renderers/SVGRenderer.js +182 -72
  558. package/renderers/nodes/accessors/CameraNode.cjs.js +1 -0
  559. package/renderers/nodes/accessors/CameraNode.js +40 -29
  560. package/renderers/nodes/accessors/ModelNode.cjs.js +1 -0
  561. package/renderers/nodes/accessors/ModelNode.js +37 -28
  562. package/renderers/nodes/accessors/ModelViewProjectionNode.cjs.js +1 -0
  563. package/renderers/nodes/accessors/ModelViewProjectionNode.js +23 -10
  564. package/renderers/nodes/accessors/NormalNode.cjs.js +1 -0
  565. package/renderers/nodes/accessors/NormalNode.js +45 -35
  566. package/renderers/nodes/accessors/PositionNode.cjs.js +1 -0
  567. package/renderers/nodes/accessors/PositionNode.js +19 -18
  568. package/renderers/nodes/accessors/UVNode.cjs.js +1 -0
  569. package/renderers/nodes/accessors/UVNode.js +10 -5
  570. package/renderers/nodes/core/AttributeNode.cjs.js +1 -0
  571. package/renderers/nodes/core/AttributeNode.js +14 -5
  572. package/renderers/nodes/core/InputNode.cjs.js +1 -0
  573. package/renderers/nodes/core/InputNode.js +14 -4
  574. package/renderers/nodes/core/Node.cjs.js +1 -0
  575. package/renderers/nodes/core/Node.js +17 -7
  576. package/renderers/nodes/core/NodeAttribute.cjs.js +1 -0
  577. package/renderers/nodes/core/NodeAttribute.js +6 -3
  578. package/renderers/nodes/core/NodeBuilder.cjs.js +1 -0
  579. package/renderers/nodes/core/NodeBuilder.js +154 -87
  580. package/renderers/nodes/core/NodeFrame.cjs.js +1 -0
  581. package/renderers/nodes/core/NodeFrame.js +12 -9
  582. package/renderers/nodes/core/NodeSlot.cjs.js +1 -0
  583. package/renderers/nodes/core/NodeSlot.js +3 -2
  584. package/renderers/nodes/core/NodeUniform.cjs.js +1 -0
  585. package/renderers/nodes/core/NodeUniform.js +9 -4
  586. package/renderers/nodes/core/NodeVary.cjs.js +1 -0
  587. package/renderers/nodes/core/NodeVary.js +7 -4
  588. package/renderers/nodes/core/VaryNode.cjs.js +1 -0
  589. package/renderers/nodes/core/VaryNode.js +12 -6
  590. package/renderers/nodes/core/constants.cjs.js +1 -0
  591. package/renderers/nodes/core/constants.js +13 -16
  592. package/renderers/nodes/inputs/ColorNode.cjs.js +1 -0
  593. package/renderers/nodes/inputs/ColorNode.js +11 -5
  594. package/renderers/nodes/inputs/FloatNode.cjs.js +1 -0
  595. package/renderers/nodes/inputs/FloatNode.js +11 -5
  596. package/renderers/nodes/inputs/Matrix3Node.cjs.js +1 -0
  597. package/renderers/nodes/inputs/Matrix3Node.js +13 -7
  598. package/renderers/nodes/inputs/Matrix4Node.cjs.js +1 -0
  599. package/renderers/nodes/inputs/Matrix4Node.js +13 -7
  600. package/renderers/nodes/inputs/TextureNode.cjs.js +1 -0
  601. package/renderers/nodes/inputs/TextureNode.js +15 -7
  602. package/renderers/nodes/inputs/Vector2Node.cjs.js +1 -0
  603. package/renderers/nodes/inputs/Vector2Node.js +11 -5
  604. package/renderers/nodes/inputs/Vector3Node.cjs.js +1 -0
  605. package/renderers/nodes/inputs/Vector3Node.js +13 -7
  606. package/renderers/nodes/inputs/Vector4Node.cjs.js +1 -0
  607. package/renderers/nodes/inputs/Vector4Node.js +13 -7
  608. package/renderers/nodes/math/MathNode.cjs.js +1 -0
  609. package/renderers/nodes/math/MathNode.js +30 -20
  610. package/renderers/nodes/math/OperatorNode.cjs.js +1 -0
  611. package/renderers/nodes/math/OperatorNode.js +20 -4
  612. package/renderers/nodes/utils/SwitchNode.cjs.js +1 -0
  613. package/renderers/nodes/utils/SwitchNode.js +9 -4
  614. package/renderers/nodes/utils/TimerNode.cjs.js +1 -0
  615. package/renderers/nodes/utils/TimerNode.js +10 -5
  616. package/renderers/webgpu/WebGPU.cjs.js +1 -0
  617. package/renderers/webgpu/WebGPU.js +16 -14
  618. package/renderers/webgpu/WebGPUAttributes.cjs.js +1 -0
  619. package/renderers/webgpu/WebGPUAttributes.js +23 -16
  620. package/renderers/webgpu/WebGPUBackground.cjs.js +1 -0
  621. package/renderers/webgpu/WebGPUBackground.js +30 -13
  622. package/renderers/webgpu/WebGPUBinding.cjs.js +1 -0
  623. package/renderers/webgpu/WebGPUBinding.js +7 -4
  624. package/renderers/webgpu/WebGPUBindings.cjs.js +1 -0
  625. package/renderers/webgpu/WebGPUBindings.js +57 -21
  626. package/renderers/webgpu/WebGPUComputePipelines.cjs.js +1 -0
  627. package/renderers/webgpu/WebGPUComputePipelines.js +25 -14
  628. package/renderers/webgpu/WebGPUGeometries.cjs.js +1 -0
  629. package/renderers/webgpu/WebGPUGeometries.js +15 -5
  630. package/renderers/webgpu/WebGPUInfo.cjs.js +1 -0
  631. package/renderers/webgpu/WebGPUInfo.js +8 -3
  632. package/renderers/webgpu/WebGPUObjects.cjs.js +1 -0
  633. package/renderers/webgpu/WebGPUObjects.js +10 -5
  634. package/renderers/webgpu/WebGPUProperties.cjs.js +1 -0
  635. package/renderers/webgpu/WebGPUProperties.js +11 -5
  636. package/renderers/webgpu/WebGPURenderLists.cjs.js +1 -0
  637. package/renderers/webgpu/WebGPURenderLists.js +36 -20
  638. package/renderers/webgpu/WebGPURenderPipelines.cjs.js +1 -0
  639. package/renderers/webgpu/WebGPURenderPipelines.js +387 -260
  640. package/renderers/webgpu/WebGPURenderer.cjs.js +1 -0
  641. package/renderers/webgpu/WebGPURenderer.js +262 -124
  642. package/renderers/webgpu/WebGPUSampledTexture.cjs.js +1 -0
  643. package/renderers/webgpu/WebGPUSampledTexture.js +31 -18
  644. package/renderers/webgpu/WebGPUSampler.cjs.js +1 -0
  645. package/renderers/webgpu/WebGPUSampler.js +12 -7
  646. package/renderers/webgpu/WebGPUStorageBuffer.cjs.js +1 -0
  647. package/renderers/webgpu/WebGPUStorageBuffer.js +12 -7
  648. package/renderers/webgpu/WebGPUTextureRenderer.cjs.js +1 -0
  649. package/renderers/webgpu/WebGPUTextureRenderer.js +11 -5
  650. package/renderers/webgpu/WebGPUTextureUtils.cjs.js +1 -0
  651. package/renderers/webgpu/WebGPUTextureUtils.js +40 -29
  652. package/renderers/webgpu/WebGPUTextures.cjs.js +1 -0
  653. package/renderers/webgpu/WebGPUTextures.js +333 -186
  654. package/renderers/webgpu/WebGPUUniform.cjs.js +1 -0
  655. package/renderers/webgpu/WebGPUUniform.js +51 -25
  656. package/renderers/webgpu/WebGPUUniformsGroup.cjs.js +1 -0
  657. package/renderers/webgpu/WebGPUUniformsGroup.js +72 -32
  658. package/renderers/webgpu/constants.cjs.js +1 -0
  659. package/renderers/webgpu/constants.js +181 -190
  660. package/renderers/webgpu/nodes/ShaderLib.cjs.js +1 -0
  661. package/renderers/webgpu/nodes/ShaderLib.js +2 -2
  662. package/renderers/webgpu/nodes/WebGPUNodeBuilder.cjs.js +1 -0
  663. package/renderers/webgpu/nodes/WebGPUNodeBuilder.js +124 -53
  664. package/renderers/webgpu/nodes/WebGPUNodeUniform.cjs.js +1 -0
  665. package/renderers/webgpu/nodes/WebGPUNodeUniform.js +31 -17
  666. package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.cjs.js +1 -0
  667. package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +9 -8
  668. package/renderers/webgpu/nodes/WebGPUNodes.cjs.js +1 -0
  669. package/renderers/webgpu/nodes/WebGPUNodes.js +45 -7
  670. package/shaders/ACESFilmicToneMappingShader.cjs.js +1 -0
  671. package/shaders/ACESFilmicToneMappingShader.js +24 -44
  672. package/shaders/AfterimageShader.cjs.js +1 -0
  673. package/shaders/AfterimageShader.js +18 -28
  674. package/shaders/BasicShader.cjs.js +1 -0
  675. package/shaders/BasicShader.js +7 -9
  676. package/shaders/BleachBypassShader.cjs.js +1 -0
  677. package/shaders/BleachBypassShader.js +15 -31
  678. package/shaders/BlendShader.cjs.js +1 -0
  679. package/shaders/BlendShader.js +19 -26
  680. package/shaders/BokehShader.cjs.js +1 -0
  681. package/shaders/BokehShader.js +36 -98
  682. package/shaders/BokehShader2.cjs.js +1 -0
  683. package/shaders/BokehShader2.js +90 -261
  684. package/shaders/BrightnessContrastShader.cjs.js +1 -0
  685. package/shaders/BrightnessContrastShader.js +19 -28
  686. package/shaders/ColorCorrectionShader.cjs.js +1 -0
  687. package/shaders/ColorCorrectionShader.js +22 -26
  688. package/shaders/ColorifyShader.cjs.js +1 -0
  689. package/shaders/ColorifyShader.js +16 -24
  690. package/shaders/ConvolutionShader.cjs.js +1 -0
  691. package/shaders/ConvolutionShader.js +36 -40
  692. package/shaders/CopyShader.cjs.js +1 -0
  693. package/shaders/CopyShader.js +13 -21
  694. package/shaders/DOFMipMapShader.cjs.js +1 -0
  695. package/shaders/DOFMipMapShader.js +21 -28
  696. package/shaders/DepthLimitedBlurShader.cjs.js +1 -0
  697. package/shaders/DepthLimitedBlurShader.js +40 -85
  698. package/shaders/DigitalGlitch.cjs.js +1 -0
  699. package/shaders/DigitalGlitch.js +46 -74
  700. package/shaders/DotScreenShader.cjs.js +1 -0
  701. package/shaders/DotScreenShader.js +27 -35
  702. package/shaders/FXAAShader.cjs.js +1 -0
  703. package/shaders/FXAAShader.js +19 -1094
  704. package/shaders/FilmShader.cjs.js +1 -0
  705. package/shaders/FilmShader.js +52 -38
  706. package/shaders/FocusShader.cjs.js +1 -0
  707. package/shaders/FocusShader.js +24 -51
  708. package/shaders/FreiChenShader.cjs.js +1 -0
  709. package/shaders/FreiChenShader.js +24 -57
  710. package/shaders/FresnelShader.cjs.js +1 -0
  711. package/shaders/FresnelShader.js +22 -43
  712. package/shaders/GammaCorrectionShader.cjs.js +1 -0
  713. package/shaders/GammaCorrectionShader.js +11 -19
  714. package/shaders/GodRaysShader.cjs.js +1 -0
  715. package/shaders/GodRaysShader.js +94 -103
  716. package/shaders/HalftoneShader.cjs.js +1 -0
  717. package/shaders/HalftoneShader.js +65 -208
  718. package/shaders/HorizontalBlurShader.cjs.js +1 -0
  719. package/shaders/HorizontalBlurShader.js +23 -7
  720. package/shaders/HorizontalTiltShiftShader.cjs.js +1 -0
  721. package/shaders/HorizontalTiltShiftShader.js +21 -33
  722. package/shaders/HueSaturationShader.cjs.js +1 -0
  723. package/shaders/HueSaturationShader.js +21 -37
  724. package/shaders/KaleidoShader.cjs.js +1 -0
  725. package/shaders/KaleidoShader.js +22 -30
  726. package/shaders/LuminosityHighPassShader.cjs.js +1 -0
  727. package/shaders/LuminosityHighPassShader.js +27 -33
  728. package/shaders/LuminosityShader.cjs.js +1 -0
  729. package/shaders/LuminosityShader.js +11 -21
  730. package/shaders/MirrorShader.cjs.js +1 -0
  731. package/shaders/MirrorShader.js +16 -31
  732. package/shaders/NormalMapShader.cjs.js +1 -0
  733. package/shaders/NormalMapShader.js +23 -27
  734. package/shaders/ParallaxShader.cjs.js +1 -0
  735. package/shaders/ParallaxShader.js +48 -107
  736. package/shaders/PixelShader.cjs.js +1 -0
  737. package/shaders/PixelShader.js +16 -24
  738. package/shaders/RGBShiftShader.cjs.js +1 -0
  739. package/shaders/RGBShiftShader.js +22 -26
  740. package/shaders/SAOShader.cjs.js +1 -0
  741. package/shaders/SAOShader.js +48 -132
  742. package/shaders/SMAAShader.cjs.js +1 -0
  743. package/shaders/SMAAShader.js +135 -256
  744. package/shaders/SSAOShader.cjs.js +1 -0
  745. package/shaders/SSAOShader.js +81 -153
  746. package/shaders/SSRShader.cjs.js +1 -0
  747. package/shaders/SSRShader.js +87 -32
  748. package/shaders/SepiaShader.cjs.js +1 -0
  749. package/shaders/SepiaShader.js +15 -25
  750. package/shaders/SobelOperatorShader.cjs.js +1 -0
  751. package/shaders/SobelOperatorShader.js +29 -40
  752. package/shaders/SubsurfaceScatteringShader.cjs.js +1 -0
  753. package/shaders/SubsurfaceScatteringShader.js +39 -53
  754. package/shaders/TechnicolorShader.cjs.js +1 -0
  755. package/shaders/TechnicolorShader.js +13 -20
  756. package/shaders/ToneMapShader.cjs.js +1 -0
  757. package/shaders/ToneMapShader.js +28 -44
  758. package/shaders/ToonShader.cjs.js +1 -0
  759. package/shaders/ToonShader.js +96 -172
  760. package/shaders/TriangleBlurShader.cjs.js +1 -0
  761. package/shaders/TriangleBlurShader.js +23 -32
  762. package/shaders/UnpackDepthRGBAShader.cjs.js +1 -0
  763. package/shaders/UnpackDepthRGBAShader.js +14 -22
  764. package/shaders/VerticalBlurShader.cjs.js +1 -0
  765. package/shaders/VerticalBlurShader.js +23 -7
  766. package/shaders/VerticalTiltShiftShader.cjs.js +1 -0
  767. package/shaders/VerticalTiltShiftShader.js +21 -33
  768. package/shaders/VignetteShader.cjs.js +1 -0
  769. package/shaders/VignetteShader.js +28 -24
  770. package/shaders/VolumeShader.cjs.js +1 -0
  771. package/shaders/VolumeShader.js +77 -174
  772. package/shaders/WaterRefractionShader.cjs.js +1 -0
  773. package/shaders/WaterRefractionShader.js +6 -38
  774. package/shaders/types.cjs.js +1 -0
  775. package/shaders/types.js +1 -1
  776. package/textures/FlakesTexture.cjs.js +1 -0
  777. package/textures/FlakesTexture.js +10 -8
  778. package/types/helpers.cjs.js +1 -0
  779. package/types/helpers.js +2 -3
  780. package/types/shared.cjs.js +1 -0
  781. package/types/shared.js +1 -0
  782. package/types/utils.cjs.js +1 -0
  783. package/types/utils.js +1 -0
  784. package/utils/BufferGeometryUtils.cjs.js +1 -0
  785. package/utils/BufferGeometryUtils.js +325 -251
  786. package/utils/GeometryCompressionUtils.cjs.js +1 -0
  787. package/utils/GeometryCompressionUtils.js +239 -241
  788. package/utils/GeometryUtils.cjs.js +1 -0
  789. package/utils/GeometryUtils.js +94 -41
  790. package/utils/LDrawUtils.cjs.js +1 -0
  791. package/utils/LDrawUtils.d.ts +5 -0
  792. package/utils/LDrawUtils.js +144 -0
  793. package/utils/RoughnessMipmapper.cjs.js +1 -0
  794. package/utils/RoughnessMipmapper.js +82 -38
  795. package/utils/SceneUtils.cjs.js +1 -0
  796. package/utils/SceneUtils.js +20 -15
  797. package/utils/ShadowMapViewer.cjs.js +1 -0
  798. package/utils/ShadowMapViewer.js +95 -49
  799. package/utils/SkeletonUtils.cjs.js +1 -0
  800. package/utils/SkeletonUtils.js +165 -74
  801. package/utils/UVsDebug.cjs.js +1 -0
  802. package/utils/UVsDebug.js +62 -32
  803. package/utils/WorkerPool.cjs.js +1 -0
  804. package/utils/WorkerPool.js +33 -13
  805. package/webxr/ARButton.cjs.js +1 -0
  806. package/webxr/ARButton.js +98 -72
  807. package/webxr/OculusHandModel.cjs.js +1 -0
  808. package/webxr/OculusHandModel.js +37 -18
  809. package/webxr/OculusHandPointerModel.cjs.js +1 -0
  810. package/webxr/OculusHandPointerModel.js +80 -58
  811. package/webxr/Text2D.cjs.js +1 -0
  812. package/webxr/Text2D.js +19 -37
  813. package/webxr/VRButton.cjs.js +1 -0
  814. package/webxr/VRButton.js +90 -59
  815. package/webxr/XRControllerModelFactory.cjs.js +1 -0
  816. package/webxr/XRControllerModelFactory.js +116 -58
  817. package/webxr/XREstimatedLight.cjs.js +1 -0
  818. package/webxr/XREstimatedLight.js +66 -39
  819. package/webxr/XRHandMeshModel.cjs.js +1 -0
  820. package/webxr/XRHandMeshModel.js +29 -40
  821. package/webxr/XRHandModelFactory.cjs.js +1 -0
  822. package/webxr/XRHandModelFactory.js +31 -28
  823. package/webxr/XRHandPrimitiveModel.cjs.js +1 -0
  824. package/webxr/XRHandPrimitiveModel.js +27 -41
  825. package/animation/AnimationClipCreator.mjs +0 -57
  826. package/animation/CCDIKSolver.mjs +0 -223
  827. package/animation/MMDAnimationHelper.mjs +0 -514
  828. package/animation/MMDPhysics.mjs +0 -769
  829. package/cameras/CinematicCamera.mjs +0 -129
  830. package/controls/ArcballControls.mjs +0 -1737
  831. package/controls/DeviceOrientationControls.mjs +0 -74
  832. package/controls/DragControls.mjs +0 -172
  833. package/controls/FirstPersonControls.mjs +0 -220
  834. package/controls/FlyControls.mjs +0 -239
  835. package/controls/OrbitControls.mjs +0 -731
  836. package/controls/PointerLockControls.mjs +0 -88
  837. package/controls/TrackballControls.mjs +0 -481
  838. package/controls/TransformControls.mjs +0 -1068
  839. package/controls/experimental/CameraControls.mjs +0 -673
  840. package/csm/CSM.mjs +0 -244
  841. package/csm/CSMFrustum.mjs +0 -75
  842. package/csm/CSMHelper.mjs +0 -114
  843. package/csm/CSMShader.mjs +0 -251
  844. package/curves/CurveExtras.mjs +0 -224
  845. package/curves/NURBSCurve.mjs +0 -35
  846. package/curves/NURBSSurface.mjs +0 -28
  847. package/curves/NURBSUtils.mjs +0 -226
  848. package/deprecated/Geometry.mjs +0 -966
  849. package/effects/AnaglyphEffect.mjs +0 -120
  850. package/effects/AsciiEffect.mjs +0 -173
  851. package/effects/OutlineEffect.mjs +0 -295
  852. package/effects/ParallaxBarrierEffect.mjs +0 -64
  853. package/effects/PeppersGhostEffect.mjs +0 -85
  854. package/effects/StereoEffect.mjs +0 -32
  855. package/environments/RoomEnvironment.mjs +0 -78
  856. package/exporters/ColladaExporter.mjs +0 -299
  857. package/exporters/DRACOExporter.mjs +0 -132
  858. package/exporters/GLTFExporter.mjs +0 -1381
  859. package/exporters/MMDExporter.mjs +0 -102
  860. package/exporters/OBJExporter.mjs +0 -166
  861. package/exporters/PLYExporter.mjs +0 -278
  862. package/exporters/STLExporter.mjs +0 -129
  863. package/exporters/USDZExporter.mjs +0 -328
  864. package/geometries/BoxLineGeometry.mjs +0 -45
  865. package/geometries/ConvexGeometry.mjs +0 -29
  866. package/geometries/DecalGeometry.mjs +0 -184
  867. package/geometries/LightningStrike.mjs +0 -547
  868. package/geometries/ParametricGeometries.mjs +0 -129
  869. package/geometries/ParametricGeometry.mjs +0 -63
  870. package/geometries/RoundedBoxGeometry.mjs +0 -91
  871. package/geometries/TeapotGeometry.mjs +0 -1557
  872. package/geometries/TextGeometry.mjs +0 -23
  873. package/helpers/LightProbeHelper.mjs +0 -72
  874. package/helpers/PositionalAudioHelper.mjs +0 -68
  875. package/helpers/RectAreaLightHelper.mjs +0 -44
  876. package/helpers/VertexNormalsHelper.mjs +0 -54
  877. package/helpers/VertexTangentsHelper.mjs +0 -45
  878. package/index.mjs +0 -969
  879. package/interactive/SelectionBox.mjs +0 -137
  880. package/interactive/SelectionHelper.mjs +0 -54
  881. package/libs/MeshoptDecoder.mjs +0 -210
  882. package/libs/MotionControllers.mjs +0 -261
  883. package/lights/LightProbeGenerator.mjs +0 -145
  884. package/lights/RectAreaLightUniformsLib.mjs +0 -32842
  885. package/lines/Line2.mjs +0 -13
  886. package/lines/LineGeometry.mjs +0 -44
  887. package/lines/LineMaterial.mjs +0 -539
  888. package/lines/LineSegments2.mjs +0 -202
  889. package/lines/LineSegmentsGeometry.mjs +0 -124
  890. package/lines/Wireframe.mjs +0 -31
  891. package/lines/WireframeGeometry2.mjs +0 -13
  892. package/loaders/3DMLoader.mjs +0 -802
  893. package/loaders/3MFLoader.mjs +0 -837
  894. package/loaders/AMFLoader.mjs +0 -284
  895. package/loaders/AssimpLoader.mjs +0 -1396
  896. package/loaders/BVHLoader.mjs +0 -207
  897. package/loaders/BasisTextureLoader.mjs +0 -474
  898. package/loaders/ColladaLoader.mjs +0 -2403
  899. package/loaders/DDSLoader.mjs +0 -148
  900. package/loaders/DRACOLoader.mjs +0 -340
  901. package/loaders/EXRLoader.mjs +0 -1351
  902. package/loaders/FBXLoader.mjs +0 -2362
  903. package/loaders/FontLoader.mjs +0 -111
  904. package/loaders/GCodeLoader.mjs +0 -141
  905. package/loaders/GLTFLoader.mjs +0 -2316
  906. package/loaders/HDRCubeTextureLoader.mjs +0 -77
  907. package/loaders/KMZLoader.mjs +0 -75
  908. package/loaders/KTX2Loader.mjs +0 -427
  909. package/loaders/KTXLoader.mjs +0 -87
  910. package/loaders/LDrawLoader.mjs +0 -1409
  911. package/loaders/LUT3dlLoader.mjs +0 -100
  912. package/loaders/LUTCubeLoader.mjs +0 -104
  913. package/loaders/LWOLoader.mjs +0 -625
  914. package/loaders/LottieLoader.mjs +0 -47
  915. package/loaders/MD2Loader.mjs +0 -359
  916. package/loaders/MDDLoader.mjs +0 -58
  917. package/loaders/MMDLoader.mjs +0 -998
  918. package/loaders/MTLLoader.mjs +0 -280
  919. package/loaders/NRRDLoader.mjs +0 -401
  920. package/loaders/NodeMaterialLoader.mjs +0 -146
  921. package/loaders/OBJLoader.mjs +0 -487
  922. package/loaders/PCDLoader.mjs +0 -248
  923. package/loaders/PDBLoader.mjs +0 -246
  924. package/loaders/PLYLoader.mjs +0 -317
  925. package/loaders/PRWMLoader.mjs +0 -160
  926. package/loaders/PVRLoader.mjs +0 -131
  927. package/loaders/RGBELoader.mjs +0 -244
  928. package/loaders/RGBMLoader.mjs +0 -998
  929. package/loaders/STLLoader.mjs +0 -190
  930. package/loaders/SVGLoader.mjs +0 -1709
  931. package/loaders/TDSLoader.mjs +0 -480
  932. package/loaders/TGALoader.mjs +0 -285
  933. package/loaders/TTFLoader.mjs +0 -131
  934. package/loaders/TiltLoader.mjs +0 -373
  935. package/loaders/VOXLoader.mjs +0 -431
  936. package/loaders/VRMLLoader.mjs +0 -2093
  937. package/loaders/VRMLoader.mjs +0 -38
  938. package/loaders/VTKLoader.mjs +0 -646
  939. package/loaders/XLoader.mjs +0 -1258
  940. package/loaders/XYZLoader.mjs +0 -60
  941. package/loaders/lwo/IFFParser.mjs +0 -697
  942. package/loaders/lwo/LWO2Parser.mjs +0 -327
  943. package/loaders/lwo/LWO3Parser.mjs +0 -298
  944. package/math/Capsule.mjs +0 -100
  945. package/math/ColorConverter.mjs +0 -51
  946. package/math/ConvexHull.mjs +0 -574
  947. package/math/ImprovedNoise.mjs +0 -302
  948. package/math/Lut.mjs +0 -135
  949. package/math/MeshSurfaceSampler.mjs +0 -107
  950. package/math/OBB.mjs +0 -235
  951. package/math/Octree.mjs +0 -278
  952. package/math/SimplexNoise.mjs +0 -425
  953. package/misc/ConvexObjectBreaker.mjs +0 -292
  954. package/misc/GPUComputationRenderer.mjs +0 -171
  955. package/misc/Gyroscope.mjs +0 -35
  956. package/misc/MD2Character.mjs +0 -162
  957. package/misc/MD2CharacterComplex.mjs +0 -328
  958. package/misc/MorphAnimMesh.mjs +0 -40
  959. package/misc/MorphBlendMesh.mjs +0 -179
  960. package/misc/ProgressiveLightmap.mjs +0 -166
  961. package/misc/RollerCoaster.mjs +0 -346
  962. package/misc/TubePainter.mjs +0 -123
  963. package/misc/Volume.mjs +0 -244
  964. package/misc/VolumeSlice.mjs +0 -106
  965. package/misc/WebGL.mjs +0 -74
  966. package/modifiers/CurveModifier.mjs +0 -182
  967. package/modifiers/EdgeSplitModifier.mjs +0 -162
  968. package/modifiers/SimplifyModifier.mjs +0 -282
  969. package/modifiers/TessellateModifier.mjs +0 -206
  970. package/nodes/Nodes.mjs +0 -400
  971. package/nodes/ShaderNode.mjs +0 -408
  972. package/nodes/accessors/BufferNode.mjs +0 -15
  973. package/nodes/accessors/CameraNode.mjs +0 -44
  974. package/nodes/accessors/CubeTextureNode.mjs +0 -42
  975. package/nodes/accessors/MaterialNode.mjs +0 -71
  976. package/nodes/accessors/MaterialReferenceNode.mjs +0 -14
  977. package/nodes/accessors/ModelNode.mjs +0 -9
  978. package/nodes/accessors/ModelViewProjectionNode.mjs +0 -24
  979. package/nodes/accessors/NormalNode.mjs +0 -62
  980. package/nodes/accessors/Object3DNode.mjs +0 -76
  981. package/nodes/accessors/PointUVNode.mjs +0 -13
  982. package/nodes/accessors/PositionNode.mjs +0 -65
  983. package/nodes/accessors/ReferenceNode.mjs +0 -37
  984. package/nodes/accessors/ReflectNode.mjs +0 -43
  985. package/nodes/accessors/SkinningNode.mjs +0 -58
  986. package/nodes/accessors/TextureNode.mjs +0 -54
  987. package/nodes/accessors/UVNode.mjs +0 -23
  988. package/nodes/core/ArrayUniformNode.mjs +0 -14
  989. package/nodes/core/AttributeNode.mjs +0 -30
  990. package/nodes/core/BypassNode.mjs +0 -22
  991. package/nodes/core/CodeNode.mjs +0 -28
  992. package/nodes/core/ConstNode.mjs +0 -14
  993. package/nodes/core/ContextNode.mjs +0 -22
  994. package/nodes/core/ExpressionNode.mjs +0 -19
  995. package/nodes/core/FunctionCallNode.mjs +0 -37
  996. package/nodes/core/FunctionNode.mjs +0 -56
  997. package/nodes/core/InputNode.mjs +0 -38
  998. package/nodes/core/Node.mjs +0 -139
  999. package/nodes/core/NodeAttribute.mjs +0 -10
  1000. package/nodes/core/NodeBuilder.mjs +0 -395
  1001. package/nodes/core/NodeCode.mjs +0 -11
  1002. package/nodes/core/NodeFrame.mjs +0 -35
  1003. package/nodes/core/NodeFunctionInput.mjs +0 -13
  1004. package/nodes/core/NodeKeywords.mjs +0 -44
  1005. package/nodes/core/NodeUniform.mjs +0 -18
  1006. package/nodes/core/NodeUtils.mjs +0 -57
  1007. package/nodes/core/NodeVar.mjs +0 -10
  1008. package/nodes/core/NodeVary.mjs +0 -10
  1009. package/nodes/core/PropertyNode.mjs +0 -21
  1010. package/nodes/core/TempNode.mjs +0 -25
  1011. package/nodes/core/UniformNode.mjs +0 -23
  1012. package/nodes/core/VarNode.mjs +0 -31
  1013. package/nodes/core/VaryNode.mjs +0 -30
  1014. package/nodes/core/constants.mjs +0 -24
  1015. package/nodes/display/ColorSpaceNode.mjs +0 -63
  1016. package/nodes/display/NormalMapNode.mjs +0 -54
  1017. package/nodes/fog/FogNode.mjs +0 -15
  1018. package/nodes/fog/FogRangeNode.mjs +0 -17
  1019. package/nodes/functions/BSDFs.mjs +0 -64
  1020. package/nodes/lights/LightContextNode.mjs +0 -35
  1021. package/nodes/lights/LightNode.mjs +0 -58
  1022. package/nodes/lights/LightsNode.mjs +0 -59
  1023. package/nodes/loaders/NodeLoader.mjs +0 -66
  1024. package/nodes/loaders/NodeMaterialLoader.mjs +0 -24
  1025. package/nodes/loaders/NodeObjectLoader.mjs +0 -40
  1026. package/nodes/materials/LineBasicNodeMaterial.mjs +0 -27
  1027. package/nodes/materials/Materials.mjs +0 -28
  1028. package/nodes/materials/MeshBasicNodeMaterial.mjs +0 -28
  1029. package/nodes/materials/MeshStandardNodeMaterial.mjs +0 -41
  1030. package/nodes/materials/NodeMaterial.mjs +0 -64
  1031. package/nodes/materials/PointsNodeMaterial.mjs +0 -30
  1032. package/nodes/math/CondNode.mjs +0 -38
  1033. package/nodes/math/MathNode.mjs +0 -163
  1034. package/nodes/math/OperatorNode.mjs +0 -103
  1035. package/nodes/procedural/CheckerNode.mjs +0 -21
  1036. package/nodes/utils/ArrayElementNode.mjs +0 -19
  1037. package/nodes/utils/ConvertNode.mjs +0 -25
  1038. package/nodes/utils/JoinNode.mjs +0 -26
  1039. package/nodes/utils/MatcapUVNode.mjs +0 -16
  1040. package/nodes/utils/OscNode.mjs +0 -50
  1041. package/nodes/utils/SplitNode.mjs +0 -45
  1042. package/nodes/utils/SpriteSheetUVNode.mjs +0 -40
  1043. package/nodes/utils/TimerNode.mjs +0 -44
  1044. package/objects/GroundProjectedEnv.mjs +0 -130
  1045. package/objects/Lensflare.mjs +0 -262
  1046. package/objects/LightningStorm.mjs +0 -110
  1047. package/objects/MarchingCubes.mjs +0 -457
  1048. package/objects/Reflector.mjs +0 -166
  1049. package/objects/ReflectorForSSRPass.mjs +0 -247
  1050. package/objects/ReflectorRTT.mjs +0 -10
  1051. package/objects/Refractor.mjs +0 -178
  1052. package/objects/ShadowMesh.mjs +0 -41
  1053. package/objects/Sky.mjs +0 -124
  1054. package/objects/Water.mjs +0 -235
  1055. package/objects/Water2.mjs +0 -252
  1056. package/offscreen/jank.mjs +0 -27
  1057. package/offscreen/offscreen.mjs +0 -5
  1058. package/offscreen/scene.mjs +0 -52
  1059. package/physics/AmmoPhysics.mjs +0 -165
  1060. package/postprocessing/AdaptiveToneMappingPass.mjs +0 -221
  1061. package/postprocessing/AfterimagePass.mjs +0 -55
  1062. package/postprocessing/BloomPass.mjs +0 -90
  1063. package/postprocessing/BokehPass.mjs +0 -76
  1064. package/postprocessing/ClearPass.mjs +0 -27
  1065. package/postprocessing/CubeTexturePass.mjs +0 -49
  1066. package/postprocessing/DotScreenPass.mjs +0 -40
  1067. package/postprocessing/EffectComposer.mjs +0 -139
  1068. package/postprocessing/FilmPass.mjs +0 -42
  1069. package/postprocessing/GlitchPass.mjs +0 -75
  1070. package/postprocessing/HalftonePass.mjs +0 -44
  1071. package/postprocessing/LUTPass.mjs +0 -136
  1072. package/postprocessing/MaskPass.mjs +0 -60
  1073. package/postprocessing/OutlinePass.mjs +0 -438
  1074. package/postprocessing/Pass.mjs +0 -37
  1075. package/postprocessing/RenderPass.mjs +0 -48
  1076. package/postprocessing/RenderPixelatedPass.mjs +0 -199
  1077. package/postprocessing/SAOPass.mjs +0 -282
  1078. package/postprocessing/SMAAPass.mjs +0 -112
  1079. package/postprocessing/SSAARenderPass.mjs +0 -170
  1080. package/postprocessing/SSAOPass.mjs +0 -265
  1081. package/postprocessing/SSRPass.mjs +0 -432
  1082. package/postprocessing/SavePass.mjs +0 -37
  1083. package/postprocessing/ShaderPass.mjs +0 -39
  1084. package/postprocessing/TAARenderPass.mjs +0 -88
  1085. package/postprocessing/TexturePass.mjs +0 -39
  1086. package/postprocessing/UnrealBloomPass.mjs +0 -220
  1087. package/renderers/CSS2DRenderer.mjs +0 -112
  1088. package/renderers/CSS3DRenderer.mjs +0 -133
  1089. package/renderers/Projector.mjs +0 -511
  1090. package/renderers/SVGRenderer.mjs +0 -306
  1091. package/renderers/nodes/accessors/CameraNode.mjs +0 -63
  1092. package/renderers/nodes/accessors/ModelNode.mjs +0 -61
  1093. package/renderers/nodes/accessors/ModelViewProjectionNode.mjs +0 -21
  1094. package/renderers/nodes/accessors/NormalNode.mjs +0 -61
  1095. package/renderers/nodes/accessors/PositionNode.mjs +0 -30
  1096. package/renderers/nodes/accessors/UVNode.mjs +0 -13
  1097. package/renderers/nodes/core/AttributeNode.mjs +0 -35
  1098. package/renderers/nodes/core/InputNode.mjs +0 -31
  1099. package/renderers/nodes/core/Node.mjs +0 -34
  1100. package/renderers/nodes/core/NodeAttribute.mjs +0 -10
  1101. package/renderers/nodes/core/NodeBuilder.mjs +0 -243
  1102. package/renderers/nodes/core/NodeFrame.mjs +0 -35
  1103. package/renderers/nodes/core/NodeSlot.mjs +0 -10
  1104. package/renderers/nodes/core/NodeUniform.mjs +0 -18
  1105. package/renderers/nodes/core/NodeVary.mjs +0 -11
  1106. package/renderers/nodes/core/VaryNode.mjs +0 -22
  1107. package/renderers/nodes/core/constants.mjs +0 -22
  1108. package/renderers/nodes/inputs/ColorNode.mjs +0 -11
  1109. package/renderers/nodes/inputs/FloatNode.mjs +0 -11
  1110. package/renderers/nodes/inputs/Matrix3Node.mjs +0 -12
  1111. package/renderers/nodes/inputs/Matrix4Node.mjs +0 -12
  1112. package/renderers/nodes/inputs/TextureNode.mjs +0 -20
  1113. package/renderers/nodes/inputs/Vector2Node.mjs +0 -11
  1114. package/renderers/nodes/inputs/Vector3Node.mjs +0 -12
  1115. package/renderers/nodes/inputs/Vector4Node.mjs +0 -12
  1116. package/renderers/nodes/math/MathNode.mjs +0 -55
  1117. package/renderers/nodes/math/OperatorNode.mjs +0 -42
  1118. package/renderers/nodes/utils/SwitchNode.mjs +0 -20
  1119. package/renderers/nodes/utils/TimerNode.mjs +0 -14
  1120. package/renderers/webgpu/WebGPU.mjs +0 -24
  1121. package/renderers/webgpu/WebGPUAttributes.mjs +0 -69
  1122. package/renderers/webgpu/WebGPUBackground.mjs +0 -61
  1123. package/renderers/webgpu/WebGPUBinding.mjs +0 -14
  1124. package/renderers/webgpu/WebGPUBindings.mjs +0 -155
  1125. package/renderers/webgpu/WebGPUComputePipelines.mjs +0 -44
  1126. package/renderers/webgpu/WebGPUGeometries.mjs +0 -41
  1127. package/renderers/webgpu/WebGPUInfo.mjs +0 -46
  1128. package/renderers/webgpu/WebGPUObjects.mjs +0 -25
  1129. package/renderers/webgpu/WebGPUProperties.mjs +0 -22
  1130. package/renderers/webgpu/WebGPURenderLists.mjs +0 -119
  1131. package/renderers/webgpu/WebGPURenderPipelines.mjs +0 -545
  1132. package/renderers/webgpu/WebGPURenderer.mjs +0 -574
  1133. package/renderers/webgpu/WebGPUSampledTexture.mjs +0 -40
  1134. package/renderers/webgpu/WebGPUSampler.mjs +0 -15
  1135. package/renderers/webgpu/WebGPUStorageBuffer.mjs +0 -15
  1136. package/renderers/webgpu/WebGPUTextureRenderer.mjs +0 -23
  1137. package/renderers/webgpu/WebGPUTextureUtils.mjs +0 -98
  1138. package/renderers/webgpu/WebGPUTextures.mjs +0 -484
  1139. package/renderers/webgpu/WebGPUUniform.mjs +0 -81
  1140. package/renderers/webgpu/WebGPUUniformsGroup.mjs +0 -176
  1141. package/renderers/webgpu/constants.mjs +0 -230
  1142. package/renderers/webgpu/nodes/ShaderLib.mjs +0 -42
  1143. package/renderers/webgpu/nodes/WebGPUNodeBuilder.mjs +0 -165
  1144. package/renderers/webgpu/nodes/WebGPUNodeUniform.mjs +0 -73
  1145. package/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.mjs +0 -15
  1146. package/renderers/webgpu/nodes/WebGPUNodes.mjs +0 -40
  1147. package/shaders/ACESFilmicToneMappingShader.mjs +0 -48
  1148. package/shaders/AfterimageShader.mjs +0 -32
  1149. package/shaders/BasicShader.mjs +0 -12
  1150. package/shaders/BleachBypassShader.mjs +0 -35
  1151. package/shaders/BlendShader.mjs +0 -30
  1152. package/shaders/BokehShader.mjs +0 -106
  1153. package/shaders/BokehShader2.mjs +0 -269
  1154. package/shaders/BrightnessContrastShader.mjs +0 -32
  1155. package/shaders/ColorCorrectionShader.mjs +0 -30
  1156. package/shaders/ColorifyShader.mjs +0 -28
  1157. package/shaders/ConvolutionShader.mjs +0 -55
  1158. package/shaders/CopyShader.mjs +0 -25
  1159. package/shaders/DOFMipMapShader.mjs +0 -32
  1160. package/shaders/DepthLimitedBlurShader.mjs +0 -114
  1161. package/shaders/DigitalGlitch.mjs +0 -78
  1162. package/shaders/DotScreenShader.mjs +0 -39
  1163. package/shaders/FXAAShader.mjs +0 -1098
  1164. package/shaders/FilmShader.mjs +0 -42
  1165. package/shaders/FocusShader.mjs +0 -55
  1166. package/shaders/FreiChenShader.mjs +0 -61
  1167. package/shaders/FresnelShader.mjs +0 -47
  1168. package/shaders/GammaCorrectionShader.mjs +0 -23
  1169. package/shaders/GodRaysShader.mjs +0 -146
  1170. package/shaders/HalftoneShader.mjs +0 -212
  1171. package/shaders/HorizontalBlurShader.mjs +0 -43
  1172. package/shaders/HorizontalTiltShiftShader.mjs +0 -37
  1173. package/shaders/HueSaturationShader.mjs +0 -41
  1174. package/shaders/KaleidoShader.mjs +0 -34
  1175. package/shaders/LuminosityHighPassShader.mjs +0 -37
  1176. package/shaders/LuminosityShader.mjs +0 -25
  1177. package/shaders/MirrorShader.mjs +0 -35
  1178. package/shaders/NormalMapShader.mjs +0 -31
  1179. package/shaders/ParallaxShader.mjs +0 -113
  1180. package/shaders/PixelShader.mjs +0 -28
  1181. package/shaders/RGBShiftShader.mjs +0 -30
  1182. package/shaders/SAOShader.mjs +0 -144
  1183. package/shaders/SMAAShader.mjs +0 -272
  1184. package/shaders/SSAOShader.mjs +0 -172
  1185. package/shaders/SSRShader.mjs +0 -324
  1186. package/shaders/SepiaShader.mjs +0 -29
  1187. package/shaders/SobelOperatorShader.mjs +0 -44
  1188. package/shaders/SubsurfaceScatteringShader.mjs +0 -59
  1189. package/shaders/TechnicolorShader.mjs +0 -24
  1190. package/shaders/ToneMapShader.mjs +0 -48
  1191. package/shaders/ToonShader.mjs +0 -188
  1192. package/shaders/TriangleBlurShader.mjs +0 -36
  1193. package/shaders/UnpackDepthRGBAShader.mjs +0 -26
  1194. package/shaders/VerticalBlurShader.mjs +0 -44
  1195. package/shaders/VerticalTiltShiftShader.mjs +0 -37
  1196. package/shaders/VignetteShader.mjs +0 -28
  1197. package/shaders/VolumeShader.mjs +0 -178
  1198. package/shaders/WaterRefractionShader.mjs +0 -57
  1199. package/textures/FlakesTexture.mjs +0 -30
  1200. package/types/helpers.mjs +0 -4
  1201. package/utils/BufferGeometryUtils.mjs +0 -570
  1202. package/utils/GeometryCompressionUtils.mjs +0 -547
  1203. package/utils/GeometryUtils.mjs +0 -108
  1204. package/utils/RoughnessMipmapper.mjs +0 -213
  1205. package/utils/SceneUtils.mjs +0 -36
  1206. package/utils/ShadowMapViewer.mjs +0 -114
  1207. package/utils/SkeletonUtils.mjs +0 -292
  1208. package/utils/UVsDebug.mjs +0 -85
  1209. package/utils/WorkerPool.mjs +0 -62
  1210. package/webxr/ARButton.mjs +0 -119
  1211. package/webxr/OculusHandModel.mjs +0 -71
  1212. package/webxr/OculusHandPointerModel.mjs +0 -207
  1213. package/webxr/Text2D.mjs +0 -31
  1214. package/webxr/VRButton.mjs +0 -105
  1215. package/webxr/XRControllerModelFactory.mjs +0 -146
  1216. package/webxr/XREstimatedLight.mjs +0 -126
  1217. package/webxr/XRHandMeshModel.mjs +0 -73
  1218. package/webxr/XRHandModelFactory.mjs +0 -61
  1219. package/webxr/XRHandPrimitiveModel.mjs +0 -68
@@ -1,6 +1,7 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const THREE = require("three");
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import { Matrix4, EventDispatcher, EllipseCurve, BufferGeometry, MathUtils, Vector3, GridHelper, LineBasicMaterial, Line, Raycaster, Vector2, Quaternion, Group, Box3, Sphere } from 'three';
3
+
4
+ //trackball state
4
5
  const STATE = {
5
6
  IDLE: Symbol(),
6
7
  ROTATE: Symbol(),
@@ -20,300 +21,604 @@ const INPUT = {
20
21
  TWO_FINGER: Symbol(),
21
22
  MULT_FINGER: Symbol(),
22
23
  CURSOR: Symbol()
23
- };
24
+ }; //cursor center coordinates
25
+
24
26
  const _center = {
25
27
  x: 0,
26
28
  y: 0
27
- };
29
+ }; //transformation matrices for gizmos and camera
30
+
28
31
  const _transformation = {
29
- camera: new THREE.Matrix4(),
30
- gizmos: new THREE.Matrix4()
32
+ camera: new Matrix4(),
33
+ gizmos: new Matrix4()
34
+ }; //events
35
+
36
+ const _changeEvent = {
37
+ type: 'change'
38
+ };
39
+ const _startEvent = {
40
+ type: 'start'
41
+ };
42
+ const _endEvent = {
43
+ type: 'end'
31
44
  };
32
- const _changeEvent = { type: "change" };
33
- const _startEvent = { type: "start" };
34
- const _endEvent = { type: "end" };
35
- class ArcballControls extends THREE.EventDispatcher {
36
- constructor(camera, domElement = null, scene = null) {
45
+ /**
46
+ *
47
+ * @param {CamOrthographicCamera | PerspectiveCameraera} camera Virtual camera used in the scene
48
+ * @param {HTMLElement=null} domElement Renderer's dom element
49
+ * @param {Scene=null} scene The scene to be rendered
50
+ */
51
+
52
+ class ArcballControls extends EventDispatcher {
53
+ constructor(_camera, _domElement = null, scene = null) {
37
54
  super();
38
- this.onWindowResize = () => {
55
+
56
+ _defineProperty(this, "camera", void 0);
57
+
58
+ _defineProperty(this, "domElement", void 0);
59
+
60
+ _defineProperty(this, "scene", void 0);
61
+
62
+ _defineProperty(this, "mouseActions", void 0);
63
+
64
+ _defineProperty(this, "_mouseOp", void 0);
65
+
66
+ _defineProperty(this, "_v2_1", void 0);
67
+
68
+ _defineProperty(this, "_v3_1", void 0);
69
+
70
+ _defineProperty(this, "_v3_2", void 0);
71
+
72
+ _defineProperty(this, "_m4_1", void 0);
73
+
74
+ _defineProperty(this, "_m4_2", void 0);
75
+
76
+ _defineProperty(this, "_quat", void 0);
77
+
78
+ _defineProperty(this, "_translationMatrix", void 0);
79
+
80
+ _defineProperty(this, "_rotationMatrix", void 0);
81
+
82
+ _defineProperty(this, "_scaleMatrix", void 0);
83
+
84
+ _defineProperty(this, "_rotationAxis", void 0);
85
+
86
+ _defineProperty(this, "_cameraMatrixState", void 0);
87
+
88
+ _defineProperty(this, "_cameraProjectionState", void 0);
89
+
90
+ _defineProperty(this, "_fovState", void 0);
91
+
92
+ _defineProperty(this, "_upState", void 0);
93
+
94
+ _defineProperty(this, "_zoomState", void 0);
95
+
96
+ _defineProperty(this, "_nearPos", void 0);
97
+
98
+ _defineProperty(this, "_farPos", void 0);
99
+
100
+ _defineProperty(this, "_gizmoMatrixState", void 0);
101
+
102
+ _defineProperty(this, "_up0", void 0);
103
+
104
+ _defineProperty(this, "_zoom0", void 0);
105
+
106
+ _defineProperty(this, "_fov0", void 0);
107
+
108
+ _defineProperty(this, "_initialNear", void 0);
109
+
110
+ _defineProperty(this, "_nearPos0", void 0);
111
+
112
+ _defineProperty(this, "_initialFar", void 0);
113
+
114
+ _defineProperty(this, "_farPos0", void 0);
115
+
116
+ _defineProperty(this, "_cameraMatrixState0", void 0);
117
+
118
+ _defineProperty(this, "_gizmoMatrixState0", void 0);
119
+
120
+ _defineProperty(this, "_button", void 0);
121
+
122
+ _defineProperty(this, "_touchStart", void 0);
123
+
124
+ _defineProperty(this, "_touchCurrent", void 0);
125
+
126
+ _defineProperty(this, "_input", void 0);
127
+
128
+ _defineProperty(this, "_switchSensibility", void 0);
129
+
130
+ _defineProperty(this, "_startFingerDistance", void 0);
131
+
132
+ _defineProperty(this, "_currentFingerDistance", void 0);
133
+
134
+ _defineProperty(this, "_startFingerRotation", void 0);
135
+
136
+ _defineProperty(this, "_currentFingerRotation", void 0);
137
+
138
+ _defineProperty(this, "_devPxRatio", void 0);
139
+
140
+ _defineProperty(this, "_downValid", void 0);
141
+
142
+ _defineProperty(this, "_nclicks", void 0);
143
+
144
+ _defineProperty(this, "_downEvents", void 0);
145
+
146
+ _defineProperty(this, "_clickStart", void 0);
147
+
148
+ _defineProperty(this, "_maxDownTime", void 0);
149
+
150
+ _defineProperty(this, "_maxInterval", void 0);
151
+
152
+ _defineProperty(this, "_posThreshold", void 0);
153
+
154
+ _defineProperty(this, "_movementThreshold", void 0);
155
+
156
+ _defineProperty(this, "_currentCursorPosition", void 0);
157
+
158
+ _defineProperty(this, "_startCursorPosition", void 0);
159
+
160
+ _defineProperty(this, "_grid", void 0);
161
+
162
+ _defineProperty(this, "_gridPosition", void 0);
163
+
164
+ _defineProperty(this, "_gizmos", void 0);
165
+
166
+ _defineProperty(this, "_curvePts", void 0);
167
+
168
+ _defineProperty(this, "_timeStart", void 0);
169
+
170
+ _defineProperty(this, "_animationId", void 0);
171
+
172
+ _defineProperty(this, "focusAnimationTime", void 0);
173
+
174
+ _defineProperty(this, "_timePrev", void 0);
175
+
176
+ _defineProperty(this, "_timeCurrent", void 0);
177
+
178
+ _defineProperty(this, "_anglePrev", void 0);
179
+
180
+ _defineProperty(this, "_angleCurrent", void 0);
181
+
182
+ _defineProperty(this, "_cursorPosPrev", void 0);
183
+
184
+ _defineProperty(this, "_cursorPosCurr", void 0);
185
+
186
+ _defineProperty(this, "_wPrev", void 0);
187
+
188
+ _defineProperty(this, "_wCurr", void 0);
189
+
190
+ _defineProperty(this, "adjustNearFar", void 0);
191
+
192
+ _defineProperty(this, "scaleFactor", void 0);
193
+
194
+ _defineProperty(this, "dampingFactor", void 0);
195
+
196
+ _defineProperty(this, "wMax", void 0);
197
+
198
+ _defineProperty(this, "enableAnimations", void 0);
199
+
200
+ _defineProperty(this, "enableGrid", void 0);
201
+
202
+ _defineProperty(this, "cursorZoom", void 0);
203
+
204
+ _defineProperty(this, "minFov", void 0);
205
+
206
+ _defineProperty(this, "maxFov", void 0);
207
+
208
+ _defineProperty(this, "enabled", void 0);
209
+
210
+ _defineProperty(this, "enablePan", void 0);
211
+
212
+ _defineProperty(this, "enableRotate", void 0);
213
+
214
+ _defineProperty(this, "enableZoom", void 0);
215
+
216
+ _defineProperty(this, "minDistance", void 0);
217
+
218
+ _defineProperty(this, "maxDistance", void 0);
219
+
220
+ _defineProperty(this, "minZoom", void 0);
221
+
222
+ _defineProperty(this, "maxZoom", void 0);
223
+
224
+ _defineProperty(this, "target", void 0);
225
+
226
+ _defineProperty(this, "_currentTarget", void 0);
227
+
228
+ _defineProperty(this, "_tbRadius", void 0);
229
+
230
+ _defineProperty(this, "_state", void 0);
231
+
232
+ _defineProperty(this, "onWindowResize", () => {
39
233
  const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3;
234
+
40
235
  if (this.camera) {
41
236
  const tbRadius = this.calculateTbRadius(this.camera);
42
- if (tbRadius !== void 0) {
237
+
238
+ if (tbRadius !== undefined) {
43
239
  this._tbRadius = tbRadius;
44
240
  }
45
241
  }
46
- const newRadius = this._tbRadius / scale;
47
- const curve = new THREE.EllipseCurve(0, 0, newRadius, newRadius);
242
+
243
+ const newRadius = this._tbRadius / scale; // @ts-expect-error
244
+
245
+ const curve = new EllipseCurve(0, 0, newRadius, newRadius);
48
246
  const points = curve.getPoints(this._curvePts);
49
- const curveGeometry = new THREE.BufferGeometry().setFromPoints(points);
247
+ const curveGeometry = new BufferGeometry().setFromPoints(points);
248
+
50
249
  for (const gizmo in this._gizmos.children) {
51
250
  const child = this._gizmos.children[gizmo];
52
251
  child.geometry = curveGeometry;
53
252
  }
253
+
54
254
  this.dispatchEvent(_changeEvent);
55
- };
56
- this.onContextMenu = (event) => {
255
+ });
256
+
257
+ _defineProperty(this, "onContextMenu", event => {
57
258
  if (!this.enabled) {
58
259
  return;
59
260
  }
261
+
60
262
  for (let i = 0; i < this.mouseActions.length; i++) {
61
263
  if (this.mouseActions[i].mouse == 2) {
264
+ //prevent only if button 2 is actually used
62
265
  event.preventDefault();
63
266
  break;
64
267
  }
65
268
  }
66
- };
67
- this.onPointerCancel = () => {
269
+ });
270
+
271
+ _defineProperty(this, "onPointerCancel", () => {
68
272
  this._touchStart.splice(0, this._touchStart.length);
273
+
69
274
  this._touchCurrent.splice(0, this._touchCurrent.length);
275
+
70
276
  this._input = INPUT.NONE;
71
- };
72
- this.onPointerDown = (event) => {
277
+ });
278
+
279
+ _defineProperty(this, "onPointerDown", event => {
73
280
  if (event.button == 0 && event.isPrimary) {
74
281
  this._downValid = true;
282
+
75
283
  this._downEvents.push(event);
76
284
  } else {
77
285
  this._downValid = false;
78
286
  }
79
- if (event.pointerType == "touch" && this._input != INPUT.CURSOR) {
287
+
288
+ if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {
80
289
  this._touchStart.push(event);
290
+
81
291
  this._touchCurrent.push(event);
292
+
82
293
  switch (this._input) {
83
294
  case INPUT.NONE:
295
+ //singleStart
84
296
  this._input = INPUT.ONE_FINGER;
85
- this.onSinglePanStart(event, "ROTATE");
86
- window.addEventListener("pointermove", this.onPointerMove);
87
- window.addEventListener("pointerup", this.onPointerUp);
297
+ this.onSinglePanStart(event, 'ROTATE');
298
+ window.addEventListener('pointermove', this.onPointerMove);
299
+ window.addEventListener('pointerup', this.onPointerUp);
88
300
  break;
301
+
89
302
  case INPUT.ONE_FINGER:
90
303
  case INPUT.ONE_FINGER_SWITCHED:
304
+ //doubleStart
91
305
  this._input = INPUT.TWO_FINGER;
92
306
  this.onRotateStart();
93
307
  this.onPinchStart();
94
308
  this.onDoublePanStart();
95
309
  break;
310
+
96
311
  case INPUT.TWO_FINGER:
312
+ //multipleStart
97
313
  this._input = INPUT.MULT_FINGER;
98
314
  this.onTriplePanStart();
99
315
  break;
100
316
  }
101
- } else if (event.pointerType != "touch" && this._input == INPUT.NONE) {
317
+ } else if (event.pointerType != 'touch' && this._input == INPUT.NONE) {
102
318
  let modifier = null;
319
+
103
320
  if (event.ctrlKey || event.metaKey) {
104
- modifier = "CTRL";
321
+ modifier = 'CTRL';
105
322
  } else if (event.shiftKey) {
106
- modifier = "SHIFT";
323
+ modifier = 'SHIFT';
107
324
  }
325
+
108
326
  this._mouseOp = this.getOpFromAction(event.button, modifier);
327
+
109
328
  if (this._mouseOp) {
110
- window.addEventListener("pointermove", this.onPointerMove);
111
- window.addEventListener("pointerup", this.onPointerUp);
329
+ window.addEventListener('pointermove', this.onPointerMove);
330
+ window.addEventListener('pointerup', this.onPointerUp); //singleStart
331
+
112
332
  this._input = INPUT.CURSOR;
113
333
  this._button = event.button;
114
334
  this.onSinglePanStart(event, this._mouseOp);
115
335
  }
116
336
  }
117
- };
118
- this.onPointerMove = (event) => {
119
- if (event.pointerType == "touch" && this._input != INPUT.CURSOR) {
337
+ });
338
+
339
+ _defineProperty(this, "onPointerMove", event => {
340
+ if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {
120
341
  switch (this._input) {
121
342
  case INPUT.ONE_FINGER:
343
+ //singleMove
122
344
  this.updateTouchEvent(event);
123
345
  this.onSinglePanMove(event, STATE.ROTATE);
124
346
  break;
347
+
125
348
  case INPUT.ONE_FINGER_SWITCHED:
126
349
  const movement = this.calculatePointersDistance(this._touchCurrent[0], event) * this._devPxRatio;
350
+
127
351
  if (movement >= this._switchSensibility) {
352
+ //singleMove
128
353
  this._input = INPUT.ONE_FINGER;
129
354
  this.updateTouchEvent(event);
130
- this.onSinglePanStart(event, "ROTATE");
355
+ this.onSinglePanStart(event, 'ROTATE');
131
356
  break;
132
357
  }
358
+
133
359
  break;
360
+
134
361
  case INPUT.TWO_FINGER:
362
+ //rotate/pan/pinchMove
135
363
  this.updateTouchEvent(event);
136
364
  this.onRotateMove();
137
365
  this.onPinchMove();
138
366
  this.onDoublePanMove();
139
367
  break;
368
+
140
369
  case INPUT.MULT_FINGER:
370
+ //multMove
141
371
  this.updateTouchEvent(event);
142
372
  this.onTriplePanMove();
143
373
  break;
144
374
  }
145
- } else if (event.pointerType != "touch" && this._input == INPUT.CURSOR) {
375
+ } else if (event.pointerType != 'touch' && this._input == INPUT.CURSOR) {
146
376
  let modifier = null;
377
+
147
378
  if (event.ctrlKey || event.metaKey) {
148
- modifier = "CTRL";
379
+ modifier = 'CTRL';
149
380
  } else if (event.shiftKey) {
150
- modifier = "SHIFT";
381
+ modifier = 'SHIFT';
151
382
  }
383
+
152
384
  const mouseOpState = this.getOpStateFromAction(this._button, modifier);
385
+
153
386
  if (mouseOpState) {
154
387
  this.onSinglePanMove(event, mouseOpState);
155
388
  }
156
- }
389
+ } //checkDistance
390
+
391
+
157
392
  if (this._downValid) {
158
393
  const movement = this.calculatePointersDistance(this._downEvents[this._downEvents.length - 1], event) * this._devPxRatio;
394
+
159
395
  if (movement > this._movementThreshold) {
160
396
  this._downValid = false;
161
397
  }
162
398
  }
163
- };
164
- this.onPointerUp = (event) => {
165
- if (event.pointerType == "touch" && this._input != INPUT.CURSOR) {
399
+ });
400
+
401
+ _defineProperty(this, "onPointerUp", event => {
402
+ if (event.pointerType == 'touch' && this._input != INPUT.CURSOR) {
166
403
  const nTouch = this._touchCurrent.length;
404
+
167
405
  for (let i = 0; i < nTouch; i++) {
168
406
  if (this._touchCurrent[i].pointerId == event.pointerId) {
169
407
  this._touchCurrent.splice(i, 1);
408
+
170
409
  this._touchStart.splice(i, 1);
410
+
171
411
  break;
172
412
  }
173
413
  }
414
+
174
415
  switch (this._input) {
175
416
  case INPUT.ONE_FINGER:
176
417
  case INPUT.ONE_FINGER_SWITCHED:
177
- window.removeEventListener("pointermove", this.onPointerMove);
178
- window.removeEventListener("pointerup", this.onPointerUp);
418
+ //singleEnd
419
+ window.removeEventListener('pointermove', this.onPointerMove);
420
+ window.removeEventListener('pointerup', this.onPointerUp);
179
421
  this._input = INPUT.NONE;
180
422
  this.onSinglePanEnd();
181
423
  break;
424
+
182
425
  case INPUT.TWO_FINGER:
426
+ //doubleEnd
183
427
  this.onDoublePanEnd();
184
428
  this.onPinchEnd();
185
- this.onRotateEnd();
429
+ this.onRotateEnd(); //switching to singleStart
430
+
186
431
  this._input = INPUT.ONE_FINGER_SWITCHED;
187
432
  break;
433
+
188
434
  case INPUT.MULT_FINGER:
189
435
  if (this._touchCurrent.length == 0) {
190
- window.removeEventListener("pointermove", this.onPointerMove);
191
- window.removeEventListener("pointerup", this.onPointerUp);
436
+ window.removeEventListener('pointermove', this.onPointerMove);
437
+ window.removeEventListener('pointerup', this.onPointerUp); //multCancel
438
+
192
439
  this._input = INPUT.NONE;
193
440
  this.onTriplePanEnd();
194
441
  }
442
+
195
443
  break;
196
444
  }
197
- } else if (event.pointerType != "touch" && this._input == INPUT.CURSOR) {
198
- window.removeEventListener("pointermove", this.onPointerMove);
199
- window.removeEventListener("pointerup", this.onPointerUp);
445
+ } else if (event.pointerType != 'touch' && this._input == INPUT.CURSOR) {
446
+ window.removeEventListener('pointermove', this.onPointerMove);
447
+ window.removeEventListener('pointerup', this.onPointerUp);
200
448
  this._input = INPUT.NONE;
201
449
  this.onSinglePanEnd();
202
450
  this._button = -1;
203
451
  }
452
+
204
453
  if (event.isPrimary) {
205
454
  if (this._downValid) {
206
455
  const downTime = event.timeStamp - this._downEvents[this._downEvents.length - 1].timeStamp;
456
+
207
457
  if (downTime <= this._maxDownTime) {
208
458
  if (this._nclicks == 0) {
459
+ //first valid click detected
209
460
  this._nclicks = 1;
210
461
  this._clickStart = performance.now();
211
462
  } else {
212
463
  const clickInterval = event.timeStamp - this._clickStart;
464
+
213
465
  const movement = this.calculatePointersDistance(this._downEvents[1], this._downEvents[0]) * this._devPxRatio;
466
+
214
467
  if (clickInterval <= this._maxInterval && movement <= this._posThreshold) {
468
+ //second valid click detected
469
+ //fire double tap and reset values
215
470
  this._nclicks = 0;
471
+
216
472
  this._downEvents.splice(0, this._downEvents.length);
473
+
217
474
  this.onDoubleTap(event);
218
475
  } else {
476
+ //new 'first click'
219
477
  this._nclicks = 1;
478
+
220
479
  this._downEvents.shift();
480
+
221
481
  this._clickStart = performance.now();
222
482
  }
223
483
  }
224
484
  } else {
225
485
  this._downValid = false;
226
486
  this._nclicks = 0;
487
+
227
488
  this._downEvents.splice(0, this._downEvents.length);
228
489
  }
229
490
  } else {
230
491
  this._nclicks = 0;
492
+
231
493
  this._downEvents.splice(0, this._downEvents.length);
232
494
  }
233
495
  }
234
- };
235
- this.onWheel = (event) => {
236
- var _a, _b, _c, _d, _e;
496
+ });
497
+
498
+ _defineProperty(this, "onWheel", event => {
499
+ var _this$camera3;
500
+
237
501
  if (this.enabled && this.enableZoom && this.domElement) {
238
502
  let modifier = null;
503
+
239
504
  if (event.ctrlKey || event.metaKey) {
240
- modifier = "CTRL";
505
+ modifier = 'CTRL';
241
506
  } else if (event.shiftKey) {
242
- modifier = "SHIFT";
507
+ modifier = 'SHIFT';
243
508
  }
244
- const mouseOp = this.getOpFromAction("WHEEL", modifier);
509
+
510
+ const mouseOp = this.getOpFromAction('WHEEL', modifier);
511
+
245
512
  if (mouseOp) {
246
513
  event.preventDefault();
247
514
  this.dispatchEvent(_startEvent);
248
- const notchDeltaY = 125;
515
+ const notchDeltaY = 125; //distance of one notch of mouse wheel
516
+
249
517
  let sgn = event.deltaY / notchDeltaY;
250
518
  let size = 1;
519
+
251
520
  if (sgn > 0) {
252
521
  size = 1 / this.scaleFactor;
253
522
  } else if (sgn < 0) {
254
523
  size = this.scaleFactor;
255
524
  }
525
+
256
526
  switch (mouseOp) {
257
- case "ZOOM":
527
+ case 'ZOOM':
258
528
  this.updateTbState(STATE.SCALE, true);
529
+
259
530
  if (sgn > 0) {
260
531
  size = 1 / Math.pow(this.scaleFactor, sgn);
261
532
  } else if (sgn < 0) {
262
533
  size = Math.pow(this.scaleFactor, -sgn);
263
534
  }
535
+
264
536
  if (this.cursorZoom && this.enablePan) {
537
+ var _this$camera, _this$camera2;
538
+
265
539
  let scalePoint;
266
- if (((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera") {
267
- scalePoint = (_b = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)) == null ? void 0 : _b.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._gizmos.position);
540
+
541
+ if (((_this$camera = this.camera) === null || _this$camera === void 0 ? void 0 : _this$camera.type) === 'OrthographicCamera') {
542
+ var _this$unprojectOnTbPl;
543
+
544
+ scalePoint = (_this$unprojectOnTbPl = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)) === null || _this$unprojectOnTbPl === void 0 ? void 0 : _this$unprojectOnTbPl.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._gizmos.position);
268
545
  }
269
- if (((_c = this.camera) == null ? void 0 : _c.type) === "PerspectiveCamera") {
270
- scalePoint = (_d = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)) == null ? void 0 : _d.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);
546
+
547
+ if (((_this$camera2 = this.camera) === null || _this$camera2 === void 0 ? void 0 : _this$camera2.type) === 'PerspectiveCamera') {
548
+ var _this$unprojectOnTbPl2;
549
+
550
+ scalePoint = (_this$unprojectOnTbPl2 = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)) === null || _this$unprojectOnTbPl2 === void 0 ? void 0 : _this$unprojectOnTbPl2.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);
271
551
  }
272
- if (scalePoint !== void 0)
273
- this.applyTransformMatrix(this.applyScale(size, scalePoint));
552
+
553
+ if (scalePoint !== undefined) this.applyTransformMatrix(this.applyScale(size, scalePoint));
274
554
  } else {
275
555
  this.applyTransformMatrix(this.applyScale(size, this._gizmos.position));
276
556
  }
557
+
277
558
  if (this._grid) {
278
559
  this.disposeGrid();
279
560
  this.drawGrid();
280
561
  }
562
+
281
563
  this.updateTbState(STATE.IDLE, false);
282
564
  this.dispatchEvent(_changeEvent);
283
565
  this.dispatchEvent(_endEvent);
284
566
  break;
285
- case "FOV":
286
- if (((_e = this.camera) == null ? void 0 : _e.type) === "PerspectiveCamera") {
287
- this.updateTbState(STATE.FOV, true);
567
+
568
+ case 'FOV':
569
+ if (((_this$camera3 = this.camera) === null || _this$camera3 === void 0 ? void 0 : _this$camera3.type) === 'PerspectiveCamera') {
570
+ this.updateTbState(STATE.FOV, true); //Vertigo effect
571
+ // fov / 2
572
+ // |\
573
+ // | \
574
+ // | \
575
+ // x | \
576
+ // | \
577
+ // | \
578
+ // | _ _ _\
579
+ // y
580
+ //check for iOs shift shortcut
581
+
288
582
  if (event.deltaX != 0) {
289
583
  sgn = event.deltaX / notchDeltaY;
290
584
  size = 1;
585
+
291
586
  if (sgn > 0) {
292
587
  size = 1 / Math.pow(this.scaleFactor, sgn);
293
588
  } else if (sgn < 0) {
294
589
  size = Math.pow(this.scaleFactor, -sgn);
295
590
  }
296
591
  }
592
+
297
593
  this._v3_1.setFromMatrixPosition(this._cameraMatrixState);
594
+
298
595
  const x = this._v3_1.distanceTo(this._gizmos.position);
299
- let xNew = x / size;
300
- xNew = THREE.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
301
- const y = x * Math.tan(THREE.MathUtils.DEG2RAD * this.camera.fov * 0.5);
302
- let newFov = THREE.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);
596
+
597
+ let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed
598
+ //check min and max distance
599
+
600
+ xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
601
+ const y = x * Math.tan(MathUtils.DEG2RAD * this.camera.fov * 0.5); //calculate new fov
602
+
603
+ let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2); //check min and max fov
604
+
303
605
  if (newFov > this.maxFov) {
304
606
  newFov = this.maxFov;
305
607
  } else if (newFov < this.minFov) {
306
608
  newFov = this.minFov;
307
609
  }
308
- const newDistance = y / Math.tan(THREE.MathUtils.DEG2RAD * (newFov / 2));
610
+
611
+ const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2));
309
612
  size = x / newDistance;
310
613
  this.setFov(newFov);
311
614
  this.applyTransformMatrix(this.applyScale(size, this._gizmos.position, false));
312
615
  }
616
+
313
617
  if (this._grid) {
314
618
  this.disposeGrid();
315
619
  this.drawGrid();
316
620
  }
621
+
317
622
  this.updateTbState(STATE.IDLE, false);
318
623
  this.dispatchEvent(_changeEvent);
319
624
  this.dispatchEvent(_endEvent);
@@ -321,16 +626,19 @@ class ArcballControls extends THREE.EventDispatcher {
321
626
  }
322
627
  }
323
628
  }
324
- };
325
- this.onSinglePanStart = (event, operation) => {
326
- var _a;
629
+ });
630
+
631
+ _defineProperty(this, "onSinglePanStart", (event, operation) => {
632
+ var _this$camera4;
633
+
327
634
  if (this.enabled && this.domElement) {
328
635
  this.dispatchEvent(_startEvent);
329
636
  this.setCenter(event.clientX, event.clientY);
637
+
330
638
  switch (operation) {
331
- case "PAN":
332
- if (!this.enablePan)
333
- return;
639
+ case 'PAN':
640
+ if (!this.enablePan) return;
641
+
334
642
  if (this._animationId != -1) {
335
643
  cancelAnimationFrame(this._animationId);
336
644
  this._animationId = -1;
@@ -338,48 +646,62 @@ class ArcballControls extends THREE.EventDispatcher {
338
646
  this.activateGizmos(false);
339
647
  this.dispatchEvent(_changeEvent);
340
648
  }
649
+
341
650
  if (this.camera) {
342
651
  this.updateTbState(STATE.PAN, true);
343
652
  const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement);
344
- if (rayDir !== void 0) {
653
+
654
+ if (rayDir !== undefined) {
345
655
  this._startCursorPosition.copy(rayDir);
346
656
  }
657
+
347
658
  if (this.enableGrid) {
348
659
  this.drawGrid();
349
660
  this.dispatchEvent(_changeEvent);
350
661
  }
351
662
  }
663
+
352
664
  break;
353
- case "ROTATE":
354
- if (!this.enableRotate)
355
- return;
665
+
666
+ case 'ROTATE':
667
+ if (!this.enableRotate) return;
668
+
356
669
  if (this._animationId != -1) {
357
670
  cancelAnimationFrame(this._animationId);
358
671
  this._animationId = -1;
359
672
  this._timeStart = -1;
360
673
  }
674
+
361
675
  if (this.camera) {
362
676
  this.updateTbState(STATE.ROTATE, true);
363
677
  const rayDir = this.unprojectOnTbSurface(this.camera, _center.x, _center.y, this.domElement, this._tbRadius);
364
- if (rayDir !== void 0) {
678
+
679
+ if (rayDir !== undefined) {
365
680
  this._startCursorPosition.copy(rayDir);
366
681
  }
682
+
367
683
  this.activateGizmos(true);
684
+
368
685
  if (this.enableAnimations) {
369
686
  this._timePrev = this._timeCurrent = performance.now();
370
687
  this._angleCurrent = this._anglePrev = 0;
688
+
371
689
  this._cursorPosPrev.copy(this._startCursorPosition);
690
+
372
691
  this._cursorPosCurr.copy(this._cursorPosPrev);
692
+
373
693
  this._wCurr = 0;
374
694
  this._wPrev = this._wCurr;
375
695
  }
376
696
  }
697
+
377
698
  this.dispatchEvent(_changeEvent);
378
699
  break;
379
- case "FOV":
380
- if (!this.enableZoom)
381
- return;
382
- if (((_a = this.camera) == null ? void 0 : _a.type) === "PerspectiveCamera") {
700
+
701
+ case 'FOV':
702
+ if (!this.enableZoom) return;
703
+
704
+ if (((_this$camera4 = this.camera) === null || _this$camera4 === void 0 ? void 0 : _this$camera4.type) === 'PerspectiveCamera') {
383
705
  if (this._animationId != -1) {
384
706
  cancelAnimationFrame(this._animationId);
385
707
  this._animationId = -1;
@@ -387,14 +709,19 @@ class ArcballControls extends THREE.EventDispatcher {
387
709
  this.activateGizmos(false);
388
710
  this.dispatchEvent(_changeEvent);
389
711
  }
712
+
390
713
  this.updateTbState(STATE.FOV, true);
714
+
391
715
  this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
716
+
392
717
  this._currentCursorPosition.copy(this._startCursorPosition);
393
718
  }
719
+
394
720
  break;
395
- case "ZOOM":
396
- if (!this.enableZoom)
397
- return;
721
+
722
+ case 'ZOOM':
723
+ if (!this.enableZoom) return;
724
+
398
725
  if (this._animationId != -1) {
399
726
  cancelAnimationFrame(this._animationId);
400
727
  this._animationId = -1;
@@ -402,182 +729,234 @@ class ArcballControls extends THREE.EventDispatcher {
402
729
  this.activateGizmos(false);
403
730
  this.dispatchEvent(_changeEvent);
404
731
  }
732
+
405
733
  this.updateTbState(STATE.SCALE, true);
734
+
406
735
  this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
736
+
407
737
  this._currentCursorPosition.copy(this._startCursorPosition);
738
+
408
739
  break;
409
740
  }
410
741
  }
411
- };
412
- this.onSinglePanMove = (event, opState) => {
413
- var _a;
742
+ });
743
+
744
+ _defineProperty(this, "onSinglePanMove", (event, opState) => {
745
+ var _this$camera5;
746
+
414
747
  if (this.enabled && this.domElement) {
415
748
  const restart = opState != this._state;
416
749
  this.setCenter(event.clientX, event.clientY);
750
+
417
751
  switch (opState) {
418
752
  case STATE.PAN:
419
753
  if (this.enablePan && this.camera) {
420
754
  if (restart) {
755
+ //switch to pan operation
421
756
  this.dispatchEvent(_endEvent);
422
757
  this.dispatchEvent(_startEvent);
423
758
  this.updateTbState(opState, true);
424
759
  const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement);
425
- if (rayDir !== void 0) {
760
+
761
+ if (rayDir !== undefined) {
426
762
  this._startCursorPosition.copy(rayDir);
427
763
  }
764
+
428
765
  if (this.enableGrid) {
429
766
  this.drawGrid();
430
767
  }
768
+
431
769
  this.activateGizmos(false);
432
770
  } else {
771
+ //continue with pan operation
433
772
  const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement);
434
- if (rayDir !== void 0) {
773
+
774
+ if (rayDir !== undefined) {
435
775
  this._currentCursorPosition.copy(rayDir);
436
776
  }
777
+
437
778
  this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition));
438
779
  }
439
780
  }
781
+
440
782
  break;
783
+
441
784
  case STATE.ROTATE:
442
785
  if (this.enableRotate && this.camera) {
443
786
  if (restart) {
787
+ //switch to rotate operation
444
788
  this.dispatchEvent(_endEvent);
445
789
  this.dispatchEvent(_startEvent);
446
790
  this.updateTbState(opState, true);
447
- const rayDir = this.unprojectOnTbSurface(
448
- this.camera,
449
- _center.x,
450
- _center.y,
451
- this.domElement,
452
- this._tbRadius
453
- );
454
- if (rayDir !== void 0) {
791
+ const rayDir = this.unprojectOnTbSurface(this.camera, _center.x, _center.y, this.domElement, this._tbRadius);
792
+
793
+ if (rayDir !== undefined) {
455
794
  this._startCursorPosition.copy(rayDir);
456
795
  }
796
+
457
797
  if (this.enableGrid) {
458
798
  this.disposeGrid();
459
799
  }
800
+
460
801
  this.activateGizmos(true);
461
802
  } else {
462
- const rayDir = this.unprojectOnTbSurface(
463
- this.camera,
464
- _center.x,
465
- _center.y,
466
- this.domElement,
467
- this._tbRadius
468
- );
469
- if (rayDir !== void 0) {
803
+ //continue with rotate operation
804
+ const rayDir = this.unprojectOnTbSurface(this.camera, _center.x, _center.y, this.domElement, this._tbRadius);
805
+
806
+ if (rayDir !== undefined) {
470
807
  this._currentCursorPosition.copy(rayDir);
471
808
  }
809
+
472
810
  const distance = this._startCursorPosition.distanceTo(this._currentCursorPosition);
811
+
473
812
  const angle = this._startCursorPosition.angleTo(this._currentCursorPosition);
474
- const amount = Math.max(distance / this._tbRadius, angle);
475
- this.applyTransformMatrix(
476
- this.rotate(this.calculateRotationAxis(this._startCursorPosition, this._currentCursorPosition), amount)
477
- );
813
+
814
+ const amount = Math.max(distance / this._tbRadius, angle); //effective rotation angle
815
+
816
+ this.applyTransformMatrix(this.rotate(this.calculateRotationAxis(this._startCursorPosition, this._currentCursorPosition), amount));
817
+
478
818
  if (this.enableAnimations) {
479
819
  this._timePrev = this._timeCurrent;
480
820
  this._timeCurrent = performance.now();
481
821
  this._anglePrev = this._angleCurrent;
482
822
  this._angleCurrent = amount;
823
+
483
824
  this._cursorPosPrev.copy(this._cursorPosCurr);
825
+
484
826
  this._cursorPosCurr.copy(this._currentCursorPosition);
827
+
485
828
  this._wPrev = this._wCurr;
486
- this._wCurr = this.calculateAngularSpeed(
487
- this._anglePrev,
488
- this._angleCurrent,
489
- this._timePrev,
490
- this._timeCurrent
491
- );
829
+ this._wCurr = this.calculateAngularSpeed(this._anglePrev, this._angleCurrent, this._timePrev, this._timeCurrent);
492
830
  }
493
831
  }
494
832
  }
833
+
495
834
  break;
835
+
496
836
  case STATE.SCALE:
497
837
  if (this.enableZoom) {
498
838
  if (restart) {
839
+ //switch to zoom operation
499
840
  this.dispatchEvent(_endEvent);
500
841
  this.dispatchEvent(_startEvent);
501
842
  this.updateTbState(opState, true);
843
+
502
844
  this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
845
+
503
846
  this._currentCursorPosition.copy(this._startCursorPosition);
847
+
504
848
  if (this.enableGrid) {
505
849
  this.disposeGrid();
506
850
  }
851
+
507
852
  this.activateGizmos(false);
508
853
  } else {
509
- const screenNotches = 8;
854
+ //continue with zoom operation
855
+ const screenNotches = 8; //how many wheel notches corresponds to a full screen pan
856
+
510
857
  this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
858
+
511
859
  const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
512
860
  let size = 1;
861
+
513
862
  if (movement < 0) {
514
863
  size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);
515
864
  } else if (movement > 0) {
516
865
  size = Math.pow(this.scaleFactor, movement * screenNotches);
517
866
  }
867
+
518
868
  this.applyTransformMatrix(this.applyScale(size, this._gizmos.position));
519
869
  }
520
870
  }
871
+
521
872
  break;
873
+
522
874
  case STATE.FOV:
523
- if (this.enableZoom && ((_a = this.camera) == null ? void 0 : _a.type) === "PerspectiveCamera") {
875
+ if (this.enableZoom && ((_this$camera5 = this.camera) === null || _this$camera5 === void 0 ? void 0 : _this$camera5.type) === 'PerspectiveCamera') {
524
876
  if (restart) {
877
+ //switch to fov operation
525
878
  this.dispatchEvent(_endEvent);
526
879
  this.dispatchEvent(_startEvent);
527
880
  this.updateTbState(opState, true);
881
+
528
882
  this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
883
+
529
884
  this._currentCursorPosition.copy(this._startCursorPosition);
885
+
530
886
  if (this.enableGrid) {
531
887
  this.disposeGrid();
532
888
  }
889
+
533
890
  this.activateGizmos(false);
534
891
  } else {
535
- const screenNotches = 8;
892
+ //continue with fov operation
893
+ const screenNotches = 8; //how many wheel notches corresponds to a full screen pan
894
+
536
895
  this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
896
+
537
897
  const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
538
898
  let size = 1;
899
+
539
900
  if (movement < 0) {
540
901
  size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);
541
902
  } else if (movement > 0) {
542
903
  size = Math.pow(this.scaleFactor, movement * screenNotches);
543
904
  }
905
+
544
906
  this._v3_1.setFromMatrixPosition(this._cameraMatrixState);
907
+
545
908
  const x = this._v3_1.distanceTo(this._gizmos.position);
546
- let xNew = x / size;
547
- xNew = THREE.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
548
- const y = x * Math.tan(THREE.MathUtils.DEG2RAD * this._fovState * 0.5);
549
- let newFov = THREE.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);
550
- newFov = THREE.MathUtils.clamp(newFov, this.minFov, this.maxFov);
551
- const newDistance = y / Math.tan(THREE.MathUtils.DEG2RAD * (newFov / 2));
909
+
910
+ let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed
911
+ //check min and max distance
912
+
913
+ xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
914
+ const y = x * Math.tan(MathUtils.DEG2RAD * this._fovState * 0.5); //calculate new fov
915
+
916
+ let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2); //check min and max fov
917
+
918
+ newFov = MathUtils.clamp(newFov, this.minFov, this.maxFov);
919
+ const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2));
552
920
  size = x / newDistance;
921
+
553
922
  this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);
923
+
554
924
  this.setFov(newFov);
555
- this.applyTransformMatrix(this.applyScale(size, this._v3_2, false));
925
+ this.applyTransformMatrix(this.applyScale(size, this._v3_2, false)); //adjusting distance
926
+
556
927
  const direction = this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(newDistance / x);
928
+
557
929
  this._m4_1.makeTranslation(direction.x, direction.y, direction.z);
558
930
  }
559
931
  }
932
+
560
933
  break;
561
934
  }
935
+
562
936
  this.dispatchEvent(_changeEvent);
563
937
  }
564
- };
565
- this.onSinglePanEnd = () => {
938
+ });
939
+
940
+ _defineProperty(this, "onSinglePanEnd", () => {
566
941
  if (this._state == STATE.ROTATE) {
567
942
  if (!this.enableRotate) {
568
943
  return;
569
944
  }
945
+
570
946
  if (this.enableAnimations) {
947
+ //perform rotation animation
571
948
  const deltaTime = performance.now() - this._timeCurrent;
949
+
572
950
  if (deltaTime < 120) {
573
951
  const w = Math.abs((this._wPrev + this._wCurr) / 2);
574
952
  const self = this;
575
- this._animationId = window.requestAnimationFrame(function(t) {
953
+ this._animationId = window.requestAnimationFrame(function (t) {
576
954
  self.updateTbState(STATE.ANIMATION_ROTATE, true);
577
955
  const rotationAxis = self.calculateRotationAxis(self._cursorPosPrev, self._cursorPosCurr);
578
956
  self.onRotationAnim(t, rotationAxis, Math.min(w, self.wMax));
579
957
  });
580
958
  } else {
959
+ //cursor has been standing still for over 120 ms since last movement
581
960
  this.updateTbState(STATE.IDLE, false);
582
961
  this.activateGizmos(false);
583
962
  this.dispatchEvent(_changeEvent);
@@ -589,26 +968,33 @@ class ArcballControls extends THREE.EventDispatcher {
589
968
  }
590
969
  } else if (this._state == STATE.PAN || this._state == STATE.IDLE) {
591
970
  this.updateTbState(STATE.IDLE, false);
971
+
592
972
  if (this.enableGrid) {
593
973
  this.disposeGrid();
594
974
  }
975
+
595
976
  this.activateGizmos(false);
596
977
  this.dispatchEvent(_changeEvent);
597
978
  }
979
+
598
980
  this.dispatchEvent(_endEvent);
599
- };
600
- this.onDoubleTap = (event) => {
981
+ });
982
+
983
+ _defineProperty(this, "onDoubleTap", event => {
601
984
  if (this.enabled && this.enablePan && this.scene && this.camera && this.domElement) {
602
985
  this.dispatchEvent(_startEvent);
603
986
  this.setCenter(event.clientX, event.clientY);
604
987
  const hitP = this.unprojectOnObj(this.getCursorNDC(_center.x, _center.y, this.domElement), this.camera);
988
+
605
989
  if (hitP && this.enableAnimations) {
606
990
  const self = this;
991
+
607
992
  if (this._animationId != -1) {
608
993
  window.cancelAnimationFrame(this._animationId);
609
994
  }
995
+
610
996
  this._timeStart = -1;
611
- this._animationId = window.requestAnimationFrame(function(t) {
997
+ this._animationId = window.requestAnimationFrame(function (t) {
612
998
  self.updateTbState(STATE.ANIMATION_FOCUS, true);
613
999
  self.onFocusAnim(t, hitP, self._cameraMatrixState, self._gizmoMatrixState);
614
1000
  });
@@ -619,90 +1005,106 @@ class ArcballControls extends THREE.EventDispatcher {
619
1005
  this.dispatchEvent(_changeEvent);
620
1006
  }
621
1007
  }
1008
+
622
1009
  this.dispatchEvent(_endEvent);
623
- };
624
- this.onDoublePanStart = () => {
1010
+ });
1011
+
1012
+ _defineProperty(this, "onDoublePanStart", () => {
625
1013
  if (this.enabled && this.enablePan && this.camera && this.domElement) {
626
1014
  this.dispatchEvent(_startEvent);
627
1015
  this.updateTbState(STATE.PAN, true);
628
- this.setCenter(
629
- (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
630
- (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2
631
- );
1016
+ this.setCenter((this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2, (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2);
632
1017
  const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true);
633
- if (rayDir !== void 0) {
1018
+
1019
+ if (rayDir !== undefined) {
634
1020
  this._startCursorPosition.copy(rayDir);
635
1021
  }
1022
+
636
1023
  this._currentCursorPosition.copy(this._startCursorPosition);
1024
+
637
1025
  this.activateGizmos(false);
638
1026
  }
639
- };
640
- this.onDoublePanMove = () => {
1027
+ });
1028
+
1029
+ _defineProperty(this, "onDoublePanMove", () => {
641
1030
  if (this.enabled && this.enablePan && this.camera && this.domElement) {
642
- this.setCenter(
643
- (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
644
- (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2
645
- );
1031
+ this.setCenter((this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2, (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2);
1032
+
646
1033
  if (this._state != STATE.PAN) {
647
1034
  this.updateTbState(STATE.PAN, true);
1035
+
648
1036
  this._startCursorPosition.copy(this._currentCursorPosition);
649
1037
  }
1038
+
650
1039
  const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true);
651
- if (rayDir !== void 0)
652
- this._currentCursorPosition.copy(rayDir);
1040
+ if (rayDir !== undefined) this._currentCursorPosition.copy(rayDir);
653
1041
  this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition, true));
654
1042
  this.dispatchEvent(_changeEvent);
655
1043
  }
656
- };
657
- this.onDoublePanEnd = () => {
1044
+ });
1045
+
1046
+ _defineProperty(this, "onDoublePanEnd", () => {
658
1047
  this.updateTbState(STATE.IDLE, false);
659
1048
  this.dispatchEvent(_endEvent);
660
- };
661
- this.onRotateStart = () => {
662
- var _a;
1049
+ });
1050
+
1051
+ _defineProperty(this, "onRotateStart", () => {
663
1052
  if (this.enabled && this.enableRotate) {
1053
+ var _this$camera6;
1054
+
664
1055
  this.dispatchEvent(_startEvent);
665
- this.updateTbState(STATE.ZROTATE, true);
1056
+ this.updateTbState(STATE.ZROTATE, true); //this._startFingerRotation = event.rotation;
1057
+
666
1058
  this._startFingerRotation = this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) + this.getAngle(this._touchStart[1], this._touchStart[0]);
667
1059
  this._currentFingerRotation = this._startFingerRotation;
668
- (_a = this.camera) == null ? void 0 : _a.getWorldDirection(this._rotationAxis);
1060
+ (_this$camera6 = this.camera) === null || _this$camera6 === void 0 ? void 0 : _this$camera6.getWorldDirection(this._rotationAxis); //rotation axis
1061
+
669
1062
  if (!this.enablePan && !this.enableZoom) {
670
1063
  this.activateGizmos(true);
671
1064
  }
672
1065
  }
673
- };
674
- this.onRotateMove = () => {
675
- var _a;
1066
+ });
1067
+
1068
+ _defineProperty(this, "onRotateMove", () => {
676
1069
  if (this.enabled && this.enableRotate && this.camera && this.domElement) {
677
- this.setCenter(
678
- (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
679
- (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2
680
- );
1070
+ this.setCenter((this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2, (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2);
681
1071
  let rotationPoint;
1072
+
682
1073
  if (this._state != STATE.ZROTATE) {
683
1074
  this.updateTbState(STATE.ZROTATE, true);
684
1075
  this._startFingerRotation = this._currentFingerRotation;
685
- }
1076
+ } //this._currentFingerRotation = event.rotation;
1077
+
1078
+
686
1079
  this._currentFingerRotation = this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) + this.getAngle(this._touchStart[1], this._touchStart[0]);
1080
+
687
1081
  if (!this.enablePan) {
688
- rotationPoint = new THREE.Vector3().setFromMatrixPosition(this._gizmoMatrixState);
1082
+ rotationPoint = new Vector3().setFromMatrixPosition(this._gizmoMatrixState);
689
1083
  } else if (this.camera) {
1084
+ var _this$unprojectOnTbPl3;
1085
+
690
1086
  this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);
691
- rotationPoint = (_a = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)) == null ? void 0 : _a.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._v3_2);
1087
+
1088
+ rotationPoint = (_this$unprojectOnTbPl3 = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)) === null || _this$unprojectOnTbPl3 === void 0 ? void 0 : _this$unprojectOnTbPl3.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._v3_2);
692
1089
  }
693
- const amount = THREE.MathUtils.DEG2RAD * (this._startFingerRotation - this._currentFingerRotation);
694
- if (rotationPoint !== void 0) {
1090
+
1091
+ const amount = MathUtils.DEG2RAD * (this._startFingerRotation - this._currentFingerRotation);
1092
+
1093
+ if (rotationPoint !== undefined) {
695
1094
  this.applyTransformMatrix(this.zRotate(rotationPoint, amount));
696
1095
  }
1096
+
697
1097
  this.dispatchEvent(_changeEvent);
698
1098
  }
699
- };
700
- this.onRotateEnd = () => {
1099
+ });
1100
+
1101
+ _defineProperty(this, "onRotateEnd", () => {
701
1102
  this.updateTbState(STATE.IDLE, false);
702
1103
  this.activateGizmos(false);
703
1104
  this.dispatchEvent(_endEvent);
704
- };
705
- this.onPinchStart = () => {
1105
+ });
1106
+
1107
+ _defineProperty(this, "onPinchStart", () => {
706
1108
  if (this.enabled && this.enableZoom) {
707
1109
  this.dispatchEvent(_startEvent);
708
1110
  this.updateTbState(STATE.SCALE, true);
@@ -710,407 +1112,583 @@ class ArcballControls extends THREE.EventDispatcher {
710
1112
  this._currentFingerDistance = this._startFingerDistance;
711
1113
  this.activateGizmos(false);
712
1114
  }
713
- };
714
- this.onPinchMove = () => {
715
- var _a, _b, _c, _d;
1115
+ });
1116
+
1117
+ _defineProperty(this, "onPinchMove", () => {
716
1118
  if (this.enabled && this.enableZoom && this.domElement) {
717
- this.setCenter(
718
- (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
719
- (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2
720
- );
721
- const minDistance = 12;
1119
+ this.setCenter((this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2, (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2);
1120
+ const minDistance = 12; //minimum distance between fingers (in css pixels)
1121
+
722
1122
  if (this._state != STATE.SCALE) {
723
1123
  this._startFingerDistance = this._currentFingerDistance;
724
1124
  this.updateTbState(STATE.SCALE, true);
725
1125
  }
726
- this._currentFingerDistance = Math.max(
727
- this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1]),
728
- minDistance * this._devPxRatio
729
- );
1126
+
1127
+ this._currentFingerDistance = Math.max(this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1]), minDistance * this._devPxRatio);
730
1128
  const amount = this._currentFingerDistance / this._startFingerDistance;
731
1129
  let scalePoint;
1130
+
732
1131
  if (!this.enablePan) {
733
1132
  scalePoint = this._gizmos.position;
734
1133
  } else {
735
- if (((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera") {
736
- scalePoint = (_b = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)) == null ? void 0 : _b.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._gizmos.position);
737
- } else if (((_c = this.camera) == null ? void 0 : _c.type) === "PerspectiveCamera") {
738
- scalePoint = (_d = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)) == null ? void 0 : _d.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);
1134
+ var _this$camera7, _this$camera8;
1135
+
1136
+ if (((_this$camera7 = this.camera) === null || _this$camera7 === void 0 ? void 0 : _this$camera7.type) === 'OrthographicCamera') {
1137
+ var _this$unprojectOnTbPl4;
1138
+
1139
+ scalePoint = (_this$unprojectOnTbPl4 = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)) === null || _this$unprojectOnTbPl4 === void 0 ? void 0 : _this$unprojectOnTbPl4.applyQuaternion(this.camera.quaternion).multiplyScalar(1 / this.camera.zoom).add(this._gizmos.position);
1140
+ } else if (((_this$camera8 = this.camera) === null || _this$camera8 === void 0 ? void 0 : _this$camera8.type) === 'PerspectiveCamera') {
1141
+ var _this$unprojectOnTbPl5;
1142
+
1143
+ scalePoint = (_this$unprojectOnTbPl5 = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)) === null || _this$unprojectOnTbPl5 === void 0 ? void 0 : _this$unprojectOnTbPl5.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);
739
1144
  }
740
1145
  }
741
- if (scalePoint !== void 0) {
1146
+
1147
+ if (scalePoint !== undefined) {
742
1148
  this.applyTransformMatrix(this.applyScale(amount, scalePoint));
743
1149
  }
1150
+
744
1151
  this.dispatchEvent(_changeEvent);
745
1152
  }
746
- };
747
- this.onPinchEnd = () => {
1153
+ });
1154
+
1155
+ _defineProperty(this, "onPinchEnd", () => {
748
1156
  this.updateTbState(STATE.IDLE, false);
749
1157
  this.dispatchEvent(_endEvent);
750
- };
751
- this.onTriplePanStart = () => {
1158
+ });
1159
+
1160
+ _defineProperty(this, "onTriplePanStart", () => {
752
1161
  if (this.enabled && this.enableZoom && this.domElement) {
753
1162
  this.dispatchEvent(_startEvent);
754
- this.updateTbState(STATE.SCALE, true);
1163
+ this.updateTbState(STATE.SCALE, true); //const center = event.center;
1164
+
755
1165
  let clientX = 0;
756
1166
  let clientY = 0;
757
1167
  const nFingers = this._touchCurrent.length;
1168
+
758
1169
  for (let i = 0; i < nFingers; i++) {
759
1170
  clientX += this._touchCurrent[i].clientX;
760
1171
  clientY += this._touchCurrent[i].clientY;
761
1172
  }
1173
+
762
1174
  this.setCenter(clientX / nFingers, clientY / nFingers);
1175
+
763
1176
  this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
1177
+
764
1178
  this._currentCursorPosition.copy(this._startCursorPosition);
765
1179
  }
766
- };
767
- this.onTriplePanMove = () => {
1180
+ });
1181
+
1182
+ _defineProperty(this, "onTriplePanMove", () => {
768
1183
  if (this.enabled && this.enableZoom && this.camera && this.domElement) {
1184
+ // fov / 2
1185
+ // |\
1186
+ // | \
1187
+ // | \
1188
+ // x | \
1189
+ // | \
1190
+ // | \
1191
+ // | _ _ _\
1192
+ // y
1193
+ //const center = event.center;
769
1194
  let clientX = 0;
770
1195
  let clientY = 0;
771
1196
  const nFingers = this._touchCurrent.length;
1197
+
772
1198
  for (let i = 0; i < nFingers; i++) {
773
1199
  clientX += this._touchCurrent[i].clientX;
774
1200
  clientY += this._touchCurrent[i].clientY;
775
1201
  }
1202
+
776
1203
  this.setCenter(clientX / nFingers, clientY / nFingers);
777
- const screenNotches = 8;
1204
+ const screenNotches = 8; //how many wheel notches corresponds to a full screen pan
1205
+
778
1206
  this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
1207
+
779
1208
  const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
780
1209
  let size = 1;
1210
+
781
1211
  if (movement < 0) {
782
1212
  size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);
783
1213
  } else if (movement > 0) {
784
1214
  size = Math.pow(this.scaleFactor, movement * screenNotches);
785
1215
  }
1216
+
786
1217
  this._v3_1.setFromMatrixPosition(this._cameraMatrixState);
1218
+
787
1219
  const x = this._v3_1.distanceTo(this._gizmos.position);
788
- let xNew = x / size;
789
- xNew = THREE.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
790
- const y = x * Math.tan(THREE.MathUtils.DEG2RAD * this._fovState * 0.5);
791
- let newFov = THREE.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);
792
- newFov = THREE.MathUtils.clamp(newFov, this.minFov, this.maxFov);
793
- const newDistance = y / Math.tan(THREE.MathUtils.DEG2RAD * (newFov / 2));
1220
+
1221
+ let xNew = x / size; //distance between camera and gizmos if scale(size, scalepoint) would be performed
1222
+ //check min and max distance
1223
+
1224
+ xNew = MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
1225
+ const y = x * Math.tan(MathUtils.DEG2RAD * this._fovState * 0.5); //calculate new fov
1226
+
1227
+ let newFov = MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2); //check min and max fov
1228
+
1229
+ newFov = MathUtils.clamp(newFov, this.minFov, this.maxFov);
1230
+ const newDistance = y / Math.tan(MathUtils.DEG2RAD * (newFov / 2));
794
1231
  size = x / newDistance;
1232
+
795
1233
  this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);
1234
+
796
1235
  this.setFov(newFov);
797
- this.applyTransformMatrix(this.applyScale(size, this._v3_2, false));
1236
+ this.applyTransformMatrix(this.applyScale(size, this._v3_2, false)); //adjusting distance
1237
+
798
1238
  const direction = this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(newDistance / x);
1239
+
799
1240
  this._m4_1.makeTranslation(direction.x, direction.y, direction.z);
1241
+
800
1242
  this.dispatchEvent(_changeEvent);
801
1243
  }
802
- };
803
- this.onTriplePanEnd = () => {
1244
+ });
1245
+
1246
+ _defineProperty(this, "onTriplePanEnd", () => {
804
1247
  this.updateTbState(STATE.IDLE, false);
805
- this.dispatchEvent(_endEvent);
806
- };
807
- this.setCenter = (clientX, clientY) => {
1248
+ this.dispatchEvent(_endEvent); //this.dispatchEvent( _changeEvent );
1249
+ });
1250
+
1251
+ _defineProperty(this, "setCenter", (clientX, clientY) => {
808
1252
  _center.x = clientX;
809
1253
  _center.y = clientY;
810
- };
811
- this.initializeMouseActions = () => {
812
- this.setMouseAction("PAN", 0, "CTRL");
813
- this.setMouseAction("PAN", 2);
814
- this.setMouseAction("ROTATE", 0);
815
- this.setMouseAction("ZOOM", "WHEEL");
816
- this.setMouseAction("ZOOM", 1);
817
- this.setMouseAction("FOV", "WHEEL", "SHIFT");
818
- this.setMouseAction("FOV", 1, "SHIFT");
819
- };
820
- this.setMouseAction = (operation, mouse, key = null) => {
821
- const operationInput = ["PAN", "ROTATE", "ZOOM", "FOV"];
822
- const mouseInput = [0, 1, 2, "WHEEL"];
823
- const keyInput = ["CTRL", "SHIFT", null];
1254
+ });
1255
+
1256
+ _defineProperty(this, "initializeMouseActions", () => {
1257
+ this.setMouseAction('PAN', 0, 'CTRL');
1258
+ this.setMouseAction('PAN', 2);
1259
+ this.setMouseAction('ROTATE', 0);
1260
+ this.setMouseAction('ZOOM', 'WHEEL');
1261
+ this.setMouseAction('ZOOM', 1);
1262
+ this.setMouseAction('FOV', 'WHEEL', 'SHIFT');
1263
+ this.setMouseAction('FOV', 1, 'SHIFT');
1264
+ });
1265
+
1266
+ _defineProperty(this, "setMouseAction", (operation, mouse, key = null) => {
1267
+ const operationInput = ['PAN', 'ROTATE', 'ZOOM', 'FOV'];
1268
+ const mouseInput = [0, 1, 2, 'WHEEL'];
1269
+ const keyInput = ['CTRL', 'SHIFT', null];
824
1270
  let state;
1271
+
825
1272
  if (!operationInput.includes(operation) || !mouseInput.includes(mouse) || !keyInput.includes(key)) {
1273
+ //invalid parameters
826
1274
  return false;
827
1275
  }
828
- if (mouse == "WHEEL") {
829
- if (operation != "ZOOM" && operation != "FOV") {
1276
+
1277
+ if (mouse == 'WHEEL') {
1278
+ if (operation != 'ZOOM' && operation != 'FOV') {
1279
+ //cannot associate 2D operation to 1D input
830
1280
  return false;
831
1281
  }
832
1282
  }
1283
+
833
1284
  switch (operation) {
834
- case "PAN":
1285
+ case 'PAN':
835
1286
  state = STATE.PAN;
836
1287
  break;
837
- case "ROTATE":
1288
+
1289
+ case 'ROTATE':
838
1290
  state = STATE.ROTATE;
839
1291
  break;
840
- case "ZOOM":
1292
+
1293
+ case 'ZOOM':
841
1294
  state = STATE.SCALE;
842
1295
  break;
843
- case "FOV":
1296
+
1297
+ case 'FOV':
844
1298
  state = STATE.FOV;
845
1299
  break;
846
1300
  }
1301
+
847
1302
  const action = {
848
- operation,
849
- mouse,
850
- key,
851
- state
1303
+ operation: operation,
1304
+ mouse: mouse,
1305
+ key: key,
1306
+ state: state
852
1307
  };
1308
+
853
1309
  for (let i = 0; i < this.mouseActions.length; i++) {
854
1310
  if (this.mouseActions[i].mouse == action.mouse && this.mouseActions[i].key == action.key) {
855
1311
  this.mouseActions.splice(i, 1, action);
856
1312
  return true;
857
1313
  }
858
1314
  }
1315
+
859
1316
  this.mouseActions.push(action);
860
1317
  return true;
861
- };
862
- this.getOpFromAction = (mouse, key) => {
1318
+ });
1319
+
1320
+ _defineProperty(this, "getOpFromAction", (mouse, key) => {
863
1321
  let action;
1322
+
864
1323
  for (let i = 0; i < this.mouseActions.length; i++) {
865
1324
  action = this.mouseActions[i];
1325
+
866
1326
  if (action.mouse == mouse && action.key == key) {
867
1327
  return action.operation;
868
1328
  }
869
1329
  }
1330
+
870
1331
  if (key) {
871
1332
  for (let i = 0; i < this.mouseActions.length; i++) {
872
1333
  action = this.mouseActions[i];
1334
+
873
1335
  if (action.mouse == mouse && action.key == null) {
874
1336
  return action.operation;
875
1337
  }
876
1338
  }
877
1339
  }
1340
+
878
1341
  return null;
879
- };
880
- this.getOpStateFromAction = (mouse, key) => {
1342
+ });
1343
+
1344
+ _defineProperty(this, "getOpStateFromAction", (mouse, key) => {
881
1345
  let action;
1346
+
882
1347
  for (let i = 0; i < this.mouseActions.length; i++) {
883
1348
  action = this.mouseActions[i];
1349
+
884
1350
  if (action.mouse == mouse && action.key == key) {
885
1351
  return action.state;
886
1352
  }
887
1353
  }
1354
+
888
1355
  if (key) {
889
1356
  for (let i = 0; i < this.mouseActions.length; i++) {
890
1357
  action = this.mouseActions[i];
1358
+
891
1359
  if (action.mouse == mouse && action.key == null) {
892
1360
  return action.state;
893
1361
  }
894
1362
  }
895
1363
  }
1364
+
896
1365
  return null;
897
- };
898
- this.getAngle = (p1, p2) => {
1366
+ });
1367
+
1368
+ _defineProperty(this, "getAngle", (p1, p2) => {
899
1369
  return Math.atan2(p2.clientY - p1.clientY, p2.clientX - p1.clientX) * 180 / Math.PI;
900
- };
901
- this.updateTouchEvent = (event) => {
1370
+ });
1371
+
1372
+ _defineProperty(this, "updateTouchEvent", event => {
902
1373
  for (let i = 0; i < this._touchCurrent.length; i++) {
903
1374
  if (this._touchCurrent[i].pointerId == event.pointerId) {
904
1375
  this._touchCurrent.splice(i, 1, event);
1376
+
905
1377
  break;
906
1378
  }
907
1379
  }
908
- };
909
- this.calculateAngularSpeed = (p0, p1, t0, t1) => {
1380
+ });
1381
+
1382
+ _defineProperty(this, "calculateAngularSpeed", (p0, p1, t0, t1) => {
910
1383
  const s = p1 - p0;
911
- const t = (t1 - t0) / 1e3;
1384
+ const t = (t1 - t0) / 1000;
1385
+
912
1386
  if (t == 0) {
913
1387
  return 0;
914
1388
  }
1389
+
915
1390
  return s / t;
916
- };
917
- this.calculatePointersDistance = (p0, p1) => {
1391
+ });
1392
+
1393
+ _defineProperty(this, "calculatePointersDistance", (p0, p1) => {
918
1394
  return Math.sqrt(Math.pow(p1.clientX - p0.clientX, 2) + Math.pow(p1.clientY - p0.clientY, 2));
919
- };
920
- this.calculateRotationAxis = (vec1, vec2) => {
1395
+ });
1396
+
1397
+ _defineProperty(this, "calculateRotationAxis", (vec1, vec2) => {
921
1398
  this._rotationMatrix.extractRotation(this._cameraMatrixState);
1399
+
922
1400
  this._quat.setFromRotationMatrix(this._rotationMatrix);
1401
+
923
1402
  this._rotationAxis.crossVectors(vec1, vec2).applyQuaternion(this._quat);
1403
+
924
1404
  return this._rotationAxis.normalize().clone();
925
- };
926
- this.calculateTbRadius = (camera2) => {
1405
+ });
1406
+
1407
+ _defineProperty(this, "calculateTbRadius", camera => {
927
1408
  const factor = 0.67;
928
- const distance = camera2.position.distanceTo(this._gizmos.position);
929
- if (camera2.type == "PerspectiveCamera") {
930
- const halfFovV = THREE.MathUtils.DEG2RAD * camera2.fov * 0.5;
931
- const halfFovH = Math.atan(camera2.aspect * Math.tan(halfFovV));
1409
+ const distance = camera.position.distanceTo(this._gizmos.position);
1410
+
1411
+ if (camera.type == 'PerspectiveCamera') {
1412
+ const halfFovV = MathUtils.DEG2RAD * camera.fov * 0.5; //vertical fov/2 in radians
1413
+
1414
+ const halfFovH = Math.atan(camera.aspect * Math.tan(halfFovV)); //horizontal fov/2 in radians
1415
+
932
1416
  return Math.tan(Math.min(halfFovV, halfFovH)) * distance * factor;
933
- } else if (camera2.type == "OrthographicCamera") {
934
- return Math.min(camera2.top, camera2.right) * factor;
1417
+ } else if (camera.type == 'OrthographicCamera') {
1418
+ return Math.min(camera.top, camera.right) * factor;
935
1419
  }
936
- };
937
- this.focus = (point, size, amount = 1) => {
1420
+ });
1421
+
1422
+ _defineProperty(this, "focus", (point, size, amount = 1) => {
938
1423
  if (this.camera) {
939
- const focusPoint = point.clone();
1424
+ const focusPoint = point.clone(); //move center of camera (along with gizmos) towards point of interest
1425
+
940
1426
  focusPoint.sub(this._gizmos.position).multiplyScalar(amount);
1427
+
941
1428
  this._translationMatrix.makeTranslation(focusPoint.x, focusPoint.y, focusPoint.z);
1429
+
942
1430
  const gizmoStateTemp = this._gizmoMatrixState.clone();
1431
+
943
1432
  this._gizmoMatrixState.premultiply(this._translationMatrix);
1433
+
944
1434
  this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1435
+
945
1436
  const cameraStateTemp = this._cameraMatrixState.clone();
1437
+
946
1438
  this._cameraMatrixState.premultiply(this._translationMatrix);
947
- this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);
1439
+
1440
+ this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale); //apply zoom
1441
+
1442
+
948
1443
  if (this.enableZoom) {
949
1444
  this.applyTransformMatrix(this.applyScale(size, this._gizmos.position));
950
1445
  }
1446
+
951
1447
  this._gizmoMatrixState.copy(gizmoStateTemp);
1448
+
952
1449
  this._cameraMatrixState.copy(cameraStateTemp);
953
1450
  }
954
- };
955
- this.drawGrid = () => {
956
- var _a, _b;
1451
+ });
1452
+
1453
+ _defineProperty(this, "drawGrid", () => {
957
1454
  if (this.scene) {
958
- const color = 8947848;
1455
+ var _this$camera9, _this$camera10;
1456
+
1457
+ const color = 0x888888;
959
1458
  const multiplier = 3;
960
1459
  let size, divisions, maxLength, tick;
961
- if (((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera") {
1460
+
1461
+ if (((_this$camera9 = this.camera) === null || _this$camera9 === void 0 ? void 0 : _this$camera9.type) === 'OrthographicCamera') {
962
1462
  const width = this.camera.right - this.camera.left;
963
1463
  const height = this.camera.bottom - this.camera.top;
964
1464
  maxLength = Math.max(width, height);
965
1465
  tick = maxLength / 20;
966
1466
  size = maxLength / this.camera.zoom * multiplier;
967
1467
  divisions = size / tick * this.camera.zoom;
968
- } else if (((_b = this.camera) == null ? void 0 : _b.type) === "PerspectiveCamera") {
1468
+ } else if (((_this$camera10 = this.camera) === null || _this$camera10 === void 0 ? void 0 : _this$camera10.type) === 'PerspectiveCamera') {
969
1469
  const distance = this.camera.position.distanceTo(this._gizmos.position);
970
- const halfFovV = THREE.MathUtils.DEG2RAD * this.camera.fov * 0.5;
1470
+ const halfFovV = MathUtils.DEG2RAD * this.camera.fov * 0.5;
971
1471
  const halfFovH = Math.atan(this.camera.aspect * Math.tan(halfFovV));
972
1472
  maxLength = Math.tan(Math.max(halfFovV, halfFovH)) * distance * 2;
973
1473
  tick = maxLength / 20;
974
1474
  size = maxLength * multiplier;
975
1475
  divisions = size / tick;
976
1476
  }
1477
+
977
1478
  if (this._grid == null && this.camera) {
978
- this._grid = new THREE.GridHelper(size, divisions, color, color);
1479
+ this._grid = new GridHelper(size, divisions, color, color);
1480
+
979
1481
  this._grid.position.copy(this._gizmos.position);
1482
+
980
1483
  this._gridPosition.copy(this._grid.position);
1484
+
981
1485
  this._grid.quaternion.copy(this.camera.quaternion);
1486
+
982
1487
  this._grid.rotateX(Math.PI * 0.5);
1488
+
983
1489
  this.scene.add(this._grid);
984
1490
  }
985
1491
  }
986
- };
987
- this.connect = (domElement2) => {
988
- if (domElement2 === document) {
989
- console.error(
990
- 'THREE.ArcballControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'
991
- );
992
- }
993
- this.domElement = domElement2;
994
- this.domElement.style.touchAction = "none";
995
- this.domElement.addEventListener("contextmenu", this.onContextMenu);
996
- this.domElement.addEventListener("pointerdown", this.onPointerDown);
997
- this.domElement.addEventListener("pointercancel", this.onPointerCancel);
998
- this.domElement.addEventListener("wheel", this.onWheel);
999
- };
1000
- this.dispose = () => {
1001
- var _a, _b, _c, _d, _e;
1492
+ });
1493
+
1494
+ _defineProperty(this, "connect", domElement => {
1495
+ // https://github.com/mrdoob/three.js/issues/20575
1496
+ if (domElement === document) {
1497
+ console.error('THREE.ArcballControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.');
1498
+ }
1499
+
1500
+ this.domElement = domElement; // disables touch scroll
1501
+ // touch-action needs to be defined for pointer events to work on mobile
1502
+ // https://stackoverflow.com/a/48254578
1503
+
1504
+ this.domElement.style.touchAction = 'none';
1505
+ this.domElement.addEventListener('contextmenu', this.onContextMenu);
1506
+ this.domElement.addEventListener('pointerdown', this.onPointerDown);
1507
+ this.domElement.addEventListener('pointercancel', this.onPointerCancel);
1508
+ this.domElement.addEventListener('wheel', this.onWheel);
1509
+ });
1510
+
1511
+ _defineProperty(this, "dispose", () => {
1512
+ var _this$domElement, _this$domElement2, _this$domElement3, _this$domElement4, _this$scene;
1513
+
1002
1514
  if (this._animationId != -1) {
1003
1515
  window.cancelAnimationFrame(this._animationId);
1004
1516
  }
1005
- (_a = this.domElement) == null ? void 0 : _a.removeEventListener("pointerdown", this.onPointerDown);
1006
- (_b = this.domElement) == null ? void 0 : _b.removeEventListener("pointercancel", this.onPointerCancel);
1007
- (_c = this.domElement) == null ? void 0 : _c.removeEventListener("wheel", this.onWheel);
1008
- (_d = this.domElement) == null ? void 0 : _d.removeEventListener("contextmenu", this.onContextMenu);
1009
- window.removeEventListener("pointermove", this.onPointerMove);
1010
- window.removeEventListener("pointerup", this.onPointerUp);
1011
- window.removeEventListener("resize", this.onWindowResize);
1012
- (_e = this.scene) == null ? void 0 : _e.remove(this._gizmos);
1517
+
1518
+ (_this$domElement = this.domElement) === null || _this$domElement === void 0 ? void 0 : _this$domElement.removeEventListener('pointerdown', this.onPointerDown);
1519
+ (_this$domElement2 = this.domElement) === null || _this$domElement2 === void 0 ? void 0 : _this$domElement2.removeEventListener('pointercancel', this.onPointerCancel);
1520
+ (_this$domElement3 = this.domElement) === null || _this$domElement3 === void 0 ? void 0 : _this$domElement3.removeEventListener('wheel', this.onWheel);
1521
+ (_this$domElement4 = this.domElement) === null || _this$domElement4 === void 0 ? void 0 : _this$domElement4.removeEventListener('contextmenu', this.onContextMenu);
1522
+ window.removeEventListener('pointermove', this.onPointerMove);
1523
+ window.removeEventListener('pointerup', this.onPointerUp);
1524
+ window.removeEventListener('resize', this.onWindowResize);
1525
+ (_this$scene = this.scene) === null || _this$scene === void 0 ? void 0 : _this$scene.remove(this._gizmos);
1013
1526
  this.disposeGrid();
1014
- };
1015
- this.disposeGrid = () => {
1527
+ });
1528
+
1529
+ _defineProperty(this, "disposeGrid", () => {
1016
1530
  if (this._grid && this.scene) {
1017
1531
  this.scene.remove(this._grid);
1018
1532
  this._grid = null;
1019
1533
  }
1020
- };
1021
- this.easeOutCubic = (t) => {
1534
+ });
1535
+
1536
+ _defineProperty(this, "easeOutCubic", t => {
1022
1537
  return 1 - Math.pow(1 - t, 3);
1023
- };
1024
- this.activateGizmos = (isActive) => {
1538
+ });
1539
+
1540
+ _defineProperty(this, "activateGizmos", isActive => {
1025
1541
  for (const gizmo of this._gizmos.children) {
1026
- ;
1027
- gizmo.material.setValues({ opacity: isActive ? 1 : 0.6 });
1542
+ gizmo.material.setValues({
1543
+ opacity: isActive ? 1 : 0.6
1544
+ });
1028
1545
  }
1029
- };
1030
- this.getCursorNDC = (cursorX, cursorY, canvas) => {
1546
+ });
1547
+
1548
+ _defineProperty(this, "getCursorNDC", (cursorX, cursorY, canvas) => {
1031
1549
  const canvasRect = canvas.getBoundingClientRect();
1550
+
1032
1551
  this._v2_1.setX((cursorX - canvasRect.left) / canvasRect.width * 2 - 1);
1552
+
1033
1553
  this._v2_1.setY((canvasRect.bottom - cursorY) / canvasRect.height * 2 - 1);
1554
+
1034
1555
  return this._v2_1.clone();
1035
- };
1036
- this.getCursorPosition = (cursorX, cursorY, canvas) => {
1037
- var _a;
1556
+ });
1557
+
1558
+ _defineProperty(this, "getCursorPosition", (cursorX, cursorY, canvas) => {
1559
+ var _this$camera11;
1560
+
1038
1561
  this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));
1039
- if (((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera") {
1562
+
1563
+ if (((_this$camera11 = this.camera) === null || _this$camera11 === void 0 ? void 0 : _this$camera11.type) === 'OrthographicCamera') {
1040
1564
  this._v2_1.x *= (this.camera.right - this.camera.left) * 0.5;
1041
1565
  this._v2_1.y *= (this.camera.top - this.camera.bottom) * 0.5;
1042
1566
  }
1567
+
1043
1568
  return this._v2_1.clone();
1044
- };
1045
- this.setCamera = (camera2) => {
1046
- if (camera2) {
1047
- camera2.lookAt(this.target);
1048
- camera2.updateMatrix();
1049
- if ((camera2 == null ? void 0 : camera2.type) == "PerspectiveCamera") {
1050
- this._fov0 = camera2.fov;
1051
- this._fovState = camera2.fov;
1052
- }
1053
- this._cameraMatrixState0.copy(camera2.matrix);
1569
+ });
1570
+
1571
+ _defineProperty(this, "setCamera", camera => {
1572
+ if (camera) {
1573
+ camera.lookAt(this.target);
1574
+ camera.updateMatrix(); //setting state
1575
+
1576
+ if ((camera === null || camera === void 0 ? void 0 : camera.type) == 'PerspectiveCamera') {
1577
+ this._fov0 = camera.fov;
1578
+ this._fovState = camera.fov;
1579
+ }
1580
+
1581
+ this._cameraMatrixState0.copy(camera.matrix);
1582
+
1054
1583
  this._cameraMatrixState.copy(this._cameraMatrixState0);
1055
- this._cameraProjectionState.copy(camera2.projectionMatrix);
1056
- this._zoom0 = camera2.zoom;
1584
+
1585
+ this._cameraProjectionState.copy(camera.projectionMatrix);
1586
+
1587
+ this._zoom0 = camera.zoom;
1057
1588
  this._zoomState = this._zoom0;
1058
- this._initialNear = camera2.near;
1059
- this._nearPos0 = camera2.position.distanceTo(this.target) - camera2.near;
1589
+ this._initialNear = camera.near;
1590
+ this._nearPos0 = camera.position.distanceTo(this.target) - camera.near;
1060
1591
  this._nearPos = this._initialNear;
1061
- this._initialFar = camera2.far;
1062
- this._farPos0 = camera2.position.distanceTo(this.target) - camera2.far;
1592
+ this._initialFar = camera.far;
1593
+ this._farPos0 = camera.position.distanceTo(this.target) - camera.far;
1063
1594
  this._farPos = this._initialFar;
1064
- this._up0.copy(camera2.up);
1065
- this._upState.copy(camera2.up);
1066
- this.camera = camera2;
1067
- this.camera.updateProjectionMatrix();
1068
- const tbRadius = this.calculateTbRadius(camera2);
1069
- if (tbRadius !== void 0) {
1595
+
1596
+ this._up0.copy(camera.up);
1597
+
1598
+ this._upState.copy(camera.up);
1599
+
1600
+ this.camera = camera;
1601
+ this.camera.updateProjectionMatrix(); //making gizmos
1602
+
1603
+ const tbRadius = this.calculateTbRadius(camera);
1604
+
1605
+ if (tbRadius !== undefined) {
1070
1606
  this._tbRadius = tbRadius;
1071
1607
  }
1608
+
1072
1609
  this.makeGizmos(this.target, this._tbRadius);
1073
1610
  }
1074
- };
1075
- this.makeGizmos = (tbCenter, tbRadius) => {
1076
- const curve = new THREE.EllipseCurve(0, 0, tbRadius, tbRadius);
1077
- const points = curve.getPoints(this._curvePts);
1078
- const curveGeometry = new THREE.BufferGeometry().setFromPoints(points);
1079
- const curveMaterialX = new THREE.LineBasicMaterial({ color: 16744576, fog: false, transparent: true, opacity: 0.6 });
1080
- const curveMaterialY = new THREE.LineBasicMaterial({ color: 8454016, fog: false, transparent: true, opacity: 0.6 });
1081
- const curveMaterialZ = new THREE.LineBasicMaterial({ color: 8421631, fog: false, transparent: true, opacity: 0.6 });
1082
- const gizmoX = new THREE.Line(curveGeometry, curveMaterialX);
1083
- const gizmoY = new THREE.Line(curveGeometry, curveMaterialY);
1084
- const gizmoZ = new THREE.Line(curveGeometry, curveMaterialZ);
1611
+ });
1612
+
1613
+ _defineProperty(this, "makeGizmos", (tbCenter, tbRadius) => {
1614
+ // @ts-expect-error
1615
+ const curve = new EllipseCurve(0, 0, tbRadius, tbRadius);
1616
+ const points = curve.getPoints(this._curvePts); //geometry
1617
+
1618
+ const curveGeometry = new BufferGeometry().setFromPoints(points); //material
1619
+
1620
+ const curveMaterialX = new LineBasicMaterial({
1621
+ color: 0xff8080,
1622
+ fog: false,
1623
+ transparent: true,
1624
+ opacity: 0.6
1625
+ });
1626
+ const curveMaterialY = new LineBasicMaterial({
1627
+ color: 0x80ff80,
1628
+ fog: false,
1629
+ transparent: true,
1630
+ opacity: 0.6
1631
+ });
1632
+ const curveMaterialZ = new LineBasicMaterial({
1633
+ color: 0x8080ff,
1634
+ fog: false,
1635
+ transparent: true,
1636
+ opacity: 0.6
1637
+ }); //line
1638
+
1639
+ const gizmoX = new Line(curveGeometry, curveMaterialX);
1640
+ const gizmoY = new Line(curveGeometry, curveMaterialY);
1641
+ const gizmoZ = new Line(curveGeometry, curveMaterialZ);
1085
1642
  const rotation = Math.PI * 0.5;
1086
1643
  gizmoX.rotation.x = rotation;
1087
- gizmoY.rotation.y = rotation;
1644
+ gizmoY.rotation.y = rotation; //setting state
1645
+
1088
1646
  this._gizmoMatrixState0.identity().setPosition(tbCenter);
1647
+
1089
1648
  this._gizmoMatrixState.copy(this._gizmoMatrixState0);
1649
+
1090
1650
  if (this.camera && this.camera.zoom != 1) {
1651
+ //adapt gizmos size to camera zoom
1091
1652
  const size = 1 / this.camera.zoom;
1653
+
1092
1654
  this._scaleMatrix.makeScale(size, size, size);
1655
+
1093
1656
  this._translationMatrix.makeTranslation(-tbCenter.x, -tbCenter.y, -tbCenter.z);
1657
+
1094
1658
  this._gizmoMatrixState.premultiply(this._translationMatrix).premultiply(this._scaleMatrix);
1659
+
1095
1660
  this._translationMatrix.makeTranslation(tbCenter.x, tbCenter.y, tbCenter.z);
1661
+
1096
1662
  this._gizmoMatrixState.premultiply(this._translationMatrix);
1097
1663
  }
1664
+
1098
1665
  this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1666
+
1099
1667
  this._gizmos.clear();
1668
+
1100
1669
  this._gizmos.add(gizmoX);
1670
+
1101
1671
  this._gizmos.add(gizmoY);
1672
+
1102
1673
  this._gizmos.add(gizmoZ);
1103
- };
1104
- this.onFocusAnim = (time, point, cameraMatrix, gizmoMatrix) => {
1674
+ });
1675
+
1676
+ _defineProperty(this, "onFocusAnim", (time, point, cameraMatrix, gizmoMatrix) => {
1105
1677
  if (this._timeStart == -1) {
1678
+ //animation start
1106
1679
  this._timeStart = time;
1107
1680
  }
1681
+
1108
1682
  if (this._state == STATE.ANIMATION_FOCUS) {
1109
1683
  const deltaTime = time - this._timeStart;
1110
1684
  const animTime = deltaTime / this.focusAnimationTime;
1685
+
1111
1686
  this._gizmoMatrixState.copy(gizmoMatrix);
1687
+
1112
1688
  if (animTime >= 1) {
1689
+ //animation end
1113
1690
  this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1691
+
1114
1692
  this.focus(point, this.scaleFactor);
1115
1693
  this._timeStart = -1;
1116
1694
  this.updateTbState(STATE.IDLE, false);
@@ -1119,34 +1697,43 @@ class ArcballControls extends THREE.EventDispatcher {
1119
1697
  } else {
1120
1698
  const amount = this.easeOutCubic(animTime);
1121
1699
  const size = 1 - amount + this.scaleFactor * amount;
1700
+
1122
1701
  this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1702
+
1123
1703
  this.focus(point, size, amount);
1124
1704
  this.dispatchEvent(_changeEvent);
1125
1705
  const self = this;
1126
- this._animationId = window.requestAnimationFrame(function(t) {
1706
+ this._animationId = window.requestAnimationFrame(function (t) {
1127
1707
  self.onFocusAnim(t, point, cameraMatrix, gizmoMatrix.clone());
1128
1708
  });
1129
1709
  }
1130
1710
  } else {
1711
+ //interrupt animation
1131
1712
  this._animationId = -1;
1132
1713
  this._timeStart = -1;
1133
1714
  }
1134
- };
1135
- this.onRotationAnim = (time, rotationAxis, w0) => {
1715
+ });
1716
+
1717
+ _defineProperty(this, "onRotationAnim", (time, rotationAxis, w0) => {
1136
1718
  if (this._timeStart == -1) {
1719
+ //animation start
1137
1720
  this._anglePrev = 0;
1138
1721
  this._angleCurrent = 0;
1139
1722
  this._timeStart = time;
1140
1723
  }
1724
+
1141
1725
  if (this._state == STATE.ANIMATION_ROTATE) {
1142
- const deltaTime = (time - this._timeStart) / 1e3;
1726
+ //w = w0 + alpha * t
1727
+ const deltaTime = (time - this._timeStart) / 1000;
1143
1728
  const w = w0 + -this.dampingFactor * deltaTime;
1729
+
1144
1730
  if (w > 0) {
1731
+ //tetha = 0.5 * alpha * t^2 + w0 * t + tetha0
1145
1732
  this._angleCurrent = 0.5 * -this.dampingFactor * Math.pow(deltaTime, 2) + w0 * deltaTime + 0;
1146
1733
  this.applyTransformMatrix(this.rotate(rotationAxis, this._angleCurrent));
1147
1734
  this.dispatchEvent(_changeEvent);
1148
1735
  const self = this;
1149
- this._animationId = window.requestAnimationFrame(function(t) {
1736
+ this._animationId = window.requestAnimationFrame(function (t) {
1150
1737
  self.onRotationAnim(t, rotationAxis, w0);
1151
1738
  });
1152
1739
  } else {
@@ -1157,123 +1744,167 @@ class ArcballControls extends THREE.EventDispatcher {
1157
1744
  this.dispatchEvent(_changeEvent);
1158
1745
  }
1159
1746
  } else {
1747
+ //interrupt animation
1160
1748
  this._animationId = -1;
1161
1749
  this._timeStart = -1;
1750
+
1162
1751
  if (this._state != STATE.ROTATE) {
1163
1752
  this.activateGizmos(false);
1164
1753
  this.dispatchEvent(_changeEvent);
1165
1754
  }
1166
1755
  }
1167
- };
1168
- this.pan = (p0, p1, adjust = false) => {
1756
+ });
1757
+
1758
+ _defineProperty(this, "pan", (p0, p1, adjust = false) => {
1169
1759
  if (this.camera) {
1170
1760
  const movement = p0.clone().sub(p1);
1171
- if (this.camera.type === "OrthographicCamera") {
1761
+
1762
+ if (this.camera.type === 'OrthographicCamera') {
1763
+ //adjust movement amount
1172
1764
  movement.multiplyScalar(1 / this.camera.zoom);
1173
1765
  }
1174
- if (this.camera.type === "PerspectiveCamera" && adjust) {
1175
- this._v3_1.setFromMatrixPosition(this._cameraMatrixState0);
1176
- this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0);
1766
+
1767
+ if (this.camera.type === 'PerspectiveCamera' && adjust) {
1768
+ //adjust movement amount
1769
+ this._v3_1.setFromMatrixPosition(this._cameraMatrixState0); //camera's initial position
1770
+
1771
+
1772
+ this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0); //gizmo's initial position
1773
+
1774
+
1177
1775
  const distanceFactor = this._v3_1.distanceTo(this._v3_2) / this.camera.position.distanceTo(this._gizmos.position);
1178
1776
  movement.multiplyScalar(1 / distanceFactor);
1179
1777
  }
1778
+
1180
1779
  this._v3_1.set(movement.x, movement.y, 0).applyQuaternion(this.camera.quaternion);
1780
+
1181
1781
  this._m4_1.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z);
1782
+
1182
1783
  this.setTransformationMatrices(this._m4_1, this._m4_1);
1183
1784
  }
1785
+
1184
1786
  return _transformation;
1185
- };
1186
- this.reset = () => {
1787
+ });
1788
+
1789
+ _defineProperty(this, "reset", () => {
1187
1790
  if (this.camera) {
1188
1791
  this.camera.zoom = this._zoom0;
1189
- if (this.camera.type === "PerspectiveCamera") {
1792
+
1793
+ if (this.camera.type === 'PerspectiveCamera') {
1190
1794
  this.camera.fov = this._fov0;
1191
1795
  }
1796
+
1192
1797
  this.camera.near = this._nearPos;
1193
1798
  this.camera.far = this._farPos;
1799
+
1194
1800
  this._cameraMatrixState.copy(this._cameraMatrixState0);
1801
+
1195
1802
  this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);
1803
+
1196
1804
  this.camera.up.copy(this._up0);
1197
1805
  this.camera.updateMatrix();
1198
1806
  this.camera.updateProjectionMatrix();
1807
+
1199
1808
  this._gizmoMatrixState.copy(this._gizmoMatrixState0);
1809
+
1200
1810
  this._gizmoMatrixState0.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1811
+
1201
1812
  this._gizmos.updateMatrix();
1813
+
1202
1814
  const tbRadius = this.calculateTbRadius(this.camera);
1203
- if (tbRadius !== void 0) {
1815
+
1816
+ if (tbRadius !== undefined) {
1204
1817
  this._tbRadius = tbRadius;
1205
1818
  }
1819
+
1206
1820
  this.makeGizmos(this._gizmos.position, this._tbRadius);
1207
1821
  this.camera.lookAt(this._gizmos.position);
1208
1822
  this.updateTbState(STATE.IDLE, false);
1209
1823
  this.dispatchEvent(_changeEvent);
1210
1824
  }
1211
- };
1212
- this.rotate = (axis, angle) => {
1213
- const point = this._gizmos.position;
1825
+ });
1826
+
1827
+ _defineProperty(this, "rotate", (axis, angle) => {
1828
+ const point = this._gizmos.position; //rotation center
1829
+
1214
1830
  this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z);
1215
- this._rotationMatrix.makeRotationAxis(axis, -angle);
1831
+
1832
+ this._rotationMatrix.makeRotationAxis(axis, -angle); //rotate camera
1833
+
1834
+
1216
1835
  this._m4_1.makeTranslation(point.x, point.y, point.z);
1836
+
1217
1837
  this._m4_1.multiply(this._rotationMatrix);
1838
+
1218
1839
  this._m4_1.multiply(this._translationMatrix);
1840
+
1219
1841
  this.setTransformationMatrices(this._m4_1);
1220
1842
  return _transformation;
1221
- };
1222
- this.copyState = () => {
1223
- var _a;
1843
+ });
1844
+
1845
+ _defineProperty(this, "copyState", () => {
1224
1846
  if (this.camera) {
1225
- const state = JSON.stringify(
1226
- ((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera" ? {
1227
- arcballState: {
1228
- cameraFar: this.camera.far,
1229
- cameraMatrix: this.camera.matrix,
1230
- cameraNear: this.camera.near,
1231
- cameraUp: this.camera.up,
1232
- cameraZoom: this.camera.zoom,
1233
- gizmoMatrix: this._gizmos.matrix
1234
- }
1235
- } : {
1236
- arcballState: {
1237
- cameraFar: this.camera.far,
1238
- cameraFov: this.camera.fov,
1239
- cameraMatrix: this.camera.matrix,
1240
- cameraNear: this.camera.near,
1241
- cameraUp: this.camera.up,
1242
- cameraZoom: this.camera.zoom,
1243
- gizmoMatrix: this._gizmos.matrix
1244
- }
1847
+ var _this$camera12;
1848
+
1849
+ const state = JSON.stringify(((_this$camera12 = this.camera) === null || _this$camera12 === void 0 ? void 0 : _this$camera12.type) === 'OrthographicCamera' ? {
1850
+ arcballState: {
1851
+ cameraFar: this.camera.far,
1852
+ cameraMatrix: this.camera.matrix,
1853
+ cameraNear: this.camera.near,
1854
+ cameraUp: this.camera.up,
1855
+ cameraZoom: this.camera.zoom,
1856
+ gizmoMatrix: this._gizmos.matrix
1245
1857
  }
1246
- );
1858
+ } : {
1859
+ arcballState: {
1860
+ cameraFar: this.camera.far,
1861
+ cameraFov: this.camera.fov,
1862
+ cameraMatrix: this.camera.matrix,
1863
+ cameraNear: this.camera.near,
1864
+ cameraUp: this.camera.up,
1865
+ cameraZoom: this.camera.zoom,
1866
+ gizmoMatrix: this._gizmos.matrix
1867
+ }
1868
+ });
1247
1869
  navigator.clipboard.writeText(state);
1248
1870
  }
1249
- };
1250
- this.pasteState = () => {
1871
+ });
1872
+
1873
+ _defineProperty(this, "pasteState", () => {
1251
1874
  const self = this;
1252
1875
  navigator.clipboard.readText().then(function resolved(value) {
1253
1876
  self.setStateFromJSON(value);
1254
1877
  });
1255
- };
1256
- this.saveState = () => {
1257
- if (!this.camera)
1258
- return;
1878
+ });
1879
+
1880
+ _defineProperty(this, "saveState", () => {
1881
+ if (!this.camera) return;
1882
+
1259
1883
  this._cameraMatrixState0.copy(this.camera.matrix);
1884
+
1260
1885
  this._gizmoMatrixState0.copy(this._gizmos.matrix);
1886
+
1261
1887
  this._nearPos = this.camera.near;
1262
1888
  this._farPos = this.camera.far;
1263
1889
  this._zoom0 = this.camera.zoom;
1890
+
1264
1891
  this._up0.copy(this.camera.up);
1265
- if (this.camera.type === "PerspectiveCamera") {
1892
+
1893
+ if (this.camera.type === 'PerspectiveCamera') {
1266
1894
  this._fov0 = this.camera.fov;
1267
1895
  }
1268
- };
1269
- this.applyScale = (size, point, scaleGizmos = true) => {
1270
- if (!this.camera)
1271
- return;
1896
+ });
1897
+
1898
+ _defineProperty(this, "applyScale", (size, point, scaleGizmos = true) => {
1899
+ if (!this.camera) return;
1272
1900
  const scalePoint = point.clone();
1273
1901
  let sizeInverse = 1 / size;
1274
- if (this.camera.type === "OrthographicCamera") {
1902
+
1903
+ if (this.camera.type === 'OrthographicCamera') {
1904
+ //camera zoom
1275
1905
  this.camera.zoom = this._zoomState;
1276
- this.camera.zoom *= size;
1906
+ this.camera.zoom *= size; //check min and max zoom
1907
+
1277
1908
  if (this.camera.zoom > this.maxZoom) {
1278
1909
  this.camera.zoom = this.maxZoom;
1279
1910
  sizeInverse = this._zoomState / this.maxZoom;
@@ -1281,26 +1912,46 @@ class ArcballControls extends THREE.EventDispatcher {
1281
1912
  this.camera.zoom = this.minZoom;
1282
1913
  sizeInverse = this._zoomState / this.minZoom;
1283
1914
  }
1915
+
1284
1916
  this.camera.updateProjectionMatrix();
1285
- this._v3_1.setFromMatrixPosition(this._gizmoMatrixState);
1917
+
1918
+ this._v3_1.setFromMatrixPosition(this._gizmoMatrixState); //gizmos position
1919
+ //scale gizmos so they appear in the same spot having the same dimension
1920
+
1921
+
1286
1922
  this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse);
1923
+
1287
1924
  this._translationMatrix.makeTranslation(-this._v3_1.x, -this._v3_1.y, -this._v3_1.z);
1925
+
1288
1926
  this._m4_2.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z).multiply(this._scaleMatrix);
1289
- this._m4_2.multiply(this._translationMatrix);
1927
+
1928
+ this._m4_2.multiply(this._translationMatrix); //move camera and gizmos to obtain pinch effect
1929
+
1930
+
1290
1931
  scalePoint.sub(this._v3_1);
1291
1932
  const amount = scalePoint.clone().multiplyScalar(sizeInverse);
1292
1933
  scalePoint.sub(amount);
1934
+
1293
1935
  this._m4_1.makeTranslation(scalePoint.x, scalePoint.y, scalePoint.z);
1936
+
1294
1937
  this._m4_2.premultiply(this._m4_1);
1938
+
1295
1939
  this.setTransformationMatrices(this._m4_1, this._m4_2);
1296
1940
  return _transformation;
1297
1941
  }
1298
- if (this.camera.type === "PerspectiveCamera") {
1942
+
1943
+ if (this.camera.type === 'PerspectiveCamera') {
1299
1944
  this._v3_1.setFromMatrixPosition(this._cameraMatrixState);
1300
- this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);
1945
+
1946
+ this._v3_2.setFromMatrixPosition(this._gizmoMatrixState); //move camera
1947
+
1948
+
1301
1949
  let distance = this._v3_1.distanceTo(scalePoint);
1302
- let amount = distance - distance * sizeInverse;
1950
+
1951
+ let amount = distance - distance * sizeInverse; //check min and max distance
1952
+
1303
1953
  const newDistance = distance - amount;
1954
+
1304
1955
  if (newDistance < this.minDistance) {
1305
1956
  sizeInverse = this.minDistance / distance;
1306
1957
  amount = distance - distance * sizeInverse;
@@ -1308,152 +1959,270 @@ class ArcballControls extends THREE.EventDispatcher {
1308
1959
  sizeInverse = this.maxDistance / distance;
1309
1960
  amount = distance - distance * sizeInverse;
1310
1961
  }
1962
+
1311
1963
  let direction = scalePoint.clone().sub(this._v3_1).normalize().multiplyScalar(amount);
1964
+
1312
1965
  this._m4_1.makeTranslation(direction.x, direction.y, direction.z);
1966
+
1313
1967
  if (scaleGizmos) {
1968
+ //scale gizmos so they appear in the same spot having the same dimension
1314
1969
  const pos = this._v3_2;
1315
1970
  distance = pos.distanceTo(scalePoint);
1316
1971
  amount = distance - distance * sizeInverse;
1317
1972
  direction = scalePoint.clone().sub(this._v3_2).normalize().multiplyScalar(amount);
1973
+
1318
1974
  this._translationMatrix.makeTranslation(pos.x, pos.y, pos.z);
1975
+
1319
1976
  this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse);
1977
+
1320
1978
  this._m4_2.makeTranslation(direction.x, direction.y, direction.z).multiply(this._translationMatrix);
1979
+
1321
1980
  this._m4_2.multiply(this._scaleMatrix);
1981
+
1322
1982
  this._translationMatrix.makeTranslation(-pos.x, -pos.y, -pos.z);
1983
+
1323
1984
  this._m4_2.multiply(this._translationMatrix);
1985
+
1324
1986
  this.setTransformationMatrices(this._m4_1, this._m4_2);
1325
1987
  } else {
1326
1988
  this.setTransformationMatrices(this._m4_1);
1327
1989
  }
1990
+
1328
1991
  return _transformation;
1329
1992
  }
1330
- };
1331
- this.setFov = (value) => {
1332
- var _a;
1333
- if (((_a = this.camera) == null ? void 0 : _a.type) === "PerspectiveCamera") {
1334
- this.camera.fov = THREE.MathUtils.clamp(value, this.minFov, this.maxFov);
1993
+ });
1994
+
1995
+ _defineProperty(this, "setFov", value => {
1996
+ var _this$camera13;
1997
+
1998
+ if (((_this$camera13 = this.camera) === null || _this$camera13 === void 0 ? void 0 : _this$camera13.type) === 'PerspectiveCamera') {
1999
+ this.camera.fov = MathUtils.clamp(value, this.minFov, this.maxFov);
1335
2000
  this.camera.updateProjectionMatrix();
1336
2001
  }
1337
- };
1338
- this.setTarget = (x, y, z) => {
2002
+ });
2003
+
2004
+ _defineProperty(this, "setTarget", (x, y, z) => {
1339
2005
  if (this.camera) {
1340
2006
  this.target.set(x, y, z);
1341
- this._gizmos.position.set(x, y, z);
2007
+
2008
+ this._gizmos.position.set(x, y, z); //for correct radius calculation
2009
+
2010
+
1342
2011
  const tbRadius = this.calculateTbRadius(this.camera);
1343
- if (tbRadius !== void 0) {
2012
+
2013
+ if (tbRadius !== undefined) {
1344
2014
  this._tbRadius = tbRadius;
1345
2015
  }
2016
+
1346
2017
  this.makeGizmos(this.target, this._tbRadius);
1347
2018
  this.camera.lookAt(this.target);
1348
2019
  }
1349
- };
1350
- this.zRotate = (point, angle) => {
2020
+ });
2021
+
2022
+ _defineProperty(this, "zRotate", (point, angle) => {
1351
2023
  this._rotationMatrix.makeRotationAxis(this._rotationAxis, angle);
2024
+
1352
2025
  this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z);
2026
+
1353
2027
  this._m4_1.makeTranslation(point.x, point.y, point.z);
2028
+
1354
2029
  this._m4_1.multiply(this._rotationMatrix);
2030
+
1355
2031
  this._m4_1.multiply(this._translationMatrix);
1356
- this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(point);
1357
- this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis, angle);
2032
+
2033
+ this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(point); //vector from rotation center to gizmos position
2034
+
2035
+
2036
+ this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis, angle); //apply rotation
2037
+
2038
+
1358
2039
  this._v3_2.sub(this._v3_1);
2040
+
1359
2041
  this._m4_2.makeTranslation(this._v3_2.x, this._v3_2.y, this._v3_2.z);
2042
+
1360
2043
  this.setTransformationMatrices(this._m4_1, this._m4_2);
1361
2044
  return _transformation;
1362
- };
1363
- this.unprojectOnObj = (cursor, camera2) => {
1364
- if (!this.scene)
1365
- return null;
1366
- const raycaster = new THREE.Raycaster();
1367
- raycaster.near = camera2.near;
1368
- raycaster.far = camera2.far;
1369
- raycaster.setFromCamera(cursor, camera2);
2045
+ });
2046
+
2047
+ _defineProperty(this, "unprojectOnObj", (cursor, camera) => {
2048
+ if (!this.scene) return null;
2049
+ const raycaster = new Raycaster();
2050
+ raycaster.near = camera.near;
2051
+ raycaster.far = camera.far;
2052
+ raycaster.setFromCamera(cursor, camera);
1370
2053
  const intersect = raycaster.intersectObjects(this.scene.children, true);
2054
+
1371
2055
  for (let i = 0; i < intersect.length; i++) {
1372
2056
  if (intersect[i].object.uuid != this._gizmos.uuid && intersect[i].face) {
1373
2057
  return intersect[i].point.clone();
1374
2058
  }
1375
2059
  }
2060
+
1376
2061
  return null;
1377
- };
1378
- this.unprojectOnTbSurface = (camera2, cursorX, cursorY, canvas, tbRadius) => {
1379
- if (camera2.type == "OrthographicCamera") {
2062
+ });
2063
+
2064
+ _defineProperty(this, "unprojectOnTbSurface", (camera, cursorX, cursorY, canvas, tbRadius) => {
2065
+ if (camera.type == 'OrthographicCamera') {
1380
2066
  this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas));
2067
+
1381
2068
  this._v3_1.set(this._v2_1.x, this._v2_1.y, 0);
2069
+
1382
2070
  const x2 = Math.pow(this._v2_1.x, 2);
1383
2071
  const y2 = Math.pow(this._v2_1.y, 2);
1384
2072
  const r2 = Math.pow(this._tbRadius, 2);
2073
+
1385
2074
  if (x2 + y2 <= r2 * 0.5) {
2075
+ //intersection with sphere
1386
2076
  this._v3_1.setZ(Math.sqrt(r2 - (x2 + y2)));
1387
2077
  } else {
2078
+ //intersection with hyperboloid
1388
2079
  this._v3_1.setZ(r2 * 0.5 / Math.sqrt(x2 + y2));
1389
2080
  }
2081
+
1390
2082
  return this._v3_1;
1391
2083
  }
1392
- if (camera2.type == "PerspectiveCamera") {
2084
+
2085
+ if (camera.type == 'PerspectiveCamera') {
2086
+ //unproject cursor on the near plane
1393
2087
  this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));
2088
+
1394
2089
  this._v3_1.set(this._v2_1.x, this._v2_1.y, -1);
1395
- this._v3_1.applyMatrix4(camera2.projectionMatrixInverse);
1396
- const rayDir = this._v3_1.clone().normalize();
1397
- const cameraGizmoDistance = camera2.position.distanceTo(this._gizmos.position);
1398
- const radius2 = Math.pow(tbRadius, 2);
2090
+
2091
+ this._v3_1.applyMatrix4(camera.projectionMatrixInverse);
2092
+
2093
+ const rayDir = this._v3_1.clone().normalize(); //unprojected ray direction
2094
+
2095
+
2096
+ const cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position);
2097
+ const radius2 = Math.pow(tbRadius, 2); // camera
2098
+ // |\
2099
+ // | \
2100
+ // | \
2101
+ // h | \
2102
+ // | \
2103
+ // | \
2104
+ // _ _ | _ _ _\ _ _ near plane
2105
+ // l
2106
+
1399
2107
  const h = this._v3_1.z;
1400
2108
  const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2));
2109
+
1401
2110
  if (l == 0) {
2111
+ //ray aligned with camera
1402
2112
  rayDir.set(this._v3_1.x, this._v3_1.y, tbRadius);
1403
2113
  return rayDir;
1404
2114
  }
2115
+
1405
2116
  const m = h / l;
1406
2117
  const q = cameraGizmoDistance;
2118
+ /*
2119
+ * calculate intersection point between unprojected ray and trackball surface
2120
+ *|y = m * x + q
2121
+ *|x^2 + y^2 = r^2
2122
+ *
2123
+ * (m^2 + 1) * x^2 + (2 * m * q) * x + q^2 - r^2 = 0
2124
+ */
2125
+
1407
2126
  let a = Math.pow(m, 2) + 1;
1408
2127
  let b = 2 * m * q;
1409
2128
  let c = Math.pow(q, 2) - radius2;
1410
2129
  let delta = Math.pow(b, 2) - 4 * a * c;
2130
+
1411
2131
  if (delta >= 0) {
2132
+ //intersection with sphere
1412
2133
  this._v2_1.setX((-b - Math.sqrt(delta)) / (2 * a));
2134
+
1413
2135
  this._v2_1.setY(m * this._v2_1.x + q);
1414
- const angle = THREE.MathUtils.RAD2DEG * this._v2_1.angle();
2136
+
2137
+ const angle = MathUtils.RAD2DEG * this._v2_1.angle();
2138
+
1415
2139
  if (angle >= 45) {
1416
- const rayLength2 = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2));
1417
- rayDir.multiplyScalar(rayLength2);
2140
+ //if angle between intersection point and X' axis is >= 45°, return that point
2141
+ //otherwise, calculate intersection point with hyperboloid
2142
+ const rayLength = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2));
2143
+ rayDir.multiplyScalar(rayLength);
1418
2144
  rayDir.z += cameraGizmoDistance;
1419
2145
  return rayDir;
1420
2146
  }
1421
- }
2147
+ } //intersection with hyperboloid
2148
+
2149
+ /*
2150
+ *|y = m * x + q
2151
+ *|y = (1 / x) * (r^2 / 2)
2152
+ *
2153
+ * m * x^2 + q * x - r^2 / 2 = 0
2154
+ */
2155
+
2156
+
1422
2157
  a = m;
1423
2158
  b = q;
1424
2159
  c = -radius2 * 0.5;
1425
2160
  delta = Math.pow(b, 2) - 4 * a * c;
2161
+
1426
2162
  this._v2_1.setX((-b - Math.sqrt(delta)) / (2 * a));
2163
+
1427
2164
  this._v2_1.setY(m * this._v2_1.x + q);
2165
+
1428
2166
  const rayLength = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2));
1429
2167
  rayDir.multiplyScalar(rayLength);
1430
2168
  rayDir.z += cameraGizmoDistance;
1431
2169
  return rayDir;
1432
2170
  }
1433
- };
1434
- this.unprojectOnTbPlane = (camera2, cursorX, cursorY, canvas, initialDistance = false) => {
1435
- if (camera2.type == "OrthographicCamera") {
2171
+ });
2172
+
2173
+ _defineProperty(this, "unprojectOnTbPlane", (camera, cursorX, cursorY, canvas, initialDistance = false) => {
2174
+ if (camera.type == 'OrthographicCamera') {
1436
2175
  this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas));
2176
+
1437
2177
  this._v3_1.set(this._v2_1.x, this._v2_1.y, 0);
2178
+
1438
2179
  return this._v3_1.clone();
1439
2180
  }
1440
- if (camera2.type == "PerspectiveCamera") {
1441
- this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));
2181
+
2182
+ if (camera.type == 'PerspectiveCamera') {
2183
+ this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas)); //unproject cursor on the near plane
2184
+
2185
+
1442
2186
  this._v3_1.set(this._v2_1.x, this._v2_1.y, -1);
1443
- this._v3_1.applyMatrix4(camera2.projectionMatrixInverse);
1444
- const rayDir = this._v3_1.clone().normalize();
2187
+
2188
+ this._v3_1.applyMatrix4(camera.projectionMatrixInverse);
2189
+
2190
+ const rayDir = this._v3_1.clone().normalize(); //unprojected ray direction
2191
+ // camera
2192
+ // |\
2193
+ // | \
2194
+ // | \
2195
+ // h | \
2196
+ // | \
2197
+ // | \
2198
+ // _ _ | _ _ _\ _ _ near plane
2199
+ // l
2200
+
2201
+
1445
2202
  const h = this._v3_1.z;
1446
2203
  const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2));
1447
2204
  let cameraGizmoDistance;
2205
+
1448
2206
  if (initialDistance) {
1449
2207
  cameraGizmoDistance = this._v3_1.setFromMatrixPosition(this._cameraMatrixState0).distanceTo(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0));
1450
2208
  } else {
1451
- cameraGizmoDistance = camera2.position.distanceTo(this._gizmos.position);
1452
- }
2209
+ cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position);
2210
+ }
2211
+ /*
2212
+ * calculate intersection point between unprojected ray and the plane
2213
+ *|y = mx + q
2214
+ *|y = 0
2215
+ *
2216
+ * x = -q/m
2217
+ */
2218
+
2219
+
1453
2220
  if (l == 0) {
2221
+ //ray aligned with camera
1454
2222
  rayDir.set(0, 0, 0);
1455
2223
  return rayDir;
1456
2224
  }
2225
+
1457
2226
  const m = h / l;
1458
2227
  const q = cameraGizmoDistance;
1459
2228
  const x = -q / m;
@@ -1462,179 +2231,259 @@ class ArcballControls extends THREE.EventDispatcher {
1462
2231
  rayDir.z = 0;
1463
2232
  return rayDir;
1464
2233
  }
1465
- };
1466
- this.updateMatrixState = () => {
1467
- if (!this.camera)
1468
- return;
2234
+ });
2235
+
2236
+ _defineProperty(this, "updateMatrixState", () => {
2237
+ if (!this.camera) return; //update camera and gizmos state
2238
+
1469
2239
  this._cameraMatrixState.copy(this.camera.matrix);
2240
+
1470
2241
  this._gizmoMatrixState.copy(this._gizmos.matrix);
1471
- if (this.camera.type === "OrthographicCamera") {
2242
+
2243
+ if (this.camera.type === 'OrthographicCamera') {
1472
2244
  this._cameraProjectionState.copy(this.camera.projectionMatrix);
2245
+
1473
2246
  this.camera.updateProjectionMatrix();
1474
2247
  this._zoomState = this.camera.zoom;
1475
2248
  }
1476
- if (this.camera.type === "PerspectiveCamera") {
2249
+
2250
+ if (this.camera.type === 'PerspectiveCamera') {
1477
2251
  this._fovState = this.camera.fov;
1478
2252
  }
1479
- };
1480
- this.updateTbState = (newState, updateMatrices) => {
2253
+ });
2254
+
2255
+ _defineProperty(this, "updateTbState", (newState, updateMatrices) => {
1481
2256
  this._state = newState;
2257
+
1482
2258
  if (updateMatrices) {
1483
2259
  this.updateMatrixState();
1484
2260
  }
1485
- };
1486
- this.update = () => {
1487
- const EPS = 1e-6;
2261
+ });
2262
+
2263
+ _defineProperty(this, "update", () => {
2264
+ const EPS = 0.000001; // Update target and gizmos state
2265
+
1488
2266
  if (!this.target.equals(this._currentTarget) && this.camera) {
1489
- this._gizmos.position.set(this.target.x, this.target.y, this.target.z);
2267
+ this._gizmos.position.set(this.target.x, this.target.y, this.target.z); //for correct radius calculation
2268
+
2269
+
1490
2270
  const tbRadius = this.calculateTbRadius(this.camera);
1491
- if (tbRadius !== void 0) {
2271
+
2272
+ if (tbRadius !== undefined) {
1492
2273
  this._tbRadius = tbRadius;
1493
2274
  }
2275
+
1494
2276
  this.makeGizmos(this.target, this._tbRadius);
2277
+
1495
2278
  this._currentTarget.copy(this.target);
1496
2279
  }
1497
- if (!this.camera)
1498
- return;
1499
- if (this.camera.type === "OrthographicCamera") {
2280
+
2281
+ if (!this.camera) return; //check min/max parameters
2282
+
2283
+ if (this.camera.type === 'OrthographicCamera') {
2284
+ //check zoom
1500
2285
  if (this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom) {
1501
- const newZoom = THREE.MathUtils.clamp(this.camera.zoom, this.minZoom, this.maxZoom);
2286
+ const newZoom = MathUtils.clamp(this.camera.zoom, this.minZoom, this.maxZoom);
1502
2287
  this.applyTransformMatrix(this.applyScale(newZoom / this.camera.zoom, this._gizmos.position, true));
1503
2288
  }
1504
2289
  }
1505
- if (this.camera.type === "PerspectiveCamera") {
2290
+
2291
+ if (this.camera.type === 'PerspectiveCamera') {
2292
+ //check distance
1506
2293
  const distance = this.camera.position.distanceTo(this._gizmos.position);
2294
+
1507
2295
  if (distance > this.maxDistance + EPS || distance < this.minDistance - EPS) {
1508
- const newDistance = THREE.MathUtils.clamp(distance, this.minDistance, this.maxDistance);
2296
+ const newDistance = MathUtils.clamp(distance, this.minDistance, this.maxDistance);
1509
2297
  this.applyTransformMatrix(this.applyScale(newDistance / distance, this._gizmos.position));
1510
2298
  this.updateMatrixState();
1511
- }
2299
+ } //check fov
2300
+
2301
+
1512
2302
  if (this.camera.fov < this.minFov || this.camera.fov > this.maxFov) {
1513
- this.camera.fov = THREE.MathUtils.clamp(this.camera.fov, this.minFov, this.maxFov);
2303
+ this.camera.fov = MathUtils.clamp(this.camera.fov, this.minFov, this.maxFov);
1514
2304
  this.camera.updateProjectionMatrix();
1515
2305
  }
2306
+
1516
2307
  const oldRadius = this._tbRadius;
1517
2308
  const tbRadius = this.calculateTbRadius(this.camera);
1518
- if (tbRadius !== void 0) {
2309
+
2310
+ if (tbRadius !== undefined) {
1519
2311
  this._tbRadius = tbRadius;
1520
2312
  }
2313
+
1521
2314
  if (oldRadius < this._tbRadius - EPS || oldRadius > this._tbRadius + EPS) {
1522
2315
  const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3;
1523
- const newRadius = this._tbRadius / scale;
1524
- const curve = new THREE.EllipseCurve(0, 0, newRadius, newRadius);
2316
+ const newRadius = this._tbRadius / scale; // @ts-expect-error
2317
+
2318
+ const curve = new EllipseCurve(0, 0, newRadius, newRadius);
1525
2319
  const points = curve.getPoints(this._curvePts);
1526
- const curveGeometry = new THREE.BufferGeometry().setFromPoints(points);
2320
+ const curveGeometry = new BufferGeometry().setFromPoints(points);
2321
+
1527
2322
  for (const gizmo in this._gizmos.children) {
1528
2323
  const child = this._gizmos.children[gizmo];
1529
2324
  child.geometry = curveGeometry;
1530
2325
  }
1531
2326
  }
1532
2327
  }
2328
+
1533
2329
  this.camera.lookAt(this._gizmos.position);
1534
- };
1535
- this.setStateFromJSON = (json) => {
2330
+ });
2331
+
2332
+ _defineProperty(this, "setStateFromJSON", json => {
1536
2333
  const state = JSON.parse(json);
2334
+
1537
2335
  if (state.arcballState && this.camera) {
1538
2336
  this._cameraMatrixState.fromArray(state.arcballState.cameraMatrix.elements);
2337
+
1539
2338
  this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);
2339
+
1540
2340
  this.camera.up.copy(state.arcballState.cameraUp);
1541
2341
  this.camera.near = state.arcballState.cameraNear;
1542
2342
  this.camera.far = state.arcballState.cameraFar;
1543
2343
  this.camera.zoom = state.arcballState.cameraZoom;
1544
- if (this.camera.type === "PerspectiveCamera") {
2344
+
2345
+ if (this.camera.type === 'PerspectiveCamera') {
1545
2346
  this.camera.fov = state.arcballState.cameraFov;
1546
2347
  }
2348
+
1547
2349
  this._gizmoMatrixState.fromArray(state.arcballState.gizmoMatrix.elements);
2350
+
1548
2351
  this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
2352
+
1549
2353
  this.camera.updateMatrix();
1550
2354
  this.camera.updateProjectionMatrix();
2355
+
1551
2356
  this._gizmos.updateMatrix();
2357
+
1552
2358
  const tbRadius = this.calculateTbRadius(this.camera);
1553
- if (tbRadius !== void 0) {
2359
+
2360
+ if (tbRadius !== undefined) {
1554
2361
  this._tbRadius = tbRadius;
1555
2362
  }
1556
- const gizmoTmp = new THREE.Matrix4().copy(this._gizmoMatrixState0);
2363
+
2364
+ const gizmoTmp = new Matrix4().copy(this._gizmoMatrixState0);
1557
2365
  this.makeGizmos(this._gizmos.position, this._tbRadius);
2366
+
1558
2367
  this._gizmoMatrixState0.copy(gizmoTmp);
2368
+
1559
2369
  this.camera.lookAt(this._gizmos.position);
1560
2370
  this.updateTbState(STATE.IDLE, false);
1561
2371
  this.dispatchEvent(_changeEvent);
1562
2372
  }
1563
- };
2373
+ });
2374
+
1564
2375
  this.camera = null;
1565
- this.domElement = domElement;
2376
+ this.domElement = _domElement;
1566
2377
  this.scene = scene;
1567
2378
  this.mouseActions = [];
1568
- this._mouseOp = null;
1569
- this._v2_1 = new THREE.Vector2();
1570
- this._v3_1 = new THREE.Vector3();
1571
- this._v3_2 = new THREE.Vector3();
1572
- this._m4_1 = new THREE.Matrix4();
1573
- this._m4_2 = new THREE.Matrix4();
1574
- this._quat = new THREE.Quaternion();
1575
- this._translationMatrix = new THREE.Matrix4();
1576
- this._rotationMatrix = new THREE.Matrix4();
1577
- this._scaleMatrix = new THREE.Matrix4();
1578
- this._rotationAxis = new THREE.Vector3();
1579
- this._cameraMatrixState = new THREE.Matrix4();
1580
- this._cameraProjectionState = new THREE.Matrix4();
2379
+ this._mouseOp = null; //global vectors and matrices that are used in some operations to avoid creating new objects every time (e.g. every time cursor moves)
2380
+
2381
+ this._v2_1 = new Vector2();
2382
+ this._v3_1 = new Vector3();
2383
+ this._v3_2 = new Vector3();
2384
+ this._m4_1 = new Matrix4();
2385
+ this._m4_2 = new Matrix4();
2386
+ this._quat = new Quaternion(); //transformation matrices
2387
+
2388
+ this._translationMatrix = new Matrix4(); //matrix for translation operation
2389
+
2390
+ this._rotationMatrix = new Matrix4(); //matrix for rotation operation
2391
+
2392
+ this._scaleMatrix = new Matrix4(); //matrix for scaling operation
2393
+
2394
+ this._rotationAxis = new Vector3(); //axis for rotate operation
2395
+ //camera state
2396
+
2397
+ this._cameraMatrixState = new Matrix4();
2398
+ this._cameraProjectionState = new Matrix4();
1581
2399
  this._fovState = 1;
1582
- this._upState = new THREE.Vector3();
2400
+ this._upState = new Vector3();
1583
2401
  this._zoomState = 1;
1584
2402
  this._nearPos = 0;
1585
2403
  this._farPos = 0;
1586
- this._gizmoMatrixState = new THREE.Matrix4();
1587
- this._up0 = new THREE.Vector3();
2404
+ this._gizmoMatrixState = new Matrix4(); //initial values
2405
+
2406
+ this._up0 = new Vector3();
1588
2407
  this._zoom0 = 1;
1589
2408
  this._fov0 = 0;
1590
2409
  this._initialNear = 0;
1591
2410
  this._nearPos0 = 0;
1592
2411
  this._initialFar = 0;
1593
2412
  this._farPos0 = 0;
1594
- this._cameraMatrixState0 = new THREE.Matrix4();
1595
- this._gizmoMatrixState0 = new THREE.Matrix4();
2413
+ this._cameraMatrixState0 = new Matrix4();
2414
+ this._gizmoMatrixState0 = new Matrix4(); //pointers array
2415
+
1596
2416
  this._button = -1;
1597
2417
  this._touchStart = [];
1598
2418
  this._touchCurrent = [];
1599
- this._input = INPUT.NONE;
1600
- this._switchSensibility = 32;
1601
- this._startFingerDistance = 0;
2419
+ this._input = INPUT.NONE; //two fingers touch interaction
2420
+
2421
+ this._switchSensibility = 32; //minimum movement to be performed to fire single pan start after the second finger has been released
2422
+
2423
+ this._startFingerDistance = 0; //distance between two fingers
2424
+
1602
2425
  this._currentFingerDistance = 0;
1603
- this._startFingerRotation = 0;
1604
- this._currentFingerRotation = 0;
2426
+ this._startFingerRotation = 0; //amount of rotation performed with two fingers
2427
+
2428
+ this._currentFingerRotation = 0; //double tap
2429
+
1605
2430
  this._devPxRatio = 0;
1606
2431
  this._downValid = true;
1607
2432
  this._nclicks = 0;
1608
2433
  this._downEvents = [];
1609
- this._clickStart = 0;
2434
+ this._clickStart = 0; //first click time
2435
+
1610
2436
  this._maxDownTime = 250;
1611
2437
  this._maxInterval = 300;
1612
2438
  this._posThreshold = 24;
1613
- this._movementThreshold = 24;
1614
- this._currentCursorPosition = new THREE.Vector3();
1615
- this._startCursorPosition = new THREE.Vector3();
1616
- this._grid = null;
1617
- this._gridPosition = new THREE.Vector3();
1618
- this._gizmos = new THREE.Group();
1619
- this._curvePts = 128;
1620
- this._timeStart = -1;
1621
- this._animationId = -1;
1622
- this.focusAnimationTime = 500;
1623
- this._timePrev = 0;
1624
- this._timeCurrent = 0;
1625
- this._anglePrev = 0;
1626
- this._angleCurrent = 0;
1627
- this._cursorPosPrev = new THREE.Vector3();
1628
- this._cursorPosCurr = new THREE.Vector3();
1629
- this._wPrev = 0;
1630
- this._wCurr = 0;
2439
+ this._movementThreshold = 24; //cursor positions
2440
+
2441
+ this._currentCursorPosition = new Vector3();
2442
+ this._startCursorPosition = new Vector3(); //grid
2443
+
2444
+ this._grid = null; //grid to be visualized during pan operation
2445
+
2446
+ this._gridPosition = new Vector3(); //gizmos
2447
+
2448
+ this._gizmos = new Group();
2449
+ this._curvePts = 128; //animations
2450
+
2451
+ this._timeStart = -1; //initial time
2452
+
2453
+ this._animationId = -1; //focus animation
2454
+
2455
+ this.focusAnimationTime = 500; //duration of focus animation in ms
2456
+ //rotate animation
2457
+
2458
+ this._timePrev = 0; //time at which previous rotate operation has been detected
2459
+
2460
+ this._timeCurrent = 0; //time at which current rotate operation has been detected
2461
+
2462
+ this._anglePrev = 0; //angle of previous rotation
2463
+
2464
+ this._angleCurrent = 0; //angle of current rotation
2465
+
2466
+ this._cursorPosPrev = new Vector3(); //cursor position when previous rotate operation has been detected
2467
+
2468
+ this._cursorPosCurr = new Vector3(); //cursor position when current rotate operation has been detected
2469
+
2470
+ this._wPrev = 0; //angular velocity of the previous rotate operation
2471
+
2472
+ this._wCurr = 0; //angular velocity of the current rotate operation
2473
+ //parameters
2474
+
1631
2475
  this.adjustNearFar = false;
1632
- this.scaleFactor = 1.1;
2476
+ this.scaleFactor = 1.1; //zoom/distance multiplier
2477
+
1633
2478
  this.dampingFactor = 25;
1634
- this.wMax = 20;
1635
- this.enableAnimations = true;
1636
- this.enableGrid = false;
1637
- this.cursorZoom = false;
2479
+ this.wMax = 20; //maximum angular velocity allowed
2480
+
2481
+ this.enableAnimations = true; //if animations should be performed
2482
+
2483
+ this.enableGrid = false; //if grid should be showed during pan operation
2484
+
2485
+ this.cursorZoom = false; //if wheel zoom should be cursor centered
2486
+
1638
2487
  this.minFov = 5;
1639
2488
  this.maxFov = 90;
1640
2489
  this.enabled = true;
@@ -1644,45 +2493,63 @@ class ArcballControls extends THREE.EventDispatcher {
1644
2493
  this.minDistance = 0;
1645
2494
  this.maxDistance = Infinity;
1646
2495
  this.minZoom = 0;
1647
- this.maxZoom = Infinity;
1648
- this.target = new THREE.Vector3(0, 0, 0);
1649
- this._currentTarget = new THREE.Vector3(0, 0, 0);
1650
- this._tbRadius = 1;
2496
+ this.maxZoom = Infinity; //trackball parameters
2497
+
2498
+ this.target = new Vector3(0, 0, 0);
2499
+ this._currentTarget = new Vector3(0, 0, 0);
2500
+ this._tbRadius = 1; //FSA
2501
+
1651
2502
  this._state = STATE.IDLE;
1652
- this.setCamera(camera);
2503
+ this.setCamera(_camera);
2504
+
1653
2505
  if (this.scene) {
1654
2506
  this.scene.add(this._gizmos);
1655
2507
  }
2508
+
1656
2509
  this._devPxRatio = window.devicePixelRatio;
1657
2510
  this.initializeMouseActions();
1658
- if (this.domElement)
1659
- this.connect(this.domElement);
1660
- window.addEventListener("resize", this.onWindowResize);
1661
- }
2511
+ if (this.domElement) this.connect(this.domElement);
2512
+ window.addEventListener('resize', this.onWindowResize);
2513
+ } //listeners
2514
+
2515
+
2516
+ /**
2517
+ * Apply a transformation matrix, to the camera and gizmos
2518
+ * @param {Object} transformation Object containing matrices to apply to camera and gizmos
2519
+ */
1662
2520
  applyTransformMatrix(transformation) {
1663
- if ((transformation == null ? void 0 : transformation.camera) && this.camera) {
2521
+ if (transformation !== null && transformation !== void 0 && transformation.camera && this.camera) {
1664
2522
  this._m4_1.copy(this._cameraMatrixState).premultiply(transformation.camera);
2523
+
1665
2524
  this._m4_1.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);
1666
- this.camera.updateMatrix();
2525
+
2526
+ this.camera.updateMatrix(); //update camera up vector
2527
+
1667
2528
  if (this._state == STATE.ROTATE || this._state == STATE.ZROTATE || this._state == STATE.ANIMATION_ROTATE) {
1668
2529
  this.camera.up.copy(this._upState).applyQuaternion(this.camera.quaternion);
1669
2530
  }
1670
2531
  }
1671
- if (transformation == null ? void 0 : transformation.gizmos) {
2532
+
2533
+ if (transformation !== null && transformation !== void 0 && transformation.gizmos) {
1672
2534
  this._m4_1.copy(this._gizmoMatrixState).premultiply(transformation.gizmos);
2535
+
1673
2536
  this._m4_1.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
2537
+
1674
2538
  this._gizmos.updateMatrix();
1675
2539
  }
2540
+
1676
2541
  if ((this._state == STATE.SCALE || this._state == STATE.FOCUS || this._state == STATE.ANIMATION_FOCUS) && this.camera) {
1677
2542
  const tbRadius = this.calculateTbRadius(this.camera);
1678
- if (tbRadius !== void 0) {
2543
+
2544
+ if (tbRadius !== undefined) {
1679
2545
  this._tbRadius = tbRadius;
1680
2546
  }
2547
+
1681
2548
  if (this.adjustNearFar) {
1682
2549
  const cameraDistance = this.camera.position.distanceTo(this._gizmos.position);
1683
- const bb = new THREE.Box3();
2550
+ const bb = new Box3();
1684
2551
  bb.setFromObject(this._gizmos);
1685
- const sphere = new THREE.Sphere();
2552
+ const sphere = new Sphere();
1686
2553
  bb.getBoundingSphere(sphere);
1687
2554
  const adjustedNearPosition = Math.max(this._nearPos0, sphere.radius + sphere.center.length());
1688
2555
  const regularNearPosition = cameraDistance - this._initialNear;
@@ -1695,24 +2562,52 @@ class ArcballControls extends THREE.EventDispatcher {
1695
2562
  this.camera.updateProjectionMatrix();
1696
2563
  } else {
1697
2564
  let update = false;
2565
+
1698
2566
  if (this.camera.near != this._initialNear) {
1699
2567
  this.camera.near = this._initialNear;
1700
2568
  update = true;
1701
2569
  }
2570
+
1702
2571
  if (this.camera.far != this._initialFar) {
1703
2572
  this.camera.far = this._initialFar;
1704
2573
  update = true;
1705
2574
  }
2575
+
1706
2576
  if (update) {
1707
2577
  this.camera.updateProjectionMatrix();
1708
2578
  }
1709
2579
  }
1710
2580
  }
1711
2581
  }
2582
+ /**
2583
+ * Calculate the angular speed
2584
+ * @param {Number} p0 Position at t0
2585
+ * @param {Number} p1 Position at t1
2586
+ * @param {Number} t0 Initial time in milliseconds
2587
+ * @param {Number} t1 Ending time in milliseconds
2588
+ */
2589
+
2590
+
2591
+ /**
2592
+ * Set gizmos visibility
2593
+ * @param {Boolean} value Value of gizmos visibility
2594
+ */
1712
2595
  setGizmosVisible(value) {
1713
2596
  this._gizmos.visible = value;
1714
2597
  this.dispatchEvent(_changeEvent);
1715
2598
  }
2599
+ /**
2600
+ * Creates the rotation gizmos matching trackball center and radius
2601
+ * @param {Vector3} tbCenter The trackball center
2602
+ * @param {number} tbRadius The trackball radius
2603
+ */
2604
+
2605
+
2606
+ /**
2607
+ * Set values in transformation object
2608
+ * @param {Matrix4} camera Transformation to be applied to the camera
2609
+ * @param {Matrix4} gizmos Transformation to be applied to gizmos
2610
+ */
1716
2611
  setTransformationMatrices(camera = null, gizmos = null) {
1717
2612
  if (camera) {
1718
2613
  if (_transformation.camera) {
@@ -1723,6 +2618,7 @@ class ArcballControls extends THREE.EventDispatcher {
1723
2618
  } else {
1724
2619
  _transformation.camera = null;
1725
2620
  }
2621
+
1726
2622
  if (gizmos) {
1727
2623
  if (_transformation.gizmos) {
1728
2624
  _transformation.gizmos.copy(gizmos);
@@ -1733,5 +2629,14 @@ class ArcballControls extends THREE.EventDispatcher {
1733
2629
  _transformation.gizmos = null;
1734
2630
  }
1735
2631
  }
2632
+ /**
2633
+ * Rotate camera around its direction axis passing by a given point by a given angle
2634
+ * @param {Vector3} point The point where the rotation axis is passing trough
2635
+ * @param {Number} angle Angle in radians
2636
+ * @returns The computed transormation matix
2637
+ */
2638
+
2639
+
1736
2640
  }
1737
- exports.ArcballControls = ArcballControls;
2641
+
2642
+ export { ArcballControls };