three-stdlib 2.22.7 → 2.22.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1065) hide show
  1. package/dist/_polyfill/CompressedArrayTexture.js +12 -0
  2. package/dist/_polyfill/CompressedArrayTexture.mjs +12 -0
  3. package/dist/_polyfill/Data3DTexture.js +17 -0
  4. package/dist/_polyfill/Data3DTexture.mjs +17 -0
  5. package/dist/animation/AnimationClipCreator.d.ts +12 -0
  6. package/dist/animation/AnimationClipCreator.js +57 -0
  7. package/dist/animation/AnimationClipCreator.mjs +57 -0
  8. package/dist/animation/CCDIKSolver.d.ts +25 -0
  9. package/dist/animation/CCDIKSolver.js +224 -0
  10. package/dist/animation/CCDIKSolver.mjs +224 -0
  11. package/dist/animation/MMDAnimationHelper.d.ts +93 -0
  12. package/dist/animation/MMDAnimationHelper.js +590 -0
  13. package/dist/animation/MMDAnimationHelper.mjs +590 -0
  14. package/dist/animation/MMDPhysics.d.ts +114 -0
  15. package/dist/animation/MMDPhysics.js +819 -0
  16. package/dist/animation/MMDPhysics.mjs +819 -0
  17. package/dist/cameras/CinematicCamera.d.ts +34 -0
  18. package/dist/cameras/CinematicCamera.js +131 -0
  19. package/dist/cameras/CinematicCamera.mjs +131 -0
  20. package/dist/controls/ArcballControls.d.ts +374 -0
  21. package/dist/controls/ArcballControls.js +2039 -0
  22. package/dist/controls/ArcballControls.mjs +2039 -0
  23. package/dist/controls/DeviceOrientationControls.d.ts +27 -0
  24. package/dist/controls/DeviceOrientationControls.js +84 -0
  25. package/dist/controls/DeviceOrientationControls.mjs +84 -0
  26. package/dist/controls/DragControls.d.ts +34 -0
  27. package/dist/controls/DragControls.js +182 -0
  28. package/dist/controls/DragControls.mjs +182 -0
  29. package/dist/controls/FirstPersonControls.d.ts +48 -0
  30. package/dist/controls/FirstPersonControls.js +229 -0
  31. package/dist/controls/FirstPersonControls.mjs +229 -0
  32. package/dist/controls/FlyControls.d.ts +32 -0
  33. package/dist/controls/FlyControls.js +248 -0
  34. package/dist/controls/FlyControls.mjs +248 -0
  35. package/dist/controls/OrbitControls.d.ts +63 -0
  36. package/dist/controls/OrbitControls.js +781 -0
  37. package/dist/controls/OrbitControls.mjs +781 -0
  38. package/dist/controls/PointerLockControls.d.ts +24 -0
  39. package/dist/controls/PointerLockControls.js +103 -0
  40. package/dist/controls/PointerLockControls.mjs +103 -0
  41. package/dist/controls/TrackballControls.d.ts +95 -0
  42. package/dist/controls/TrackballControls.js +502 -0
  43. package/dist/controls/TrackballControls.mjs +502 -0
  44. package/dist/controls/TransformControls.d.ts +151 -0
  45. package/dist/controls/TransformControls.js +1089 -0
  46. package/dist/controls/TransformControls.mjs +1089 -0
  47. package/dist/controls/experimental/CameraControls.d.ts +212 -0
  48. package/dist/controls/experimental/CameraControls.js +736 -0
  49. package/dist/controls/experimental/CameraControls.mjs +736 -0
  50. package/dist/csm/CSM.d.ts +61 -0
  51. package/dist/csm/CSM.js +244 -0
  52. package/dist/csm/CSM.mjs +244 -0
  53. package/dist/csm/CSMFrustum.d.ts +19 -0
  54. package/dist/csm/CSMFrustum.js +75 -0
  55. package/dist/csm/CSMFrustum.mjs +75 -0
  56. package/dist/csm/CSMHelper.d.ts +26 -0
  57. package/dist/csm/CSMHelper.js +114 -0
  58. package/dist/csm/CSMHelper.mjs +114 -0
  59. package/dist/csm/CSMShader.d.ts +4 -0
  60. package/dist/csm/CSMShader.js +257 -0
  61. package/dist/csm/CSMShader.mjs +257 -0
  62. package/dist/curves/CurveExtras.d.ts +68 -0
  63. package/dist/curves/CurveExtras.js +224 -0
  64. package/dist/curves/CurveExtras.mjs +224 -0
  65. package/dist/curves/NURBSCurve.d.ts +11 -0
  66. package/dist/curves/NURBSCurve.js +35 -0
  67. package/dist/curves/NURBSCurve.mjs +35 -0
  68. package/dist/curves/NURBSSurface.d.ts +13 -0
  69. package/dist/curves/NURBSSurface.js +28 -0
  70. package/dist/curves/NURBSSurface.mjs +28 -0
  71. package/dist/curves/NURBSUtils.d.ts +22 -0
  72. package/dist/curves/NURBSUtils.js +226 -0
  73. package/dist/curves/NURBSUtils.mjs +226 -0
  74. package/dist/custom.d.ts +5 -0
  75. package/dist/deprecated/Geometry.d.ts +342 -0
  76. package/dist/deprecated/Geometry.js +971 -0
  77. package/dist/deprecated/Geometry.mjs +971 -0
  78. package/dist/effects/AnaglyphEffect.d.ts +11 -0
  79. package/dist/effects/AnaglyphEffect.js +121 -0
  80. package/dist/effects/AnaglyphEffect.mjs +121 -0
  81. package/dist/effects/AsciiEffect.d.ts +18 -0
  82. package/dist/effects/AsciiEffect.js +173 -0
  83. package/dist/effects/AsciiEffect.mjs +173 -0
  84. package/dist/effects/OutlineEffect.d.ts +28 -0
  85. package/dist/effects/OutlineEffect.js +298 -0
  86. package/dist/effects/OutlineEffect.mjs +298 -0
  87. package/dist/effects/ParallaxBarrierEffect.d.ts +8 -0
  88. package/dist/effects/ParallaxBarrierEffect.js +64 -0
  89. package/dist/effects/ParallaxBarrierEffect.mjs +64 -0
  90. package/dist/effects/PeppersGhostEffect.d.ts +10 -0
  91. package/dist/effects/PeppersGhostEffect.js +85 -0
  92. package/dist/effects/PeppersGhostEffect.mjs +85 -0
  93. package/dist/effects/StereoEffect.d.ts +9 -0
  94. package/dist/effects/StereoEffect.js +32 -0
  95. package/dist/effects/StereoEffect.mjs +32 -0
  96. package/dist/environments/RoomEnvironment.d.ts +5 -0
  97. package/dist/environments/RoomEnvironment.js +95 -0
  98. package/dist/environments/RoomEnvironment.mjs +78 -0
  99. package/dist/exporters/ColladaExporter.d.ts +50 -0
  100. package/dist/exporters/ColladaExporter.js +331 -0
  101. package/dist/exporters/ColladaExporter.mjs +331 -0
  102. package/dist/exporters/DRACOExporter.d.ts +23 -0
  103. package/dist/exporters/DRACOExporter.js +141 -0
  104. package/dist/exporters/DRACOExporter.mjs +141 -0
  105. package/dist/exporters/GLTFExporter.d.ts +446 -0
  106. package/dist/exporters/GLTFExporter.js +1575 -0
  107. package/dist/exporters/GLTFExporter.mjs +1575 -0
  108. package/dist/exporters/MMDExporter.d.ts +12 -0
  109. package/dist/exporters/MMDExporter.js +131 -0
  110. package/dist/exporters/MMDExporter.mjs +131 -0
  111. package/dist/exporters/OBJExporter.d.ts +18 -0
  112. package/dist/exporters/OBJExporter.js +181 -0
  113. package/dist/exporters/OBJExporter.mjs +181 -0
  114. package/dist/exporters/PLYExporter.d.ts +23 -0
  115. package/dist/exporters/PLYExporter.js +280 -0
  116. package/dist/exporters/PLYExporter.mjs +280 -0
  117. package/dist/exporters/STLExporter.d.ts +31 -0
  118. package/dist/exporters/STLExporter.js +146 -0
  119. package/dist/exporters/STLExporter.mjs +146 -0
  120. package/dist/exporters/USDZExporter.d.ts +27 -0
  121. package/dist/exporters/USDZExporter.js +340 -0
  122. package/dist/exporters/USDZExporter.mjs +340 -0
  123. package/dist/geometries/BoxLineGeometry.d.ts +12 -0
  124. package/dist/geometries/BoxLineGeometry.js +45 -0
  125. package/dist/geometries/BoxLineGeometry.mjs +45 -0
  126. package/dist/geometries/ConvexGeometry.d.ts +5 -0
  127. package/dist/geometries/ConvexGeometry.js +29 -0
  128. package/dist/geometries/ConvexGeometry.mjs +29 -0
  129. package/dist/geometries/DecalGeometry.d.ts +10 -0
  130. package/dist/geometries/DecalGeometry.js +184 -0
  131. package/dist/geometries/DecalGeometry.mjs +184 -0
  132. package/dist/geometries/LightningStrike.d.ts +108 -0
  133. package/dist/geometries/LightningStrike.js +548 -0
  134. package/dist/geometries/LightningStrike.mjs +548 -0
  135. package/dist/geometries/ParametricGeometries.d.ts +26 -0
  136. package/dist/geometries/ParametricGeometries.js +129 -0
  137. package/dist/geometries/ParametricGeometries.mjs +129 -0
  138. package/dist/geometries/ParametricGeometry.d.ts +18 -0
  139. package/dist/geometries/ParametricGeometry.js +63 -0
  140. package/dist/geometries/ParametricGeometry.mjs +63 -0
  141. package/dist/geometries/RoundedBoxGeometry.d.ts +5 -0
  142. package/dist/geometries/RoundedBoxGeometry.js +91 -0
  143. package/dist/geometries/RoundedBoxGeometry.mjs +91 -0
  144. package/dist/geometries/TeapotGeometry.d.ts +13 -0
  145. package/dist/geometries/TeapotGeometry.js +1563 -0
  146. package/dist/geometries/TeapotGeometry.mjs +1563 -0
  147. package/dist/geometries/TextGeometry.d.ts +18 -0
  148. package/dist/geometries/TextGeometry.js +27 -0
  149. package/dist/geometries/TextGeometry.mjs +27 -0
  150. package/dist/helpers/LightProbeHelper.d.ts +10 -0
  151. package/dist/helpers/LightProbeHelper.js +73 -0
  152. package/dist/helpers/LightProbeHelper.mjs +73 -0
  153. package/dist/helpers/PositionalAudioHelper.d.ts +13 -0
  154. package/dist/helpers/PositionalAudioHelper.js +68 -0
  155. package/dist/helpers/PositionalAudioHelper.mjs +68 -0
  156. package/dist/helpers/RectAreaLightHelper.d.ts +10 -0
  157. package/dist/helpers/RectAreaLightHelper.js +44 -0
  158. package/dist/helpers/RectAreaLightHelper.mjs +44 -0
  159. package/dist/helpers/VertexNormalsHelper.d.ts +10 -0
  160. package/dist/helpers/VertexNormalsHelper.js +54 -0
  161. package/dist/helpers/VertexNormalsHelper.mjs +54 -0
  162. package/dist/helpers/VertexTangentsHelper.d.ts +10 -0
  163. package/dist/helpers/VertexTangentsHelper.js +45 -0
  164. package/dist/helpers/VertexTangentsHelper.mjs +45 -0
  165. package/dist/index.d.ts +325 -0
  166. package/dist/index.js +978 -0
  167. package/dist/index.mjs +978 -0
  168. package/dist/interactive/HTMLMesh.d.ts +6 -0
  169. package/dist/interactive/HTMLMesh.js +325 -0
  170. package/dist/interactive/HTMLMesh.mjs +325 -0
  171. package/dist/interactive/InteractiveGroup.d.ts +5 -0
  172. package/dist/interactive/InteractiveGroup.js +68 -0
  173. package/dist/interactive/InteractiveGroup.mjs +68 -0
  174. package/dist/interactive/SelectionBox.d.ts +15 -0
  175. package/dist/interactive/SelectionBox.js +137 -0
  176. package/dist/interactive/SelectionBox.mjs +137 -0
  177. package/dist/interactive/SelectionHelper.d.ts +17 -0
  178. package/dist/interactive/SelectionHelper.js +54 -0
  179. package/dist/interactive/SelectionHelper.mjs +54 -0
  180. package/dist/libs/MeshoptDecoder.d.ts +12 -0
  181. package/dist/libs/MeshoptDecoder.js +221 -0
  182. package/dist/libs/MeshoptDecoder.mjs +221 -0
  183. package/dist/libs/MotionControllers.d.ts +175 -0
  184. package/dist/libs/MotionControllers.js +325 -0
  185. package/dist/libs/MotionControllers.mjs +325 -0
  186. package/dist/lights/LightProbeGenerator.d.ts +6 -0
  187. package/dist/lights/LightProbeGenerator.js +145 -0
  188. package/dist/lights/LightProbeGenerator.mjs +145 -0
  189. package/dist/lights/RectAreaLightUniformsLib.d.ts +3 -0
  190. package/dist/lights/RectAreaLightUniformsLib.js +32842 -0
  191. package/dist/lights/RectAreaLightUniformsLib.mjs +32842 -0
  192. package/dist/lines/Line2.d.ts +11 -0
  193. package/dist/lines/Line2.js +13 -0
  194. package/dist/lines/Line2.mjs +13 -0
  195. package/dist/lines/LineGeometry.d.ts +10 -0
  196. package/dist/lines/LineGeometry.js +44 -0
  197. package/dist/lines/LineGeometry.mjs +44 -0
  198. package/dist/lines/LineMaterial.d.ts +31 -0
  199. package/dist/lines/LineMaterial.js +547 -0
  200. package/dist/lines/LineMaterial.mjs +547 -0
  201. package/dist/lines/LineSegments2.d.ts +14 -0
  202. package/dist/lines/LineSegments2.js +203 -0
  203. package/dist/lines/LineSegments2.mjs +203 -0
  204. package/dist/lines/LineSegmentsGeometry.d.ts +16 -0
  205. package/dist/lines/LineSegmentsGeometry.js +124 -0
  206. package/dist/lines/LineSegmentsGeometry.mjs +124 -0
  207. package/dist/lines/Wireframe.d.ts +11 -0
  208. package/dist/lines/Wireframe.js +32 -0
  209. package/dist/lines/Wireframe.mjs +32 -0
  210. package/dist/lines/WireframeGeometry2.d.ts +8 -0
  211. package/dist/lines/WireframeGeometry2.js +13 -0
  212. package/dist/lines/WireframeGeometry2.mjs +13 -0
  213. package/dist/loaders/3DMLoader.d.ts +17 -0
  214. package/dist/loaders/3DMLoader.js +803 -0
  215. package/dist/loaders/3DMLoader.mjs +803 -0
  216. package/dist/loaders/3MFLoader.d.ts +16 -0
  217. package/dist/loaders/3MFLoader.js +854 -0
  218. package/dist/loaders/3MFLoader.mjs +854 -0
  219. package/dist/loaders/AMFLoader.d.ts +14 -0
  220. package/dist/loaders/AMFLoader.js +284 -0
  221. package/dist/loaders/AMFLoader.mjs +284 -0
  222. package/dist/loaders/AssimpLoader.js +1396 -0
  223. package/dist/loaders/AssimpLoader.mjs +1396 -0
  224. package/dist/loaders/BVHLoader.d.ts +21 -0
  225. package/dist/loaders/BVHLoader.js +207 -0
  226. package/dist/loaders/BVHLoader.mjs +207 -0
  227. package/dist/loaders/BasisTextureLoader.d.ts +32 -0
  228. package/dist/loaders/BasisTextureLoader.js +480 -0
  229. package/dist/loaders/BasisTextureLoader.mjs +480 -0
  230. package/dist/loaders/ColladaLoader.d.ts +20 -0
  231. package/dist/loaders/ColladaLoader.js +2405 -0
  232. package/dist/loaders/ColladaLoader.mjs +2405 -0
  233. package/dist/loaders/DDSLoader.d.ts +16 -0
  234. package/dist/loaders/DDSLoader.js +148 -0
  235. package/dist/loaders/DDSLoader.mjs +148 -0
  236. package/dist/loaders/DRACOLoader.d.ts +18 -0
  237. package/dist/loaders/DRACOLoader.js +341 -0
  238. package/dist/loaders/DRACOLoader.mjs +341 -0
  239. package/dist/loaders/EXRLoader.d.ts +18 -0
  240. package/dist/loaders/EXRLoader.js +1354 -0
  241. package/dist/loaders/EXRLoader.mjs +1354 -0
  242. package/dist/loaders/FBXLoader.d.ts +14 -0
  243. package/dist/loaders/FBXLoader.js +2457 -0
  244. package/dist/loaders/FBXLoader.mjs +2457 -0
  245. package/dist/loaders/FontLoader.d.ts +36 -0
  246. package/dist/loaders/FontLoader.js +120 -0
  247. package/dist/loaders/FontLoader.mjs +120 -0
  248. package/dist/loaders/GCodeLoader.d.ts +15 -0
  249. package/dist/loaders/GCodeLoader.js +141 -0
  250. package/dist/loaders/GCodeLoader.mjs +141 -0
  251. package/dist/loaders/GLTFLoader.d.ts +153 -0
  252. package/dist/loaders/GLTFLoader.js +2459 -0
  253. package/dist/loaders/GLTFLoader.mjs +2459 -0
  254. package/dist/loaders/HDRCubeTextureLoader.d.ts +18 -0
  255. package/dist/loaders/HDRCubeTextureLoader.js +75 -0
  256. package/dist/loaders/HDRCubeTextureLoader.mjs +75 -0
  257. package/dist/loaders/KMZLoader.d.ts +16 -0
  258. package/dist/loaders/KMZLoader.js +75 -0
  259. package/dist/loaders/KMZLoader.mjs +75 -0
  260. package/dist/loaders/KTX2Loader.d.ts +16 -0
  261. package/dist/loaders/KTX2Loader.js +461 -0
  262. package/dist/loaders/KTX2Loader.mjs +461 -0
  263. package/dist/loaders/KTXLoader.d.ts +16 -0
  264. package/dist/loaders/KTXLoader.js +93 -0
  265. package/dist/loaders/KTXLoader.mjs +93 -0
  266. package/dist/loaders/LDrawLoader.d.ts +26 -0
  267. package/dist/loaders/LDrawLoader.js +1424 -0
  268. package/dist/loaders/LDrawLoader.mjs +1424 -0
  269. package/dist/loaders/LUT3dlLoader.d.ts +20 -0
  270. package/dist/loaders/LUT3dlLoader.js +103 -0
  271. package/dist/loaders/LUT3dlLoader.mjs +103 -0
  272. package/dist/loaders/LUTCubeLoader.d.ts +23 -0
  273. package/dist/loaders/LUTCubeLoader.js +107 -0
  274. package/dist/loaders/LUTCubeLoader.mjs +107 -0
  275. package/dist/loaders/LWOLoader.d.ts +26 -0
  276. package/dist/loaders/LWOLoader.js +645 -0
  277. package/dist/loaders/LWOLoader.mjs +645 -0
  278. package/dist/loaders/LottieLoader.d.ts +15 -0
  279. package/dist/loaders/LottieLoader.js +47 -0
  280. package/dist/loaders/LottieLoader.mjs +47 -0
  281. package/dist/loaders/MD2Loader.d.ts +14 -0
  282. package/dist/loaders/MD2Loader.js +359 -0
  283. package/dist/loaders/MD2Loader.mjs +359 -0
  284. package/dist/loaders/MDDLoader.d.ts +19 -0
  285. package/dist/loaders/MDDLoader.js +58 -0
  286. package/dist/loaders/MDDLoader.mjs +58 -0
  287. package/dist/loaders/MMDLoader.d.ts +63 -0
  288. package/dist/loaders/MMDLoader.js +1121 -0
  289. package/dist/loaders/MMDLoader.mjs +1121 -0
  290. package/dist/loaders/MTLLoader.d.ts +100 -0
  291. package/dist/loaders/MTLLoader.js +304 -0
  292. package/dist/loaders/MTLLoader.mjs +304 -0
  293. package/dist/loaders/NRRDLoader.d.ts +21 -0
  294. package/dist/loaders/NRRDLoader.js +401 -0
  295. package/dist/loaders/NRRDLoader.mjs +401 -0
  296. package/dist/loaders/NodeMaterialLoader.js +146 -0
  297. package/dist/loaders/NodeMaterialLoader.mjs +146 -0
  298. package/dist/loaders/OBJLoader.d.ts +17 -0
  299. package/dist/loaders/OBJLoader.js +487 -0
  300. package/dist/loaders/OBJLoader.mjs +487 -0
  301. package/dist/loaders/PCDLoader.d.ts +15 -0
  302. package/dist/loaders/PCDLoader.js +248 -0
  303. package/dist/loaders/PCDLoader.mjs +248 -0
  304. package/dist/loaders/PDBLoader.d.ts +22 -0
  305. package/dist/loaders/PDBLoader.js +247 -0
  306. package/dist/loaders/PDBLoader.mjs +247 -0
  307. package/dist/loaders/PLYLoader.d.ts +16 -0
  308. package/dist/loaders/PLYLoader.js +317 -0
  309. package/dist/loaders/PLYLoader.mjs +317 -0
  310. package/dist/loaders/PRWMLoader.d.ts +16 -0
  311. package/dist/loaders/PRWMLoader.js +160 -0
  312. package/dist/loaders/PRWMLoader.mjs +160 -0
  313. package/dist/loaders/PVRLoader.d.ts +16 -0
  314. package/dist/loaders/PVRLoader.js +131 -0
  315. package/dist/loaders/PVRLoader.mjs +131 -0
  316. package/dist/loaders/RGBELoader.d.ts +20 -0
  317. package/dist/loaders/RGBELoader.js +252 -0
  318. package/dist/loaders/RGBELoader.mjs +252 -0
  319. package/dist/loaders/RGBMLoader.d.ts +32 -0
  320. package/dist/loaders/RGBMLoader.js +998 -0
  321. package/dist/loaders/RGBMLoader.mjs +998 -0
  322. package/dist/loaders/STLLoader.d.ts +14 -0
  323. package/dist/loaders/STLLoader.js +190 -0
  324. package/dist/loaders/STLLoader.mjs +190 -0
  325. package/dist/loaders/SVGLoader.d.ts +63 -0
  326. package/dist/loaders/SVGLoader.js +1712 -0
  327. package/dist/loaders/SVGLoader.mjs +1712 -0
  328. package/dist/loaders/TDSLoader.d.ts +42 -0
  329. package/dist/loaders/TDSLoader.js +650 -0
  330. package/dist/loaders/TDSLoader.mjs +650 -0
  331. package/dist/loaders/TGALoader.d.ts +14 -0
  332. package/dist/loaders/TGALoader.js +285 -0
  333. package/dist/loaders/TGALoader.mjs +285 -0
  334. package/dist/loaders/TTFLoader.d.ts +15 -0
  335. package/dist/loaders/TTFLoader.js +131 -0
  336. package/dist/loaders/TTFLoader.mjs +131 -0
  337. package/dist/loaders/TiltLoader.d.ts +14 -0
  338. package/dist/loaders/TiltLoader.js +373 -0
  339. package/dist/loaders/TiltLoader.mjs +373 -0
  340. package/dist/loaders/VOXLoader.d.ts +28 -0
  341. package/dist/loaders/VOXLoader.js +432 -0
  342. package/dist/loaders/VOXLoader.mjs +432 -0
  343. package/dist/loaders/VRMLLoader.d.ts +14 -0
  344. package/dist/loaders/VRMLLoader.js +2105 -0
  345. package/dist/loaders/VRMLLoader.mjs +2105 -0
  346. package/dist/loaders/VRMLoader.js +38 -0
  347. package/dist/loaders/VRMLoader.mjs +38 -0
  348. package/dist/loaders/VTKLoader.d.ts +14 -0
  349. package/dist/loaders/VTKLoader.js +648 -0
  350. package/dist/loaders/VTKLoader.mjs +648 -0
  351. package/dist/loaders/XLoader.js +1258 -0
  352. package/dist/loaders/XLoader.mjs +1258 -0
  353. package/dist/loaders/XYZLoader.d.ts +14 -0
  354. package/dist/loaders/XYZLoader.js +60 -0
  355. package/dist/loaders/XYZLoader.mjs +60 -0
  356. package/dist/loaders/lwo/IFFParser.js +749 -0
  357. package/dist/loaders/lwo/IFFParser.mjs +749 -0
  358. package/dist/loaders/lwo/LWO2Parser.js +327 -0
  359. package/dist/loaders/lwo/LWO2Parser.mjs +327 -0
  360. package/dist/loaders/lwo/LWO3Parser.js +298 -0
  361. package/dist/loaders/lwo/LWO3Parser.mjs +298 -0
  362. package/dist/math/Capsule.d.ts +27 -0
  363. package/dist/math/Capsule.js +100 -0
  364. package/dist/math/Capsule.mjs +100 -0
  365. package/dist/math/ColorConverter.d.ts +21 -0
  366. package/dist/math/ColorConverter.js +52 -0
  367. package/dist/math/ColorConverter.mjs +52 -0
  368. package/dist/math/ConvexHull.d.ts +89 -0
  369. package/dist/math/ConvexHull.js +597 -0
  370. package/dist/math/ConvexHull.mjs +597 -0
  371. package/dist/math/ImprovedNoise.d.ts +4 -0
  372. package/dist/math/ImprovedNoise.js +302 -0
  373. package/dist/math/ImprovedNoise.mjs +302 -0
  374. package/dist/math/Lut.d.ts +27 -0
  375. package/dist/math/Lut.js +135 -0
  376. package/dist/math/Lut.mjs +135 -0
  377. package/dist/math/MeshSurfaceSampler.d.ts +15 -0
  378. package/dist/math/MeshSurfaceSampler.js +107 -0
  379. package/dist/math/MeshSurfaceSampler.mjs +107 -0
  380. package/dist/math/OBB.d.ts +24 -0
  381. package/dist/math/OBB.js +262 -0
  382. package/dist/math/OBB.mjs +262 -0
  383. package/dist/math/Octree.d.ts +24 -0
  384. package/dist/math/Octree.js +278 -0
  385. package/dist/math/Octree.mjs +278 -0
  386. package/dist/math/SimplexNoise.d.ts +21 -0
  387. package/dist/math/SimplexNoise.js +440 -0
  388. package/dist/math/SimplexNoise.mjs +440 -0
  389. package/dist/misc/ConvexObjectBreaker.d.ts +25 -0
  390. package/dist/misc/ConvexObjectBreaker.js +298 -0
  391. package/dist/misc/ConvexObjectBreaker.mjs +298 -0
  392. package/dist/misc/GPUComputationRenderer.d.ts +52 -0
  393. package/dist/misc/GPUComputationRenderer.js +171 -0
  394. package/dist/misc/GPUComputationRenderer.mjs +171 -0
  395. package/dist/misc/Gyroscope.d.ts +5 -0
  396. package/dist/misc/Gyroscope.js +35 -0
  397. package/dist/misc/Gyroscope.mjs +35 -0
  398. package/dist/misc/MD2Character.d.ts +33 -0
  399. package/dist/misc/MD2Character.js +165 -0
  400. package/dist/misc/MD2Character.mjs +165 -0
  401. package/dist/misc/MD2CharacterComplex.d.ts +47 -0
  402. package/dist/misc/MD2CharacterComplex.js +331 -0
  403. package/dist/misc/MD2CharacterComplex.mjs +331 -0
  404. package/dist/misc/MorphAnimMesh.d.ts +13 -0
  405. package/dist/misc/MorphAnimMesh.js +40 -0
  406. package/dist/misc/MorphAnimMesh.mjs +40 -0
  407. package/dist/misc/MorphBlendMesh.d.ts +21 -0
  408. package/dist/misc/MorphBlendMesh.js +179 -0
  409. package/dist/misc/MorphBlendMesh.mjs +179 -0
  410. package/dist/misc/ProgressiveLightmap.d.ts +61 -0
  411. package/dist/misc/ProgressiveLightmap.js +186 -0
  412. package/dist/misc/ProgressiveLightmap.mjs +186 -0
  413. package/dist/misc/RollerCoaster.d.ts +21 -0
  414. package/dist/misc/RollerCoaster.js +346 -0
  415. package/dist/misc/RollerCoaster.mjs +346 -0
  416. package/dist/misc/Timer.d.ts +27 -0
  417. package/dist/misc/Timer.js +101 -0
  418. package/dist/misc/Timer.mjs +101 -0
  419. package/dist/misc/TubePainter.d.ts +10 -0
  420. package/dist/misc/TubePainter.js +123 -0
  421. package/dist/misc/TubePainter.mjs +123 -0
  422. package/dist/misc/Volume.d.ts +37 -0
  423. package/dist/misc/Volume.js +302 -0
  424. package/dist/misc/Volume.mjs +302 -0
  425. package/dist/misc/VolumeSlice.d.ts +28 -0
  426. package/dist/misc/VolumeSlice.js +115 -0
  427. package/dist/misc/VolumeSlice.mjs +115 -0
  428. package/dist/misc/WebGL.d.ts +5 -0
  429. package/dist/misc/WebGL.js +74 -0
  430. package/dist/misc/WebGL.mjs +74 -0
  431. package/dist/modifiers/CurveModifier.d.ts +91 -0
  432. package/dist/modifiers/CurveModifier.js +232 -0
  433. package/dist/modifiers/CurveModifier.mjs +232 -0
  434. package/dist/modifiers/EdgeSplitModifier.d.ts +19 -0
  435. package/dist/modifiers/EdgeSplitModifier.js +167 -0
  436. package/dist/modifiers/EdgeSplitModifier.mjs +168 -0
  437. package/dist/modifiers/SimplifyModifier.d.ts +19 -0
  438. package/dist/modifiers/SimplifyModifier.js +300 -0
  439. package/dist/modifiers/SimplifyModifier.mjs +300 -0
  440. package/dist/modifiers/TessellateModifier.d.ts +11 -0
  441. package/dist/modifiers/TessellateModifier.js +214 -0
  442. package/dist/modifiers/TessellateModifier.mjs +214 -0
  443. package/dist/nodes/Nodes.js +347 -0
  444. package/dist/nodes/Nodes.mjs +347 -0
  445. package/dist/nodes/ShaderNode.js +408 -0
  446. package/dist/nodes/ShaderNode.mjs +408 -0
  447. package/dist/nodes/accessors/BufferNode.js +14 -0
  448. package/dist/nodes/accessors/BufferNode.mjs +15 -0
  449. package/dist/nodes/accessors/CameraNode.js +43 -0
  450. package/dist/nodes/accessors/CameraNode.mjs +44 -0
  451. package/dist/nodes/accessors/CubeTextureNode.js +41 -0
  452. package/dist/nodes/accessors/CubeTextureNode.mjs +42 -0
  453. package/dist/nodes/accessors/MaterialNode.js +70 -0
  454. package/dist/nodes/accessors/MaterialNode.mjs +71 -0
  455. package/dist/nodes/accessors/MaterialReferenceNode.js +13 -0
  456. package/dist/nodes/accessors/MaterialReferenceNode.mjs +14 -0
  457. package/dist/nodes/accessors/ModelNode.js +8 -0
  458. package/dist/nodes/accessors/ModelNode.mjs +9 -0
  459. package/dist/nodes/accessors/ModelViewProjectionNode.js +23 -0
  460. package/dist/nodes/accessors/ModelViewProjectionNode.mjs +24 -0
  461. package/dist/nodes/accessors/NormalNode.js +61 -0
  462. package/dist/nodes/accessors/NormalNode.mjs +62 -0
  463. package/dist/nodes/accessors/Object3DNode.js +75 -0
  464. package/dist/nodes/accessors/Object3DNode.mjs +76 -0
  465. package/dist/nodes/accessors/PointUVNode.js +12 -0
  466. package/dist/nodes/accessors/PointUVNode.mjs +13 -0
  467. package/dist/nodes/accessors/PositionNode.js +64 -0
  468. package/dist/nodes/accessors/PositionNode.mjs +65 -0
  469. package/dist/nodes/accessors/ReferenceNode.js +36 -0
  470. package/dist/nodes/accessors/ReferenceNode.mjs +37 -0
  471. package/dist/nodes/accessors/ReflectNode.js +42 -0
  472. package/dist/nodes/accessors/ReflectNode.mjs +43 -0
  473. package/dist/nodes/accessors/SkinningNode.js +57 -0
  474. package/dist/nodes/accessors/SkinningNode.mjs +58 -0
  475. package/dist/nodes/accessors/TextureNode.js +53 -0
  476. package/dist/nodes/accessors/TextureNode.mjs +54 -0
  477. package/dist/nodes/accessors/UVNode.js +22 -0
  478. package/dist/nodes/accessors/UVNode.mjs +23 -0
  479. package/dist/nodes/core/ArrayUniformNode.js +13 -0
  480. package/dist/nodes/core/ArrayUniformNode.mjs +14 -0
  481. package/dist/nodes/core/AttributeNode.js +29 -0
  482. package/dist/nodes/core/AttributeNode.mjs +30 -0
  483. package/dist/nodes/core/BypassNode.js +21 -0
  484. package/dist/nodes/core/BypassNode.mjs +22 -0
  485. package/dist/nodes/core/CodeNode.js +27 -0
  486. package/dist/nodes/core/CodeNode.mjs +28 -0
  487. package/dist/nodes/core/ConstNode.js +13 -0
  488. package/dist/nodes/core/ConstNode.mjs +14 -0
  489. package/dist/nodes/core/ContextNode.js +21 -0
  490. package/dist/nodes/core/ContextNode.mjs +22 -0
  491. package/dist/nodes/core/ExpressionNode.js +18 -0
  492. package/dist/nodes/core/ExpressionNode.mjs +19 -0
  493. package/dist/nodes/core/FunctionCallNode.js +36 -0
  494. package/dist/nodes/core/FunctionCallNode.mjs +37 -0
  495. package/dist/nodes/core/FunctionNode.js +55 -0
  496. package/dist/nodes/core/FunctionNode.mjs +56 -0
  497. package/dist/nodes/core/InputNode.js +37 -0
  498. package/dist/nodes/core/InputNode.mjs +38 -0
  499. package/dist/nodes/core/Node.js +138 -0
  500. package/dist/nodes/core/Node.mjs +139 -0
  501. package/dist/nodes/core/NodeAttribute.js +9 -0
  502. package/dist/nodes/core/NodeAttribute.mjs +10 -0
  503. package/dist/nodes/core/NodeBuilder.js +402 -0
  504. package/dist/nodes/core/NodeBuilder.mjs +402 -0
  505. package/dist/nodes/core/NodeCode.js +10 -0
  506. package/dist/nodes/core/NodeCode.mjs +11 -0
  507. package/dist/nodes/core/NodeFrame.js +34 -0
  508. package/dist/nodes/core/NodeFrame.mjs +35 -0
  509. package/dist/nodes/core/NodeFunctionInput.js +12 -0
  510. package/dist/nodes/core/NodeFunctionInput.mjs +13 -0
  511. package/dist/nodes/core/NodeKeywords.js +43 -0
  512. package/dist/nodes/core/NodeKeywords.mjs +44 -0
  513. package/dist/nodes/core/NodeUniform.js +17 -0
  514. package/dist/nodes/core/NodeUniform.mjs +18 -0
  515. package/dist/nodes/core/NodeUtils.js +57 -0
  516. package/dist/nodes/core/NodeUtils.mjs +57 -0
  517. package/dist/nodes/core/NodeVar.js +9 -0
  518. package/dist/nodes/core/NodeVar.mjs +10 -0
  519. package/dist/nodes/core/NodeVary.js +9 -0
  520. package/dist/nodes/core/NodeVary.mjs +10 -0
  521. package/dist/nodes/core/PropertyNode.js +20 -0
  522. package/dist/nodes/core/PropertyNode.mjs +21 -0
  523. package/dist/nodes/core/TempNode.js +24 -0
  524. package/dist/nodes/core/TempNode.mjs +25 -0
  525. package/dist/nodes/core/UniformNode.js +22 -0
  526. package/dist/nodes/core/UniformNode.mjs +23 -0
  527. package/dist/nodes/core/VarNode.js +30 -0
  528. package/dist/nodes/core/VarNode.mjs +31 -0
  529. package/dist/nodes/core/VaryNode.js +29 -0
  530. package/dist/nodes/core/VaryNode.mjs +30 -0
  531. package/dist/nodes/core/constants.js +24 -0
  532. package/dist/nodes/core/constants.mjs +24 -0
  533. package/dist/nodes/display/ColorSpaceNode.js +62 -0
  534. package/dist/nodes/display/ColorSpaceNode.mjs +62 -0
  535. package/dist/nodes/display/NormalMapNode.js +53 -0
  536. package/dist/nodes/display/NormalMapNode.mjs +54 -0
  537. package/dist/nodes/fog/FogNode.js +14 -0
  538. package/dist/nodes/fog/FogNode.mjs +15 -0
  539. package/dist/nodes/fog/FogRangeNode.js +16 -0
  540. package/dist/nodes/fog/FogRangeNode.mjs +17 -0
  541. package/dist/nodes/functions/BSDFs.js +64 -0
  542. package/dist/nodes/functions/BSDFs.mjs +64 -0
  543. package/dist/nodes/lights/LightContextNode.js +34 -0
  544. package/dist/nodes/lights/LightContextNode.mjs +35 -0
  545. package/dist/nodes/lights/LightNode.js +57 -0
  546. package/dist/nodes/lights/LightNode.mjs +58 -0
  547. package/dist/nodes/lights/LightsNode.js +58 -0
  548. package/dist/nodes/lights/LightsNode.mjs +59 -0
  549. package/dist/nodes/loaders/NodeLoader.js +195 -0
  550. package/dist/nodes/loaders/NodeLoader.mjs +196 -0
  551. package/dist/nodes/loaders/NodeMaterialLoader.js +23 -0
  552. package/dist/nodes/loaders/NodeMaterialLoader.mjs +24 -0
  553. package/dist/nodes/loaders/NodeObjectLoader.js +39 -0
  554. package/dist/nodes/loaders/NodeObjectLoader.mjs +40 -0
  555. package/dist/nodes/materials/LineBasicNodeMaterial.js +26 -0
  556. package/dist/nodes/materials/LineBasicNodeMaterial.mjs +27 -0
  557. package/dist/nodes/materials/Materials.js +24 -0
  558. package/dist/nodes/materials/Materials.mjs +24 -0
  559. package/dist/nodes/materials/MeshBasicNodeMaterial.js +27 -0
  560. package/dist/nodes/materials/MeshBasicNodeMaterial.mjs +28 -0
  561. package/dist/nodes/materials/MeshStandardNodeMaterial.js +40 -0
  562. package/dist/nodes/materials/MeshStandardNodeMaterial.mjs +41 -0
  563. package/dist/nodes/materials/NodeMaterial.js +63 -0
  564. package/dist/nodes/materials/NodeMaterial.mjs +64 -0
  565. package/dist/nodes/materials/PointsNodeMaterial.js +29 -0
  566. package/dist/nodes/materials/PointsNodeMaterial.mjs +30 -0
  567. package/dist/nodes/math/CondNode.js +40 -0
  568. package/dist/nodes/math/CondNode.mjs +41 -0
  569. package/dist/nodes/math/MathNode.js +165 -0
  570. package/dist/nodes/math/MathNode.mjs +166 -0
  571. package/dist/nodes/math/OperatorNode.js +102 -0
  572. package/dist/nodes/math/OperatorNode.mjs +103 -0
  573. package/dist/nodes/procedural/CheckerNode.js +20 -0
  574. package/dist/nodes/procedural/CheckerNode.mjs +21 -0
  575. package/dist/nodes/utils/ArrayElementNode.js +18 -0
  576. package/dist/nodes/utils/ArrayElementNode.mjs +19 -0
  577. package/dist/nodes/utils/ConvertNode.js +24 -0
  578. package/dist/nodes/utils/ConvertNode.mjs +25 -0
  579. package/dist/nodes/utils/JoinNode.js +25 -0
  580. package/dist/nodes/utils/JoinNode.mjs +26 -0
  581. package/dist/nodes/utils/MatcapUVNode.js +15 -0
  582. package/dist/nodes/utils/MatcapUVNode.mjs +16 -0
  583. package/dist/nodes/utils/OscNode.js +49 -0
  584. package/dist/nodes/utils/OscNode.mjs +50 -0
  585. package/dist/nodes/utils/SplitNode.js +44 -0
  586. package/dist/nodes/utils/SplitNode.mjs +45 -0
  587. package/dist/nodes/utils/SpriteSheetUVNode.js +39 -0
  588. package/dist/nodes/utils/SpriteSheetUVNode.mjs +40 -0
  589. package/dist/nodes/utils/TimerNode.js +43 -0
  590. package/dist/nodes/utils/TimerNode.mjs +44 -0
  591. package/dist/objects/GroundProjectedEnv.d.ts +12 -0
  592. package/dist/objects/GroundProjectedEnv.js +134 -0
  593. package/dist/objects/GroundProjectedEnv.mjs +134 -0
  594. package/dist/objects/Lensflare.d.ts +17 -0
  595. package/dist/objects/Lensflare.js +280 -0
  596. package/dist/objects/Lensflare.mjs +280 -0
  597. package/dist/objects/LightningStorm.d.ts +32 -0
  598. package/dist/objects/LightningStorm.js +110 -0
  599. package/dist/objects/LightningStorm.mjs +110 -0
  600. package/dist/objects/MarchingCubes.d.ts +75 -0
  601. package/dist/objects/MarchingCubes.js +457 -0
  602. package/dist/objects/MarchingCubes.mjs +457 -0
  603. package/dist/objects/Reflector.d.ts +19 -0
  604. package/dist/objects/Reflector.js +175 -0
  605. package/dist/objects/Reflector.mjs +175 -0
  606. package/dist/objects/ReflectorForSSRPass.d.ts +48 -0
  607. package/dist/objects/ReflectorForSSRPass.js +256 -0
  608. package/dist/objects/ReflectorForSSRPass.mjs +256 -0
  609. package/dist/objects/ReflectorRTT.js +10 -0
  610. package/dist/objects/ReflectorRTT.mjs +10 -0
  611. package/dist/objects/Refractor.d.ts +19 -0
  612. package/dist/objects/Refractor.js +188 -0
  613. package/dist/objects/Refractor.mjs +188 -0
  614. package/dist/objects/ShadowMesh.d.ts +7 -0
  615. package/dist/objects/ShadowMesh.js +41 -0
  616. package/dist/objects/ShadowMesh.mjs +41 -0
  617. package/dist/objects/Sky.d.ts +43 -0
  618. package/dist/objects/Sky.js +156 -0
  619. package/dist/objects/Sky.mjs +156 -0
  620. package/dist/objects/Water.d.ts +22 -0
  621. package/dist/objects/Water.js +241 -0
  622. package/dist/objects/Water.mjs +241 -0
  623. package/dist/objects/Water2.d.ts +22 -0
  624. package/dist/objects/Water2.js +258 -0
  625. package/dist/objects/Water2.mjs +258 -0
  626. package/dist/offscreen/jank.js +26 -0
  627. package/dist/offscreen/jank.mjs +27 -0
  628. package/dist/offscreen/offscreen.js +8 -0
  629. package/dist/offscreen/offscreen.mjs +7 -0
  630. package/dist/offscreen/scene.js +68 -0
  631. package/dist/offscreen/scene.mjs +52 -0
  632. package/dist/physics/AmmoPhysics.d.ts +7 -0
  633. package/dist/physics/AmmoPhysics.js +166 -0
  634. package/dist/physics/AmmoPhysics.mjs +166 -0
  635. package/dist/postprocessing/AdaptiveToneMappingPass.d.ts +29 -0
  636. package/dist/postprocessing/AdaptiveToneMappingPass.js +225 -0
  637. package/dist/postprocessing/AdaptiveToneMappingPass.mjs +225 -0
  638. package/dist/postprocessing/AfterimagePass.d.ts +15 -0
  639. package/dist/postprocessing/AfterimagePass.js +68 -0
  640. package/dist/postprocessing/AfterimagePass.mjs +68 -0
  641. package/dist/postprocessing/BloomPass.d.ts +16 -0
  642. package/dist/postprocessing/BloomPass.js +109 -0
  643. package/dist/postprocessing/BloomPass.mjs +109 -0
  644. package/dist/postprocessing/BokehPass.d.ts +26 -0
  645. package/dist/postprocessing/BokehPass.js +90 -0
  646. package/dist/postprocessing/BokehPass.mjs +90 -0
  647. package/dist/postprocessing/ClearPass.d.ts +10 -0
  648. package/dist/postprocessing/ClearPass.js +36 -0
  649. package/dist/postprocessing/ClearPass.mjs +36 -0
  650. package/dist/postprocessing/CubeTexturePass.d.ts +14 -0
  651. package/dist/postprocessing/CubeTexturePass.js +49 -0
  652. package/dist/postprocessing/CubeTexturePass.mjs +49 -0
  653. package/dist/postprocessing/DotScreenPass.d.ts +10 -0
  654. package/dist/postprocessing/DotScreenPass.js +49 -0
  655. package/dist/postprocessing/DotScreenPass.mjs +49 -0
  656. package/dist/postprocessing/EffectComposer.d.ts +27 -0
  657. package/dist/postprocessing/EffectComposer.js +156 -0
  658. package/dist/postprocessing/EffectComposer.mjs +156 -0
  659. package/dist/postprocessing/FilmPass.d.ts +10 -0
  660. package/dist/postprocessing/FilmPass.js +51 -0
  661. package/dist/postprocessing/FilmPass.mjs +51 -0
  662. package/dist/postprocessing/GlitchPass.d.ts +15 -0
  663. package/dist/postprocessing/GlitchPass.js +84 -0
  664. package/dist/postprocessing/GlitchPass.mjs +84 -0
  665. package/dist/postprocessing/HalftonePass.d.ts +26 -0
  666. package/dist/postprocessing/HalftonePass.js +53 -0
  667. package/dist/postprocessing/HalftonePass.mjs +53 -0
  668. package/dist/postprocessing/LUTPass.d.ts +13 -0
  669. package/dist/postprocessing/LUTPass.js +142 -0
  670. package/dist/postprocessing/LUTPass.mjs +142 -0
  671. package/dist/postprocessing/MaskPass.d.ts +14 -0
  672. package/dist/postprocessing/MaskPass.js +69 -0
  673. package/dist/postprocessing/MaskPass.mjs +69 -0
  674. package/dist/postprocessing/OutlinePass.d.ts +53 -0
  675. package/dist/postprocessing/OutlinePass.js +479 -0
  676. package/dist/postprocessing/OutlinePass.mjs +479 -0
  677. package/dist/postprocessing/Pass.d.ts +20 -0
  678. package/dist/postprocessing/Pass.js +48 -0
  679. package/dist/postprocessing/Pass.mjs +48 -0
  680. package/dist/postprocessing/RenderPass.d.ts +14 -0
  681. package/dist/postprocessing/RenderPass.js +59 -0
  682. package/dist/postprocessing/RenderPass.mjs +59 -0
  683. package/dist/postprocessing/RenderPixelatedPass.js +199 -0
  684. package/dist/postprocessing/RenderPixelatedPass.mjs +199 -0
  685. package/dist/postprocessing/SAOPass.d.ts +79 -0
  686. package/dist/postprocessing/SAOPass.js +282 -0
  687. package/dist/postprocessing/SAOPass.mjs +282 -0
  688. package/dist/postprocessing/SMAAPass.d.ts +21 -0
  689. package/dist/postprocessing/SMAAPass.js +112 -0
  690. package/dist/postprocessing/SMAAPass.mjs +112 -0
  691. package/dist/postprocessing/SSAARenderPass.d.ts +17 -0
  692. package/dist/postprocessing/SSAARenderPass.js +171 -0
  693. package/dist/postprocessing/SSAARenderPass.mjs +171 -0
  694. package/dist/postprocessing/SSAOPass.d.ts +71 -0
  695. package/dist/postprocessing/SSAOPass.js +265 -0
  696. package/dist/postprocessing/SSAOPass.mjs +265 -0
  697. package/dist/postprocessing/SSRPass.d.ts +124 -0
  698. package/dist/postprocessing/SSRPass.js +438 -0
  699. package/dist/postprocessing/SSRPass.mjs +438 -0
  700. package/dist/postprocessing/SavePass.d.ts +12 -0
  701. package/dist/postprocessing/SavePass.js +37 -0
  702. package/dist/postprocessing/SavePass.mjs +37 -0
  703. package/dist/postprocessing/ShaderPass.d.ts +13 -0
  704. package/dist/postprocessing/ShaderPass.js +49 -0
  705. package/dist/postprocessing/ShaderPass.mjs +49 -0
  706. package/dist/postprocessing/TAARenderPass.d.ts +8 -0
  707. package/dist/postprocessing/TAARenderPass.js +89 -0
  708. package/dist/postprocessing/TAARenderPass.mjs +89 -0
  709. package/dist/postprocessing/TexturePass.d.ts +12 -0
  710. package/dist/postprocessing/TexturePass.js +39 -0
  711. package/dist/postprocessing/TexturePass.mjs +39 -0
  712. package/dist/postprocessing/UnrealBloomPass.d.ts +31 -0
  713. package/dist/postprocessing/UnrealBloomPass.js +220 -0
  714. package/dist/postprocessing/UnrealBloomPass.mjs +220 -0
  715. package/dist/postprocessing/WaterPass.d.ts +30 -0
  716. package/dist/postprocessing/WaterPass.js +72 -0
  717. package/dist/postprocessing/WaterPass.mjs +72 -0
  718. package/dist/renderers/CSS2DRenderer.d.ts +22 -0
  719. package/dist/renderers/CSS2DRenderer.js +121 -0
  720. package/dist/renderers/CSS2DRenderer.mjs +121 -0
  721. package/dist/renderers/CSS3DRenderer.d.ts +26 -0
  722. package/dist/renderers/CSS3DRenderer.js +133 -0
  723. package/dist/renderers/CSS3DRenderer.mjs +133 -0
  724. package/dist/renderers/Projector.d.ts +60 -0
  725. package/dist/renderers/Projector.js +511 -0
  726. package/dist/renderers/Projector.mjs +511 -0
  727. package/dist/renderers/SVGRenderer.d.ts +25 -0
  728. package/dist/renderers/SVGRenderer.js +306 -0
  729. package/dist/renderers/SVGRenderer.mjs +306 -0
  730. package/dist/renderers/nodes/accessors/CameraNode.js +62 -0
  731. package/dist/renderers/nodes/accessors/CameraNode.mjs +63 -0
  732. package/dist/renderers/nodes/accessors/ModelNode.js +60 -0
  733. package/dist/renderers/nodes/accessors/ModelNode.mjs +61 -0
  734. package/dist/renderers/nodes/accessors/ModelViewProjectionNode.js +20 -0
  735. package/dist/renderers/nodes/accessors/ModelViewProjectionNode.mjs +21 -0
  736. package/dist/renderers/nodes/accessors/NormalNode.js +60 -0
  737. package/dist/renderers/nodes/accessors/NormalNode.mjs +61 -0
  738. package/dist/renderers/nodes/accessors/PositionNode.js +29 -0
  739. package/dist/renderers/nodes/accessors/PositionNode.mjs +30 -0
  740. package/dist/renderers/nodes/accessors/UVNode.js +12 -0
  741. package/dist/renderers/nodes/accessors/UVNode.mjs +13 -0
  742. package/dist/renderers/nodes/core/AttributeNode.js +34 -0
  743. package/dist/renderers/nodes/core/AttributeNode.mjs +35 -0
  744. package/dist/renderers/nodes/core/InputNode.js +30 -0
  745. package/dist/renderers/nodes/core/InputNode.mjs +31 -0
  746. package/dist/renderers/nodes/core/Node.js +33 -0
  747. package/dist/renderers/nodes/core/Node.mjs +34 -0
  748. package/dist/renderers/nodes/core/NodeAttribute.js +9 -0
  749. package/dist/renderers/nodes/core/NodeAttribute.mjs +10 -0
  750. package/dist/renderers/nodes/core/NodeBuilder.js +248 -0
  751. package/dist/renderers/nodes/core/NodeBuilder.mjs +249 -0
  752. package/dist/renderers/nodes/core/NodeFrame.js +34 -0
  753. package/dist/renderers/nodes/core/NodeFrame.mjs +35 -0
  754. package/dist/renderers/nodes/core/NodeSlot.js +9 -0
  755. package/dist/renderers/nodes/core/NodeSlot.mjs +10 -0
  756. package/dist/renderers/nodes/core/NodeUniform.js +17 -0
  757. package/dist/renderers/nodes/core/NodeUniform.mjs +18 -0
  758. package/dist/renderers/nodes/core/NodeVary.js +10 -0
  759. package/dist/renderers/nodes/core/NodeVary.mjs +11 -0
  760. package/dist/renderers/nodes/core/VaryNode.js +21 -0
  761. package/dist/renderers/nodes/core/VaryNode.mjs +22 -0
  762. package/dist/renderers/nodes/core/constants.js +22 -0
  763. package/dist/renderers/nodes/core/constants.mjs +22 -0
  764. package/dist/renderers/nodes/inputs/ColorNode.js +10 -0
  765. package/dist/renderers/nodes/inputs/ColorNode.mjs +11 -0
  766. package/dist/renderers/nodes/inputs/FloatNode.js +10 -0
  767. package/dist/renderers/nodes/inputs/FloatNode.mjs +11 -0
  768. package/dist/renderers/nodes/inputs/Matrix3Node.js +11 -0
  769. package/dist/renderers/nodes/inputs/Matrix3Node.mjs +12 -0
  770. package/dist/renderers/nodes/inputs/Matrix4Node.js +11 -0
  771. package/dist/renderers/nodes/inputs/Matrix4Node.mjs +12 -0
  772. package/dist/renderers/nodes/inputs/TextureNode.js +19 -0
  773. package/dist/renderers/nodes/inputs/TextureNode.mjs +20 -0
  774. package/dist/renderers/nodes/inputs/Vector2Node.js +10 -0
  775. package/dist/renderers/nodes/inputs/Vector2Node.mjs +11 -0
  776. package/dist/renderers/nodes/inputs/Vector3Node.js +11 -0
  777. package/dist/renderers/nodes/inputs/Vector3Node.mjs +12 -0
  778. package/dist/renderers/nodes/inputs/Vector4Node.js +11 -0
  779. package/dist/renderers/nodes/inputs/Vector4Node.mjs +12 -0
  780. package/dist/renderers/nodes/math/MathNode.js +54 -0
  781. package/dist/renderers/nodes/math/MathNode.mjs +55 -0
  782. package/dist/renderers/nodes/math/OperatorNode.js +41 -0
  783. package/dist/renderers/nodes/math/OperatorNode.mjs +42 -0
  784. package/dist/renderers/nodes/utils/SwitchNode.js +19 -0
  785. package/dist/renderers/nodes/utils/SwitchNode.mjs +20 -0
  786. package/dist/renderers/nodes/utils/TimerNode.js +13 -0
  787. package/dist/renderers/nodes/utils/TimerNode.mjs +14 -0
  788. package/dist/renderers/webgpu/WebGPU.js +23 -0
  789. package/dist/renderers/webgpu/WebGPU.mjs +24 -0
  790. package/dist/renderers/webgpu/WebGPUAttributes.js +68 -0
  791. package/dist/renderers/webgpu/WebGPUAttributes.mjs +69 -0
  792. package/dist/renderers/webgpu/WebGPUBackground.js +60 -0
  793. package/dist/renderers/webgpu/WebGPUBackground.mjs +61 -0
  794. package/dist/renderers/webgpu/WebGPUBinding.js +13 -0
  795. package/dist/renderers/webgpu/WebGPUBinding.mjs +14 -0
  796. package/dist/renderers/webgpu/WebGPUBindings.js +154 -0
  797. package/dist/renderers/webgpu/WebGPUBindings.mjs +155 -0
  798. package/dist/renderers/webgpu/WebGPUComputePipelines.js +43 -0
  799. package/dist/renderers/webgpu/WebGPUComputePipelines.mjs +44 -0
  800. package/dist/renderers/webgpu/WebGPUGeometries.js +40 -0
  801. package/dist/renderers/webgpu/WebGPUGeometries.mjs +41 -0
  802. package/dist/renderers/webgpu/WebGPUInfo.js +45 -0
  803. package/dist/renderers/webgpu/WebGPUInfo.mjs +46 -0
  804. package/dist/renderers/webgpu/WebGPUObjects.js +24 -0
  805. package/dist/renderers/webgpu/WebGPUObjects.mjs +25 -0
  806. package/dist/renderers/webgpu/WebGPUProperties.js +21 -0
  807. package/dist/renderers/webgpu/WebGPUProperties.mjs +22 -0
  808. package/dist/renderers/webgpu/WebGPURenderLists.js +118 -0
  809. package/dist/renderers/webgpu/WebGPURenderLists.mjs +119 -0
  810. package/dist/renderers/webgpu/WebGPURenderPipelines.js +545 -0
  811. package/dist/renderers/webgpu/WebGPURenderPipelines.mjs +546 -0
  812. package/dist/renderers/webgpu/WebGPURenderer.js +596 -0
  813. package/dist/renderers/webgpu/WebGPURenderer.mjs +575 -0
  814. package/dist/renderers/webgpu/WebGPUSampledTexture.js +40 -0
  815. package/dist/renderers/webgpu/WebGPUSampledTexture.mjs +40 -0
  816. package/dist/renderers/webgpu/WebGPUSampler.js +14 -0
  817. package/dist/renderers/webgpu/WebGPUSampler.mjs +15 -0
  818. package/dist/renderers/webgpu/WebGPUStorageBuffer.js +14 -0
  819. package/dist/renderers/webgpu/WebGPUStorageBuffer.mjs +15 -0
  820. package/dist/renderers/webgpu/WebGPUTextureRenderer.js +22 -0
  821. package/dist/renderers/webgpu/WebGPUTextureRenderer.mjs +23 -0
  822. package/dist/renderers/webgpu/WebGPUTextureUtils.js +97 -0
  823. package/dist/renderers/webgpu/WebGPUTextureUtils.mjs +98 -0
  824. package/dist/renderers/webgpu/WebGPUTextures.js +483 -0
  825. package/dist/renderers/webgpu/WebGPUTextures.mjs +484 -0
  826. package/dist/renderers/webgpu/WebGPUUniform.js +81 -0
  827. package/dist/renderers/webgpu/WebGPUUniform.mjs +81 -0
  828. package/dist/renderers/webgpu/WebGPUUniformsGroup.js +175 -0
  829. package/dist/renderers/webgpu/WebGPUUniformsGroup.mjs +176 -0
  830. package/dist/renderers/webgpu/constants.js +241 -0
  831. package/dist/renderers/webgpu/constants.mjs +241 -0
  832. package/dist/renderers/webgpu/nodes/ShaderLib.js +41 -0
  833. package/dist/renderers/webgpu/nodes/ShaderLib.mjs +42 -0
  834. package/dist/renderers/webgpu/nodes/WebGPUNodeBuilder.js +164 -0
  835. package/dist/renderers/webgpu/nodes/WebGPUNodeBuilder.mjs +165 -0
  836. package/dist/renderers/webgpu/nodes/WebGPUNodeUniform.js +73 -0
  837. package/dist/renderers/webgpu/nodes/WebGPUNodeUniform.mjs +73 -0
  838. package/dist/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +14 -0
  839. package/dist/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.mjs +15 -0
  840. package/dist/renderers/webgpu/nodes/WebGPUNodes.js +39 -0
  841. package/dist/renderers/webgpu/nodes/WebGPUNodes.mjs +40 -0
  842. package/dist/shaders/ACESFilmicToneMappingShader.d.ts +16 -0
  843. package/dist/shaders/ACESFilmicToneMappingShader.js +55 -0
  844. package/dist/shaders/ACESFilmicToneMappingShader.mjs +55 -0
  845. package/dist/shaders/AfterimageShader.d.ts +15 -0
  846. package/dist/shaders/AfterimageShader.js +32 -0
  847. package/dist/shaders/AfterimageShader.mjs +32 -0
  848. package/dist/shaders/BasicShader.d.ts +8 -0
  849. package/dist/shaders/BasicShader.js +12 -0
  850. package/dist/shaders/BasicShader.mjs +12 -0
  851. package/dist/shaders/BleachBypassShader.d.ts +14 -0
  852. package/dist/shaders/BleachBypassShader.js +35 -0
  853. package/dist/shaders/BleachBypassShader.mjs +35 -0
  854. package/dist/shaders/BlendShader.d.ts +21 -0
  855. package/dist/shaders/BlendShader.js +30 -0
  856. package/dist/shaders/BlendShader.mjs +30 -0
  857. package/dist/shaders/BokehShader.d.ts +24 -0
  858. package/dist/shaders/BokehShader.js +109 -0
  859. package/dist/shaders/BokehShader.mjs +109 -0
  860. package/dist/shaders/BokehShader2.d.ts +50 -0
  861. package/dist/shaders/BokehShader2.js +269 -0
  862. package/dist/shaders/BokehShader2.mjs +269 -0
  863. package/dist/shaders/BrightnessContrastShader.d.ts +21 -0
  864. package/dist/shaders/BrightnessContrastShader.js +32 -0
  865. package/dist/shaders/BrightnessContrastShader.mjs +32 -0
  866. package/dist/shaders/ColorCorrectionShader.d.ts +22 -0
  867. package/dist/shaders/ColorCorrectionShader.js +30 -0
  868. package/dist/shaders/ColorCorrectionShader.mjs +30 -0
  869. package/dist/shaders/ColorifyShader.d.ts +16 -0
  870. package/dist/shaders/ColorifyShader.js +28 -0
  871. package/dist/shaders/ColorifyShader.mjs +28 -0
  872. package/dist/shaders/ConvolutionShader.d.ts +21 -0
  873. package/dist/shaders/ConvolutionShader.js +55 -0
  874. package/dist/shaders/ConvolutionShader.mjs +55 -0
  875. package/dist/shaders/CopyShader.d.ts +12 -0
  876. package/dist/shaders/CopyShader.js +25 -0
  877. package/dist/shaders/CopyShader.mjs +25 -0
  878. package/dist/shaders/DOFMipMapShader.d.ts +23 -0
  879. package/dist/shaders/DOFMipMapShader.js +32 -0
  880. package/dist/shaders/DOFMipMapShader.mjs +32 -0
  881. package/dist/shaders/DepthLimitedBlurShader.d.ts +28 -0
  882. package/dist/shaders/DepthLimitedBlurShader.js +114 -0
  883. package/dist/shaders/DepthLimitedBlurShader.mjs +114 -0
  884. package/dist/shaders/DigitalGlitch.d.ts +39 -0
  885. package/dist/shaders/DigitalGlitch.js +85 -0
  886. package/dist/shaders/DigitalGlitch.mjs +85 -0
  887. package/dist/shaders/DotScreenShader.d.ts +27 -0
  888. package/dist/shaders/DotScreenShader.js +39 -0
  889. package/dist/shaders/DotScreenShader.mjs +39 -0
  890. package/dist/shaders/FXAAShader.d.ts +19 -0
  891. package/dist/shaders/FXAAShader.js +1098 -0
  892. package/dist/shaders/FXAAShader.mjs +1098 -0
  893. package/dist/shaders/FilmShader.d.ts +43 -0
  894. package/dist/shaders/FilmShader.js +53 -0
  895. package/dist/shaders/FilmShader.mjs +53 -0
  896. package/dist/shaders/FocusShader.d.ts +26 -0
  897. package/dist/shaders/FocusShader.js +55 -0
  898. package/dist/shaders/FocusShader.mjs +55 -0
  899. package/dist/shaders/FreiChenShader.d.ts +19 -0
  900. package/dist/shaders/FreiChenShader.js +64 -0
  901. package/dist/shaders/FreiChenShader.mjs +64 -0
  902. package/dist/shaders/FresnelShader.d.ts +24 -0
  903. package/dist/shaders/FresnelShader.js +47 -0
  904. package/dist/shaders/FresnelShader.mjs +47 -0
  905. package/dist/shaders/GammaCorrectionShader.d.ts +12 -0
  906. package/dist/shaders/GammaCorrectionShader.js +23 -0
  907. package/dist/shaders/GammaCorrectionShader.mjs +23 -0
  908. package/dist/shaders/GodRaysShader.d.ts +97 -0
  909. package/dist/shaders/GodRaysShader.js +183 -0
  910. package/dist/shaders/GodRaysShader.mjs +183 -0
  911. package/dist/shaders/HalftoneShader.d.ts +51 -0
  912. package/dist/shaders/HalftoneShader.js +228 -0
  913. package/dist/shaders/HalftoneShader.mjs +228 -0
  914. package/dist/shaders/HorizontalBlurShader.d.ts +18 -0
  915. package/dist/shaders/HorizontalBlurShader.js +49 -0
  916. package/dist/shaders/HorizontalBlurShader.mjs +49 -0
  917. package/dist/shaders/HorizontalTiltShiftShader.d.ts +23 -0
  918. package/dist/shaders/HorizontalTiltShiftShader.js +37 -0
  919. package/dist/shaders/HorizontalTiltShiftShader.mjs +37 -0
  920. package/dist/shaders/HueSaturationShader.d.ts +21 -0
  921. package/dist/shaders/HueSaturationShader.js +43 -0
  922. package/dist/shaders/HueSaturationShader.mjs +43 -0
  923. package/dist/shaders/KaleidoShader.d.ts +24 -0
  924. package/dist/shaders/KaleidoShader.js +34 -0
  925. package/dist/shaders/KaleidoShader.mjs +34 -0
  926. package/dist/shaders/LuminosityHighPassShader.d.ts +27 -0
  927. package/dist/shaders/LuminosityHighPassShader.js +37 -0
  928. package/dist/shaders/LuminosityHighPassShader.mjs +37 -0
  929. package/dist/shaders/LuminosityShader.d.ts +13 -0
  930. package/dist/shaders/LuminosityShader.js +25 -0
  931. package/dist/shaders/LuminosityShader.mjs +25 -0
  932. package/dist/shaders/MirrorShader.d.ts +18 -0
  933. package/dist/shaders/MirrorShader.js +35 -0
  934. package/dist/shaders/MirrorShader.mjs +35 -0
  935. package/dist/shaders/NormalMapShader.d.ts +23 -0
  936. package/dist/shaders/NormalMapShader.js +31 -0
  937. package/dist/shaders/NormalMapShader.mjs +31 -0
  938. package/dist/shaders/ParallaxShader.d.ts +28 -0
  939. package/dist/shaders/ParallaxShader.js +133 -0
  940. package/dist/shaders/ParallaxShader.mjs +133 -0
  941. package/dist/shaders/PixelShader.d.ts +18 -0
  942. package/dist/shaders/PixelShader.js +28 -0
  943. package/dist/shaders/PixelShader.mjs +28 -0
  944. package/dist/shaders/RGBShiftShader.d.ts +24 -0
  945. package/dist/shaders/RGBShiftShader.js +30 -0
  946. package/dist/shaders/RGBShiftShader.mjs +30 -0
  947. package/dist/shaders/SAOShader.d.ts +25 -0
  948. package/dist/shaders/SAOShader.js +144 -0
  949. package/dist/shaders/SAOShader.mjs +144 -0
  950. package/dist/shaders/SMAAShader.d.ts +60 -0
  951. package/dist/shaders/SMAAShader.js +358 -0
  952. package/dist/shaders/SMAAShader.mjs +358 -0
  953. package/dist/shaders/SSAOShader.d.ts +86 -0
  954. package/dist/shaders/SSAOShader.js +182 -0
  955. package/dist/shaders/SSAOShader.mjs +182 -0
  956. package/dist/shaders/SSRShader.d.ts +94 -0
  957. package/dist/shaders/SSRShader.js +342 -0
  958. package/dist/shaders/SSRShader.mjs +342 -0
  959. package/dist/shaders/SepiaShader.d.ts +17 -0
  960. package/dist/shaders/SepiaShader.js +29 -0
  961. package/dist/shaders/SepiaShader.mjs +29 -0
  962. package/dist/shaders/SobelOperatorShader.d.ts +19 -0
  963. package/dist/shaders/SobelOperatorShader.js +54 -0
  964. package/dist/shaders/SobelOperatorShader.mjs +54 -0
  965. package/dist/shaders/SubsurfaceScatteringShader.d.ts +5 -0
  966. package/dist/shaders/SubsurfaceScatteringShader.js +59 -0
  967. package/dist/shaders/SubsurfaceScatteringShader.mjs +59 -0
  968. package/dist/shaders/TechnicolorShader.d.ts +15 -0
  969. package/dist/shaders/TechnicolorShader.js +24 -0
  970. package/dist/shaders/TechnicolorShader.mjs +24 -0
  971. package/dist/shaders/ToneMapShader.d.ts +27 -0
  972. package/dist/shaders/ToneMapShader.js +51 -0
  973. package/dist/shaders/ToneMapShader.mjs +51 -0
  974. package/dist/shaders/ToonShader.d.ts +108 -0
  975. package/dist/shaders/ToonShader.js +188 -0
  976. package/dist/shaders/ToonShader.mjs +188 -0
  977. package/dist/shaders/TriangleBlurShader.d.ts +22 -0
  978. package/dist/shaders/TriangleBlurShader.js +37 -0
  979. package/dist/shaders/TriangleBlurShader.mjs +37 -0
  980. package/dist/shaders/UnpackDepthRGBAShader.d.ts +16 -0
  981. package/dist/shaders/UnpackDepthRGBAShader.js +26 -0
  982. package/dist/shaders/UnpackDepthRGBAShader.mjs +26 -0
  983. package/dist/shaders/VerticalBlurShader.d.ts +18 -0
  984. package/dist/shaders/VerticalBlurShader.js +50 -0
  985. package/dist/shaders/VerticalBlurShader.mjs +50 -0
  986. package/dist/shaders/VerticalTiltShiftShader.d.ts +23 -0
  987. package/dist/shaders/VerticalTiltShiftShader.js +37 -0
  988. package/dist/shaders/VerticalTiltShiftShader.mjs +37 -0
  989. package/dist/shaders/VignetteShader.d.ts +20 -0
  990. package/dist/shaders/VignetteShader.js +38 -0
  991. package/dist/shaders/VignetteShader.mjs +38 -0
  992. package/dist/shaders/VolumeShader.d.ts +30 -0
  993. package/dist/shaders/VolumeShader.js +225 -0
  994. package/dist/shaders/VolumeShader.mjs +225 -0
  995. package/dist/shaders/WaterRefractionShader.d.ts +21 -0
  996. package/dist/shaders/WaterRefractionShader.js +59 -0
  997. package/dist/shaders/WaterRefractionShader.mjs +59 -0
  998. package/dist/shaders/types.d.ts +14 -0
  999. package/dist/shaders/types.js +1 -0
  1000. package/dist/shaders/types.mjs +1 -0
  1001. package/dist/textures/FlakesTexture.d.ts +4 -0
  1002. package/dist/textures/FlakesTexture.js +30 -0
  1003. package/dist/textures/FlakesTexture.mjs +30 -0
  1004. package/dist/types/helpers.d.ts +1 -0
  1005. package/dist/types/helpers.js +4 -0
  1006. package/dist/types/helpers.mjs +4 -0
  1007. package/dist/types/shared.d.ts +2 -0
  1008. package/dist/types/utils.d.ts +3 -0
  1009. package/dist/utils/BufferGeometryUtils.d.ts +48 -0
  1010. package/dist/utils/BufferGeometryUtils.js +636 -0
  1011. package/dist/utils/BufferGeometryUtils.mjs +636 -0
  1012. package/dist/utils/GeometryCompressionUtils.d.ts +7 -0
  1013. package/dist/utils/GeometryCompressionUtils.js +573 -0
  1014. package/dist/utils/GeometryCompressionUtils.mjs +573 -0
  1015. package/dist/utils/GeometryUtils.d.ts +6 -0
  1016. package/dist/utils/GeometryUtils.js +109 -0
  1017. package/dist/utils/GeometryUtils.mjs +109 -0
  1018. package/dist/utils/LDrawUtils.d.ts +5 -0
  1019. package/dist/utils/RoughnessMipmapper.js +219 -0
  1020. package/dist/utils/RoughnessMipmapper.mjs +219 -0
  1021. package/dist/utils/SceneUtils.d.ts +9 -0
  1022. package/dist/utils/SceneUtils.js +36 -0
  1023. package/dist/utils/SceneUtils.mjs +36 -0
  1024. package/dist/utils/ShadowMapViewer.d.ts +24 -0
  1025. package/dist/utils/ShadowMapViewer.js +114 -0
  1026. package/dist/utils/ShadowMapViewer.mjs +114 -0
  1027. package/dist/utils/SkeletonUtils.d.ts +30 -0
  1028. package/dist/utils/SkeletonUtils.js +292 -0
  1029. package/dist/utils/SkeletonUtils.mjs +292 -0
  1030. package/dist/utils/UVsDebug.d.ts +3 -0
  1031. package/dist/utils/UVsDebug.js +85 -0
  1032. package/dist/utils/UVsDebug.mjs +85 -0
  1033. package/dist/utils/WorkerPool.js +62 -0
  1034. package/dist/utils/WorkerPool.mjs +62 -0
  1035. package/dist/webxr/ARButton.d.ts +5 -0
  1036. package/dist/webxr/ARButton.js +119 -0
  1037. package/dist/webxr/ARButton.mjs +119 -0
  1038. package/dist/webxr/OculusHandModel.d.ts +22 -0
  1039. package/dist/webxr/OculusHandModel.js +82 -0
  1040. package/dist/webxr/OculusHandModel.mjs +82 -0
  1041. package/dist/webxr/OculusHandPointerModel.d.ts +63 -0
  1042. package/dist/webxr/OculusHandPointerModel.js +224 -0
  1043. package/dist/webxr/OculusHandPointerModel.mjs +207 -0
  1044. package/dist/webxr/Text2D.d.ts +3 -0
  1045. package/dist/webxr/Text2D.js +48 -0
  1046. package/dist/webxr/Text2D.mjs +31 -0
  1047. package/dist/webxr/VRButton.d.ts +7 -0
  1048. package/dist/webxr/VRButton.js +111 -0
  1049. package/dist/webxr/VRButton.mjs +111 -0
  1050. package/dist/webxr/XRControllerModelFactory.d.ts +23 -0
  1051. package/dist/webxr/XRControllerModelFactory.js +174 -0
  1052. package/dist/webxr/XRControllerModelFactory.mjs +174 -0
  1053. package/dist/webxr/XREstimatedLight.d.ts +33 -0
  1054. package/dist/webxr/XREstimatedLight.js +126 -0
  1055. package/dist/webxr/XREstimatedLight.mjs +126 -0
  1056. package/dist/webxr/XRHandMeshModel.d.ts +9 -0
  1057. package/dist/webxr/XRHandMeshModel.js +82 -0
  1058. package/dist/webxr/XRHandMeshModel.mjs +82 -0
  1059. package/dist/webxr/XRHandModelFactory.d.ts +25 -0
  1060. package/dist/webxr/XRHandModelFactory.js +61 -0
  1061. package/dist/webxr/XRHandModelFactory.mjs +61 -0
  1062. package/dist/webxr/XRHandPrimitiveModel.d.ts +24 -0
  1063. package/dist/webxr/XRHandPrimitiveModel.js +68 -0
  1064. package/dist/webxr/XRHandPrimitiveModel.mjs +68 -0
  1065. package/package.json +1 -1
