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