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