@@ -0,0 +1,2039 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => {
5
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
+ return value;
7
+ };
8
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
+ const THREE = require("three");
10
+ const STATE = {
11
+ IDLE: Symbol(),
12
+ ROTATE: Symbol(),
13
+ PAN: Symbol(),
14
+ SCALE: Symbol(),
15
+ FOV: Symbol(),
16
+ FOCUS: Symbol(),
17
+ ZROTATE: Symbol(),
18
+ TOUCH_MULTI: Symbol(),
19
+ ANIMATION_FOCUS: Symbol(),
20
+ ANIMATION_ROTATE: Symbol()
21
+ };
22
+ const INPUT = {
23
+ NONE: Symbol(),
24
+ ONE_FINGER: Symbol(),
25
+ ONE_FINGER_SWITCHED: Symbol(),
26
+ TWO_FINGER: Symbol(),
27
+ MULT_FINGER: Symbol(),
28
+ CURSOR: Symbol()
29
+ };
30
+ const _center = {
31
+ x: 0,
32
+ y: 0
33
+ };
34
+ const _transformation = {
35
+ camera: new THREE.Matrix4(),
36
+ gizmos: new THREE.Matrix4()
37
+ };
38
+ const _changeEvent = { type: "change" };
39
+ const _startEvent = { type: "start" };
40
+ const _endEvent = { type: "end" };
41
+ class ArcballControls extends THREE.EventDispatcher {
42
+ constructor(camera, domElement = null, scene = null) {
43
+ super();
44
+ __publicField(this, "camera");
45
+ __publicField(this, "domElement");
46
+ __publicField(this, "scene");
47
+ __publicField(this, "mouseActions");
48
+ __publicField(this, "_mouseOp");
49
+ __publicField(this, "_v2_1");
50
+ __publicField(this, "_v3_1");
51
+ __publicField(this, "_v3_2");
52
+ __publicField(this, "_m4_1");
53
+ __publicField(this, "_m4_2");
54
+ __publicField(this, "_quat");
55
+ __publicField(this, "_translationMatrix");
56
+ __publicField(this, "_rotationMatrix");
57
+ __publicField(this, "_scaleMatrix");
58
+ __publicField(this, "_rotationAxis");
59
+ __publicField(this, "_cameraMatrixState");
60
+ __publicField(this, "_cameraProjectionState");
61
+ __publicField(this, "_fovState");
62
+ __publicField(this, "_upState");
63
+ __publicField(this, "_zoomState");
64
+ __publicField(this, "_nearPos");
65
+ __publicField(this, "_farPos");
66
+ __publicField(this, "_gizmoMatrixState");
67
+ __publicField(this, "_up0");
68
+ __publicField(this, "_zoom0");
69
+ __publicField(this, "_fov0");
70
+ __publicField(this, "_initialNear");
71
+ __publicField(this, "_nearPos0");
72
+ __publicField(this, "_initialFar");
73
+ __publicField(this, "_farPos0");
74
+ __publicField(this, "_cameraMatrixState0");
75
+ __publicField(this, "_gizmoMatrixState0");
76
+ __publicField(this, "_button");
77
+ __publicField(this, "_touchStart");
78
+ __publicField(this, "_touchCurrent");
79
+ __publicField(this, "_input");
80
+ __publicField(this, "_switchSensibility");
81
+ __publicField(this, "_startFingerDistance");
82
+ __publicField(this, "_currentFingerDistance");
83
+ __publicField(this, "_startFingerRotation");
84
+ __publicField(this, "_currentFingerRotation");
85
+ __publicField(this, "_devPxRatio");
86
+ __publicField(this, "_downValid");
87
+ __publicField(this, "_nclicks");
88
+ __publicField(this, "_downEvents");
89
+ __publicField(this, "_clickStart");
90
+ __publicField(this, "_maxDownTime");
91
+ __publicField(this, "_maxInterval");
92
+ __publicField(this, "_posThreshold");
93
+ __publicField(this, "_movementThreshold");
94
+ __publicField(this, "_currentCursorPosition");
95
+ __publicField(this, "_startCursorPosition");
96
+ __publicField(this, "_grid");
97
+ __publicField(this, "_gridPosition");
98
+ __publicField(this, "_gizmos");
99
+ __publicField(this, "_curvePts");
100
+ __publicField(this, "_timeStart");
101
+ __publicField(this, "_animationId");
102
+ __publicField(this, "focusAnimationTime");
103
+ __publicField(this, "_timePrev");
104
+ __publicField(this, "_timeCurrent");
105
+ __publicField(this, "_anglePrev");
106
+ __publicField(this, "_angleCurrent");
107
+ __publicField(this, "_cursorPosPrev");
108
+ __publicField(this, "_cursorPosCurr");
109
+ __publicField(this, "_wPrev");
110
+ __publicField(this, "_wCurr");
111
+ __publicField(this, "adjustNearFar");
112
+ __publicField(this, "scaleFactor");
113
+ __publicField(this, "dampingFactor");
114
+ __publicField(this, "wMax");
115
+ __publicField(this, "enableAnimations");
116
+ __publicField(this, "enableGrid");
117
+ __publicField(this, "cursorZoom");
118
+ __publicField(this, "minFov");
119
+ __publicField(this, "maxFov");
120
+ __publicField(this, "enabled");
121
+ __publicField(this, "enablePan");
122
+ __publicField(this, "enableRotate");
123
+ __publicField(this, "enableZoom");
124
+ __publicField(this, "minDistance");
125
+ __publicField(this, "maxDistance");
126
+ __publicField(this, "minZoom");
127
+ __publicField(this, "maxZoom");
128
+ __publicField(this, "target");
129
+ __publicField(this, "_currentTarget");
130
+ __publicField(this, "_tbRadius");
131
+ __publicField(this, "_state");
132
+ //listeners
133
+ __publicField(this, "onWindowResize", () => {
134
+ const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3;
135
+ if (this.camera) {
136
+ const tbRadius = this.calculateTbRadius(this.camera);
137
+ if (tbRadius !== void 0) {
138
+ this._tbRadius = tbRadius;
139
+ }
140
+ }
141
+ const newRadius = this._tbRadius / scale;
142
+ const curve = new THREE.EllipseCurve(0, 0, newRadius, newRadius);
143
+ const points = curve.getPoints(this._curvePts);
144
+ const curveGeometry = new THREE.BufferGeometry().setFromPoints(points);
145
+ for (const gizmo in this._gizmos.children) {
146
+ const child = this._gizmos.children[gizmo];
147
+ child.geometry = curveGeometry;
148
+ }
149
+ this.dispatchEvent(_changeEvent);
150
+ });
151
+ __publicField(this, "onContextMenu", (event) => {
152
+ if (!this.enabled) {
153
+ return;
154
+ }
155
+ for (let i = 0; i < this.mouseActions.length; i++) {
156
+ if (this.mouseActions[i].mouse == 2) {
157
+ event.preventDefault();
158
+ break;
159
+ }
160
+ }
161
+ });
162
+ __publicField(this, "onPointerCancel", () => {
163
+ this._touchStart.splice(0, this._touchStart.length);
164
+ this._touchCurrent.splice(0, this._touchCurrent.length);
165
+ this._input = INPUT.NONE;
166
+ });
167
+ __publicField(this, "onPointerDown", (event) => {
168
+ if (event.button == 0 && event.isPrimary) {
169
+ this._downValid = true;
170
+ this._downEvents.push(event);
171
+ } else {
172
+ this._downValid = false;
173
+ }
174
+ if (event.pointerType == "touch" && this._input != INPUT.CURSOR) {
175
+ this._touchStart.push(event);
176
+ this._touchCurrent.push(event);
177
+ switch (this._input) {
178
+ case INPUT.NONE:
179
+ this._input = INPUT.ONE_FINGER;
180
+ this.onSinglePanStart(event, "ROTATE");
181
+ window.addEventListener("pointermove", this.onPointerMove);
182
+ window.addEventListener("pointerup", this.onPointerUp);
183
+ break;
184
+ case INPUT.ONE_FINGER:
185
+ case INPUT.ONE_FINGER_SWITCHED:
186
+ this._input = INPUT.TWO_FINGER;
187
+ this.onRotateStart();
188
+ this.onPinchStart();
189
+ this.onDoublePanStart();
190
+ break;
191
+ case INPUT.TWO_FINGER:
192
+ this._input = INPUT.MULT_FINGER;
193
+ this.onTriplePanStart();
194
+ break;
195
+ }
196
+ } else if (event.pointerType != "touch" && this._input == INPUT.NONE) {
197
+ let modifier = null;
198
+ if (event.ctrlKey || event.metaKey) {
199
+ modifier = "CTRL";
200
+ } else if (event.shiftKey) {
201
+ modifier = "SHIFT";
202
+ }
203
+ this._mouseOp = this.getOpFromAction(event.button, modifier);
204
+ if (this._mouseOp) {
205
+ window.addEventListener("pointermove", this.onPointerMove);
206
+ window.addEventListener("pointerup", this.onPointerUp);
207
+ this._input = INPUT.CURSOR;
208
+ this._button = event.button;
209
+ this.onSinglePanStart(event, this._mouseOp);
210
+ }
211
+ }
212
+ });
213
+ __publicField(this, "onPointerMove", (event) => {
214
+ if (event.pointerType == "touch" && this._input != INPUT.CURSOR) {
215
+ switch (this._input) {
216
+ case INPUT.ONE_FINGER:
217
+ this.updateTouchEvent(event);
218
+ this.onSinglePanMove(event, STATE.ROTATE);
219
+ break;
220
+ case INPUT.ONE_FINGER_SWITCHED:
221
+ const movement = this.calculatePointersDistance(this._touchCurrent[0], event) * this._devPxRatio;
222
+ if (movement >= this._switchSensibility) {
223
+ this._input = INPUT.ONE_FINGER;
224
+ this.updateTouchEvent(event);
225
+ this.onSinglePanStart(event, "ROTATE");
226
+ break;
227
+ }
228
+ break;
229
+ case INPUT.TWO_FINGER:
230
+ this.updateTouchEvent(event);
231
+ this.onRotateMove();
232
+ this.onPinchMove();
233
+ this.onDoublePanMove();
234
+ break;
235
+ case INPUT.MULT_FINGER:
236
+ this.updateTouchEvent(event);
237
+ this.onTriplePanMove();
238
+ break;
239
+ }
240
+ } else if (event.pointerType != "touch" && this._input == INPUT.CURSOR) {
241
+ let modifier = null;
242
+ if (event.ctrlKey || event.metaKey) {
243
+ modifier = "CTRL";
244
+ } else if (event.shiftKey) {
245
+ modifier = "SHIFT";
246
+ }
247
+ const mouseOpState = this.getOpStateFromAction(this._button, modifier);
248
+ if (mouseOpState) {
249
+ this.onSinglePanMove(event, mouseOpState);
250
+ }
251
+ }
252
+ if (this._downValid) {
253
+ const movement = this.calculatePointersDistance(this._downEvents[this._downEvents.length - 1], event) * this._devPxRatio;
254
+ if (movement > this._movementThreshold) {
255
+ this._downValid = false;
256
+ }
257
+ }
258
+ });
259
+ __publicField(this, "onPointerUp", (event) => {
260
+ if (event.pointerType == "touch" && this._input != INPUT.CURSOR) {
261
+ const nTouch = this._touchCurrent.length;
262
+ for (let i = 0; i < nTouch; i++) {
263
+ if (this._touchCurrent[i].pointerId == event.pointerId) {
264
+ this._touchCurrent.splice(i, 1);
265
+ this._touchStart.splice(i, 1);
266
+ break;
267
+ }
268
+ }
269
+ switch (this._input) {
270
+ case INPUT.ONE_FINGER:
271
+ case INPUT.ONE_FINGER_SWITCHED:
272
+ window.removeEventListener("pointermove", this.onPointerMove);
273
+ window.removeEventListener("pointerup", this.onPointerUp);
274
+ this._input = INPUT.NONE;
275
+ this.onSinglePanEnd();
276
+ break;
277
+ case INPUT.TWO_FINGER:
278
+ this.onDoublePanEnd();
279
+ this.onPinchEnd();
280
+ this.onRotateEnd();
281
+ this._input = INPUT.ONE_FINGER_SWITCHED;
282
+ break;
283
+ case INPUT.MULT_FINGER:
284
+ if (this._touchCurrent.length == 0) {
285
+ window.removeEventListener("pointermove", this.onPointerMove);
286
+ window.removeEventListener("pointerup", this.onPointerUp);
287
+ this._input = INPUT.NONE;
288
+ this.onTriplePanEnd();
289
+ }
290
+ break;
291
+ }
292
+ } else if (event.pointerType != "touch" && this._input == INPUT.CURSOR) {
293
+ window.removeEventListener("pointermove", this.onPointerMove);
294
+ window.removeEventListener("pointerup", this.onPointerUp);
295
+ this._input = INPUT.NONE;
296
+ this.onSinglePanEnd();
297
+ this._button = -1;
298
+ }
299
+ if (event.isPrimary) {
300
+ if (this._downValid) {
301
+ const downTime = event.timeStamp - this._downEvents[this._downEvents.length - 1].timeStamp;
302
+ if (downTime <= this._maxDownTime) {
303
+ if (this._nclicks == 0) {
304
+ this._nclicks = 1;
305
+ this._clickStart = performance.now();
306
+ } else {
307
+ const clickInterval = event.timeStamp - this._clickStart;
308
+ const movement = this.calculatePointersDistance(this._downEvents[1], this._downEvents[0]) * this._devPxRatio;
309
+ if (clickInterval <= this._maxInterval && movement <= this._posThreshold) {
310
+ this._nclicks = 0;
311
+ this._downEvents.splice(0, this._downEvents.length);
312
+ this.onDoubleTap(event);
313
+ } else {
314
+ this._nclicks = 1;
315
+ this._downEvents.shift();
316
+ this._clickStart = performance.now();
317
+ }
318
+ }
319
+ } else {
320
+ this._downValid = false;
321
+ this._nclicks = 0;
322
+ this._downEvents.splice(0, this._downEvents.length);
323
+ }
324
+ } else {
325
+ this._nclicks = 0;
326
+ this._downEvents.splice(0, this._downEvents.length);
327
+ }
328
+ }
329
+ });
330
+ __publicField(this, "onWheel", (event) => {
331
+ var _a, _b, _c, _d, _e;
332
+ if (this.enabled && this.enableZoom && this.domElement) {
333
+ let modifier = null;
334
+ if (event.ctrlKey || event.metaKey) {
335
+ modifier = "CTRL";
336
+ } else if (event.shiftKey) {
337
+ modifier = "SHIFT";
338
+ }
339
+ const mouseOp = this.getOpFromAction("WHEEL", modifier);
340
+ if (mouseOp) {
341
+ event.preventDefault();
342
+ this.dispatchEvent(_startEvent);
343
+ const notchDeltaY = 125;
344
+ let sgn = event.deltaY / notchDeltaY;
345
+ let size = 1;
346
+ if (sgn > 0) {
347
+ size = 1 / this.scaleFactor;
348
+ } else if (sgn < 0) {
349
+ size = this.scaleFactor;
350
+ }
351
+ switch (mouseOp) {
352
+ case "ZOOM":
353
+ this.updateTbState(STATE.SCALE, true);
354
+ if (sgn > 0) {
355
+ size = 1 / Math.pow(this.scaleFactor, sgn);
356
+ } else if (sgn < 0) {
357
+ size = Math.pow(this.scaleFactor, -sgn);
358
+ }
359
+ if (this.cursorZoom && this.enablePan) {
360
+ let scalePoint;
361
+ if (((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera") {
362
+ 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);
363
+ }
364
+ if (((_c = this.camera) == null ? void 0 : _c.type) === "PerspectiveCamera") {
365
+ scalePoint = (_d = this.unprojectOnTbPlane(this.camera, event.clientX, event.clientY, this.domElement)) == null ? void 0 : _d.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);
366
+ }
367
+ if (scalePoint !== void 0)
368
+ this.applyTransformMatrix(this.applyScale(size, scalePoint));
369
+ } else {
370
+ this.applyTransformMatrix(this.applyScale(size, this._gizmos.position));
371
+ }
372
+ if (this._grid) {
373
+ this.disposeGrid();
374
+ this.drawGrid();
375
+ }
376
+ this.updateTbState(STATE.IDLE, false);
377
+ this.dispatchEvent(_changeEvent);
378
+ this.dispatchEvent(_endEvent);
379
+ break;
380
+ case "FOV":
381
+ if (((_e = this.camera) == null ? void 0 : _e.type) === "PerspectiveCamera") {
382
+ this.updateTbState(STATE.FOV, true);
383
+ if (event.deltaX != 0) {
384
+ sgn = event.deltaX / notchDeltaY;
385
+ size = 1;
386
+ if (sgn > 0) {
387
+ size = 1 / Math.pow(this.scaleFactor, sgn);
388
+ } else if (sgn < 0) {
389
+ size = Math.pow(this.scaleFactor, -sgn);
390
+ }
391
+ }
392
+ this._v3_1.setFromMatrixPosition(this._cameraMatrixState);
393
+ const x = this._v3_1.distanceTo(this._gizmos.position);
394
+ let xNew = x / size;
395
+ xNew = THREE.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
396
+ const y = x * Math.tan(THREE.MathUtils.DEG2RAD * this.camera.fov * 0.5);
397
+ let newFov = THREE.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);
398
+ if (newFov > this.maxFov) {
399
+ newFov = this.maxFov;
400
+ } else if (newFov < this.minFov) {
401
+ newFov = this.minFov;
402
+ }
403
+ const newDistance = y / Math.tan(THREE.MathUtils.DEG2RAD * (newFov / 2));
404
+ size = x / newDistance;
405
+ this.setFov(newFov);
406
+ this.applyTransformMatrix(this.applyScale(size, this._gizmos.position, false));
407
+ }
408
+ if (this._grid) {
409
+ this.disposeGrid();
410
+ this.drawGrid();
411
+ }
412
+ this.updateTbState(STATE.IDLE, false);
413
+ this.dispatchEvent(_changeEvent);
414
+ this.dispatchEvent(_endEvent);
415
+ break;
416
+ }
417
+ }
418
+ }
419
+ });
420
+ __publicField(this, "onSinglePanStart", (event, operation) => {
421
+ var _a;
422
+ if (this.enabled && this.domElement) {
423
+ this.dispatchEvent(_startEvent);
424
+ this.setCenter(event.clientX, event.clientY);
425
+ switch (operation) {
426
+ case "PAN":
427
+ if (!this.enablePan)
428
+ return;
429
+ if (this._animationId != -1) {
430
+ cancelAnimationFrame(this._animationId);
431
+ this._animationId = -1;
432
+ this._timeStart = -1;
433
+ this.activateGizmos(false);
434
+ this.dispatchEvent(_changeEvent);
435
+ }
436
+ if (this.camera) {
437
+ this.updateTbState(STATE.PAN, true);
438
+ const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement);
439
+ if (rayDir !== void 0) {
440
+ this._startCursorPosition.copy(rayDir);
441
+ }
442
+ if (this.enableGrid) {
443
+ this.drawGrid();
444
+ this.dispatchEvent(_changeEvent);
445
+ }
446
+ }
447
+ break;
448
+ case "ROTATE":
449
+ if (!this.enableRotate)
450
+ return;
451
+ if (this._animationId != -1) {
452
+ cancelAnimationFrame(this._animationId);
453
+ this._animationId = -1;
454
+ this._timeStart = -1;
455
+ }
456
+ if (this.camera) {
457
+ this.updateTbState(STATE.ROTATE, true);
458
+ const rayDir = this.unprojectOnTbSurface(this.camera, _center.x, _center.y, this.domElement, this._tbRadius);
459
+ if (rayDir !== void 0) {
460
+ this._startCursorPosition.copy(rayDir);
461
+ }
462
+ this.activateGizmos(true);
463
+ if (this.enableAnimations) {
464
+ this._timePrev = this._timeCurrent = performance.now();
465
+ this._angleCurrent = this._anglePrev = 0;
466
+ this._cursorPosPrev.copy(this._startCursorPosition);
467
+ this._cursorPosCurr.copy(this._cursorPosPrev);
468
+ this._wCurr = 0;
469
+ this._wPrev = this._wCurr;
470
+ }
471
+ }
472
+ this.dispatchEvent(_changeEvent);
473
+ break;
474
+ case "FOV":
475
+ if (!this.enableZoom)
476
+ return;
477
+ if (((_a = this.camera) == null ? void 0 : _a.type) === "PerspectiveCamera") {
478
+ if (this._animationId != -1) {
479
+ cancelAnimationFrame(this._animationId);
480
+ this._animationId = -1;
481
+ this._timeStart = -1;
482
+ this.activateGizmos(false);
483
+ this.dispatchEvent(_changeEvent);
484
+ }
485
+ this.updateTbState(STATE.FOV, true);
486
+ this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
487
+ this._currentCursorPosition.copy(this._startCursorPosition);
488
+ }
489
+ break;
490
+ case "ZOOM":
491
+ if (!this.enableZoom)
492
+ return;
493
+ if (this._animationId != -1) {
494
+ cancelAnimationFrame(this._animationId);
495
+ this._animationId = -1;
496
+ this._timeStart = -1;
497
+ this.activateGizmos(false);
498
+ this.dispatchEvent(_changeEvent);
499
+ }
500
+ this.updateTbState(STATE.SCALE, true);
501
+ this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
502
+ this._currentCursorPosition.copy(this._startCursorPosition);
503
+ break;
504
+ }
505
+ }
506
+ });
507
+ __publicField(this, "onSinglePanMove", (event, opState) => {
508
+ var _a;
509
+ if (this.enabled && this.domElement) {
510
+ const restart = opState != this._state;
511
+ this.setCenter(event.clientX, event.clientY);
512
+ switch (opState) {
513
+ case STATE.PAN:
514
+ if (this.enablePan && this.camera) {
515
+ if (restart) {
516
+ this.dispatchEvent(_endEvent);
517
+ this.dispatchEvent(_startEvent);
518
+ this.updateTbState(opState, true);
519
+ const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement);
520
+ if (rayDir !== void 0) {
521
+ this._startCursorPosition.copy(rayDir);
522
+ }
523
+ if (this.enableGrid) {
524
+ this.drawGrid();
525
+ }
526
+ this.activateGizmos(false);
527
+ } else {
528
+ const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement);
529
+ if (rayDir !== void 0) {
530
+ this._currentCursorPosition.copy(rayDir);
531
+ }
532
+ this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition));
533
+ }
534
+ }
535
+ break;
536
+ case STATE.ROTATE:
537
+ if (this.enableRotate && this.camera) {
538
+ if (restart) {
539
+ this.dispatchEvent(_endEvent);
540
+ this.dispatchEvent(_startEvent);
541
+ this.updateTbState(opState, true);
542
+ const rayDir = this.unprojectOnTbSurface(
543
+ this.camera,
544
+ _center.x,
545
+ _center.y,
546
+ this.domElement,
547
+ this._tbRadius
548
+ );
549
+ if (rayDir !== void 0) {
550
+ this._startCursorPosition.copy(rayDir);
551
+ }
552
+ if (this.enableGrid) {
553
+ this.disposeGrid();
554
+ }
555
+ this.activateGizmos(true);
556
+ } else {
557
+ const rayDir = this.unprojectOnTbSurface(
558
+ this.camera,
559
+ _center.x,
560
+ _center.y,
561
+ this.domElement,
562
+ this._tbRadius
563
+ );
564
+ if (rayDir !== void 0) {
565
+ this._currentCursorPosition.copy(rayDir);
566
+ }
567
+ const distance = this._startCursorPosition.distanceTo(this._currentCursorPosition);
568
+ const angle = this._startCursorPosition.angleTo(this._currentCursorPosition);
569
+ const amount = Math.max(distance / this._tbRadius, angle);
570
+ this.applyTransformMatrix(
571
+ this.rotate(this.calculateRotationAxis(this._startCursorPosition, this._currentCursorPosition), amount)
572
+ );
573
+ if (this.enableAnimations) {
574
+ this._timePrev = this._timeCurrent;
575
+ this._timeCurrent = performance.now();
576
+ this._anglePrev = this._angleCurrent;
577
+ this._angleCurrent = amount;
578
+ this._cursorPosPrev.copy(this._cursorPosCurr);
579
+ this._cursorPosCurr.copy(this._currentCursorPosition);
580
+ this._wPrev = this._wCurr;
581
+ this._wCurr = this.calculateAngularSpeed(
582
+ this._anglePrev,
583
+ this._angleCurrent,
584
+ this._timePrev,
585
+ this._timeCurrent
586
+ );
587
+ }
588
+ }
589
+ }
590
+ break;
591
+ case STATE.SCALE:
592
+ if (this.enableZoom) {
593
+ if (restart) {
594
+ this.dispatchEvent(_endEvent);
595
+ this.dispatchEvent(_startEvent);
596
+ this.updateTbState(opState, true);
597
+ this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
598
+ this._currentCursorPosition.copy(this._startCursorPosition);
599
+ if (this.enableGrid) {
600
+ this.disposeGrid();
601
+ }
602
+ this.activateGizmos(false);
603
+ } else {
604
+ const screenNotches = 8;
605
+ this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
606
+ const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
607
+ let size = 1;
608
+ if (movement < 0) {
609
+ size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);
610
+ } else if (movement > 0) {
611
+ size = Math.pow(this.scaleFactor, movement * screenNotches);
612
+ }
613
+ this.applyTransformMatrix(this.applyScale(size, this._gizmos.position));
614
+ }
615
+ }
616
+ break;
617
+ case STATE.FOV:
618
+ if (this.enableZoom && ((_a = this.camera) == null ? void 0 : _a.type) === "PerspectiveCamera") {
619
+ if (restart) {
620
+ this.dispatchEvent(_endEvent);
621
+ this.dispatchEvent(_startEvent);
622
+ this.updateTbState(opState, true);
623
+ this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
624
+ this._currentCursorPosition.copy(this._startCursorPosition);
625
+ if (this.enableGrid) {
626
+ this.disposeGrid();
627
+ }
628
+ this.activateGizmos(false);
629
+ } else {
630
+ const screenNotches = 8;
631
+ this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
632
+ const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
633
+ let size = 1;
634
+ if (movement < 0) {
635
+ size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);
636
+ } else if (movement > 0) {
637
+ size = Math.pow(this.scaleFactor, movement * screenNotches);
638
+ }
639
+ this._v3_1.setFromMatrixPosition(this._cameraMatrixState);
640
+ const x = this._v3_1.distanceTo(this._gizmos.position);
641
+ let xNew = x / size;
642
+ xNew = THREE.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
643
+ const y = x * Math.tan(THREE.MathUtils.DEG2RAD * this._fovState * 0.5);
644
+ let newFov = THREE.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);
645
+ newFov = THREE.MathUtils.clamp(newFov, this.minFov, this.maxFov);
646
+ const newDistance = y / Math.tan(THREE.MathUtils.DEG2RAD * (newFov / 2));
647
+ size = x / newDistance;
648
+ this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);
649
+ this.setFov(newFov);
650
+ this.applyTransformMatrix(this.applyScale(size, this._v3_2, false));
651
+ const direction = this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(newDistance / x);
652
+ this._m4_1.makeTranslation(direction.x, direction.y, direction.z);
653
+ }
654
+ }
655
+ break;
656
+ }
657
+ this.dispatchEvent(_changeEvent);
658
+ }
659
+ });
660
+ __publicField(this, "onSinglePanEnd", () => {
661
+ if (this._state == STATE.ROTATE) {
662
+ if (!this.enableRotate) {
663
+ return;
664
+ }
665
+ if (this.enableAnimations) {
666
+ const deltaTime = performance.now() - this._timeCurrent;
667
+ if (deltaTime < 120) {
668
+ const w = Math.abs((this._wPrev + this._wCurr) / 2);
669
+ const self = this;
670
+ this._animationId = window.requestAnimationFrame(function(t) {
671
+ self.updateTbState(STATE.ANIMATION_ROTATE, true);
672
+ const rotationAxis = self.calculateRotationAxis(self._cursorPosPrev, self._cursorPosCurr);
673
+ self.onRotationAnim(t, rotationAxis, Math.min(w, self.wMax));
674
+ });
675
+ } else {
676
+ this.updateTbState(STATE.IDLE, false);
677
+ this.activateGizmos(false);
678
+ this.dispatchEvent(_changeEvent);
679
+ }
680
+ } else {
681
+ this.updateTbState(STATE.IDLE, false);
682
+ this.activateGizmos(false);
683
+ this.dispatchEvent(_changeEvent);
684
+ }
685
+ } else if (this._state == STATE.PAN || this._state == STATE.IDLE) {
686
+ this.updateTbState(STATE.IDLE, false);
687
+ if (this.enableGrid) {
688
+ this.disposeGrid();
689
+ }
690
+ this.activateGizmos(false);
691
+ this.dispatchEvent(_changeEvent);
692
+ }
693
+ this.dispatchEvent(_endEvent);
694
+ });
695
+ __publicField(this, "onDoubleTap", (event) => {
696
+ if (this.enabled && this.enablePan && this.scene && this.camera && this.domElement) {
697
+ this.dispatchEvent(_startEvent);
698
+ this.setCenter(event.clientX, event.clientY);
699
+ const hitP = this.unprojectOnObj(this.getCursorNDC(_center.x, _center.y, this.domElement), this.camera);
700
+ if (hitP && this.enableAnimations) {
701
+ const self = this;
702
+ if (this._animationId != -1) {
703
+ window.cancelAnimationFrame(this._animationId);
704
+ }
705
+ this._timeStart = -1;
706
+ this._animationId = window.requestAnimationFrame(function(t) {
707
+ self.updateTbState(STATE.ANIMATION_FOCUS, true);
708
+ self.onFocusAnim(t, hitP, self._cameraMatrixState, self._gizmoMatrixState);
709
+ });
710
+ } else if (hitP && !this.enableAnimations) {
711
+ this.updateTbState(STATE.FOCUS, true);
712
+ this.focus(hitP, this.scaleFactor);
713
+ this.updateTbState(STATE.IDLE, false);
714
+ this.dispatchEvent(_changeEvent);
715
+ }
716
+ }
717
+ this.dispatchEvent(_endEvent);
718
+ });
719
+ __publicField(this, "onDoublePanStart", () => {
720
+ if (this.enabled && this.enablePan && this.camera && this.domElement) {
721
+ this.dispatchEvent(_startEvent);
722
+ this.updateTbState(STATE.PAN, true);
723
+ this.setCenter(
724
+ (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
725
+ (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2
726
+ );
727
+ const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true);
728
+ if (rayDir !== void 0) {
729
+ this._startCursorPosition.copy(rayDir);
730
+ }
731
+ this._currentCursorPosition.copy(this._startCursorPosition);
732
+ this.activateGizmos(false);
733
+ }
734
+ });
735
+ __publicField(this, "onDoublePanMove", () => {
736
+ if (this.enabled && this.enablePan && this.camera && this.domElement) {
737
+ this.setCenter(
738
+ (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
739
+ (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2
740
+ );
741
+ if (this._state != STATE.PAN) {
742
+ this.updateTbState(STATE.PAN, true);
743
+ this._startCursorPosition.copy(this._currentCursorPosition);
744
+ }
745
+ const rayDir = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement, true);
746
+ if (rayDir !== void 0)
747
+ this._currentCursorPosition.copy(rayDir);
748
+ this.applyTransformMatrix(this.pan(this._startCursorPosition, this._currentCursorPosition, true));
749
+ this.dispatchEvent(_changeEvent);
750
+ }
751
+ });
752
+ __publicField(this, "onDoublePanEnd", () => {
753
+ this.updateTbState(STATE.IDLE, false);
754
+ this.dispatchEvent(_endEvent);
755
+ });
756
+ __publicField(this, "onRotateStart", () => {
757
+ var _a;
758
+ if (this.enabled && this.enableRotate) {
759
+ this.dispatchEvent(_startEvent);
760
+ this.updateTbState(STATE.ZROTATE, true);
761
+ this._startFingerRotation = this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) + this.getAngle(this._touchStart[1], this._touchStart[0]);
762
+ this._currentFingerRotation = this._startFingerRotation;
763
+ (_a = this.camera) == null ? void 0 : _a.getWorldDirection(this._rotationAxis);
764
+ if (!this.enablePan && !this.enableZoom) {
765
+ this.activateGizmos(true);
766
+ }
767
+ }
768
+ });
769
+ __publicField(this, "onRotateMove", () => {
770
+ var _a;
771
+ if (this.enabled && this.enableRotate && this.camera && this.domElement) {
772
+ this.setCenter(
773
+ (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
774
+ (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2
775
+ );
776
+ let rotationPoint;
777
+ if (this._state != STATE.ZROTATE) {
778
+ this.updateTbState(STATE.ZROTATE, true);
779
+ this._startFingerRotation = this._currentFingerRotation;
780
+ }
781
+ this._currentFingerRotation = this.getAngle(this._touchCurrent[1], this._touchCurrent[0]) + this.getAngle(this._touchStart[1], this._touchStart[0]);
782
+ if (!this.enablePan) {
783
+ rotationPoint = new THREE.Vector3().setFromMatrixPosition(this._gizmoMatrixState);
784
+ } else if (this.camera) {
785
+ this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);
786
+ 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);
787
+ }
788
+ const amount = THREE.MathUtils.DEG2RAD * (this._startFingerRotation - this._currentFingerRotation);
789
+ if (rotationPoint !== void 0) {
790
+ this.applyTransformMatrix(this.zRotate(rotationPoint, amount));
791
+ }
792
+ this.dispatchEvent(_changeEvent);
793
+ }
794
+ });
795
+ __publicField(this, "onRotateEnd", () => {
796
+ this.updateTbState(STATE.IDLE, false);
797
+ this.activateGizmos(false);
798
+ this.dispatchEvent(_endEvent);
799
+ });
800
+ __publicField(this, "onPinchStart", () => {
801
+ if (this.enabled && this.enableZoom) {
802
+ this.dispatchEvent(_startEvent);
803
+ this.updateTbState(STATE.SCALE, true);
804
+ this._startFingerDistance = this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1]);
805
+ this._currentFingerDistance = this._startFingerDistance;
806
+ this.activateGizmos(false);
807
+ }
808
+ });
809
+ __publicField(this, "onPinchMove", () => {
810
+ var _a, _b, _c, _d;
811
+ if (this.enabled && this.enableZoom && this.domElement) {
812
+ this.setCenter(
813
+ (this._touchCurrent[0].clientX + this._touchCurrent[1].clientX) / 2,
814
+ (this._touchCurrent[0].clientY + this._touchCurrent[1].clientY) / 2
815
+ );
816
+ const minDistance = 12;
817
+ if (this._state != STATE.SCALE) {
818
+ this._startFingerDistance = this._currentFingerDistance;
819
+ this.updateTbState(STATE.SCALE, true);
820
+ }
821
+ this._currentFingerDistance = Math.max(
822
+ this.calculatePointersDistance(this._touchCurrent[0], this._touchCurrent[1]),
823
+ minDistance * this._devPxRatio
824
+ );
825
+ const amount = this._currentFingerDistance / this._startFingerDistance;
826
+ let scalePoint;
827
+ if (!this.enablePan) {
828
+ scalePoint = this._gizmos.position;
829
+ } else {
830
+ if (((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera") {
831
+ 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);
832
+ } else if (((_c = this.camera) == null ? void 0 : _c.type) === "PerspectiveCamera") {
833
+ scalePoint = (_d = this.unprojectOnTbPlane(this.camera, _center.x, _center.y, this.domElement)) == null ? void 0 : _d.applyQuaternion(this.camera.quaternion).add(this._gizmos.position);
834
+ }
835
+ }
836
+ if (scalePoint !== void 0) {
837
+ this.applyTransformMatrix(this.applyScale(amount, scalePoint));
838
+ }
839
+ this.dispatchEvent(_changeEvent);
840
+ }
841
+ });
842
+ __publicField(this, "onPinchEnd", () => {
843
+ this.updateTbState(STATE.IDLE, false);
844
+ this.dispatchEvent(_endEvent);
845
+ });
846
+ __publicField(this, "onTriplePanStart", () => {
847
+ if (this.enabled && this.enableZoom && this.domElement) {
848
+ this.dispatchEvent(_startEvent);
849
+ this.updateTbState(STATE.SCALE, true);
850
+ let clientX = 0;
851
+ let clientY = 0;
852
+ const nFingers = this._touchCurrent.length;
853
+ for (let i = 0; i < nFingers; i++) {
854
+ clientX += this._touchCurrent[i].clientX;
855
+ clientY += this._touchCurrent[i].clientY;
856
+ }
857
+ this.setCenter(clientX / nFingers, clientY / nFingers);
858
+ this._startCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
859
+ this._currentCursorPosition.copy(this._startCursorPosition);
860
+ }
861
+ });
862
+ __publicField(this, "onTriplePanMove", () => {
863
+ if (this.enabled && this.enableZoom && this.camera && this.domElement) {
864
+ let clientX = 0;
865
+ let clientY = 0;
866
+ const nFingers = this._touchCurrent.length;
867
+ for (let i = 0; i < nFingers; i++) {
868
+ clientX += this._touchCurrent[i].clientX;
869
+ clientY += this._touchCurrent[i].clientY;
870
+ }
871
+ this.setCenter(clientX / nFingers, clientY / nFingers);
872
+ const screenNotches = 8;
873
+ this._currentCursorPosition.setY(this.getCursorNDC(_center.x, _center.y, this.domElement).y * 0.5);
874
+ const movement = this._currentCursorPosition.y - this._startCursorPosition.y;
875
+ let size = 1;
876
+ if (movement < 0) {
877
+ size = 1 / Math.pow(this.scaleFactor, -movement * screenNotches);
878
+ } else if (movement > 0) {
879
+ size = Math.pow(this.scaleFactor, movement * screenNotches);
880
+ }
881
+ this._v3_1.setFromMatrixPosition(this._cameraMatrixState);
882
+ const x = this._v3_1.distanceTo(this._gizmos.position);
883
+ let xNew = x / size;
884
+ xNew = THREE.MathUtils.clamp(xNew, this.minDistance, this.maxDistance);
885
+ const y = x * Math.tan(THREE.MathUtils.DEG2RAD * this._fovState * 0.5);
886
+ let newFov = THREE.MathUtils.RAD2DEG * (Math.atan(y / xNew) * 2);
887
+ newFov = THREE.MathUtils.clamp(newFov, this.minFov, this.maxFov);
888
+ const newDistance = y / Math.tan(THREE.MathUtils.DEG2RAD * (newFov / 2));
889
+ size = x / newDistance;
890
+ this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);
891
+ this.setFov(newFov);
892
+ this.applyTransformMatrix(this.applyScale(size, this._v3_2, false));
893
+ const direction = this._gizmos.position.clone().sub(this.camera.position).normalize().multiplyScalar(newDistance / x);
894
+ this._m4_1.makeTranslation(direction.x, direction.y, direction.z);
895
+ this.dispatchEvent(_changeEvent);
896
+ }
897
+ });
898
+ __publicField(this, "onTriplePanEnd", () => {
899
+ this.updateTbState(STATE.IDLE, false);
900
+ this.dispatchEvent(_endEvent);
901
+ });
902
+ /**
903
+ * Set _center's x/y coordinates
904
+ * @param {Number} clientX
905
+ * @param {Number} clientY
906
+ */
907
+ __publicField(this, "setCenter", (clientX, clientY) => {
908
+ _center.x = clientX;
909
+ _center.y = clientY;
910
+ });
911
+ /**
912
+ * Set default mouse actions
913
+ */
914
+ __publicField(this, "initializeMouseActions", () => {
915
+ this.setMouseAction("PAN", 0, "CTRL");
916
+ this.setMouseAction("PAN", 2);
917
+ this.setMouseAction("ROTATE", 0);
918
+ this.setMouseAction("ZOOM", "WHEEL");
919
+ this.setMouseAction("ZOOM", 1);
920
+ this.setMouseAction("FOV", "WHEEL", "SHIFT");
921
+ this.setMouseAction("FOV", 1, "SHIFT");
922
+ });
923
+ /**
924
+ * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one
925
+ * @param {String} operation The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV)
926
+ * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
927
+ * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
928
+ * @returns {Boolean} True if the mouse action has been successfully added, false otherwise
929
+ */
930
+ __publicField(this, "setMouseAction", (operation, mouse, key = null) => {
931
+ const operationInput = ["PAN", "ROTATE", "ZOOM", "FOV"];
932
+ const mouseInput = [0, 1, 2, "WHEEL"];
933
+ const keyInput = ["CTRL", "SHIFT", null];
934
+ let state;
935
+ if (!operationInput.includes(operation) || !mouseInput.includes(mouse) || !keyInput.includes(key)) {
936
+ return false;
937
+ }
938
+ if (mouse == "WHEEL") {
939
+ if (operation != "ZOOM" && operation != "FOV") {
940
+ return false;
941
+ }
942
+ }
943
+ switch (operation) {
944
+ case "PAN":
945
+ state = STATE.PAN;
946
+ break;
947
+ case "ROTATE":
948
+ state = STATE.ROTATE;
949
+ break;
950
+ case "ZOOM":
951
+ state = STATE.SCALE;
952
+ break;
953
+ case "FOV":
954
+ state = STATE.FOV;
955
+ break;
956
+ }
957
+ const action = {
958
+ operation,
959
+ mouse,
960
+ key,
961
+ state
962
+ };
963
+ for (let i = 0; i < this.mouseActions.length; i++) {
964
+ if (this.mouseActions[i].mouse == action.mouse && this.mouseActions[i].key == action.key) {
965
+ this.mouseActions.splice(i, 1, action);
966
+ return true;
967
+ }
968
+ }
969
+ this.mouseActions.push(action);
970
+ return true;
971
+ });
972
+ /**
973
+ * Return the operation associated to a mouse/keyboard combination
974
+ * @param {*} mouse A mouse button (0, 1, 2) or 'WHEEL' for wheel notches
975
+ * @param {*} key The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed
976
+ * @returns The operation if it has been found, null otherwise
977
+ */
978
+ __publicField(this, "getOpFromAction", (mouse, key) => {
979
+ let action;
980
+ for (let i = 0; i < this.mouseActions.length; i++) {
981
+ action = this.mouseActions[i];
982
+ if (action.mouse == mouse && action.key == key) {
983
+ return action.operation;
984
+ }
985
+ }
986
+ if (key) {
987
+ for (let i = 0; i < this.mouseActions.length; i++) {
988
+ action = this.mouseActions[i];
989
+ if (action.mouse == mouse && action.key == null) {
990
+ return action.operation;
991
+ }
992
+ }
993
+ }
994
+ return null;
995
+ });
996
+ /**
997
+ * Get the operation associated to mouse and key combination and returns the corresponding FSA state
998
+ * @param {Number} mouse Mouse button
999
+ * @param {String} key Keyboard modifier
1000
+ * @returns The FSA state obtained from the operation associated to mouse/keyboard combination
1001
+ */
1002
+ __publicField(this, "getOpStateFromAction", (mouse, key) => {
1003
+ let action;
1004
+ for (let i = 0; i < this.mouseActions.length; i++) {
1005
+ action = this.mouseActions[i];
1006
+ if (action.mouse == mouse && action.key == key) {
1007
+ return action.state;
1008
+ }
1009
+ }
1010
+ if (key) {
1011
+ for (let i = 0; i < this.mouseActions.length; i++) {
1012
+ action = this.mouseActions[i];
1013
+ if (action.mouse == mouse && action.key == null) {
1014
+ return action.state;
1015
+ }
1016
+ }
1017
+ }
1018
+ return null;
1019
+ });
1020
+ /**
1021
+ * Calculate the angle between two pointers
1022
+ * @param {PointerEvent} p1
1023
+ * @param {PointerEvent} p2
1024
+ * @returns {Number} The angle between two pointers in degrees
1025
+ */
1026
+ __publicField(this, "getAngle", (p1, p2) => {
1027
+ return Math.atan2(p2.clientY - p1.clientY, p2.clientX - p1.clientX) * 180 / Math.PI;
1028
+ });
1029
+ /**
1030
+ * Update a PointerEvent inside current pointerevents array
1031
+ * @param {PointerEvent} event
1032
+ */
1033
+ __publicField(this, "updateTouchEvent", (event) => {
1034
+ for (let i = 0; i < this._touchCurrent.length; i++) {
1035
+ if (this._touchCurrent[i].pointerId == event.pointerId) {
1036
+ this._touchCurrent.splice(i, 1, event);
1037
+ break;
1038
+ }
1039
+ }
1040
+ });
1041
+ /**
1042
+ * Calculate the angular speed
1043
+ * @param {Number} p0 Position at t0
1044
+ * @param {Number} p1 Position at t1
1045
+ * @param {Number} t0 Initial time in milliseconds
1046
+ * @param {Number} t1 Ending time in milliseconds
1047
+ */
1048
+ __publicField(this, "calculateAngularSpeed", (p0, p1, t0, t1) => {
1049
+ const s = p1 - p0;
1050
+ const t = (t1 - t0) / 1e3;
1051
+ if (t == 0) {
1052
+ return 0;
1053
+ }
1054
+ return s / t;
1055
+ });
1056
+ /**
1057
+ * Calculate the distance between two pointers
1058
+ * @param {PointerEvent} p0 The first pointer
1059
+ * @param {PointerEvent} p1 The second pointer
1060
+ * @returns {number} The distance between the two pointers
1061
+ */
1062
+ __publicField(this, "calculatePointersDistance", (p0, p1) => {
1063
+ return Math.sqrt(Math.pow(p1.clientX - p0.clientX, 2) + Math.pow(p1.clientY - p0.clientY, 2));
1064
+ });
1065
+ /**
1066
+ * Calculate the rotation axis as the vector perpendicular between two vectors
1067
+ * @param {Vector3} vec1 The first vector
1068
+ * @param {Vector3} vec2 The second vector
1069
+ * @returns {Vector3} The normalized rotation axis
1070
+ */
1071
+ __publicField(this, "calculateRotationAxis", (vec1, vec2) => {
1072
+ this._rotationMatrix.extractRotation(this._cameraMatrixState);
1073
+ this._quat.setFromRotationMatrix(this._rotationMatrix);
1074
+ this._rotationAxis.crossVectors(vec1, vec2).applyQuaternion(this._quat);
1075
+ return this._rotationAxis.normalize().clone();
1076
+ });
1077
+ /**
1078
+ * Calculate the trackball radius so that gizmo's diamater will be 2/3 of the minimum side of the camera frustum
1079
+ * @param {Camera} camera
1080
+ * @returns {Number} The trackball radius
1081
+ */
1082
+ __publicField(this, "calculateTbRadius", (camera) => {
1083
+ const factor = 0.67;
1084
+ const distance = camera.position.distanceTo(this._gizmos.position);
1085
+ if (camera.type == "PerspectiveCamera") {
1086
+ const halfFovV = THREE.MathUtils.DEG2RAD * camera.fov * 0.5;
1087
+ const halfFovH = Math.atan(camera.aspect * Math.tan(halfFovV));
1088
+ return Math.tan(Math.min(halfFovV, halfFovH)) * distance * factor;
1089
+ } else if (camera.type == "OrthographicCamera") {
1090
+ return Math.min(camera.top, camera.right) * factor;
1091
+ }
1092
+ });
1093
+ /**
1094
+ * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in
1095
+ * @param {Vector3} point The point of interest
1096
+ * @param {Number} size Scale factor
1097
+ * @param {Number} amount Amount of operation to be completed (used for focus animations, default is complete full operation)
1098
+ */
1099
+ __publicField(this, "focus", (point, size, amount = 1) => {
1100
+ if (this.camera) {
1101
+ const focusPoint = point.clone();
1102
+ focusPoint.sub(this._gizmos.position).multiplyScalar(amount);
1103
+ this._translationMatrix.makeTranslation(focusPoint.x, focusPoint.y, focusPoint.z);
1104
+ const gizmoStateTemp = this._gizmoMatrixState.clone();
1105
+ this._gizmoMatrixState.premultiply(this._translationMatrix);
1106
+ this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1107
+ const cameraStateTemp = this._cameraMatrixState.clone();
1108
+ this._cameraMatrixState.premultiply(this._translationMatrix);
1109
+ this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);
1110
+ if (this.enableZoom) {
1111
+ this.applyTransformMatrix(this.applyScale(size, this._gizmos.position));
1112
+ }
1113
+ this._gizmoMatrixState.copy(gizmoStateTemp);
1114
+ this._cameraMatrixState.copy(cameraStateTemp);
1115
+ }
1116
+ });
1117
+ /**
1118
+ * Draw a grid and add it to the scene
1119
+ */
1120
+ __publicField(this, "drawGrid", () => {
1121
+ var _a, _b;
1122
+ if (this.scene) {
1123
+ const color = 8947848;
1124
+ const multiplier = 3;
1125
+ let size, divisions, maxLength, tick;
1126
+ if (((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera") {
1127
+ const width = this.camera.right - this.camera.left;
1128
+ const height = this.camera.bottom - this.camera.top;
1129
+ maxLength = Math.max(width, height);
1130
+ tick = maxLength / 20;
1131
+ size = maxLength / this.camera.zoom * multiplier;
1132
+ divisions = size / tick * this.camera.zoom;
1133
+ } else if (((_b = this.camera) == null ? void 0 : _b.type) === "PerspectiveCamera") {
1134
+ const distance = this.camera.position.distanceTo(this._gizmos.position);
1135
+ const halfFovV = THREE.MathUtils.DEG2RAD * this.camera.fov * 0.5;
1136
+ const halfFovH = Math.atan(this.camera.aspect * Math.tan(halfFovV));
1137
+ maxLength = Math.tan(Math.max(halfFovV, halfFovH)) * distance * 2;
1138
+ tick = maxLength / 20;
1139
+ size = maxLength * multiplier;
1140
+ divisions = size / tick;
1141
+ }
1142
+ if (this._grid == null && this.camera) {
1143
+ this._grid = new THREE.GridHelper(size, divisions, color, color);
1144
+ this._grid.position.copy(this._gizmos.position);
1145
+ this._gridPosition.copy(this._grid.position);
1146
+ this._grid.quaternion.copy(this.camera.quaternion);
1147
+ this._grid.rotateX(Math.PI * 0.5);
1148
+ this.scene.add(this._grid);
1149
+ }
1150
+ }
1151
+ });
1152
+ __publicField(this, "connect", (domElement) => {
1153
+ if (domElement === document) {
1154
+ console.error(
1155
+ 'THREE.ArcballControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'
1156
+ );
1157
+ }
1158
+ this.domElement = domElement;
1159
+ this.domElement.style.touchAction = "none";
1160
+ this.domElement.addEventListener("contextmenu", this.onContextMenu);
1161
+ this.domElement.addEventListener("pointerdown", this.onPointerDown);
1162
+ this.domElement.addEventListener("pointercancel", this.onPointerCancel);
1163
+ this.domElement.addEventListener("wheel", this.onWheel);
1164
+ });
1165
+ /**
1166
+ * Remove all listeners, stop animations and clean scene
1167
+ */
1168
+ __publicField(this, "dispose", () => {
1169
+ var _a, _b, _c, _d, _e;
1170
+ if (this._animationId != -1) {
1171
+ window.cancelAnimationFrame(this._animationId);
1172
+ }
1173
+ (_a = this.domElement) == null ? void 0 : _a.removeEventListener("pointerdown", this.onPointerDown);
1174
+ (_b = this.domElement) == null ? void 0 : _b.removeEventListener("pointercancel", this.onPointerCancel);
1175
+ (_c = this.domElement) == null ? void 0 : _c.removeEventListener("wheel", this.onWheel);
1176
+ (_d = this.domElement) == null ? void 0 : _d.removeEventListener("contextmenu", this.onContextMenu);
1177
+ window.removeEventListener("pointermove", this.onPointerMove);
1178
+ window.removeEventListener("pointerup", this.onPointerUp);
1179
+ window.removeEventListener("resize", this.onWindowResize);
1180
+ (_e = this.scene) == null ? void 0 : _e.remove(this._gizmos);
1181
+ this.disposeGrid();
1182
+ });
1183
+ /**
1184
+ * remove the grid from the scene
1185
+ */
1186
+ __publicField(this, "disposeGrid", () => {
1187
+ if (this._grid && this.scene) {
1188
+ this.scene.remove(this._grid);
1189
+ this._grid = null;
1190
+ }
1191
+ });
1192
+ /**
1193
+ * Compute the easing out cubic function for ease out effect in animation
1194
+ * @param {Number} t The absolute progress of the animation in the bound of 0 (beginning of the) and 1 (ending of animation)
1195
+ * @returns {Number} Result of easing out cubic at time t
1196
+ */
1197
+ __publicField(this, "easeOutCubic", (t) => {
1198
+ return 1 - Math.pow(1 - t, 3);
1199
+ });
1200
+ /**
1201
+ * Make rotation gizmos more or less visible
1202
+ * @param {Boolean} isActive If true, make gizmos more visible
1203
+ */
1204
+ __publicField(this, "activateGizmos", (isActive) => {
1205
+ for (const gizmo of this._gizmos.children) {
1206
+ ;
1207
+ gizmo.material.setValues({ opacity: isActive ? 1 : 0.6 });
1208
+ }
1209
+ });
1210
+ /**
1211
+ * Calculate the cursor position in NDC
1212
+ * @param {number} x Cursor horizontal coordinate within the canvas
1213
+ * @param {number} y Cursor vertical coordinate within the canvas
1214
+ * @param {HTMLElement} canvas The canvas where the renderer draws its output
1215
+ * @returns {Vector2} Cursor normalized position inside the canvas
1216
+ */
1217
+ __publicField(this, "getCursorNDC", (cursorX, cursorY, canvas) => {
1218
+ const canvasRect = canvas.getBoundingClientRect();
1219
+ this._v2_1.setX((cursorX - canvasRect.left) / canvasRect.width * 2 - 1);
1220
+ this._v2_1.setY((canvasRect.bottom - cursorY) / canvasRect.height * 2 - 1);
1221
+ return this._v2_1.clone();
1222
+ });
1223
+ /**
1224
+ * Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas
1225
+ * @param {Number} x Cursor horizontal coordinate within the canvas
1226
+ * @param {Number} y Cursor vertical coordinate within the canvas
1227
+ * @param {HTMLElement} canvas The canvas where the renderer draws its output
1228
+ * @returns {Vector2} Cursor position inside the canvas
1229
+ */
1230
+ __publicField(this, "getCursorPosition", (cursorX, cursorY, canvas) => {
1231
+ var _a;
1232
+ this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));
1233
+ if (((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera") {
1234
+ this._v2_1.x *= (this.camera.right - this.camera.left) * 0.5;
1235
+ this._v2_1.y *= (this.camera.top - this.camera.bottom) * 0.5;
1236
+ }
1237
+ return this._v2_1.clone();
1238
+ });
1239
+ /**
1240
+ * Set the camera to be controlled
1241
+ * @param {Camera} camera The virtual camera to be controlled
1242
+ */
1243
+ __publicField(this, "setCamera", (camera) => {
1244
+ if (camera) {
1245
+ camera.lookAt(this.target);
1246
+ camera.updateMatrix();
1247
+ if ((camera == null ? void 0 : camera.type) == "PerspectiveCamera") {
1248
+ this._fov0 = camera.fov;
1249
+ this._fovState = camera.fov;
1250
+ }
1251
+ this._cameraMatrixState0.copy(camera.matrix);
1252
+ this._cameraMatrixState.copy(this._cameraMatrixState0);
1253
+ this._cameraProjectionState.copy(camera.projectionMatrix);
1254
+ this._zoom0 = camera.zoom;
1255
+ this._zoomState = this._zoom0;
1256
+ this._initialNear = camera.near;
1257
+ this._nearPos0 = camera.position.distanceTo(this.target) - camera.near;
1258
+ this._nearPos = this._initialNear;
1259
+ this._initialFar = camera.far;
1260
+ this._farPos0 = camera.position.distanceTo(this.target) - camera.far;
1261
+ this._farPos = this._initialFar;
1262
+ this._up0.copy(camera.up);
1263
+ this._upState.copy(camera.up);
1264
+ this.camera = camera;
1265
+ this.camera.updateProjectionMatrix();
1266
+ const tbRadius = this.calculateTbRadius(camera);
1267
+ if (tbRadius !== void 0) {
1268
+ this._tbRadius = tbRadius;
1269
+ }
1270
+ this.makeGizmos(this.target, this._tbRadius);
1271
+ }
1272
+ });
1273
+ /**
1274
+ * Creates the rotation gizmos matching trackball center and radius
1275
+ * @param {Vector3} tbCenter The trackball center
1276
+ * @param {number} tbRadius The trackball radius
1277
+ */
1278
+ __publicField(this, "makeGizmos", (tbCenter, tbRadius) => {
1279
+ const curve = new THREE.EllipseCurve(0, 0, tbRadius, tbRadius);
1280
+ const points = curve.getPoints(this._curvePts);
1281
+ const curveGeometry = new THREE.BufferGeometry().setFromPoints(points);
1282
+ const curveMaterialX = new THREE.LineBasicMaterial({ color: 16744576, fog: false, transparent: true, opacity: 0.6 });
1283
+ const curveMaterialY = new THREE.LineBasicMaterial({ color: 8454016, fog: false, transparent: true, opacity: 0.6 });
1284
+ const curveMaterialZ = new THREE.LineBasicMaterial({ color: 8421631, fog: false, transparent: true, opacity: 0.6 });
1285
+ const gizmoX = new THREE.Line(curveGeometry, curveMaterialX);
1286
+ const gizmoY = new THREE.Line(curveGeometry, curveMaterialY);
1287
+ const gizmoZ = new THREE.Line(curveGeometry, curveMaterialZ);
1288
+ const rotation = Math.PI * 0.5;
1289
+ gizmoX.rotation.x = rotation;
1290
+ gizmoY.rotation.y = rotation;
1291
+ this._gizmoMatrixState0.identity().setPosition(tbCenter);
1292
+ this._gizmoMatrixState.copy(this._gizmoMatrixState0);
1293
+ if (this.camera && this.camera.zoom != 1) {
1294
+ const size = 1 / this.camera.zoom;
1295
+ this._scaleMatrix.makeScale(size, size, size);
1296
+ this._translationMatrix.makeTranslation(-tbCenter.x, -tbCenter.y, -tbCenter.z);
1297
+ this._gizmoMatrixState.premultiply(this._translationMatrix).premultiply(this._scaleMatrix);
1298
+ this._translationMatrix.makeTranslation(tbCenter.x, tbCenter.y, tbCenter.z);
1299
+ this._gizmoMatrixState.premultiply(this._translationMatrix);
1300
+ }
1301
+ this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1302
+ this._gizmos.clear();
1303
+ this._gizmos.add(gizmoX);
1304
+ this._gizmos.add(gizmoY);
1305
+ this._gizmos.add(gizmoZ);
1306
+ });
1307
+ /**
1308
+ * Perform animation for focus operation
1309
+ * @param {Number} time Instant in which this function is called as performance.now()
1310
+ * @param {Vector3} point Point of interest for focus operation
1311
+ * @param {Matrix4} cameraMatrix Camera matrix
1312
+ * @param {Matrix4} gizmoMatrix Gizmos matrix
1313
+ */
1314
+ __publicField(this, "onFocusAnim", (time, point, cameraMatrix, gizmoMatrix) => {
1315
+ if (this._timeStart == -1) {
1316
+ this._timeStart = time;
1317
+ }
1318
+ if (this._state == STATE.ANIMATION_FOCUS) {
1319
+ const deltaTime = time - this._timeStart;
1320
+ const animTime = deltaTime / this.focusAnimationTime;
1321
+ this._gizmoMatrixState.copy(gizmoMatrix);
1322
+ if (animTime >= 1) {
1323
+ this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1324
+ this.focus(point, this.scaleFactor);
1325
+ this._timeStart = -1;
1326
+ this.updateTbState(STATE.IDLE, false);
1327
+ this.activateGizmos(false);
1328
+ this.dispatchEvent(_changeEvent);
1329
+ } else {
1330
+ const amount = this.easeOutCubic(animTime);
1331
+ const size = 1 - amount + this.scaleFactor * amount;
1332
+ this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1333
+ this.focus(point, size, amount);
1334
+ this.dispatchEvent(_changeEvent);
1335
+ const self = this;
1336
+ this._animationId = window.requestAnimationFrame(function(t) {
1337
+ self.onFocusAnim(t, point, cameraMatrix, gizmoMatrix.clone());
1338
+ });
1339
+ }
1340
+ } else {
1341
+ this._animationId = -1;
1342
+ this._timeStart = -1;
1343
+ }
1344
+ });
1345
+ /**
1346
+ * Perform animation for rotation operation
1347
+ * @param {Number} time Instant in which this function is called as performance.now()
1348
+ * @param {Vector3} rotationAxis Rotation axis
1349
+ * @param {number} w0 Initial angular velocity
1350
+ */
1351
+ __publicField(this, "onRotationAnim", (time, rotationAxis, w0) => {
1352
+ if (this._timeStart == -1) {
1353
+ this._anglePrev = 0;
1354
+ this._angleCurrent = 0;
1355
+ this._timeStart = time;
1356
+ }
1357
+ if (this._state == STATE.ANIMATION_ROTATE) {
1358
+ const deltaTime = (time - this._timeStart) / 1e3;
1359
+ const w = w0 + -this.dampingFactor * deltaTime;
1360
+ if (w > 0) {
1361
+ this._angleCurrent = 0.5 * -this.dampingFactor * Math.pow(deltaTime, 2) + w0 * deltaTime + 0;
1362
+ this.applyTransformMatrix(this.rotate(rotationAxis, this._angleCurrent));
1363
+ this.dispatchEvent(_changeEvent);
1364
+ const self = this;
1365
+ this._animationId = window.requestAnimationFrame(function(t) {
1366
+ self.onRotationAnim(t, rotationAxis, w0);
1367
+ });
1368
+ } else {
1369
+ this._animationId = -1;
1370
+ this._timeStart = -1;
1371
+ this.updateTbState(STATE.IDLE, false);
1372
+ this.activateGizmos(false);
1373
+ this.dispatchEvent(_changeEvent);
1374
+ }
1375
+ } else {
1376
+ this._animationId = -1;
1377
+ this._timeStart = -1;
1378
+ if (this._state != STATE.ROTATE) {
1379
+ this.activateGizmos(false);
1380
+ this.dispatchEvent(_changeEvent);
1381
+ }
1382
+ }
1383
+ });
1384
+ /**
1385
+ * Perform pan operation moving camera between two points
1386
+ * @param {Vector3} p0 Initial point
1387
+ * @param {Vector3} p1 Ending point
1388
+ * @param {Boolean} adjust If movement should be adjusted considering camera distance (Perspective only)
1389
+ */
1390
+ __publicField(this, "pan", (p0, p1, adjust = false) => {
1391
+ if (this.camera) {
1392
+ const movement = p0.clone().sub(p1);
1393
+ if (this.camera.type === "OrthographicCamera") {
1394
+ movement.multiplyScalar(1 / this.camera.zoom);
1395
+ }
1396
+ if (this.camera.type === "PerspectiveCamera" && adjust) {
1397
+ this._v3_1.setFromMatrixPosition(this._cameraMatrixState0);
1398
+ this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0);
1399
+ const distanceFactor = this._v3_1.distanceTo(this._v3_2) / this.camera.position.distanceTo(this._gizmos.position);
1400
+ movement.multiplyScalar(1 / distanceFactor);
1401
+ }
1402
+ this._v3_1.set(movement.x, movement.y, 0).applyQuaternion(this.camera.quaternion);
1403
+ this._m4_1.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z);
1404
+ this.setTransformationMatrices(this._m4_1, this._m4_1);
1405
+ }
1406
+ return _transformation;
1407
+ });
1408
+ /**
1409
+ * Reset trackball
1410
+ */
1411
+ __publicField(this, "reset", () => {
1412
+ if (this.camera) {
1413
+ this.camera.zoom = this._zoom0;
1414
+ if (this.camera.type === "PerspectiveCamera") {
1415
+ this.camera.fov = this._fov0;
1416
+ }
1417
+ this.camera.near = this._nearPos;
1418
+ this.camera.far = this._farPos;
1419
+ this._cameraMatrixState.copy(this._cameraMatrixState0);
1420
+ this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);
1421
+ this.camera.up.copy(this._up0);
1422
+ this.camera.updateMatrix();
1423
+ this.camera.updateProjectionMatrix();
1424
+ this._gizmoMatrixState.copy(this._gizmoMatrixState0);
1425
+ this._gizmoMatrixState0.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1426
+ this._gizmos.updateMatrix();
1427
+ const tbRadius = this.calculateTbRadius(this.camera);
1428
+ if (tbRadius !== void 0) {
1429
+ this._tbRadius = tbRadius;
1430
+ }
1431
+ this.makeGizmos(this._gizmos.position, this._tbRadius);
1432
+ this.camera.lookAt(this._gizmos.position);
1433
+ this.updateTbState(STATE.IDLE, false);
1434
+ this.dispatchEvent(_changeEvent);
1435
+ }
1436
+ });
1437
+ /**
1438
+ * Rotate the camera around an axis passing by trackball's center
1439
+ * @param {Vector3} axis Rotation axis
1440
+ * @param {number} angle Angle in radians
1441
+ * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera
1442
+ */
1443
+ __publicField(this, "rotate", (axis, angle) => {
1444
+ const point = this._gizmos.position;
1445
+ this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z);
1446
+ this._rotationMatrix.makeRotationAxis(axis, -angle);
1447
+ this._m4_1.makeTranslation(point.x, point.y, point.z);
1448
+ this._m4_1.multiply(this._rotationMatrix);
1449
+ this._m4_1.multiply(this._translationMatrix);
1450
+ this.setTransformationMatrices(this._m4_1);
1451
+ return _transformation;
1452
+ });
1453
+ __publicField(this, "copyState", () => {
1454
+ var _a;
1455
+ if (this.camera) {
1456
+ const state = JSON.stringify(
1457
+ ((_a = this.camera) == null ? void 0 : _a.type) === "OrthographicCamera" ? {
1458
+ arcballState: {
1459
+ cameraFar: this.camera.far,
1460
+ cameraMatrix: this.camera.matrix,
1461
+ cameraNear: this.camera.near,
1462
+ cameraUp: this.camera.up,
1463
+ cameraZoom: this.camera.zoom,
1464
+ gizmoMatrix: this._gizmos.matrix
1465
+ }
1466
+ } : {
1467
+ arcballState: {
1468
+ cameraFar: this.camera.far,
1469
+ cameraFov: this.camera.fov,
1470
+ cameraMatrix: this.camera.matrix,
1471
+ cameraNear: this.camera.near,
1472
+ cameraUp: this.camera.up,
1473
+ cameraZoom: this.camera.zoom,
1474
+ gizmoMatrix: this._gizmos.matrix
1475
+ }
1476
+ }
1477
+ );
1478
+ navigator.clipboard.writeText(state);
1479
+ }
1480
+ });
1481
+ __publicField(this, "pasteState", () => {
1482
+ const self = this;
1483
+ navigator.clipboard.readText().then(function resolved(value) {
1484
+ self.setStateFromJSON(value);
1485
+ });
1486
+ });
1487
+ /**
1488
+ * Save the current state of the control. This can later be recovered with .reset
1489
+ */
1490
+ __publicField(this, "saveState", () => {
1491
+ if (!this.camera)
1492
+ return;
1493
+ this._cameraMatrixState0.copy(this.camera.matrix);
1494
+ this._gizmoMatrixState0.copy(this._gizmos.matrix);
1495
+ this._nearPos = this.camera.near;
1496
+ this._farPos = this.camera.far;
1497
+ this._zoom0 = this.camera.zoom;
1498
+ this._up0.copy(this.camera.up);
1499
+ if (this.camera.type === "PerspectiveCamera") {
1500
+ this._fov0 = this.camera.fov;
1501
+ }
1502
+ });
1503
+ /**
1504
+ * Perform uniform scale operation around a given point
1505
+ * @param {Number} size Scale factor
1506
+ * @param {Vector3} point Point around which scale
1507
+ * @param {Boolean} scaleGizmos If gizmos should be scaled (Perspective only)
1508
+ * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos
1509
+ */
1510
+ __publicField(this, "applyScale", (size, point, scaleGizmos = true) => {
1511
+ if (!this.camera)
1512
+ return;
1513
+ const scalePoint = point.clone();
1514
+ let sizeInverse = 1 / size;
1515
+ if (this.camera.type === "OrthographicCamera") {
1516
+ this.camera.zoom = this._zoomState;
1517
+ this.camera.zoom *= size;
1518
+ if (this.camera.zoom > this.maxZoom) {
1519
+ this.camera.zoom = this.maxZoom;
1520
+ sizeInverse = this._zoomState / this.maxZoom;
1521
+ } else if (this.camera.zoom < this.minZoom) {
1522
+ this.camera.zoom = this.minZoom;
1523
+ sizeInverse = this._zoomState / this.minZoom;
1524
+ }
1525
+ this.camera.updateProjectionMatrix();
1526
+ this._v3_1.setFromMatrixPosition(this._gizmoMatrixState);
1527
+ this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse);
1528
+ this._translationMatrix.makeTranslation(-this._v3_1.x, -this._v3_1.y, -this._v3_1.z);
1529
+ this._m4_2.makeTranslation(this._v3_1.x, this._v3_1.y, this._v3_1.z).multiply(this._scaleMatrix);
1530
+ this._m4_2.multiply(this._translationMatrix);
1531
+ scalePoint.sub(this._v3_1);
1532
+ const amount = scalePoint.clone().multiplyScalar(sizeInverse);
1533
+ scalePoint.sub(amount);
1534
+ this._m4_1.makeTranslation(scalePoint.x, scalePoint.y, scalePoint.z);
1535
+ this._m4_2.premultiply(this._m4_1);
1536
+ this.setTransformationMatrices(this._m4_1, this._m4_2);
1537
+ return _transformation;
1538
+ }
1539
+ if (this.camera.type === "PerspectiveCamera") {
1540
+ this._v3_1.setFromMatrixPosition(this._cameraMatrixState);
1541
+ this._v3_2.setFromMatrixPosition(this._gizmoMatrixState);
1542
+ let distance = this._v3_1.distanceTo(scalePoint);
1543
+ let amount = distance - distance * sizeInverse;
1544
+ const newDistance = distance - amount;
1545
+ if (newDistance < this.minDistance) {
1546
+ sizeInverse = this.minDistance / distance;
1547
+ amount = distance - distance * sizeInverse;
1548
+ } else if (newDistance > this.maxDistance) {
1549
+ sizeInverse = this.maxDistance / distance;
1550
+ amount = distance - distance * sizeInverse;
1551
+ }
1552
+ let direction = scalePoint.clone().sub(this._v3_1).normalize().multiplyScalar(amount);
1553
+ this._m4_1.makeTranslation(direction.x, direction.y, direction.z);
1554
+ if (scaleGizmos) {
1555
+ const pos = this._v3_2;
1556
+ distance = pos.distanceTo(scalePoint);
1557
+ amount = distance - distance * sizeInverse;
1558
+ direction = scalePoint.clone().sub(this._v3_2).normalize().multiplyScalar(amount);
1559
+ this._translationMatrix.makeTranslation(pos.x, pos.y, pos.z);
1560
+ this._scaleMatrix.makeScale(sizeInverse, sizeInverse, sizeInverse);
1561
+ this._m4_2.makeTranslation(direction.x, direction.y, direction.z).multiply(this._translationMatrix);
1562
+ this._m4_2.multiply(this._scaleMatrix);
1563
+ this._translationMatrix.makeTranslation(-pos.x, -pos.y, -pos.z);
1564
+ this._m4_2.multiply(this._translationMatrix);
1565
+ this.setTransformationMatrices(this._m4_1, this._m4_2);
1566
+ } else {
1567
+ this.setTransformationMatrices(this._m4_1);
1568
+ }
1569
+ return _transformation;
1570
+ }
1571
+ });
1572
+ /**
1573
+ * Set camera fov
1574
+ * @param {Number} value fov to be setted
1575
+ */
1576
+ __publicField(this, "setFov", (value) => {
1577
+ var _a;
1578
+ if (((_a = this.camera) == null ? void 0 : _a.type) === "PerspectiveCamera") {
1579
+ this.camera.fov = THREE.MathUtils.clamp(value, this.minFov, this.maxFov);
1580
+ this.camera.updateProjectionMatrix();
1581
+ }
1582
+ });
1583
+ /**
1584
+ * Set the trackball's center point
1585
+ * @param {Number} x X coordinate
1586
+ * @param {Number} y Y coordinate
1587
+ * @param {Number} z Z coordinate
1588
+ */
1589
+ __publicField(this, "setTarget", (x, y, z) => {
1590
+ if (this.camera) {
1591
+ this.target.set(x, y, z);
1592
+ this._gizmos.position.set(x, y, z);
1593
+ const tbRadius = this.calculateTbRadius(this.camera);
1594
+ if (tbRadius !== void 0) {
1595
+ this._tbRadius = tbRadius;
1596
+ }
1597
+ this.makeGizmos(this.target, this._tbRadius);
1598
+ this.camera.lookAt(this.target);
1599
+ }
1600
+ });
1601
+ /**
1602
+ * Rotate camera around its direction axis passing by a given point by a given angle
1603
+ * @param {Vector3} point The point where the rotation axis is passing trough
1604
+ * @param {Number} angle Angle in radians
1605
+ * @returns The computed transormation matix
1606
+ */
1607
+ __publicField(this, "zRotate", (point, angle) => {
1608
+ this._rotationMatrix.makeRotationAxis(this._rotationAxis, angle);
1609
+ this._translationMatrix.makeTranslation(-point.x, -point.y, -point.z);
1610
+ this._m4_1.makeTranslation(point.x, point.y, point.z);
1611
+ this._m4_1.multiply(this._rotationMatrix);
1612
+ this._m4_1.multiply(this._translationMatrix);
1613
+ this._v3_1.setFromMatrixPosition(this._gizmoMatrixState).sub(point);
1614
+ this._v3_2.copy(this._v3_1).applyAxisAngle(this._rotationAxis, angle);
1615
+ this._v3_2.sub(this._v3_1);
1616
+ this._m4_2.makeTranslation(this._v3_2.x, this._v3_2.y, this._v3_2.z);
1617
+ this.setTransformationMatrices(this._m4_1, this._m4_2);
1618
+ return _transformation;
1619
+ });
1620
+ /**
1621
+ * Unproject the cursor on the 3D object surface
1622
+ * @param {Vector2} cursor Cursor coordinates in NDC
1623
+ * @param {Camera} camera Virtual camera
1624
+ * @returns {Vector3} The point of intersection with the model, if exist, null otherwise
1625
+ */
1626
+ __publicField(this, "unprojectOnObj", (cursor, camera) => {
1627
+ if (!this.scene)
1628
+ return null;
1629
+ const raycaster = new THREE.Raycaster();
1630
+ raycaster.near = camera.near;
1631
+ raycaster.far = camera.far;
1632
+ raycaster.setFromCamera(cursor, camera);
1633
+ const intersect = raycaster.intersectObjects(this.scene.children, true);
1634
+ for (let i = 0; i < intersect.length; i++) {
1635
+ if (intersect[i].object.uuid != this._gizmos.uuid && intersect[i].face) {
1636
+ return intersect[i].point.clone();
1637
+ }
1638
+ }
1639
+ return null;
1640
+ });
1641
+ /**
1642
+ * Unproject the cursor on the trackball surface
1643
+ * @param {Camera} camera The virtual camera
1644
+ * @param {Number} cursorX Cursor horizontal coordinate on screen
1645
+ * @param {Number} cursorY Cursor vertical coordinate on screen
1646
+ * @param {HTMLElement} canvas The canvas where the renderer draws its output
1647
+ * @param {number} tbRadius The trackball radius
1648
+ * @returns {Vector3} The unprojected point on the trackball surface
1649
+ */
1650
+ __publicField(this, "unprojectOnTbSurface", (camera, cursorX, cursorY, canvas, tbRadius) => {
1651
+ if (camera.type == "OrthographicCamera") {
1652
+ this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas));
1653
+ this._v3_1.set(this._v2_1.x, this._v2_1.y, 0);
1654
+ const x2 = Math.pow(this._v2_1.x, 2);
1655
+ const y2 = Math.pow(this._v2_1.y, 2);
1656
+ const r2 = Math.pow(this._tbRadius, 2);
1657
+ if (x2 + y2 <= r2 * 0.5) {
1658
+ this._v3_1.setZ(Math.sqrt(r2 - (x2 + y2)));
1659
+ } else {
1660
+ this._v3_1.setZ(r2 * 0.5 / Math.sqrt(x2 + y2));
1661
+ }
1662
+ return this._v3_1;
1663
+ }
1664
+ if (camera.type == "PerspectiveCamera") {
1665
+ this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));
1666
+ this._v3_1.set(this._v2_1.x, this._v2_1.y, -1);
1667
+ this._v3_1.applyMatrix4(camera.projectionMatrixInverse);
1668
+ const rayDir = this._v3_1.clone().normalize();
1669
+ const cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position);
1670
+ const radius2 = Math.pow(tbRadius, 2);
1671
+ const h = this._v3_1.z;
1672
+ const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2));
1673
+ if (l == 0) {
1674
+ rayDir.set(this._v3_1.x, this._v3_1.y, tbRadius);
1675
+ return rayDir;
1676
+ }
1677
+ const m = h / l;
1678
+ const q = cameraGizmoDistance;
1679
+ let a = Math.pow(m, 2) + 1;
1680
+ let b = 2 * m * q;
1681
+ let c = Math.pow(q, 2) - radius2;
1682
+ let delta = Math.pow(b, 2) - 4 * a * c;
1683
+ if (delta >= 0) {
1684
+ this._v2_1.setX((-b - Math.sqrt(delta)) / (2 * a));
1685
+ this._v2_1.setY(m * this._v2_1.x + q);
1686
+ const angle = THREE.MathUtils.RAD2DEG * this._v2_1.angle();
1687
+ if (angle >= 45) {
1688
+ const rayLength2 = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2));
1689
+ rayDir.multiplyScalar(rayLength2);
1690
+ rayDir.z += cameraGizmoDistance;
1691
+ return rayDir;
1692
+ }
1693
+ }
1694
+ a = m;
1695
+ b = q;
1696
+ c = -radius2 * 0.5;
1697
+ delta = Math.pow(b, 2) - 4 * a * c;
1698
+ this._v2_1.setX((-b - Math.sqrt(delta)) / (2 * a));
1699
+ this._v2_1.setY(m * this._v2_1.x + q);
1700
+ const rayLength = Math.sqrt(Math.pow(this._v2_1.x, 2) + Math.pow(cameraGizmoDistance - this._v2_1.y, 2));
1701
+ rayDir.multiplyScalar(rayLength);
1702
+ rayDir.z += cameraGizmoDistance;
1703
+ return rayDir;
1704
+ }
1705
+ });
1706
+ /**
1707
+ * Unproject the cursor on the plane passing through the center of the trackball orthogonal to the camera
1708
+ * @param {Camera} camera The virtual camera
1709
+ * @param {Number} cursorX Cursor horizontal coordinate on screen
1710
+ * @param {Number} cursorY Cursor vertical coordinate on screen
1711
+ * @param {HTMLElement} canvas The canvas where the renderer draws its output
1712
+ * @param {Boolean} initialDistance If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only)
1713
+ * @returns {Vector3} The unprojected point on the trackball plane
1714
+ */
1715
+ __publicField(this, "unprojectOnTbPlane", (camera, cursorX, cursorY, canvas, initialDistance = false) => {
1716
+ if (camera.type == "OrthographicCamera") {
1717
+ this._v2_1.copy(this.getCursorPosition(cursorX, cursorY, canvas));
1718
+ this._v3_1.set(this._v2_1.x, this._v2_1.y, 0);
1719
+ return this._v3_1.clone();
1720
+ }
1721
+ if (camera.type == "PerspectiveCamera") {
1722
+ this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));
1723
+ this._v3_1.set(this._v2_1.x, this._v2_1.y, -1);
1724
+ this._v3_1.applyMatrix4(camera.projectionMatrixInverse);
1725
+ const rayDir = this._v3_1.clone().normalize();
1726
+ const h = this._v3_1.z;
1727
+ const l = Math.sqrt(Math.pow(this._v3_1.x, 2) + Math.pow(this._v3_1.y, 2));
1728
+ let cameraGizmoDistance;
1729
+ if (initialDistance) {
1730
+ cameraGizmoDistance = this._v3_1.setFromMatrixPosition(this._cameraMatrixState0).distanceTo(this._v3_2.setFromMatrixPosition(this._gizmoMatrixState0));
1731
+ } else {
1732
+ cameraGizmoDistance = camera.position.distanceTo(this._gizmos.position);
1733
+ }
1734
+ if (l == 0) {
1735
+ rayDir.set(0, 0, 0);
1736
+ return rayDir;
1737
+ }
1738
+ const m = h / l;
1739
+ const q = cameraGizmoDistance;
1740
+ const x = -q / m;
1741
+ const rayLength = Math.sqrt(Math.pow(q, 2) + Math.pow(x, 2));
1742
+ rayDir.multiplyScalar(rayLength);
1743
+ rayDir.z = 0;
1744
+ return rayDir;
1745
+ }
1746
+ });
1747
+ /**
1748
+ * Update camera and gizmos state
1749
+ */
1750
+ __publicField(this, "updateMatrixState", () => {
1751
+ if (!this.camera)
1752
+ return;
1753
+ this._cameraMatrixState.copy(this.camera.matrix);
1754
+ this._gizmoMatrixState.copy(this._gizmos.matrix);
1755
+ if (this.camera.type === "OrthographicCamera") {
1756
+ this._cameraProjectionState.copy(this.camera.projectionMatrix);
1757
+ this.camera.updateProjectionMatrix();
1758
+ this._zoomState = this.camera.zoom;
1759
+ }
1760
+ if (this.camera.type === "PerspectiveCamera") {
1761
+ this._fovState = this.camera.fov;
1762
+ }
1763
+ });
1764
+ /**
1765
+ * Update the trackball FSA
1766
+ * @param {STATE} newState New state of the FSA
1767
+ * @param {Boolean} updateMatrices If matriices state should be updated
1768
+ */
1769
+ __publicField(this, "updateTbState", (newState, updateMatrices) => {
1770
+ this._state = newState;
1771
+ if (updateMatrices) {
1772
+ this.updateMatrixState();
1773
+ }
1774
+ });
1775
+ __publicField(this, "update", () => {
1776
+ const EPS = 1e-6;
1777
+ if (!this.target.equals(this._currentTarget) && this.camera) {
1778
+ this._gizmos.position.set(this.target.x, this.target.y, this.target.z);
1779
+ const tbRadius = this.calculateTbRadius(this.camera);
1780
+ if (tbRadius !== void 0) {
1781
+ this._tbRadius = tbRadius;
1782
+ }
1783
+ this.makeGizmos(this.target, this._tbRadius);
1784
+ this._currentTarget.copy(this.target);
1785
+ }
1786
+ if (!this.camera)
1787
+ return;
1788
+ if (this.camera.type === "OrthographicCamera") {
1789
+ if (this.camera.zoom > this.maxZoom || this.camera.zoom < this.minZoom) {
1790
+ const newZoom = THREE.MathUtils.clamp(this.camera.zoom, this.minZoom, this.maxZoom);
1791
+ this.applyTransformMatrix(this.applyScale(newZoom / this.camera.zoom, this._gizmos.position, true));
1792
+ }
1793
+ }
1794
+ if (this.camera.type === "PerspectiveCamera") {
1795
+ const distance = this.camera.position.distanceTo(this._gizmos.position);
1796
+ if (distance > this.maxDistance + EPS || distance < this.minDistance - EPS) {
1797
+ const newDistance = THREE.MathUtils.clamp(distance, this.minDistance, this.maxDistance);
1798
+ this.applyTransformMatrix(this.applyScale(newDistance / distance, this._gizmos.position));
1799
+ this.updateMatrixState();
1800
+ }
1801
+ if (this.camera.fov < this.minFov || this.camera.fov > this.maxFov) {
1802
+ this.camera.fov = THREE.MathUtils.clamp(this.camera.fov, this.minFov, this.maxFov);
1803
+ this.camera.updateProjectionMatrix();
1804
+ }
1805
+ const oldRadius = this._tbRadius;
1806
+ const tbRadius = this.calculateTbRadius(this.camera);
1807
+ if (tbRadius !== void 0) {
1808
+ this._tbRadius = tbRadius;
1809
+ }
1810
+ if (oldRadius < this._tbRadius - EPS || oldRadius > this._tbRadius + EPS) {
1811
+ const scale = (this._gizmos.scale.x + this._gizmos.scale.y + this._gizmos.scale.z) / 3;
1812
+ const newRadius = this._tbRadius / scale;
1813
+ const curve = new THREE.EllipseCurve(0, 0, newRadius, newRadius);
1814
+ const points = curve.getPoints(this._curvePts);
1815
+ const curveGeometry = new THREE.BufferGeometry().setFromPoints(points);
1816
+ for (const gizmo in this._gizmos.children) {
1817
+ const child = this._gizmos.children[gizmo];
1818
+ child.geometry = curveGeometry;
1819
+ }
1820
+ }
1821
+ }
1822
+ this.camera.lookAt(this._gizmos.position);
1823
+ });
1824
+ __publicField(this, "setStateFromJSON", (json) => {
1825
+ const state = JSON.parse(json);
1826
+ if (state.arcballState && this.camera) {
1827
+ this._cameraMatrixState.fromArray(state.arcballState.cameraMatrix.elements);
1828
+ this._cameraMatrixState.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);
1829
+ this.camera.up.copy(state.arcballState.cameraUp);
1830
+ this.camera.near = state.arcballState.cameraNear;
1831
+ this.camera.far = state.arcballState.cameraFar;
1832
+ this.camera.zoom = state.arcballState.cameraZoom;
1833
+ if (this.camera.type === "PerspectiveCamera") {
1834
+ this.camera.fov = state.arcballState.cameraFov;
1835
+ }
1836
+ this._gizmoMatrixState.fromArray(state.arcballState.gizmoMatrix.elements);
1837
+ this._gizmoMatrixState.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1838
+ this.camera.updateMatrix();
1839
+ this.camera.updateProjectionMatrix();
1840
+ this._gizmos.updateMatrix();
1841
+ const tbRadius = this.calculateTbRadius(this.camera);
1842
+ if (tbRadius !== void 0) {
1843
+ this._tbRadius = tbRadius;
1844
+ }
1845
+ const gizmoTmp = new THREE.Matrix4().copy(this._gizmoMatrixState0);
1846
+ this.makeGizmos(this._gizmos.position, this._tbRadius);
1847
+ this._gizmoMatrixState0.copy(gizmoTmp);
1848
+ this.camera.lookAt(this._gizmos.position);
1849
+ this.updateTbState(STATE.IDLE, false);
1850
+ this.dispatchEvent(_changeEvent);
1851
+ }
1852
+ });
1853
+ this.camera = null;
1854
+ this.domElement = domElement;
1855
+ this.scene = scene;
1856
+ this.mouseActions = [];
1857
+ this._mouseOp = null;
1858
+ this._v2_1 = new THREE.Vector2();
1859
+ this._v3_1 = new THREE.Vector3();
1860
+ this._v3_2 = new THREE.Vector3();
1861
+ this._m4_1 = new THREE.Matrix4();
1862
+ this._m4_2 = new THREE.Matrix4();
1863
+ this._quat = new THREE.Quaternion();
1864
+ this._translationMatrix = new THREE.Matrix4();
1865
+ this._rotationMatrix = new THREE.Matrix4();
1866
+ this._scaleMatrix = new THREE.Matrix4();
1867
+ this._rotationAxis = new THREE.Vector3();
1868
+ this._cameraMatrixState = new THREE.Matrix4();
1869
+ this._cameraProjectionState = new THREE.Matrix4();
1870
+ this._fovState = 1;
1871
+ this._upState = new THREE.Vector3();
1872
+ this._zoomState = 1;
1873
+ this._nearPos = 0;
1874
+ this._farPos = 0;
1875
+ this._gizmoMatrixState = new THREE.Matrix4();
1876
+ this._up0 = new THREE.Vector3();
1877
+ this._zoom0 = 1;
1878
+ this._fov0 = 0;
1879
+ this._initialNear = 0;
1880
+ this._nearPos0 = 0;
1881
+ this._initialFar = 0;
1882
+ this._farPos0 = 0;
1883
+ this._cameraMatrixState0 = new THREE.Matrix4();
1884
+ this._gizmoMatrixState0 = new THREE.Matrix4();
1885
+ this._button = -1;
1886
+ this._touchStart = [];
1887
+ this._touchCurrent = [];
1888
+ this._input = INPUT.NONE;
1889
+ this._switchSensibility = 32;
1890
+ this._startFingerDistance = 0;
1891
+ this._currentFingerDistance = 0;
1892
+ this._startFingerRotation = 0;
1893
+ this._currentFingerRotation = 0;
1894
+ this._devPxRatio = 0;
1895
+ this._downValid = true;
1896
+ this._nclicks = 0;
1897
+ this._downEvents = [];
1898
+ this._clickStart = 0;
1899
+ this._maxDownTime = 250;
1900
+ this._maxInterval = 300;
1901
+ this._posThreshold = 24;
1902
+ this._movementThreshold = 24;
1903
+ this._currentCursorPosition = new THREE.Vector3();
1904
+ this._startCursorPosition = new THREE.Vector3();
1905
+ this._grid = null;
1906
+ this._gridPosition = new THREE.Vector3();
1907
+ this._gizmos = new THREE.Group();
1908
+ this._curvePts = 128;
1909
+ this._timeStart = -1;
1910
+ this._animationId = -1;
1911
+ this.focusAnimationTime = 500;
1912
+ this._timePrev = 0;
1913
+ this._timeCurrent = 0;
1914
+ this._anglePrev = 0;
1915
+ this._angleCurrent = 0;
1916
+ this._cursorPosPrev = new THREE.Vector3();
1917
+ this._cursorPosCurr = new THREE.Vector3();
1918
+ this._wPrev = 0;
1919
+ this._wCurr = 0;
1920
+ this.adjustNearFar = false;
1921
+ this.scaleFactor = 1.1;
1922
+ this.dampingFactor = 25;
1923
+ this.wMax = 20;
1924
+ this.enableAnimations = true;
1925
+ this.enableGrid = false;
1926
+ this.cursorZoom = false;
1927
+ this.minFov = 5;
1928
+ this.maxFov = 90;
1929
+ this.enabled = true;
1930
+ this.enablePan = true;
1931
+ this.enableRotate = true;
1932
+ this.enableZoom = true;
1933
+ this.minDistance = 0;
1934
+ this.maxDistance = Infinity;
1935
+ this.minZoom = 0;
1936
+ this.maxZoom = Infinity;
1937
+ this.target = new THREE.Vector3(0, 0, 0);
1938
+ this._currentTarget = new THREE.Vector3(0, 0, 0);
1939
+ this._tbRadius = 1;
1940
+ this._state = STATE.IDLE;
1941
+ this.setCamera(camera);
1942
+ if (this.scene) {
1943
+ this.scene.add(this._gizmos);
1944
+ }
1945
+ this._devPxRatio = window.devicePixelRatio;
1946
+ this.initializeMouseActions();
1947
+ if (this.domElement)
1948
+ this.connect(this.domElement);
1949
+ window.addEventListener("resize", this.onWindowResize);
1950
+ }
1951
+ /**
1952
+ * Apply a transformation matrix, to the camera and gizmos
1953
+ * @param {Object} transformation Object containing matrices to apply to camera and gizmos
1954
+ */
1955
+ applyTransformMatrix(transformation) {
1956
+ if ((transformation == null ? void 0 : transformation.camera) && this.camera) {
1957
+ this._m4_1.copy(this._cameraMatrixState).premultiply(transformation.camera);
1958
+ this._m4_1.decompose(this.camera.position, this.camera.quaternion, this.camera.scale);
1959
+ this.camera.updateMatrix();
1960
+ if (this._state == STATE.ROTATE || this._state == STATE.ZROTATE || this._state == STATE.ANIMATION_ROTATE) {
1961
+ this.camera.up.copy(this._upState).applyQuaternion(this.camera.quaternion);
1962
+ }
1963
+ }
1964
+ if (transformation == null ? void 0 : transformation.gizmos) {
1965
+ this._m4_1.copy(this._gizmoMatrixState).premultiply(transformation.gizmos);
1966
+ this._m4_1.decompose(this._gizmos.position, this._gizmos.quaternion, this._gizmos.scale);
1967
+ this._gizmos.updateMatrix();
1968
+ }
1969
+ if ((this._state == STATE.SCALE || this._state == STATE.FOCUS || this._state == STATE.ANIMATION_FOCUS) && this.camera) {
1970
+ const tbRadius = this.calculateTbRadius(this.camera);
1971
+ if (tbRadius !== void 0) {
1972
+ this._tbRadius = tbRadius;
1973
+ }
1974
+ if (this.adjustNearFar) {
1975
+ const cameraDistance = this.camera.position.distanceTo(this._gizmos.position);
1976
+ const bb = new THREE.Box3();
1977
+ bb.setFromObject(this._gizmos);
1978
+ const sphere = new THREE.Sphere();
1979
+ bb.getBoundingSphere(sphere);
1980
+ const adjustedNearPosition = Math.max(this._nearPos0, sphere.radius + sphere.center.length());
1981
+ const regularNearPosition = cameraDistance - this._initialNear;
1982
+ const minNearPos = Math.min(adjustedNearPosition, regularNearPosition);
1983
+ this.camera.near = cameraDistance - minNearPos;
1984
+ const adjustedFarPosition = Math.min(this._farPos0, -sphere.radius + sphere.center.length());
1985
+ const regularFarPosition = cameraDistance - this._initialFar;
1986
+ const minFarPos = Math.min(adjustedFarPosition, regularFarPosition);
1987
+ this.camera.far = cameraDistance - minFarPos;
1988
+ this.camera.updateProjectionMatrix();
1989
+ } else {
1990
+ let update = false;
1991
+ if (this.camera.near != this._initialNear) {
1992
+ this.camera.near = this._initialNear;
1993
+ update = true;
1994
+ }
1995
+ if (this.camera.far != this._initialFar) {
1996
+ this.camera.far = this._initialFar;
1997
+ update = true;
1998
+ }
1999
+ if (update) {
2000
+ this.camera.updateProjectionMatrix();
2001
+ }
2002
+ }
2003
+ }
2004
+ }
2005
+ /**
2006
+ * Set gizmos visibility
2007
+ * @param {Boolean} value Value of gizmos visibility
2008
+ */
2009
+ setGizmosVisible(value) {
2010
+ this._gizmos.visible = value;
2011
+ this.dispatchEvent(_changeEvent);
2012
+ }
2013
+ /**
2014
+ * Set values in transformation object
2015
+ * @param {Matrix4} camera Transformation to be applied to the camera
2016
+ * @param {Matrix4} gizmos Transformation to be applied to gizmos
2017
+ */
2018
+ setTransformationMatrices(camera = null, gizmos = null) {
2019
+ if (camera) {
2020
+ if (_transformation.camera) {
2021
+ _transformation.camera.copy(camera);
2022
+ } else {
2023
+ _transformation.camera = camera.clone();
2024
+ }
2025
+ } else {
2026
+ _transformation.camera = null;
2027
+ }
2028
+ if (gizmos) {
2029
+ if (_transformation.gizmos) {
2030
+ _transformation.gizmos.copy(gizmos);
2031
+ } else {
2032
+ _transformation.gizmos = gizmos.clone();
2033
+ }
2034
+ } else {
2035
+ _transformation.gizmos = null;
2036
+ }
2037
+ }
2038
+ }
2039
+ exports.ArcballControls = ArcballControls;