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