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