three-stdlib 2.25.0 → 2.25.1
Sign up to get free protection for your applications and to get access to all the features.
- package/index.cjs +116401 -611
- package/index.js +116037 -263
- package/package.json +17 -4
- package/_polyfill/CapsuleGeometry.cjs +0 -22
- package/_polyfill/CapsuleGeometry.js +0 -22
- package/_polyfill/CompressedArrayTexture.cjs +0 -12
- package/_polyfill/CompressedArrayTexture.js +0 -12
- package/_polyfill/Data3DTexture.cjs +0 -17
- package/_polyfill/Data3DTexture.js +0 -17
- package/animation/AnimationClipCreator.cjs +0 -56
- package/animation/AnimationClipCreator.js +0 -56
- package/animation/CCDIKSolver.cjs +0 -269
- package/animation/CCDIKSolver.js +0 -269
- package/animation/MMDAnimationHelper.cjs +0 -688
- package/animation/MMDAnimationHelper.js +0 -688
- package/animation/MMDPhysics.cjs +0 -830
- package/animation/MMDPhysics.js +0 -830
- package/cameras/CinematicCamera.cjs +0 -131
- package/cameras/CinematicCamera.js +0 -131
- package/controls/ArcballControls.cjs +0 -2033
- package/controls/ArcballControls.js +0 -2033
- package/controls/DeviceOrientationControls.cjs +0 -85
- package/controls/DeviceOrientationControls.js +0 -85
- package/controls/DragControls.cjs +0 -182
- package/controls/DragControls.js +0 -182
- package/controls/FirstPersonControls.cjs +0 -229
- package/controls/FirstPersonControls.js +0 -229
- package/controls/FlyControls.cjs +0 -248
- package/controls/FlyControls.js +0 -248
- package/controls/OrbitControls.cjs +0 -791
- package/controls/OrbitControls.js +0 -791
- package/controls/PointerLockControls.cjs +0 -103
- package/controls/PointerLockControls.js +0 -103
- package/controls/TrackballControls.cjs +0 -502
- package/controls/TrackballControls.js +0 -502
- package/controls/TransformControls.cjs +0 -1089
- package/controls/TransformControls.js +0 -1089
- package/controls/experimental/CameraControls.cjs +0 -736
- package/controls/experimental/CameraControls.js +0 -736
- package/csm/CSM.cjs +0 -244
- package/csm/CSM.js +0 -244
- package/csm/CSMFrustum.cjs +0 -75
- package/csm/CSMFrustum.js +0 -75
- package/csm/CSMHelper.cjs +0 -114
- package/csm/CSMHelper.js +0 -114
- package/csm/CSMShader.cjs +0 -261
- package/csm/CSMShader.js +0 -261
- package/curves/CurveExtras.cjs +0 -214
- package/curves/CurveExtras.js +0 -214
- package/curves/NURBSCurve.cjs +0 -35
- package/curves/NURBSCurve.js +0 -35
- package/curves/NURBSSurface.cjs +0 -28
- package/curves/NURBSSurface.js +0 -28
- package/curves/NURBSUtils.cjs +0 -226
- package/curves/NURBSUtils.js +0 -226
- package/deprecated/Geometry.cjs +0 -971
- package/deprecated/Geometry.js +0 -971
- package/effects/AnaglyphEffect.cjs +0 -102
- package/effects/AnaglyphEffect.js +0 -102
- package/effects/AsciiEffect.cjs +0 -155
- package/effects/AsciiEffect.js +0 -155
- package/effects/OutlineEffect.cjs +0 -275
- package/effects/OutlineEffect.js +0 -275
- package/effects/ParallaxBarrierEffect.cjs +0 -65
- package/effects/ParallaxBarrierEffect.js +0 -65
- package/effects/PeppersGhostEffect.cjs +0 -88
- package/effects/PeppersGhostEffect.js +0 -88
- package/effects/StereoEffect.cjs +0 -35
- package/effects/StereoEffect.js +0 -35
- package/environments/RoomEnvironment.cjs +0 -95
- package/environments/RoomEnvironment.js +0 -78
- package/exporters/ColladaExporter.cjs +0 -331
- package/exporters/ColladaExporter.js +0 -331
- package/exporters/DRACOExporter.cjs +0 -141
- package/exporters/DRACOExporter.js +0 -141
- package/exporters/GLTFExporter.cjs +0 -1909
- package/exporters/GLTFExporter.js +0 -1909
- package/exporters/MMDExporter.cjs +0 -131
- package/exporters/MMDExporter.js +0 -131
- package/exporters/OBJExporter.cjs +0 -181
- package/exporters/OBJExporter.js +0 -181
- package/exporters/PLYExporter.cjs +0 -280
- package/exporters/PLYExporter.js +0 -280
- package/exporters/STLExporter.cjs +0 -146
- package/exporters/STLExporter.js +0 -146
- package/exporters/USDZExporter.cjs +0 -340
- package/exporters/USDZExporter.js +0 -340
- package/geometries/BoxLineGeometry.cjs +0 -45
- package/geometries/BoxLineGeometry.js +0 -45
- package/geometries/ConvexGeometry.cjs +0 -26
- package/geometries/ConvexGeometry.js +0 -26
- package/geometries/DecalGeometry.cjs +0 -184
- package/geometries/DecalGeometry.js +0 -184
- package/geometries/LightningStrike.cjs +0 -553
- package/geometries/LightningStrike.js +0 -553
- package/geometries/ParametricGeometries.cjs +0 -130
- package/geometries/ParametricGeometries.js +0 -130
- package/geometries/ParametricGeometry.cjs +0 -63
- package/geometries/ParametricGeometry.js +0 -63
- package/geometries/RoundedBoxGeometry.cjs +0 -91
- package/geometries/RoundedBoxGeometry.js +0 -91
- package/geometries/TeapotGeometry.cjs +0 -1563
- package/geometries/TeapotGeometry.js +0 -1563
- package/geometries/TextGeometry.cjs +0 -27
- package/geometries/TextGeometry.js +0 -27
- package/helpers/LightProbeHelper.cjs +0 -73
- package/helpers/LightProbeHelper.js +0 -73
- package/helpers/PositionalAudioHelper.cjs +0 -68
- package/helpers/PositionalAudioHelper.js +0 -68
- package/helpers/RectAreaLightHelper.cjs +0 -44
- package/helpers/RectAreaLightHelper.js +0 -44
- package/helpers/VertexNormalsHelper.cjs +0 -47
- package/helpers/VertexNormalsHelper.js +0 -47
- package/helpers/VertexTangentsHelper.cjs +0 -43
- package/helpers/VertexTangentsHelper.js +0 -43
- package/interactive/HTMLMesh.cjs +0 -325
- package/interactive/HTMLMesh.js +0 -325
- package/interactive/InteractiveGroup.cjs +0 -68
- package/interactive/InteractiveGroup.js +0 -68
- package/interactive/SelectionBox.cjs +0 -134
- package/interactive/SelectionBox.js +0 -134
- package/interactive/SelectionHelper.cjs +0 -51
- package/interactive/SelectionHelper.js +0 -51
- package/libs/MeshoptDecoder.cjs +0 -221
- package/libs/MeshoptDecoder.js +0 -221
- package/libs/MotionControllers.cjs +0 -325
- package/libs/MotionControllers.js +0 -325
- package/lights/LightProbeGenerator.cjs +0 -145
- package/lights/LightProbeGenerator.js +0 -145
- package/lights/RectAreaLightUniformsLib.cjs +0 -32846
- package/lights/RectAreaLightUniformsLib.js +0 -32846
- package/lines/Line2.cjs +0 -13
- package/lines/Line2.js +0 -13
- package/lines/LineGeometry.cjs +0 -44
- package/lines/LineGeometry.js +0 -44
- package/lines/LineMaterial.cjs +0 -547
- package/lines/LineMaterial.js +0 -547
- package/lines/LineSegments2.cjs +0 -203
- package/lines/LineSegments2.js +0 -203
- package/lines/LineSegmentsGeometry.cjs +0 -124
- package/lines/LineSegmentsGeometry.js +0 -124
- package/lines/Wireframe.cjs +0 -32
- package/lines/Wireframe.js +0 -32
- package/lines/WireframeGeometry2.cjs +0 -13
- package/lines/WireframeGeometry2.js +0 -13
- package/loaders/3DMLoader.cjs +0 -803
- package/loaders/3DMLoader.js +0 -803
- package/loaders/3MFLoader.cjs +0 -854
- package/loaders/3MFLoader.js +0 -854
- package/loaders/AMFLoader.cjs +0 -284
- package/loaders/AMFLoader.js +0 -284
- package/loaders/AssimpLoader.cjs +0 -1434
- package/loaders/AssimpLoader.js +0 -1434
- package/loaders/BVHLoader.cjs +0 -207
- package/loaders/BVHLoader.js +0 -207
- package/loaders/BasisTextureLoader.cjs +0 -489
- package/loaders/BasisTextureLoader.js +0 -489
- package/loaders/ColladaLoader.cjs +0 -2405
- package/loaders/ColladaLoader.js +0 -2405
- package/loaders/DDSLoader.cjs +0 -148
- package/loaders/DDSLoader.js +0 -148
- package/loaders/DRACOLoader.cjs +0 -341
- package/loaders/DRACOLoader.js +0 -341
- package/loaders/EXRLoader.cjs +0 -1356
- package/loaders/EXRLoader.js +0 -1356
- package/loaders/FBXLoader.cjs +0 -2457
- package/loaders/FBXLoader.js +0 -2457
- package/loaders/FontLoader.cjs +0 -123
- package/loaders/FontLoader.js +0 -123
- package/loaders/GCodeLoader.cjs +0 -141
- package/loaders/GCodeLoader.js +0 -141
- package/loaders/GLTFLoader.cjs +0 -2504
- package/loaders/GLTFLoader.js +0 -2504
- package/loaders/HDRCubeTextureLoader.cjs +0 -75
- package/loaders/HDRCubeTextureLoader.js +0 -75
- package/loaders/KMZLoader.cjs +0 -75
- package/loaders/KMZLoader.js +0 -75
- package/loaders/KTX2Loader.cjs +0 -480
- package/loaders/KTX2Loader.js +0 -480
- package/loaders/KTXLoader.cjs +0 -93
- package/loaders/KTXLoader.js +0 -93
- package/loaders/LDrawLoader.cjs +0 -1424
- package/loaders/LDrawLoader.js +0 -1424
- package/loaders/LUT3dlLoader.cjs +0 -103
- package/loaders/LUT3dlLoader.js +0 -103
- package/loaders/LUTCubeLoader.cjs +0 -107
- package/loaders/LUTCubeLoader.js +0 -107
- package/loaders/LWOLoader.cjs +0 -645
- package/loaders/LWOLoader.js +0 -645
- package/loaders/LottieLoader.cjs +0 -47
- package/loaders/LottieLoader.js +0 -47
- package/loaders/MD2Loader.cjs +0 -359
- package/loaders/MD2Loader.js +0 -359
- package/loaders/MDDLoader.cjs +0 -58
- package/loaders/MDDLoader.js +0 -58
- package/loaders/MMDLoader.cjs +0 -1121
- package/loaders/MMDLoader.js +0 -1121
- package/loaders/MTLLoader.cjs +0 -304
- package/loaders/MTLLoader.js +0 -304
- package/loaders/NRRDLoader.cjs +0 -401
- package/loaders/NRRDLoader.js +0 -401
- package/loaders/OBJLoader.cjs +0 -487
- package/loaders/OBJLoader.js +0 -487
- package/loaders/PCDLoader.cjs +0 -248
- package/loaders/PCDLoader.js +0 -248
- package/loaders/PDBLoader.cjs +0 -247
- package/loaders/PDBLoader.js +0 -247
- package/loaders/PLYLoader.cjs +0 -317
- package/loaders/PLYLoader.js +0 -317
- package/loaders/PRWMLoader.cjs +0 -160
- package/loaders/PRWMLoader.js +0 -160
- package/loaders/PVRLoader.cjs +0 -131
- package/loaders/PVRLoader.js +0 -131
- package/loaders/RGBELoader.cjs +0 -252
- package/loaders/RGBELoader.js +0 -252
- package/loaders/RGBMLoader.cjs +0 -1004
- package/loaders/RGBMLoader.js +0 -1004
- package/loaders/STLLoader.cjs +0 -190
- package/loaders/STLLoader.js +0 -190
- package/loaders/SVGLoader.cjs +0 -1712
- package/loaders/SVGLoader.js +0 -1712
- package/loaders/TDSLoader.cjs +0 -650
- package/loaders/TDSLoader.js +0 -650
- package/loaders/TGALoader.cjs +0 -285
- package/loaders/TGALoader.js +0 -285
- package/loaders/TTFLoader.cjs +0 -131
- package/loaders/TTFLoader.js +0 -131
- package/loaders/TiltLoader.cjs +0 -375
- package/loaders/TiltLoader.js +0 -375
- package/loaders/VOXLoader.cjs +0 -432
- package/loaders/VOXLoader.js +0 -432
- package/loaders/VRMLLoader.cjs +0 -2105
- package/loaders/VRMLLoader.js +0 -2105
- package/loaders/VRMLoader.cjs +0 -38
- package/loaders/VRMLoader.js +0 -38
- package/loaders/VTKLoader.cjs +0 -648
- package/loaders/VTKLoader.js +0 -648
- package/loaders/XLoader.cjs +0 -1258
- package/loaders/XLoader.js +0 -1258
- package/loaders/XYZLoader.cjs +0 -60
- package/loaders/XYZLoader.js +0 -60
- package/loaders/lwo/IFFParser.cjs +0 -743
- package/loaders/lwo/IFFParser.js +0 -743
- package/loaders/lwo/LWO2Parser.cjs +0 -312
- package/loaders/lwo/LWO2Parser.js +0 -312
- package/loaders/lwo/LWO3Parser.cjs +0 -282
- package/loaders/lwo/LWO3Parser.js +0 -282
- package/math/Capsule.cjs +0 -98
- package/math/Capsule.js +0 -98
- package/math/ColorConverter.cjs +0 -42
- package/math/ColorConverter.js +0 -42
- package/math/ConvexHull.cjs +0 -596
- package/math/ConvexHull.js +0 -596
- package/math/ImprovedNoise.cjs +0 -304
- package/math/ImprovedNoise.js +0 -304
- package/math/Lut.cjs +0 -137
- package/math/Lut.js +0 -137
- package/math/MeshSurfaceSampler.cjs +0 -103
- package/math/MeshSurfaceSampler.js +0 -103
- package/math/OBB.cjs +0 -242
- package/math/OBB.js +0 -242
- package/math/Octree.cjs +0 -273
- package/math/Octree.js +0 -273
- package/math/SimplexNoise.cjs +0 -440
- package/math/SimplexNoise.js +0 -440
- package/misc/ConvexObjectBreaker.cjs +0 -292
- package/misc/ConvexObjectBreaker.js +0 -292
- package/misc/GPUComputationRenderer.cjs +0 -205
- package/misc/GPUComputationRenderer.js +0 -205
- package/misc/Gyroscope.cjs +0 -33
- package/misc/Gyroscope.js +0 -33
- package/misc/MD2Character.cjs +0 -167
- package/misc/MD2Character.js +0 -167
- package/misc/MD2CharacterComplex.cjs +0 -332
- package/misc/MD2CharacterComplex.js +0 -332
- package/misc/MorphAnimMesh.cjs +0 -40
- package/misc/MorphAnimMesh.js +0 -40
- package/misc/MorphBlendMesh.cjs +0 -179
- package/misc/MorphBlendMesh.js +0 -179
- package/misc/ProgressiveLightmap.cjs +0 -186
- package/misc/ProgressiveLightmap.js +0 -186
- package/misc/RollerCoaster.cjs +0 -353
- package/misc/RollerCoaster.js +0 -353
- package/misc/Timer.cjs +0 -101
- package/misc/Timer.js +0 -101
- package/misc/TubePainter.cjs +0 -123
- package/misc/TubePainter.js +0 -123
- package/misc/Volume.cjs +0 -305
- package/misc/Volume.js +0 -305
- package/misc/VolumeSlice.cjs +0 -114
- package/misc/VolumeSlice.js +0 -114
- package/misc/WebGL.cjs +0 -74
- package/misc/WebGL.js +0 -74
- package/modifiers/CurveModifier.cjs +0 -232
- package/modifiers/CurveModifier.js +0 -232
- package/modifiers/EdgeSplitModifier.cjs +0 -167
- package/modifiers/EdgeSplitModifier.js +0 -168
- package/modifiers/SimplifyModifier.cjs +0 -301
- package/modifiers/SimplifyModifier.js +0 -301
- package/modifiers/TessellateModifier.cjs +0 -214
- package/modifiers/TessellateModifier.js +0 -214
- package/objects/GroundProjectedEnv.cjs +0 -134
- package/objects/GroundProjectedEnv.js +0 -134
- package/objects/Lensflare.cjs +0 -291
- package/objects/Lensflare.js +0 -291
- package/objects/LightningStorm.cjs +0 -110
- package/objects/LightningStorm.js +0 -110
- package/objects/MarchingCubes.cjs +0 -4809
- package/objects/MarchingCubes.js +0 -4809
- package/objects/Reflector.cjs +0 -202
- package/objects/Reflector.js +0 -202
- package/objects/ReflectorForSSRPass.cjs +0 -260
- package/objects/ReflectorForSSRPass.js +0 -260
- package/objects/ReflectorRTT.cjs +0 -10
- package/objects/ReflectorRTT.js +0 -10
- package/objects/Refractor.cjs +0 -215
- package/objects/Refractor.js +0 -215
- package/objects/ShadowMesh.cjs +0 -45
- package/objects/ShadowMesh.js +0 -45
- package/objects/Sky.cjs +0 -200
- package/objects/Sky.js +0 -200
- package/objects/Water.cjs +0 -242
- package/objects/Water.js +0 -242
- package/objects/Water2.cjs +0 -256
- package/objects/Water2.js +0 -256
- package/physics/AmmoPhysics.cjs +0 -166
- package/physics/AmmoPhysics.js +0 -166
- package/postprocessing/AdaptiveToneMappingPass.cjs +0 -218
- package/postprocessing/AdaptiveToneMappingPass.js +0 -218
- package/postprocessing/AfterimagePass.cjs +0 -68
- package/postprocessing/AfterimagePass.js +0 -68
- package/postprocessing/BloomPass.cjs +0 -109
- package/postprocessing/BloomPass.js +0 -109
- package/postprocessing/BokehPass.cjs +0 -90
- package/postprocessing/BokehPass.js +0 -90
- package/postprocessing/ClearPass.cjs +0 -36
- package/postprocessing/ClearPass.js +0 -36
- package/postprocessing/CubeTexturePass.cjs +0 -53
- package/postprocessing/CubeTexturePass.js +0 -53
- package/postprocessing/DotScreenPass.cjs +0 -49
- package/postprocessing/DotScreenPass.js +0 -49
- package/postprocessing/EffectComposer.cjs +0 -157
- package/postprocessing/EffectComposer.js +0 -157
- package/postprocessing/FilmPass.cjs +0 -51
- package/postprocessing/FilmPass.js +0 -51
- package/postprocessing/GlitchPass.cjs +0 -84
- package/postprocessing/GlitchPass.js +0 -84
- package/postprocessing/HalftonePass.cjs +0 -53
- package/postprocessing/HalftonePass.js +0 -53
- package/postprocessing/LUTPass.cjs +0 -142
- package/postprocessing/LUTPass.js +0 -142
- package/postprocessing/MaskPass.cjs +0 -69
- package/postprocessing/MaskPass.js +0 -69
- package/postprocessing/OutlinePass.cjs +0 -479
- package/postprocessing/OutlinePass.js +0 -479
- package/postprocessing/Pass.cjs +0 -48
- package/postprocessing/Pass.js +0 -48
- package/postprocessing/RenderPass.cjs +0 -59
- package/postprocessing/RenderPass.js +0 -59
- package/postprocessing/RenderPixelatedPass.cjs +0 -199
- package/postprocessing/RenderPixelatedPass.js +0 -199
- package/postprocessing/SAOPass.cjs +0 -288
- package/postprocessing/SAOPass.js +0 -288
- package/postprocessing/SMAAPass.cjs +0 -112
- package/postprocessing/SMAAPass.js +0 -112
- package/postprocessing/SSAARenderPass.cjs +0 -189
- package/postprocessing/SSAARenderPass.js +0 -189
- package/postprocessing/SSAOPass.cjs +0 -272
- package/postprocessing/SSAOPass.js +0 -272
- package/postprocessing/SSRPass.cjs +0 -411
- package/postprocessing/SSRPass.js +0 -411
- package/postprocessing/SavePass.cjs +0 -38
- package/postprocessing/SavePass.js +0 -38
- package/postprocessing/ShaderPass.cjs +0 -49
- package/postprocessing/ShaderPass.js +0 -49
- package/postprocessing/TAARenderPass.cjs +0 -174
- package/postprocessing/TAARenderPass.js +0 -174
- package/postprocessing/TexturePass.cjs +0 -42
- package/postprocessing/TexturePass.js +0 -42
- package/postprocessing/UnrealBloomPass.cjs +0 -277
- package/postprocessing/UnrealBloomPass.js +0 -277
- package/postprocessing/WaterPass.cjs +0 -72
- package/postprocessing/WaterPass.js +0 -72
- package/renderers/CSS2DRenderer.cjs +0 -122
- package/renderers/CSS2DRenderer.js +0 -122
- package/renderers/CSS3DRenderer.cjs +0 -167
- package/renderers/CSS3DRenderer.js +0 -167
- package/renderers/Projector.cjs +0 -499
- package/renderers/Projector.js +0 -499
- package/renderers/SVGRenderer.cjs +0 -311
- package/renderers/SVGRenderer.js +0 -311
- package/shaders/ACESFilmicToneMappingShader.cjs +0 -55
- package/shaders/ACESFilmicToneMappingShader.js +0 -55
- package/shaders/AfterimageShader.cjs +0 -32
- package/shaders/AfterimageShader.js +0 -32
- package/shaders/BasicShader.cjs +0 -12
- package/shaders/BasicShader.js +0 -12
- package/shaders/BleachBypassShader.cjs +0 -35
- package/shaders/BleachBypassShader.js +0 -35
- package/shaders/BlendShader.cjs +0 -30
- package/shaders/BlendShader.js +0 -30
- package/shaders/BokehShader.cjs +0 -109
- package/shaders/BokehShader.js +0 -109
- package/shaders/BokehShader2.cjs +0 -269
- package/shaders/BokehShader2.js +0 -269
- package/shaders/BrightnessContrastShader.cjs +0 -32
- package/shaders/BrightnessContrastShader.js +0 -32
- package/shaders/ColorCorrectionShader.cjs +0 -30
- package/shaders/ColorCorrectionShader.js +0 -30
- package/shaders/ColorifyShader.cjs +0 -28
- package/shaders/ColorifyShader.js +0 -28
- package/shaders/ConvolutionShader.cjs +0 -55
- package/shaders/ConvolutionShader.js +0 -55
- package/shaders/CopyShader.cjs +0 -25
- package/shaders/CopyShader.js +0 -25
- package/shaders/DOFMipMapShader.cjs +0 -32
- package/shaders/DOFMipMapShader.js +0 -32
- package/shaders/DepthLimitedBlurShader.cjs +0 -114
- package/shaders/DepthLimitedBlurShader.js +0 -114
- package/shaders/DigitalGlitch.cjs +0 -85
- package/shaders/DigitalGlitch.js +0 -85
- package/shaders/DotScreenShader.cjs +0 -39
- package/shaders/DotScreenShader.js +0 -39
- package/shaders/FXAAShader.cjs +0 -1098
- package/shaders/FXAAShader.js +0 -1098
- package/shaders/FilmShader.cjs +0 -53
- package/shaders/FilmShader.js +0 -53
- package/shaders/FocusShader.cjs +0 -55
- package/shaders/FocusShader.js +0 -55
- package/shaders/FreiChenShader.cjs +0 -64
- package/shaders/FreiChenShader.js +0 -64
- package/shaders/FresnelShader.cjs +0 -47
- package/shaders/FresnelShader.js +0 -47
- package/shaders/GammaCorrectionShader.cjs +0 -23
- package/shaders/GammaCorrectionShader.js +0 -23
- package/shaders/GodRaysShader.cjs +0 -183
- package/shaders/GodRaysShader.js +0 -183
- package/shaders/HalftoneShader.cjs +0 -228
- package/shaders/HalftoneShader.js +0 -228
- package/shaders/HorizontalBlurShader.cjs +0 -49
- package/shaders/HorizontalBlurShader.js +0 -49
- package/shaders/HorizontalTiltShiftShader.cjs +0 -37
- package/shaders/HorizontalTiltShiftShader.js +0 -37
- package/shaders/HueSaturationShader.cjs +0 -43
- package/shaders/HueSaturationShader.js +0 -43
- package/shaders/KaleidoShader.cjs +0 -34
- package/shaders/KaleidoShader.js +0 -34
- package/shaders/LuminosityHighPassShader.cjs +0 -37
- package/shaders/LuminosityHighPassShader.js +0 -37
- package/shaders/LuminosityShader.cjs +0 -25
- package/shaders/LuminosityShader.js +0 -25
- package/shaders/MirrorShader.cjs +0 -35
- package/shaders/MirrorShader.js +0 -35
- package/shaders/NormalMapShader.cjs +0 -31
- package/shaders/NormalMapShader.js +0 -31
- package/shaders/ParallaxShader.cjs +0 -133
- package/shaders/ParallaxShader.js +0 -133
- package/shaders/PixelShader.cjs +0 -28
- package/shaders/PixelShader.js +0 -28
- package/shaders/RGBShiftShader.cjs +0 -30
- package/shaders/RGBShiftShader.js +0 -30
- package/shaders/SAOShader.cjs +0 -144
- package/shaders/SAOShader.js +0 -144
- package/shaders/SMAAShader.cjs +0 -358
- package/shaders/SMAAShader.js +0 -358
- package/shaders/SSAOShader.cjs +0 -182
- package/shaders/SSAOShader.js +0 -182
- package/shaders/SSRShader.cjs +0 -342
- package/shaders/SSRShader.js +0 -342
- package/shaders/SepiaShader.cjs +0 -29
- package/shaders/SepiaShader.js +0 -29
- package/shaders/SobelOperatorShader.cjs +0 -54
- package/shaders/SobelOperatorShader.js +0 -54
- package/shaders/SubsurfaceScatteringShader.cjs +0 -98
- package/shaders/SubsurfaceScatteringShader.js +0 -98
- package/shaders/TechnicolorShader.cjs +0 -24
- package/shaders/TechnicolorShader.js +0 -24
- package/shaders/ToneMapShader.cjs +0 -51
- package/shaders/ToneMapShader.js +0 -51
- package/shaders/ToonShader.cjs +0 -188
- package/shaders/ToonShader.js +0 -188
- package/shaders/TriangleBlurShader.cjs +0 -37
- package/shaders/TriangleBlurShader.js +0 -37
- package/shaders/UnpackDepthRGBAShader.cjs +0 -26
- package/shaders/UnpackDepthRGBAShader.js +0 -26
- package/shaders/VerticalBlurShader.cjs +0 -50
- package/shaders/VerticalBlurShader.js +0 -50
- package/shaders/VerticalTiltShiftShader.cjs +0 -37
- package/shaders/VerticalTiltShiftShader.js +0 -37
- package/shaders/VignetteShader.cjs +0 -38
- package/shaders/VignetteShader.js +0 -38
- package/shaders/VolumeShader.cjs +0 -225
- package/shaders/VolumeShader.js +0 -225
- package/shaders/WaterRefractionShader.cjs +0 -59
- package/shaders/WaterRefractionShader.js +0 -59
- package/shaders/types.cjs +0 -1
- package/shaders/types.js +0 -1
- package/textures/FlakesTexture.cjs +0 -30
- package/textures/FlakesTexture.js +0 -30
- package/types/helpers.cjs +0 -4
- package/types/helpers.js +0 -4
- package/utils/BufferGeometryUtils.cjs +0 -636
- package/utils/BufferGeometryUtils.js +0 -636
- package/utils/GeometryCompressionUtils.cjs +0 -573
- package/utils/GeometryCompressionUtils.js +0 -573
- package/utils/GeometryUtils.cjs +0 -109
- package/utils/GeometryUtils.js +0 -109
- package/utils/RoughnessMipmapper.cjs +0 -223
- package/utils/RoughnessMipmapper.js +0 -223
- package/utils/SceneUtils.cjs +0 -36
- package/utils/SceneUtils.js +0 -36
- package/utils/ShadowMapViewer.cjs +0 -111
- package/utils/ShadowMapViewer.js +0 -111
- package/utils/SkeletonUtils.cjs +0 -211
- package/utils/SkeletonUtils.js +0 -211
- package/utils/UVsDebug.cjs +0 -80
- package/utils/UVsDebug.js +0 -80
- package/utils/WorkerPool.cjs +0 -62
- package/utils/WorkerPool.js +0 -62
- package/webxr/ARButton.cjs +0 -119
- package/webxr/ARButton.js +0 -119
- package/webxr/OculusHandModel.cjs +0 -82
- package/webxr/OculusHandModel.js +0 -82
- package/webxr/OculusHandPointerModel.cjs +0 -241
- package/webxr/OculusHandPointerModel.js +0 -224
- package/webxr/Text2D.cjs +0 -48
- package/webxr/Text2D.js +0 -31
- package/webxr/VRButton.cjs +0 -111
- package/webxr/VRButton.js +0 -111
- package/webxr/XRControllerModelFactory.cjs +0 -174
- package/webxr/XRControllerModelFactory.js +0 -174
- package/webxr/XREstimatedLight.cjs +0 -126
- package/webxr/XREstimatedLight.js +0 -126
- package/webxr/XRHandMeshModel.cjs +0 -82
- package/webxr/XRHandMeshModel.js +0 -82
- package/webxr/XRHandModelFactory.cjs +0 -61
- package/webxr/XRHandModelFactory.js +0 -61
- package/webxr/XRHandPrimitiveModel.cjs +0 -68
- package/webxr/XRHandPrimitiveModel.js +0 -68
@@ -1,1089 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3
|
-
var __publicField = (obj, key, value) => {
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
5
|
-
return value;
|
6
|
-
};
|
7
|
-
import { Object3D, Raycaster, Vector3, Quaternion, Euler, Matrix4, MeshBasicMaterial, DoubleSide, LineBasicMaterial, CylinderGeometry, BoxGeometry, BufferGeometry, Float32BufferAttribute, Mesh, Line, OctahedronGeometry, PlaneGeometry, TorusGeometry, SphereGeometry, Color } from "three";
|
8
|
-
class TransformControls extends Object3D {
|
9
|
-
constructor(camera, domElement) {
|
10
|
-
super();
|
11
|
-
__publicField(this, "isTransformControls", true);
|
12
|
-
__publicField(this, "visible", false);
|
13
|
-
__publicField(this, "domElement");
|
14
|
-
__publicField(this, "raycaster", new Raycaster());
|
15
|
-
__publicField(this, "gizmo");
|
16
|
-
__publicField(this, "plane");
|
17
|
-
__publicField(this, "tempVector", new Vector3());
|
18
|
-
__publicField(this, "tempVector2", new Vector3());
|
19
|
-
__publicField(this, "tempQuaternion", new Quaternion());
|
20
|
-
__publicField(this, "unit", {
|
21
|
-
X: new Vector3(1, 0, 0),
|
22
|
-
Y: new Vector3(0, 1, 0),
|
23
|
-
Z: new Vector3(0, 0, 1)
|
24
|
-
});
|
25
|
-
__publicField(this, "pointStart", new Vector3());
|
26
|
-
__publicField(this, "pointEnd", new Vector3());
|
27
|
-
__publicField(this, "offset", new Vector3());
|
28
|
-
__publicField(this, "rotationAxis", new Vector3());
|
29
|
-
__publicField(this, "startNorm", new Vector3());
|
30
|
-
__publicField(this, "endNorm", new Vector3());
|
31
|
-
__publicField(this, "rotationAngle", 0);
|
32
|
-
__publicField(this, "cameraPosition", new Vector3());
|
33
|
-
__publicField(this, "cameraQuaternion", new Quaternion());
|
34
|
-
__publicField(this, "cameraScale", new Vector3());
|
35
|
-
__publicField(this, "parentPosition", new Vector3());
|
36
|
-
__publicField(this, "parentQuaternion", new Quaternion());
|
37
|
-
__publicField(this, "parentQuaternionInv", new Quaternion());
|
38
|
-
__publicField(this, "parentScale", new Vector3());
|
39
|
-
__publicField(this, "worldPositionStart", new Vector3());
|
40
|
-
__publicField(this, "worldQuaternionStart", new Quaternion());
|
41
|
-
__publicField(this, "worldScaleStart", new Vector3());
|
42
|
-
__publicField(this, "worldPosition", new Vector3());
|
43
|
-
__publicField(this, "worldQuaternion", new Quaternion());
|
44
|
-
__publicField(this, "worldQuaternionInv", new Quaternion());
|
45
|
-
__publicField(this, "worldScale", new Vector3());
|
46
|
-
__publicField(this, "eye", new Vector3());
|
47
|
-
__publicField(this, "positionStart", new Vector3());
|
48
|
-
__publicField(this, "quaternionStart", new Quaternion());
|
49
|
-
__publicField(this, "scaleStart", new Vector3());
|
50
|
-
__publicField(this, "camera");
|
51
|
-
__publicField(this, "object");
|
52
|
-
__publicField(this, "enabled", true);
|
53
|
-
__publicField(this, "axis", null);
|
54
|
-
__publicField(this, "mode", "translate");
|
55
|
-
__publicField(this, "translationSnap", null);
|
56
|
-
__publicField(this, "rotationSnap", null);
|
57
|
-
__publicField(this, "scaleSnap", null);
|
58
|
-
__publicField(this, "space", "world");
|
59
|
-
__publicField(this, "size", 1);
|
60
|
-
__publicField(this, "dragging", false);
|
61
|
-
__publicField(this, "showX", true);
|
62
|
-
__publicField(this, "showY", true);
|
63
|
-
__publicField(this, "showZ", true);
|
64
|
-
// events
|
65
|
-
__publicField(this, "changeEvent", { type: "change" });
|
66
|
-
__publicField(this, "mouseDownEvent", { type: "mouseDown", mode: this.mode });
|
67
|
-
__publicField(this, "mouseUpEvent", { type: "mouseUp", mode: this.mode });
|
68
|
-
__publicField(this, "objectChangeEvent", { type: "objectChange" });
|
69
|
-
__publicField(this, "intersectObjectWithRay", (object, raycaster, includeInvisible) => {
|
70
|
-
const allIntersections = raycaster.intersectObject(object, true);
|
71
|
-
for (let i = 0; i < allIntersections.length; i++) {
|
72
|
-
if (allIntersections[i].object.visible || includeInvisible) {
|
73
|
-
return allIntersections[i];
|
74
|
-
}
|
75
|
-
}
|
76
|
-
return false;
|
77
|
-
});
|
78
|
-
// Set current object
|
79
|
-
__publicField(this, "attach", (object) => {
|
80
|
-
this.object = object;
|
81
|
-
this.visible = true;
|
82
|
-
return this;
|
83
|
-
});
|
84
|
-
// Detatch from object
|
85
|
-
__publicField(this, "detach", () => {
|
86
|
-
this.object = void 0;
|
87
|
-
this.visible = false;
|
88
|
-
this.axis = null;
|
89
|
-
return this;
|
90
|
-
});
|
91
|
-
// Reset
|
92
|
-
__publicField(this, "reset", () => {
|
93
|
-
if (!this.enabled)
|
94
|
-
return this;
|
95
|
-
if (this.dragging) {
|
96
|
-
if (this.object !== void 0) {
|
97
|
-
this.object.position.copy(this.positionStart);
|
98
|
-
this.object.quaternion.copy(this.quaternionStart);
|
99
|
-
this.object.scale.copy(this.scaleStart);
|
100
|
-
this.dispatchEvent(this.changeEvent);
|
101
|
-
this.dispatchEvent(this.objectChangeEvent);
|
102
|
-
this.pointStart.copy(this.pointEnd);
|
103
|
-
}
|
104
|
-
}
|
105
|
-
return this;
|
106
|
-
});
|
107
|
-
__publicField(this, "updateMatrixWorld", () => {
|
108
|
-
if (this.object !== void 0) {
|
109
|
-
this.object.updateMatrixWorld();
|
110
|
-
if (this.object.parent === null) {
|
111
|
-
console.error("TransformControls: The attached 3D object must be a part of the scene graph.");
|
112
|
-
} else {
|
113
|
-
this.object.parent.matrixWorld.decompose(this.parentPosition, this.parentQuaternion, this.parentScale);
|
114
|
-
}
|
115
|
-
this.object.matrixWorld.decompose(this.worldPosition, this.worldQuaternion, this.worldScale);
|
116
|
-
this.parentQuaternionInv.copy(this.parentQuaternion).invert();
|
117
|
-
this.worldQuaternionInv.copy(this.worldQuaternion).invert();
|
118
|
-
}
|
119
|
-
this.camera.updateMatrixWorld();
|
120
|
-
this.camera.matrixWorld.decompose(this.cameraPosition, this.cameraQuaternion, this.cameraScale);
|
121
|
-
this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize();
|
122
|
-
super.updateMatrixWorld();
|
123
|
-
});
|
124
|
-
__publicField(this, "pointerHover", (pointer) => {
|
125
|
-
if (this.object === void 0 || this.dragging === true)
|
126
|
-
return;
|
127
|
-
this.raycaster.setFromCamera(pointer, this.camera);
|
128
|
-
const intersect = this.intersectObjectWithRay(this.gizmo.picker[this.mode], this.raycaster);
|
129
|
-
if (intersect) {
|
130
|
-
this.axis = intersect.object.name;
|
131
|
-
} else {
|
132
|
-
this.axis = null;
|
133
|
-
}
|
134
|
-
});
|
135
|
-
__publicField(this, "pointerDown", (pointer) => {
|
136
|
-
if (this.object === void 0 || this.dragging === true || pointer.button !== 0)
|
137
|
-
return;
|
138
|
-
if (this.axis !== null) {
|
139
|
-
this.raycaster.setFromCamera(pointer, this.camera);
|
140
|
-
const planeIntersect = this.intersectObjectWithRay(this.plane, this.raycaster, true);
|
141
|
-
if (planeIntersect) {
|
142
|
-
let space = this.space;
|
143
|
-
if (this.mode === "scale") {
|
144
|
-
space = "local";
|
145
|
-
} else if (this.axis === "E" || this.axis === "XYZE" || this.axis === "XYZ") {
|
146
|
-
space = "world";
|
147
|
-
}
|
148
|
-
if (space === "local" && this.mode === "rotate") {
|
149
|
-
const snap = this.rotationSnap;
|
150
|
-
if (this.axis === "X" && snap)
|
151
|
-
this.object.rotation.x = Math.round(this.object.rotation.x / snap) * snap;
|
152
|
-
if (this.axis === "Y" && snap)
|
153
|
-
this.object.rotation.y = Math.round(this.object.rotation.y / snap) * snap;
|
154
|
-
if (this.axis === "Z" && snap)
|
155
|
-
this.object.rotation.z = Math.round(this.object.rotation.z / snap) * snap;
|
156
|
-
}
|
157
|
-
this.object.updateMatrixWorld();
|
158
|
-
if (this.object.parent) {
|
159
|
-
this.object.parent.updateMatrixWorld();
|
160
|
-
}
|
161
|
-
this.positionStart.copy(this.object.position);
|
162
|
-
this.quaternionStart.copy(this.object.quaternion);
|
163
|
-
this.scaleStart.copy(this.object.scale);
|
164
|
-
this.object.matrixWorld.decompose(this.worldPositionStart, this.worldQuaternionStart, this.worldScaleStart);
|
165
|
-
this.pointStart.copy(planeIntersect.point).sub(this.worldPositionStart);
|
166
|
-
}
|
167
|
-
this.dragging = true;
|
168
|
-
this.mouseDownEvent.mode = this.mode;
|
169
|
-
this.dispatchEvent(this.mouseDownEvent);
|
170
|
-
}
|
171
|
-
});
|
172
|
-
__publicField(this, "pointerMove", (pointer) => {
|
173
|
-
const axis = this.axis;
|
174
|
-
const mode = this.mode;
|
175
|
-
const object = this.object;
|
176
|
-
let space = this.space;
|
177
|
-
if (mode === "scale") {
|
178
|
-
space = "local";
|
179
|
-
} else if (axis === "E" || axis === "XYZE" || axis === "XYZ") {
|
180
|
-
space = "world";
|
181
|
-
}
|
182
|
-
if (object === void 0 || axis === null || this.dragging === false || pointer.button !== -1)
|
183
|
-
return;
|
184
|
-
this.raycaster.setFromCamera(pointer, this.camera);
|
185
|
-
const planeIntersect = this.intersectObjectWithRay(this.plane, this.raycaster, true);
|
186
|
-
if (!planeIntersect)
|
187
|
-
return;
|
188
|
-
this.pointEnd.copy(planeIntersect.point).sub(this.worldPositionStart);
|
189
|
-
if (mode === "translate") {
|
190
|
-
this.offset.copy(this.pointEnd).sub(this.pointStart);
|
191
|
-
if (space === "local" && axis !== "XYZ") {
|
192
|
-
this.offset.applyQuaternion(this.worldQuaternionInv);
|
193
|
-
}
|
194
|
-
if (axis.indexOf("X") === -1)
|
195
|
-
this.offset.x = 0;
|
196
|
-
if (axis.indexOf("Y") === -1)
|
197
|
-
this.offset.y = 0;
|
198
|
-
if (axis.indexOf("Z") === -1)
|
199
|
-
this.offset.z = 0;
|
200
|
-
if (space === "local" && axis !== "XYZ") {
|
201
|
-
this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale);
|
202
|
-
} else {
|
203
|
-
this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale);
|
204
|
-
}
|
205
|
-
object.position.copy(this.offset).add(this.positionStart);
|
206
|
-
if (this.translationSnap) {
|
207
|
-
if (space === "local") {
|
208
|
-
object.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert());
|
209
|
-
if (axis.search("X") !== -1) {
|
210
|
-
object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
|
211
|
-
}
|
212
|
-
if (axis.search("Y") !== -1) {
|
213
|
-
object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
|
214
|
-
}
|
215
|
-
if (axis.search("Z") !== -1) {
|
216
|
-
object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
|
217
|
-
}
|
218
|
-
object.position.applyQuaternion(this.quaternionStart);
|
219
|
-
}
|
220
|
-
if (space === "world") {
|
221
|
-
if (object.parent) {
|
222
|
-
object.position.add(this.tempVector.setFromMatrixPosition(object.parent.matrixWorld));
|
223
|
-
}
|
224
|
-
if (axis.search("X") !== -1) {
|
225
|
-
object.position.x = Math.round(object.position.x / this.translationSnap) * this.translationSnap;
|
226
|
-
}
|
227
|
-
if (axis.search("Y") !== -1) {
|
228
|
-
object.position.y = Math.round(object.position.y / this.translationSnap) * this.translationSnap;
|
229
|
-
}
|
230
|
-
if (axis.search("Z") !== -1) {
|
231
|
-
object.position.z = Math.round(object.position.z / this.translationSnap) * this.translationSnap;
|
232
|
-
}
|
233
|
-
if (object.parent) {
|
234
|
-
object.position.sub(this.tempVector.setFromMatrixPosition(object.parent.matrixWorld));
|
235
|
-
}
|
236
|
-
}
|
237
|
-
}
|
238
|
-
} else if (mode === "scale") {
|
239
|
-
if (axis.search("XYZ") !== -1) {
|
240
|
-
let d = this.pointEnd.length() / this.pointStart.length();
|
241
|
-
if (this.pointEnd.dot(this.pointStart) < 0)
|
242
|
-
d *= -1;
|
243
|
-
this.tempVector2.set(d, d, d);
|
244
|
-
} else {
|
245
|
-
this.tempVector.copy(this.pointStart);
|
246
|
-
this.tempVector2.copy(this.pointEnd);
|
247
|
-
this.tempVector.applyQuaternion(this.worldQuaternionInv);
|
248
|
-
this.tempVector2.applyQuaternion(this.worldQuaternionInv);
|
249
|
-
this.tempVector2.divide(this.tempVector);
|
250
|
-
if (axis.search("X") === -1) {
|
251
|
-
this.tempVector2.x = 1;
|
252
|
-
}
|
253
|
-
if (axis.search("Y") === -1) {
|
254
|
-
this.tempVector2.y = 1;
|
255
|
-
}
|
256
|
-
if (axis.search("Z") === -1) {
|
257
|
-
this.tempVector2.z = 1;
|
258
|
-
}
|
259
|
-
}
|
260
|
-
object.scale.copy(this.scaleStart).multiply(this.tempVector2);
|
261
|
-
if (this.scaleSnap && this.object) {
|
262
|
-
if (axis.search("X") !== -1) {
|
263
|
-
this.object.scale.x = Math.round(object.scale.x / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
264
|
-
}
|
265
|
-
if (axis.search("Y") !== -1) {
|
266
|
-
object.scale.y = Math.round(object.scale.y / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
267
|
-
}
|
268
|
-
if (axis.search("Z") !== -1) {
|
269
|
-
object.scale.z = Math.round(object.scale.z / this.scaleSnap) * this.scaleSnap || this.scaleSnap;
|
270
|
-
}
|
271
|
-
}
|
272
|
-
} else if (mode === "rotate") {
|
273
|
-
this.offset.copy(this.pointEnd).sub(this.pointStart);
|
274
|
-
const ROTATION_SPEED = 20 / this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));
|
275
|
-
if (axis === "E") {
|
276
|
-
this.rotationAxis.copy(this.eye);
|
277
|
-
this.rotationAngle = this.pointEnd.angleTo(this.pointStart);
|
278
|
-
this.startNorm.copy(this.pointStart).normalize();
|
279
|
-
this.endNorm.copy(this.pointEnd).normalize();
|
280
|
-
this.rotationAngle *= this.endNorm.cross(this.startNorm).dot(this.eye) < 0 ? 1 : -1;
|
281
|
-
} else if (axis === "XYZE") {
|
282
|
-
this.rotationAxis.copy(this.offset).cross(this.eye).normalize();
|
283
|
-
this.rotationAngle = this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye)) * ROTATION_SPEED;
|
284
|
-
} else if (axis === "X" || axis === "Y" || axis === "Z") {
|
285
|
-
this.rotationAxis.copy(this.unit[axis]);
|
286
|
-
this.tempVector.copy(this.unit[axis]);
|
287
|
-
if (space === "local") {
|
288
|
-
this.tempVector.applyQuaternion(this.worldQuaternion);
|
289
|
-
}
|
290
|
-
this.rotationAngle = this.offset.dot(this.tempVector.cross(this.eye).normalize()) * ROTATION_SPEED;
|
291
|
-
}
|
292
|
-
if (this.rotationSnap) {
|
293
|
-
this.rotationAngle = Math.round(this.rotationAngle / this.rotationSnap) * this.rotationSnap;
|
294
|
-
}
|
295
|
-
if (space === "local" && axis !== "E" && axis !== "XYZE") {
|
296
|
-
object.quaternion.copy(this.quaternionStart);
|
297
|
-
object.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle)).normalize();
|
298
|
-
} else {
|
299
|
-
this.rotationAxis.applyQuaternion(this.parentQuaternionInv);
|
300
|
-
object.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis, this.rotationAngle));
|
301
|
-
object.quaternion.multiply(this.quaternionStart).normalize();
|
302
|
-
}
|
303
|
-
}
|
304
|
-
this.dispatchEvent(this.changeEvent);
|
305
|
-
this.dispatchEvent(this.objectChangeEvent);
|
306
|
-
});
|
307
|
-
__publicField(this, "pointerUp", (pointer) => {
|
308
|
-
if (pointer.button !== 0)
|
309
|
-
return;
|
310
|
-
if (this.dragging && this.axis !== null) {
|
311
|
-
this.mouseUpEvent.mode = this.mode;
|
312
|
-
this.dispatchEvent(this.mouseUpEvent);
|
313
|
-
}
|
314
|
-
this.dragging = false;
|
315
|
-
this.axis = null;
|
316
|
-
});
|
317
|
-
__publicField(this, "getPointer", (event) => {
|
318
|
-
var _a, _b;
|
319
|
-
if (this.domElement && ((_a = this.domElement.ownerDocument) == null ? void 0 : _a.pointerLockElement)) {
|
320
|
-
return {
|
321
|
-
x: 0,
|
322
|
-
y: 0,
|
323
|
-
button: event.button
|
324
|
-
};
|
325
|
-
} else {
|
326
|
-
const pointer = event.changedTouches ? event.changedTouches[0] : event;
|
327
|
-
const rect = (_b = this.domElement) == null ? void 0 : _b.getBoundingClientRect();
|
328
|
-
return {
|
329
|
-
x: (pointer.clientX - rect.left) / rect.width * 2 - 1,
|
330
|
-
y: -(pointer.clientY - rect.top) / rect.height * 2 + 1,
|
331
|
-
button: event.button
|
332
|
-
};
|
333
|
-
}
|
334
|
-
});
|
335
|
-
__publicField(this, "onPointerHover", (event) => {
|
336
|
-
if (!this.enabled)
|
337
|
-
return;
|
338
|
-
switch (event.pointerType) {
|
339
|
-
case "mouse":
|
340
|
-
case "pen":
|
341
|
-
this.pointerHover(this.getPointer(event));
|
342
|
-
break;
|
343
|
-
}
|
344
|
-
});
|
345
|
-
__publicField(this, "onPointerDown", (event) => {
|
346
|
-
if (!this.enabled || !this.domElement)
|
347
|
-
return;
|
348
|
-
this.domElement.style.touchAction = "none";
|
349
|
-
this.domElement.ownerDocument.addEventListener("pointermove", this.onPointerMove);
|
350
|
-
this.pointerHover(this.getPointer(event));
|
351
|
-
this.pointerDown(this.getPointer(event));
|
352
|
-
});
|
353
|
-
__publicField(this, "onPointerMove", (event) => {
|
354
|
-
if (!this.enabled)
|
355
|
-
return;
|
356
|
-
this.pointerMove(this.getPointer(event));
|
357
|
-
});
|
358
|
-
__publicField(this, "onPointerUp", (event) => {
|
359
|
-
if (!this.enabled || !this.domElement)
|
360
|
-
return;
|
361
|
-
this.domElement.style.touchAction = "";
|
362
|
-
this.domElement.ownerDocument.removeEventListener("pointermove", this.onPointerMove);
|
363
|
-
this.pointerUp(this.getPointer(event));
|
364
|
-
});
|
365
|
-
__publicField(this, "getMode", () => this.mode);
|
366
|
-
__publicField(this, "setMode", (mode) => {
|
367
|
-
this.mode = mode;
|
368
|
-
});
|
369
|
-
__publicField(this, "setTranslationSnap", (translationSnap) => {
|
370
|
-
this.translationSnap = translationSnap;
|
371
|
-
});
|
372
|
-
__publicField(this, "setRotationSnap", (rotationSnap) => {
|
373
|
-
this.rotationSnap = rotationSnap;
|
374
|
-
});
|
375
|
-
__publicField(this, "setScaleSnap", (scaleSnap) => {
|
376
|
-
this.scaleSnap = scaleSnap;
|
377
|
-
});
|
378
|
-
__publicField(this, "setSize", (size) => {
|
379
|
-
this.size = size;
|
380
|
-
});
|
381
|
-
__publicField(this, "setSpace", (space) => {
|
382
|
-
this.space = space;
|
383
|
-
});
|
384
|
-
__publicField(this, "update", () => {
|
385
|
-
console.warn(
|
386
|
-
"THREE.TransformControls: update function has no more functionality and therefore has been deprecated."
|
387
|
-
);
|
388
|
-
});
|
389
|
-
__publicField(this, "connect", (domElement) => {
|
390
|
-
if (domElement === document) {
|
391
|
-
console.error(
|
392
|
-
'THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'
|
393
|
-
);
|
394
|
-
}
|
395
|
-
this.domElement = domElement;
|
396
|
-
this.domElement.addEventListener("pointerdown", this.onPointerDown);
|
397
|
-
this.domElement.addEventListener("pointermove", this.onPointerHover);
|
398
|
-
this.domElement.ownerDocument.addEventListener("pointerup", this.onPointerUp);
|
399
|
-
});
|
400
|
-
__publicField(this, "dispose", () => {
|
401
|
-
var _a, _b, _c, _d, _e, _f;
|
402
|
-
(_a = this.domElement) == null ? void 0 : _a.removeEventListener("pointerdown", this.onPointerDown);
|
403
|
-
(_b = this.domElement) == null ? void 0 : _b.removeEventListener("pointermove", this.onPointerHover);
|
404
|
-
(_d = (_c = this.domElement) == null ? void 0 : _c.ownerDocument) == null ? void 0 : _d.removeEventListener("pointermove", this.onPointerMove);
|
405
|
-
(_f = (_e = this.domElement) == null ? void 0 : _e.ownerDocument) == null ? void 0 : _f.removeEventListener("pointerup", this.onPointerUp);
|
406
|
-
this.traverse((child) => {
|
407
|
-
const mesh = child;
|
408
|
-
if (mesh.geometry) {
|
409
|
-
mesh.geometry.dispose();
|
410
|
-
}
|
411
|
-
if (mesh.material) {
|
412
|
-
mesh.material.dispose();
|
413
|
-
}
|
414
|
-
});
|
415
|
-
});
|
416
|
-
this.domElement = domElement;
|
417
|
-
this.camera = camera;
|
418
|
-
this.gizmo = new TransformControlsGizmo();
|
419
|
-
this.add(this.gizmo);
|
420
|
-
this.plane = new TransformControlsPlane();
|
421
|
-
this.add(this.plane);
|
422
|
-
const defineProperty = (propName, defaultValue) => {
|
423
|
-
let propValue = defaultValue;
|
424
|
-
Object.defineProperty(this, propName, {
|
425
|
-
get: function() {
|
426
|
-
return propValue !== void 0 ? propValue : defaultValue;
|
427
|
-
},
|
428
|
-
set: function(value) {
|
429
|
-
if (propValue !== value) {
|
430
|
-
propValue = value;
|
431
|
-
this.plane[propName] = value;
|
432
|
-
this.gizmo[propName] = value;
|
433
|
-
this.dispatchEvent({ type: propName + "-changed", value });
|
434
|
-
this.dispatchEvent(this.changeEvent);
|
435
|
-
}
|
436
|
-
}
|
437
|
-
});
|
438
|
-
this[propName] = defaultValue;
|
439
|
-
this.plane[propName] = defaultValue;
|
440
|
-
this.gizmo[propName] = defaultValue;
|
441
|
-
};
|
442
|
-
defineProperty("camera", this.camera);
|
443
|
-
defineProperty("object", this.object);
|
444
|
-
defineProperty("enabled", this.enabled);
|
445
|
-
defineProperty("axis", this.axis);
|
446
|
-
defineProperty("mode", this.mode);
|
447
|
-
defineProperty("translationSnap", this.translationSnap);
|
448
|
-
defineProperty("rotationSnap", this.rotationSnap);
|
449
|
-
defineProperty("scaleSnap", this.scaleSnap);
|
450
|
-
defineProperty("space", this.space);
|
451
|
-
defineProperty("size", this.size);
|
452
|
-
defineProperty("dragging", this.dragging);
|
453
|
-
defineProperty("showX", this.showX);
|
454
|
-
defineProperty("showY", this.showY);
|
455
|
-
defineProperty("showZ", this.showZ);
|
456
|
-
defineProperty("worldPosition", this.worldPosition);
|
457
|
-
defineProperty("worldPositionStart", this.worldPositionStart);
|
458
|
-
defineProperty("worldQuaternion", this.worldQuaternion);
|
459
|
-
defineProperty("worldQuaternionStart", this.worldQuaternionStart);
|
460
|
-
defineProperty("cameraPosition", this.cameraPosition);
|
461
|
-
defineProperty("cameraQuaternion", this.cameraQuaternion);
|
462
|
-
defineProperty("pointStart", this.pointStart);
|
463
|
-
defineProperty("pointEnd", this.pointEnd);
|
464
|
-
defineProperty("rotationAxis", this.rotationAxis);
|
465
|
-
defineProperty("rotationAngle", this.rotationAngle);
|
466
|
-
defineProperty("eye", this.eye);
|
467
|
-
if (domElement !== void 0)
|
468
|
-
this.connect(domElement);
|
469
|
-
}
|
470
|
-
}
|
471
|
-
class TransformControlsGizmo extends Object3D {
|
472
|
-
constructor() {
|
473
|
-
super();
|
474
|
-
__publicField(this, "isTransformControlsGizmo", true);
|
475
|
-
__publicField(this, "type", "TransformControlsGizmo");
|
476
|
-
__publicField(this, "tempVector", new Vector3(0, 0, 0));
|
477
|
-
__publicField(this, "tempEuler", new Euler());
|
478
|
-
__publicField(this, "alignVector", new Vector3(0, 1, 0));
|
479
|
-
__publicField(this, "zeroVector", new Vector3(0, 0, 0));
|
480
|
-
__publicField(this, "lookAtMatrix", new Matrix4());
|
481
|
-
__publicField(this, "tempQuaternion", new Quaternion());
|
482
|
-
__publicField(this, "tempQuaternion2", new Quaternion());
|
483
|
-
__publicField(this, "identityQuaternion", new Quaternion());
|
484
|
-
__publicField(this, "unitX", new Vector3(1, 0, 0));
|
485
|
-
__publicField(this, "unitY", new Vector3(0, 1, 0));
|
486
|
-
__publicField(this, "unitZ", new Vector3(0, 0, 1));
|
487
|
-
__publicField(this, "gizmo");
|
488
|
-
__publicField(this, "picker");
|
489
|
-
__publicField(this, "helper");
|
490
|
-
// these are set from parent class TransformControls
|
491
|
-
__publicField(this, "rotationAxis", new Vector3());
|
492
|
-
__publicField(this, "cameraPosition", new Vector3());
|
493
|
-
__publicField(this, "worldPositionStart", new Vector3());
|
494
|
-
__publicField(this, "worldQuaternionStart", new Quaternion());
|
495
|
-
__publicField(this, "worldPosition", new Vector3());
|
496
|
-
__publicField(this, "worldQuaternion", new Quaternion());
|
497
|
-
__publicField(this, "eye", new Vector3());
|
498
|
-
__publicField(this, "camera", null);
|
499
|
-
__publicField(this, "enabled", true);
|
500
|
-
__publicField(this, "axis", null);
|
501
|
-
__publicField(this, "mode", "translate");
|
502
|
-
__publicField(this, "space", "world");
|
503
|
-
__publicField(this, "size", 1);
|
504
|
-
__publicField(this, "dragging", false);
|
505
|
-
__publicField(this, "showX", true);
|
506
|
-
__publicField(this, "showY", true);
|
507
|
-
__publicField(this, "showZ", true);
|
508
|
-
// updateMatrixWorld will update transformations and appearance of individual handles
|
509
|
-
__publicField(this, "updateMatrixWorld", () => {
|
510
|
-
let space = this.space;
|
511
|
-
if (this.mode === "scale") {
|
512
|
-
space = "local";
|
513
|
-
}
|
514
|
-
const quaternion = space === "local" ? this.worldQuaternion : this.identityQuaternion;
|
515
|
-
this.gizmo["translate"].visible = this.mode === "translate";
|
516
|
-
this.gizmo["rotate"].visible = this.mode === "rotate";
|
517
|
-
this.gizmo["scale"].visible = this.mode === "scale";
|
518
|
-
this.helper["translate"].visible = this.mode === "translate";
|
519
|
-
this.helper["rotate"].visible = this.mode === "rotate";
|
520
|
-
this.helper["scale"].visible = this.mode === "scale";
|
521
|
-
let handles = [];
|
522
|
-
handles = handles.concat(this.picker[this.mode].children);
|
523
|
-
handles = handles.concat(this.gizmo[this.mode].children);
|
524
|
-
handles = handles.concat(this.helper[this.mode].children);
|
525
|
-
for (let i = 0; i < handles.length; i++) {
|
526
|
-
const handle = handles[i];
|
527
|
-
handle.visible = true;
|
528
|
-
handle.rotation.set(0, 0, 0);
|
529
|
-
handle.position.copy(this.worldPosition);
|
530
|
-
let factor;
|
531
|
-
if (this.camera.isOrthographicCamera) {
|
532
|
-
factor = (this.camera.top - this.camera.bottom) / this.camera.zoom;
|
533
|
-
} else {
|
534
|
-
factor = this.worldPosition.distanceTo(this.cameraPosition) * Math.min(1.9 * Math.tan(Math.PI * this.camera.fov / 360) / this.camera.zoom, 7);
|
535
|
-
}
|
536
|
-
handle.scale.set(1, 1, 1).multiplyScalar(factor * this.size / 7);
|
537
|
-
if (handle.tag === "helper") {
|
538
|
-
handle.visible = false;
|
539
|
-
if (handle.name === "AXIS") {
|
540
|
-
handle.position.copy(this.worldPositionStart);
|
541
|
-
handle.visible = !!this.axis;
|
542
|
-
if (this.axis === "X") {
|
543
|
-
this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, 0));
|
544
|
-
handle.quaternion.copy(quaternion).multiply(this.tempQuaternion);
|
545
|
-
if (Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
546
|
-
handle.visible = false;
|
547
|
-
}
|
548
|
-
}
|
549
|
-
if (this.axis === "Y") {
|
550
|
-
this.tempQuaternion.setFromEuler(this.tempEuler.set(0, 0, Math.PI / 2));
|
551
|
-
handle.quaternion.copy(quaternion).multiply(this.tempQuaternion);
|
552
|
-
if (Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
553
|
-
handle.visible = false;
|
554
|
-
}
|
555
|
-
}
|
556
|
-
if (this.axis === "Z") {
|
557
|
-
this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0));
|
558
|
-
handle.quaternion.copy(quaternion).multiply(this.tempQuaternion);
|
559
|
-
if (Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(quaternion).dot(this.eye)) > 0.9) {
|
560
|
-
handle.visible = false;
|
561
|
-
}
|
562
|
-
}
|
563
|
-
if (this.axis === "XYZE") {
|
564
|
-
this.tempQuaternion.setFromEuler(this.tempEuler.set(0, Math.PI / 2, 0));
|
565
|
-
this.alignVector.copy(this.rotationAxis);
|
566
|
-
handle.quaternion.setFromRotationMatrix(
|
567
|
-
this.lookAtMatrix.lookAt(this.zeroVector, this.alignVector, this.unitY)
|
568
|
-
);
|
569
|
-
handle.quaternion.multiply(this.tempQuaternion);
|
570
|
-
handle.visible = this.dragging;
|
571
|
-
}
|
572
|
-
if (this.axis === "E") {
|
573
|
-
handle.visible = false;
|
574
|
-
}
|
575
|
-
} else if (handle.name === "START") {
|
576
|
-
handle.position.copy(this.worldPositionStart);
|
577
|
-
handle.visible = this.dragging;
|
578
|
-
} else if (handle.name === "END") {
|
579
|
-
handle.position.copy(this.worldPosition);
|
580
|
-
handle.visible = this.dragging;
|
581
|
-
} else if (handle.name === "DELTA") {
|
582
|
-
handle.position.copy(this.worldPositionStart);
|
583
|
-
handle.quaternion.copy(this.worldQuaternionStart);
|
584
|
-
this.tempVector.set(1e-10, 1e-10, 1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1);
|
585
|
-
this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert());
|
586
|
-
handle.scale.copy(this.tempVector);
|
587
|
-
handle.visible = this.dragging;
|
588
|
-
} else {
|
589
|
-
handle.quaternion.copy(quaternion);
|
590
|
-
if (this.dragging) {
|
591
|
-
handle.position.copy(this.worldPositionStart);
|
592
|
-
} else {
|
593
|
-
handle.position.copy(this.worldPosition);
|
594
|
-
}
|
595
|
-
if (this.axis) {
|
596
|
-
handle.visible = this.axis.search(handle.name) !== -1;
|
597
|
-
}
|
598
|
-
}
|
599
|
-
continue;
|
600
|
-
}
|
601
|
-
handle.quaternion.copy(quaternion);
|
602
|
-
if (this.mode === "translate" || this.mode === "scale") {
|
603
|
-
const AXIS_HIDE_TRESHOLD = 0.99;
|
604
|
-
const PLANE_HIDE_TRESHOLD = 0.2;
|
605
|
-
const AXIS_FLIP_TRESHOLD = 0;
|
606
|
-
if (handle.name === "X" || handle.name === "XYZX") {
|
607
|
-
if (Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
608
|
-
handle.scale.set(1e-10, 1e-10, 1e-10);
|
609
|
-
handle.visible = false;
|
610
|
-
}
|
611
|
-
}
|
612
|
-
if (handle.name === "Y" || handle.name === "XYZY") {
|
613
|
-
if (Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
614
|
-
handle.scale.set(1e-10, 1e-10, 1e-10);
|
615
|
-
handle.visible = false;
|
616
|
-
}
|
617
|
-
}
|
618
|
-
if (handle.name === "Z" || handle.name === "XYZZ") {
|
619
|
-
if (Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(quaternion).dot(this.eye)) > AXIS_HIDE_TRESHOLD) {
|
620
|
-
handle.scale.set(1e-10, 1e-10, 1e-10);
|
621
|
-
handle.visible = false;
|
622
|
-
}
|
623
|
-
}
|
624
|
-
if (handle.name === "XY") {
|
625
|
-
if (Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
626
|
-
handle.scale.set(1e-10, 1e-10, 1e-10);
|
627
|
-
handle.visible = false;
|
628
|
-
}
|
629
|
-
}
|
630
|
-
if (handle.name === "YZ") {
|
631
|
-
if (Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
632
|
-
handle.scale.set(1e-10, 1e-10, 1e-10);
|
633
|
-
handle.visible = false;
|
634
|
-
}
|
635
|
-
}
|
636
|
-
if (handle.name === "XZ") {
|
637
|
-
if (Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(quaternion).dot(this.eye)) < PLANE_HIDE_TRESHOLD) {
|
638
|
-
handle.scale.set(1e-10, 1e-10, 1e-10);
|
639
|
-
handle.visible = false;
|
640
|
-
}
|
641
|
-
}
|
642
|
-
if (handle.name.search("X") !== -1) {
|
643
|
-
if (this.alignVector.copy(this.unitX).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
644
|
-
if (handle.tag === "fwd") {
|
645
|
-
handle.visible = false;
|
646
|
-
} else {
|
647
|
-
handle.scale.x *= -1;
|
648
|
-
}
|
649
|
-
} else if (handle.tag === "bwd") {
|
650
|
-
handle.visible = false;
|
651
|
-
}
|
652
|
-
}
|
653
|
-
if (handle.name.search("Y") !== -1) {
|
654
|
-
if (this.alignVector.copy(this.unitY).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
655
|
-
if (handle.tag === "fwd") {
|
656
|
-
handle.visible = false;
|
657
|
-
} else {
|
658
|
-
handle.scale.y *= -1;
|
659
|
-
}
|
660
|
-
} else if (handle.tag === "bwd") {
|
661
|
-
handle.visible = false;
|
662
|
-
}
|
663
|
-
}
|
664
|
-
if (handle.name.search("Z") !== -1) {
|
665
|
-
if (this.alignVector.copy(this.unitZ).applyQuaternion(quaternion).dot(this.eye) < AXIS_FLIP_TRESHOLD) {
|
666
|
-
if (handle.tag === "fwd") {
|
667
|
-
handle.visible = false;
|
668
|
-
} else {
|
669
|
-
handle.scale.z *= -1;
|
670
|
-
}
|
671
|
-
} else if (handle.tag === "bwd") {
|
672
|
-
handle.visible = false;
|
673
|
-
}
|
674
|
-
}
|
675
|
-
} else if (this.mode === "rotate") {
|
676
|
-
this.tempQuaternion2.copy(quaternion);
|
677
|
-
this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(quaternion).invert());
|
678
|
-
if (handle.name.search("E") !== -1) {
|
679
|
-
handle.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye, this.zeroVector, this.unitY));
|
680
|
-
}
|
681
|
-
if (handle.name === "X") {
|
682
|
-
this.tempQuaternion.setFromAxisAngle(this.unitX, Math.atan2(-this.alignVector.y, this.alignVector.z));
|
683
|
-
this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion);
|
684
|
-
handle.quaternion.copy(this.tempQuaternion);
|
685
|
-
}
|
686
|
-
if (handle.name === "Y") {
|
687
|
-
this.tempQuaternion.setFromAxisAngle(this.unitY, Math.atan2(this.alignVector.x, this.alignVector.z));
|
688
|
-
this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion);
|
689
|
-
handle.quaternion.copy(this.tempQuaternion);
|
690
|
-
}
|
691
|
-
if (handle.name === "Z") {
|
692
|
-
this.tempQuaternion.setFromAxisAngle(this.unitZ, Math.atan2(this.alignVector.y, this.alignVector.x));
|
693
|
-
this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2, this.tempQuaternion);
|
694
|
-
handle.quaternion.copy(this.tempQuaternion);
|
695
|
-
}
|
696
|
-
}
|
697
|
-
handle.visible = handle.visible && (handle.name.indexOf("X") === -1 || this.showX);
|
698
|
-
handle.visible = handle.visible && (handle.name.indexOf("Y") === -1 || this.showY);
|
699
|
-
handle.visible = handle.visible && (handle.name.indexOf("Z") === -1 || this.showZ);
|
700
|
-
handle.visible = handle.visible && (handle.name.indexOf("E") === -1 || this.showX && this.showY && this.showZ);
|
701
|
-
handle.material.tempOpacity = handle.material.tempOpacity || handle.material.opacity;
|
702
|
-
handle.material.tempColor = handle.material.tempColor || handle.material.color.clone();
|
703
|
-
handle.material.color.copy(handle.material.tempColor);
|
704
|
-
handle.material.opacity = handle.material.tempOpacity;
|
705
|
-
if (!this.enabled) {
|
706
|
-
handle.material.opacity *= 0.5;
|
707
|
-
handle.material.color.lerp(new Color(1, 1, 1), 0.5);
|
708
|
-
} else if (this.axis) {
|
709
|
-
if (handle.name === this.axis) {
|
710
|
-
handle.material.opacity = 1;
|
711
|
-
handle.material.color.lerp(new Color(1, 1, 1), 0.5);
|
712
|
-
} else if (this.axis.split("").some(function(a) {
|
713
|
-
return handle.name === a;
|
714
|
-
})) {
|
715
|
-
handle.material.opacity = 1;
|
716
|
-
handle.material.color.lerp(new Color(1, 1, 1), 0.5);
|
717
|
-
} else {
|
718
|
-
handle.material.opacity *= 0.25;
|
719
|
-
handle.material.color.lerp(new Color(1, 1, 1), 0.5);
|
720
|
-
}
|
721
|
-
}
|
722
|
-
}
|
723
|
-
super.updateMatrixWorld();
|
724
|
-
});
|
725
|
-
const gizmoMaterial = new MeshBasicMaterial({
|
726
|
-
depthTest: false,
|
727
|
-
depthWrite: false,
|
728
|
-
transparent: true,
|
729
|
-
side: DoubleSide,
|
730
|
-
fog: false,
|
731
|
-
toneMapped: false
|
732
|
-
});
|
733
|
-
const gizmoLineMaterial = new LineBasicMaterial({
|
734
|
-
depthTest: false,
|
735
|
-
depthWrite: false,
|
736
|
-
transparent: true,
|
737
|
-
linewidth: 1,
|
738
|
-
fog: false,
|
739
|
-
toneMapped: false
|
740
|
-
});
|
741
|
-
const matInvisible = gizmoMaterial.clone();
|
742
|
-
matInvisible.opacity = 0.15;
|
743
|
-
const matHelper = gizmoMaterial.clone();
|
744
|
-
matHelper.opacity = 0.33;
|
745
|
-
const matRed = gizmoMaterial.clone();
|
746
|
-
matRed.color.set(16711680);
|
747
|
-
const matGreen = gizmoMaterial.clone();
|
748
|
-
matGreen.color.set(65280);
|
749
|
-
const matBlue = gizmoMaterial.clone();
|
750
|
-
matBlue.color.set(255);
|
751
|
-
const matWhiteTransparent = gizmoMaterial.clone();
|
752
|
-
matWhiteTransparent.opacity = 0.25;
|
753
|
-
const matYellowTransparent = matWhiteTransparent.clone();
|
754
|
-
matYellowTransparent.color.set(16776960);
|
755
|
-
const matCyanTransparent = matWhiteTransparent.clone();
|
756
|
-
matCyanTransparent.color.set(65535);
|
757
|
-
const matMagentaTransparent = matWhiteTransparent.clone();
|
758
|
-
matMagentaTransparent.color.set(16711935);
|
759
|
-
const matYellow = gizmoMaterial.clone();
|
760
|
-
matYellow.color.set(16776960);
|
761
|
-
const matLineRed = gizmoLineMaterial.clone();
|
762
|
-
matLineRed.color.set(16711680);
|
763
|
-
const matLineGreen = gizmoLineMaterial.clone();
|
764
|
-
matLineGreen.color.set(65280);
|
765
|
-
const matLineBlue = gizmoLineMaterial.clone();
|
766
|
-
matLineBlue.color.set(255);
|
767
|
-
const matLineCyan = gizmoLineMaterial.clone();
|
768
|
-
matLineCyan.color.set(65535);
|
769
|
-
const matLineMagenta = gizmoLineMaterial.clone();
|
770
|
-
matLineMagenta.color.set(16711935);
|
771
|
-
const matLineYellow = gizmoLineMaterial.clone();
|
772
|
-
matLineYellow.color.set(16776960);
|
773
|
-
const matLineGray = gizmoLineMaterial.clone();
|
774
|
-
matLineGray.color.set(7895160);
|
775
|
-
const matLineYellowTransparent = matLineYellow.clone();
|
776
|
-
matLineYellowTransparent.opacity = 0.25;
|
777
|
-
const arrowGeometry = new CylinderGeometry(0, 0.05, 0.2, 12, 1, false);
|
778
|
-
const scaleHandleGeometry = new BoxGeometry(0.125, 0.125, 0.125);
|
779
|
-
const lineGeometry = new BufferGeometry();
|
780
|
-
lineGeometry.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 0, 0], 3));
|
781
|
-
const CircleGeometry = (radius, arc) => {
|
782
|
-
const geometry = new BufferGeometry();
|
783
|
-
const vertices = [];
|
784
|
-
for (let i = 0; i <= 64 * arc; ++i) {
|
785
|
-
vertices.push(0, Math.cos(i / 32 * Math.PI) * radius, Math.sin(i / 32 * Math.PI) * radius);
|
786
|
-
}
|
787
|
-
geometry.setAttribute("position", new Float32BufferAttribute(vertices, 3));
|
788
|
-
return geometry;
|
789
|
-
};
|
790
|
-
const TranslateHelperGeometry = () => {
|
791
|
-
const geometry = new BufferGeometry();
|
792
|
-
geometry.setAttribute("position", new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));
|
793
|
-
return geometry;
|
794
|
-
};
|
795
|
-
const gizmoTranslate = {
|
796
|
-
X: [
|
797
|
-
[new Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, -Math.PI / 2], null, "fwd"],
|
798
|
-
[new Mesh(arrowGeometry, matRed), [1, 0, 0], [0, 0, Math.PI / 2], null, "bwd"],
|
799
|
-
[new Line(lineGeometry, matLineRed)]
|
800
|
-
],
|
801
|
-
Y: [
|
802
|
-
[new Mesh(arrowGeometry, matGreen), [0, 1, 0], null, null, "fwd"],
|
803
|
-
[new Mesh(arrowGeometry, matGreen), [0, 1, 0], [Math.PI, 0, 0], null, "bwd"],
|
804
|
-
[new Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2]]
|
805
|
-
],
|
806
|
-
Z: [
|
807
|
-
[new Mesh(arrowGeometry, matBlue), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"],
|
808
|
-
[new Mesh(arrowGeometry, matBlue), [0, 0, 1], [-Math.PI / 2, 0, 0], null, "bwd"],
|
809
|
-
[new Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0]]
|
810
|
-
],
|
811
|
-
XYZ: [[new Mesh(new OctahedronGeometry(0.1, 0), matWhiteTransparent.clone()), [0, 0, 0], [0, 0, 0]]],
|
812
|
-
XY: [
|
813
|
-
[new Mesh(new PlaneGeometry(0.295, 0.295), matYellowTransparent.clone()), [0.15, 0.15, 0]],
|
814
|
-
[new Line(lineGeometry, matLineYellow), [0.18, 0.3, 0], null, [0.125, 1, 1]],
|
815
|
-
[new Line(lineGeometry, matLineYellow), [0.3, 0.18, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]
|
816
|
-
],
|
817
|
-
YZ: [
|
818
|
-
[new Mesh(new PlaneGeometry(0.295, 0.295), matCyanTransparent.clone()), [0, 0.15, 0.15], [0, Math.PI / 2, 0]],
|
819
|
-
[new Line(lineGeometry, matLineCyan), [0, 0.18, 0.3], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
820
|
-
[new Line(lineGeometry, matLineCyan), [0, 0.3, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]
|
821
|
-
],
|
822
|
-
XZ: [
|
823
|
-
[
|
824
|
-
new Mesh(new PlaneGeometry(0.295, 0.295), matMagentaTransparent.clone()),
|
825
|
-
[0.15, 0, 0.15],
|
826
|
-
[-Math.PI / 2, 0, 0]
|
827
|
-
],
|
828
|
-
[new Line(lineGeometry, matLineMagenta), [0.18, 0, 0.3], null, [0.125, 1, 1]],
|
829
|
-
[new Line(lineGeometry, matLineMagenta), [0.3, 0, 0.18], [0, -Math.PI / 2, 0], [0.125, 1, 1]]
|
830
|
-
]
|
831
|
-
};
|
832
|
-
const pickerTranslate = {
|
833
|
-
X: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0.6, 0, 0], [0, 0, -Math.PI / 2]]],
|
834
|
-
Y: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0.6, 0]]],
|
835
|
-
Z: [[new Mesh(new CylinderGeometry(0.2, 0, 1, 4, 1, false), matInvisible), [0, 0, 0.6], [Math.PI / 2, 0, 0]]],
|
836
|
-
XYZ: [[new Mesh(new OctahedronGeometry(0.2, 0), matInvisible)]],
|
837
|
-
XY: [[new Mesh(new PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0.2, 0]]],
|
838
|
-
YZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), matInvisible), [0, 0.2, 0.2], [0, Math.PI / 2, 0]]],
|
839
|
-
XZ: [[new Mesh(new PlaneGeometry(0.4, 0.4), matInvisible), [0.2, 0, 0.2], [-Math.PI / 2, 0, 0]]]
|
840
|
-
};
|
841
|
-
const helperTranslate = {
|
842
|
-
START: [[new Mesh(new OctahedronGeometry(0.01, 2), matHelper), null, null, null, "helper"]],
|
843
|
-
END: [[new Mesh(new OctahedronGeometry(0.01, 2), matHelper), null, null, null, "helper"]],
|
844
|
-
DELTA: [[new Line(TranslateHelperGeometry(), matHelper), null, null, null, "helper"]],
|
845
|
-
X: [[new Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
|
846
|
-
Y: [[new Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
|
847
|
-
Z: [[new Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
|
848
|
-
};
|
849
|
-
const gizmoRotate = {
|
850
|
-
X: [
|
851
|
-
[new Line(CircleGeometry(1, 0.5), matLineRed)],
|
852
|
-
[new Mesh(new OctahedronGeometry(0.04, 0), matRed), [0, 0, 0.99], null, [1, 3, 1]]
|
853
|
-
],
|
854
|
-
Y: [
|
855
|
-
[new Line(CircleGeometry(1, 0.5), matLineGreen), null, [0, 0, -Math.PI / 2]],
|
856
|
-
[new Mesh(new OctahedronGeometry(0.04, 0), matGreen), [0, 0, 0.99], null, [3, 1, 1]]
|
857
|
-
],
|
858
|
-
Z: [
|
859
|
-
[new Line(CircleGeometry(1, 0.5), matLineBlue), null, [0, Math.PI / 2, 0]],
|
860
|
-
[new Mesh(new OctahedronGeometry(0.04, 0), matBlue), [0.99, 0, 0], null, [1, 3, 1]]
|
861
|
-
],
|
862
|
-
E: [
|
863
|
-
[new Line(CircleGeometry(1.25, 1), matLineYellowTransparent), null, [0, Math.PI / 2, 0]],
|
864
|
-
[
|
865
|
-
new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent),
|
866
|
-
[1.17, 0, 0],
|
867
|
-
[0, 0, -Math.PI / 2],
|
868
|
-
[1, 1, 1e-3]
|
869
|
-
],
|
870
|
-
[
|
871
|
-
new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent),
|
872
|
-
[-1.17, 0, 0],
|
873
|
-
[0, 0, Math.PI / 2],
|
874
|
-
[1, 1, 1e-3]
|
875
|
-
],
|
876
|
-
[
|
877
|
-
new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent),
|
878
|
-
[0, -1.17, 0],
|
879
|
-
[Math.PI, 0, 0],
|
880
|
-
[1, 1, 1e-3]
|
881
|
-
],
|
882
|
-
[
|
883
|
-
new Mesh(new CylinderGeometry(0.03, 0, 0.15, 4, 1, false), matLineYellowTransparent),
|
884
|
-
[0, 1.17, 0],
|
885
|
-
[0, 0, 0],
|
886
|
-
[1, 1, 1e-3]
|
887
|
-
]
|
888
|
-
],
|
889
|
-
XYZE: [[new Line(CircleGeometry(1, 1), matLineGray), null, [0, Math.PI / 2, 0]]]
|
890
|
-
};
|
891
|
-
const helperRotate = {
|
892
|
-
AXIS: [[new Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]]
|
893
|
-
};
|
894
|
-
const pickerRotate = {
|
895
|
-
X: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],
|
896
|
-
Y: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [Math.PI / 2, 0, 0]]],
|
897
|
-
Z: [[new Mesh(new TorusGeometry(1, 0.1, 4, 24), matInvisible), [0, 0, 0], [0, 0, -Math.PI / 2]]],
|
898
|
-
E: [[new Mesh(new TorusGeometry(1.25, 0.1, 2, 24), matInvisible)]],
|
899
|
-
XYZE: [[new Mesh(new SphereGeometry(0.7, 10, 8), matInvisible)]]
|
900
|
-
};
|
901
|
-
const gizmoScale = {
|
902
|
-
X: [
|
903
|
-
[new Mesh(scaleHandleGeometry, matRed), [0.8, 0, 0], [0, 0, -Math.PI / 2]],
|
904
|
-
[new Line(lineGeometry, matLineRed), null, null, [0.8, 1, 1]]
|
905
|
-
],
|
906
|
-
Y: [
|
907
|
-
[new Mesh(scaleHandleGeometry, matGreen), [0, 0.8, 0]],
|
908
|
-
[new Line(lineGeometry, matLineGreen), null, [0, 0, Math.PI / 2], [0.8, 1, 1]]
|
909
|
-
],
|
910
|
-
Z: [
|
911
|
-
[new Mesh(scaleHandleGeometry, matBlue), [0, 0, 0.8], [Math.PI / 2, 0, 0]],
|
912
|
-
[new Line(lineGeometry, matLineBlue), null, [0, -Math.PI / 2, 0], [0.8, 1, 1]]
|
913
|
-
],
|
914
|
-
XY: [
|
915
|
-
[new Mesh(scaleHandleGeometry, matYellowTransparent), [0.85, 0.85, 0], null, [2, 2, 0.2]],
|
916
|
-
[new Line(lineGeometry, matLineYellow), [0.855, 0.98, 0], null, [0.125, 1, 1]],
|
917
|
-
[new Line(lineGeometry, matLineYellow), [0.98, 0.855, 0], [0, 0, Math.PI / 2], [0.125, 1, 1]]
|
918
|
-
],
|
919
|
-
YZ: [
|
920
|
-
[new Mesh(scaleHandleGeometry, matCyanTransparent), [0, 0.85, 0.85], null, [0.2, 2, 2]],
|
921
|
-
[new Line(lineGeometry, matLineCyan), [0, 0.855, 0.98], [0, 0, Math.PI / 2], [0.125, 1, 1]],
|
922
|
-
[new Line(lineGeometry, matLineCyan), [0, 0.98, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]
|
923
|
-
],
|
924
|
-
XZ: [
|
925
|
-
[new Mesh(scaleHandleGeometry, matMagentaTransparent), [0.85, 0, 0.85], null, [2, 0.2, 2]],
|
926
|
-
[new Line(lineGeometry, matLineMagenta), [0.855, 0, 0.98], null, [0.125, 1, 1]],
|
927
|
-
[new Line(lineGeometry, matLineMagenta), [0.98, 0, 0.855], [0, -Math.PI / 2, 0], [0.125, 1, 1]]
|
928
|
-
],
|
929
|
-
XYZX: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [1.1, 0, 0]]],
|
930
|
-
XYZY: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 1.1, 0]]],
|
931
|
-
XYZZ: [[new Mesh(new BoxGeometry(0.125, 0.125, 0.125), matWhiteTransparent.clone()), [0, 0, 1.1]]]
|
932
|
-
};
|
933
|
-
const pickerScale = {
|
934
|
-
X: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0.5, 0, 0], [0, 0, -Math.PI / 2]]],
|
935
|
-
Y: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0.5, 0]]],
|
936
|
-
Z: [[new Mesh(new CylinderGeometry(0.2, 0, 0.8, 4, 1, false), matInvisible), [0, 0, 0.5], [Math.PI / 2, 0, 0]]],
|
937
|
-
XY: [[new Mesh(scaleHandleGeometry, matInvisible), [0.85, 0.85, 0], null, [3, 3, 0.2]]],
|
938
|
-
YZ: [[new Mesh(scaleHandleGeometry, matInvisible), [0, 0.85, 0.85], null, [0.2, 3, 3]]],
|
939
|
-
XZ: [[new Mesh(scaleHandleGeometry, matInvisible), [0.85, 0, 0.85], null, [3, 0.2, 3]]],
|
940
|
-
XYZX: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), matInvisible), [1.1, 0, 0]]],
|
941
|
-
XYZY: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 1.1, 0]]],
|
942
|
-
XYZZ: [[new Mesh(new BoxGeometry(0.2, 0.2, 0.2), matInvisible), [0, 0, 1.1]]]
|
943
|
-
};
|
944
|
-
const helperScale = {
|
945
|
-
X: [[new Line(lineGeometry, matHelper.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
|
946
|
-
Y: [[new Line(lineGeometry, matHelper.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
|
947
|
-
Z: [[new Line(lineGeometry, matHelper.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
|
948
|
-
};
|
949
|
-
const setupGizmo = (gizmoMap) => {
|
950
|
-
const gizmo = new Object3D();
|
951
|
-
for (let name in gizmoMap) {
|
952
|
-
for (let i = gizmoMap[name].length; i--; ) {
|
953
|
-
const object = gizmoMap[name][i][0].clone();
|
954
|
-
const position = gizmoMap[name][i][1];
|
955
|
-
const rotation = gizmoMap[name][i][2];
|
956
|
-
const scale = gizmoMap[name][i][3];
|
957
|
-
const tag = gizmoMap[name][i][4];
|
958
|
-
object.name = name;
|
959
|
-
object.tag = tag;
|
960
|
-
if (position) {
|
961
|
-
object.position.set(position[0], position[1], position[2]);
|
962
|
-
}
|
963
|
-
if (rotation) {
|
964
|
-
object.rotation.set(rotation[0], rotation[1], rotation[2]);
|
965
|
-
}
|
966
|
-
if (scale) {
|
967
|
-
object.scale.set(scale[0], scale[1], scale[2]);
|
968
|
-
}
|
969
|
-
object.updateMatrix();
|
970
|
-
const tempGeometry = object.geometry.clone();
|
971
|
-
tempGeometry.applyMatrix4(object.matrix);
|
972
|
-
object.geometry = tempGeometry;
|
973
|
-
object.renderOrder = Infinity;
|
974
|
-
object.position.set(0, 0, 0);
|
975
|
-
object.rotation.set(0, 0, 0);
|
976
|
-
object.scale.set(1, 1, 1);
|
977
|
-
gizmo.add(object);
|
978
|
-
}
|
979
|
-
}
|
980
|
-
return gizmo;
|
981
|
-
};
|
982
|
-
this.gizmo = {};
|
983
|
-
this.picker = {};
|
984
|
-
this.helper = {};
|
985
|
-
this.add(this.gizmo["translate"] = setupGizmo(gizmoTranslate));
|
986
|
-
this.add(this.gizmo["rotate"] = setupGizmo(gizmoRotate));
|
987
|
-
this.add(this.gizmo["scale"] = setupGizmo(gizmoScale));
|
988
|
-
this.add(this.picker["translate"] = setupGizmo(pickerTranslate));
|
989
|
-
this.add(this.picker["rotate"] = setupGizmo(pickerRotate));
|
990
|
-
this.add(this.picker["scale"] = setupGizmo(pickerScale));
|
991
|
-
this.add(this.helper["translate"] = setupGizmo(helperTranslate));
|
992
|
-
this.add(this.helper["rotate"] = setupGizmo(helperRotate));
|
993
|
-
this.add(this.helper["scale"] = setupGizmo(helperScale));
|
994
|
-
this.picker["translate"].visible = false;
|
995
|
-
this.picker["rotate"].visible = false;
|
996
|
-
this.picker["scale"].visible = false;
|
997
|
-
}
|
998
|
-
}
|
999
|
-
class TransformControlsPlane extends Mesh {
|
1000
|
-
constructor() {
|
1001
|
-
super(
|
1002
|
-
new PlaneGeometry(1e5, 1e5, 2, 2),
|
1003
|
-
new MeshBasicMaterial({
|
1004
|
-
visible: false,
|
1005
|
-
wireframe: true,
|
1006
|
-
side: DoubleSide,
|
1007
|
-
transparent: true,
|
1008
|
-
opacity: 0.1,
|
1009
|
-
toneMapped: false
|
1010
|
-
})
|
1011
|
-
);
|
1012
|
-
__publicField(this, "isTransformControlsPlane", true);
|
1013
|
-
__publicField(this, "type", "TransformControlsPlane");
|
1014
|
-
__publicField(this, "unitX", new Vector3(1, 0, 0));
|
1015
|
-
__publicField(this, "unitY", new Vector3(0, 1, 0));
|
1016
|
-
__publicField(this, "unitZ", new Vector3(0, 0, 1));
|
1017
|
-
__publicField(this, "tempVector", new Vector3());
|
1018
|
-
__publicField(this, "dirVector", new Vector3());
|
1019
|
-
__publicField(this, "alignVector", new Vector3());
|
1020
|
-
__publicField(this, "tempMatrix", new Matrix4());
|
1021
|
-
__publicField(this, "identityQuaternion", new Quaternion());
|
1022
|
-
// these are set from parent class TransformControls
|
1023
|
-
__publicField(this, "cameraQuaternion", new Quaternion());
|
1024
|
-
__publicField(this, "worldPosition", new Vector3());
|
1025
|
-
__publicField(this, "worldQuaternion", new Quaternion());
|
1026
|
-
__publicField(this, "eye", new Vector3());
|
1027
|
-
__publicField(this, "axis", null);
|
1028
|
-
__publicField(this, "mode", "translate");
|
1029
|
-
__publicField(this, "space", "world");
|
1030
|
-
__publicField(this, "updateMatrixWorld", () => {
|
1031
|
-
let space = this.space;
|
1032
|
-
this.position.copy(this.worldPosition);
|
1033
|
-
if (this.mode === "scale")
|
1034
|
-
space = "local";
|
1035
|
-
this.unitX.set(1, 0, 0).applyQuaternion(space === "local" ? this.worldQuaternion : this.identityQuaternion);
|
1036
|
-
this.unitY.set(0, 1, 0).applyQuaternion(space === "local" ? this.worldQuaternion : this.identityQuaternion);
|
1037
|
-
this.unitZ.set(0, 0, 1).applyQuaternion(space === "local" ? this.worldQuaternion : this.identityQuaternion);
|
1038
|
-
this.alignVector.copy(this.unitY);
|
1039
|
-
switch (this.mode) {
|
1040
|
-
case "translate":
|
1041
|
-
case "scale":
|
1042
|
-
switch (this.axis) {
|
1043
|
-
case "X":
|
1044
|
-
this.alignVector.copy(this.eye).cross(this.unitX);
|
1045
|
-
this.dirVector.copy(this.unitX).cross(this.alignVector);
|
1046
|
-
break;
|
1047
|
-
case "Y":
|
1048
|
-
this.alignVector.copy(this.eye).cross(this.unitY);
|
1049
|
-
this.dirVector.copy(this.unitY).cross(this.alignVector);
|
1050
|
-
break;
|
1051
|
-
case "Z":
|
1052
|
-
this.alignVector.copy(this.eye).cross(this.unitZ);
|
1053
|
-
this.dirVector.copy(this.unitZ).cross(this.alignVector);
|
1054
|
-
break;
|
1055
|
-
case "XY":
|
1056
|
-
this.dirVector.copy(this.unitZ);
|
1057
|
-
break;
|
1058
|
-
case "YZ":
|
1059
|
-
this.dirVector.copy(this.unitX);
|
1060
|
-
break;
|
1061
|
-
case "XZ":
|
1062
|
-
this.alignVector.copy(this.unitZ);
|
1063
|
-
this.dirVector.copy(this.unitY);
|
1064
|
-
break;
|
1065
|
-
case "XYZ":
|
1066
|
-
case "E":
|
1067
|
-
this.dirVector.set(0, 0, 0);
|
1068
|
-
break;
|
1069
|
-
}
|
1070
|
-
break;
|
1071
|
-
case "rotate":
|
1072
|
-
default:
|
1073
|
-
this.dirVector.set(0, 0, 0);
|
1074
|
-
}
|
1075
|
-
if (this.dirVector.length() === 0) {
|
1076
|
-
this.quaternion.copy(this.cameraQuaternion);
|
1077
|
-
} else {
|
1078
|
-
this.tempMatrix.lookAt(this.tempVector.set(0, 0, 0), this.dirVector, this.alignVector);
|
1079
|
-
this.quaternion.setFromRotationMatrix(this.tempMatrix);
|
1080
|
-
}
|
1081
|
-
super.updateMatrixWorld();
|
1082
|
-
});
|
1083
|
-
}
|
1084
|
-
}
|
1085
|
-
export {
|
1086
|
-
TransformControls,
|
1087
|
-
TransformControlsGizmo,
|
1088
|
-
TransformControlsPlane
|
1089
|
-
};
|