@plastic-software/three 0.174.0 → 0.175.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +10655 -1446
- package/build/three.core.js +9626 -1094
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +834 -157
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +4 -2
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +2658 -1697
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +2654 -1709
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -1
- package/examples/jsm/animation/AnimationClipCreator.js +57 -6
- package/examples/jsm/animation/CCDIKSolver.js +93 -39
- package/examples/jsm/capabilities/WebGL.js +28 -3
- package/examples/jsm/capabilities/WebGPU.js +16 -6
- package/examples/jsm/controls/ArcballControls.js +424 -154
- package/examples/jsm/controls/DragControls.js +93 -2
- package/examples/jsm/controls/FirstPersonControls.js +113 -4
- package/examples/jsm/controls/FlyControls.js +49 -2
- package/examples/jsm/controls/MapControls.js +42 -9
- package/examples/jsm/controls/OrbitControls.js +345 -42
- package/examples/jsm/controls/PointerLockControls.js +111 -9
- package/examples/jsm/controls/TrackballControls.js +159 -8
- package/examples/jsm/controls/TransformControls.js +252 -6
- package/examples/jsm/csm/CSM.js +226 -15
- package/examples/jsm/csm/CSMFrustum.js +52 -0
- package/examples/jsm/csm/CSMHelper.js +47 -0
- package/examples/jsm/csm/CSMShader.js +10 -1
- package/examples/jsm/csm/CSMShadowNode.js +156 -13
- package/examples/jsm/curves/CurveExtras.js +289 -31
- package/examples/jsm/curves/NURBSCurve.js +57 -14
- package/examples/jsm/curves/NURBSSurface.js +50 -6
- package/examples/jsm/curves/NURBSUtils.js +96 -112
- package/examples/jsm/curves/NURBSVolume.js +22 -4
- package/examples/jsm/effects/AnaglyphEffect.js +30 -0
- package/examples/jsm/effects/AsciiEffect.js +60 -15
- package/examples/jsm/effects/OutlineEffect.js +59 -111
- package/examples/jsm/effects/ParallaxBarrierEffect.js +28 -0
- package/examples/jsm/effects/PeppersGhostEffect.js +21 -2
- package/examples/jsm/effects/StereoEffect.js +29 -0
- package/examples/jsm/environments/DebugEnvironment.js +49 -0
- package/examples/jsm/environments/RoomEnvironment.js +23 -4
- package/examples/jsm/exporters/DRACOExporter.js +53 -13
- package/examples/jsm/exporters/EXRExporter.js +37 -8
- package/examples/jsm/exporters/GLTFExporter.js +171 -48
- package/examples/jsm/exporters/KTX2Exporter.js +20 -0
- package/examples/jsm/exporters/OBJExporter.js +18 -0
- package/examples/jsm/exporters/PLYExporter.js +39 -9
- package/examples/jsm/exporters/STLExporter.js +25 -5
- package/examples/jsm/exporters/USDZExporter.js +70 -3
- package/examples/jsm/geometries/BoxLineGeometry.js +22 -0
- package/examples/jsm/geometries/ConvexGeometry.js +18 -0
- package/examples/jsm/geometries/DecalGeometry.js +20 -9
- package/examples/jsm/geometries/ParametricFunctions.js +97 -0
- package/examples/jsm/geometries/ParametricGeometry.js +37 -5
- package/examples/jsm/geometries/RoundedBoxGeometry.js +21 -0
- package/examples/jsm/geometries/TeapotGeometry.js +22 -38
- package/examples/jsm/geometries/TextGeometry.js +44 -16
- package/examples/jsm/helpers/LightProbeHelper.js +35 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +36 -0
- package/examples/jsm/helpers/OctreeHelper.js +35 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +35 -3
- package/examples/jsm/helpers/TextureHelper.js +27 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +28 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +58 -2
- package/examples/jsm/helpers/VertexTangentsHelper.js +46 -2
- package/examples/jsm/helpers/ViewHelper.js +75 -1
- package/examples/jsm/interactive/HTMLMesh.js +25 -0
- package/examples/jsm/interactive/InteractiveGroup.js +65 -5
- package/examples/jsm/interactive/SelectionBox.js +74 -9
- package/examples/jsm/interactive/SelectionHelper.js +71 -29
- package/examples/jsm/libs/motion-controllers.module.js +1 -1
- package/examples/jsm/lighting/TiledLighting.js +23 -0
- package/examples/jsm/lights/LightProbeGenerator.js +26 -1
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +48 -13
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +15 -0
- package/examples/jsm/lines/Line2.js +36 -0
- package/examples/jsm/lines/LineGeometry.js +52 -0
- package/examples/jsm/lines/LineMaterial.js +95 -0
- package/examples/jsm/lines/LineSegments2.js +51 -2
- package/examples/jsm/lines/LineSegmentsGeometry.js +62 -8
- package/examples/jsm/lines/Wireframe.js +38 -2
- package/examples/jsm/lines/WireframeGeometry2.js +24 -0
- package/examples/jsm/lines/webgpu/Line2.js +25 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +44 -6
- package/examples/jsm/lines/webgpu/Wireframe.js +30 -2
- package/examples/jsm/loaders/3DMLoader.js +71 -2
- package/examples/jsm/loaders/3MFLoader.js +41 -3
- package/examples/jsm/loaders/AMFLoader.js +31 -12
- package/examples/jsm/loaders/BVHLoader.js +57 -11
- package/examples/jsm/loaders/ColladaLoader.js +35 -0
- package/examples/jsm/loaders/DDSLoader.js +24 -0
- package/examples/jsm/loaders/DRACOLoader.js +73 -1
- package/examples/jsm/loaders/EXRLoader.js +40 -8
- package/examples/jsm/loaders/FBXLoader.js +42 -14
- package/examples/jsm/loaders/FontLoader.js +60 -2
- package/examples/jsm/loaders/GCodeLoader.js +33 -5
- package/examples/jsm/loaders/GLTFLoader.js +218 -5
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +48 -0
- package/examples/jsm/loaders/IESLoader.js +41 -0
- package/examples/jsm/loaders/KMZLoader.js +32 -0
- package/examples/jsm/loaders/KTX2Loader.js +86 -18
- package/examples/jsm/loaders/KTXLoader.js +26 -6
- package/examples/jsm/loaders/LDrawLoader.js +115 -5
- package/examples/jsm/loaders/LUT3dlLoader.js +46 -10
- package/examples/jsm/loaders/LUTCubeLoader.js +45 -9
- package/examples/jsm/loaders/LUTImageLoader.js +78 -38
- package/examples/jsm/loaders/LWOLoader.js +46 -7
- package/examples/jsm/loaders/LottieLoader.js +37 -0
- package/examples/jsm/loaders/MD2Loader.js +36 -1
- package/examples/jsm/loaders/MDDLoader.js +56 -12
- package/examples/jsm/loaders/MTLLoader.js +38 -33
- package/examples/jsm/loaders/MaterialXLoader.js +33 -0
- package/examples/jsm/loaders/NRRDLoader.js +36 -5
- package/examples/jsm/loaders/OBJLoader.js +48 -1
- package/examples/jsm/loaders/PCDLoader.js +47 -0
- package/examples/jsm/loaders/PDBLoader.js +40 -2
- package/examples/jsm/loaders/PLYLoader.js +62 -32
- package/examples/jsm/loaders/PVRLoader.js +23 -5
- package/examples/jsm/loaders/RGBELoader.js +38 -5
- package/examples/jsm/loaders/RGBMLoader.js +67 -1
- package/examples/jsm/loaders/STLLoader.js +47 -38
- package/examples/jsm/loaders/SVGLoader.js +113 -20
- package/examples/jsm/loaders/TDSLoader.js +81 -61
- package/examples/jsm/loaders/TGALoader.js +22 -0
- package/examples/jsm/loaders/TIFFLoader.js +22 -0
- package/examples/jsm/loaders/TTFLoader.js +36 -2
- package/examples/jsm/loaders/USDZLoader.js +34 -1
- package/examples/jsm/loaders/UltraHDRLoader.js +58 -12
- package/examples/jsm/loaders/VOXLoader.js +57 -0
- package/examples/jsm/loaders/VRMLLoader.js +32 -1
- package/examples/jsm/loaders/VTKLoader.js +38 -0
- package/examples/jsm/loaders/XYZLoader.js +35 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +39 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +39 -0
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +24 -2
- package/examples/jsm/math/Capsule.js +89 -14
- package/examples/jsm/math/ColorConverter.js +21 -0
- package/examples/jsm/math/ColorSpaces.js +53 -0
- package/examples/jsm/math/ConvexHull.js +514 -92
- package/examples/jsm/math/ImprovedNoise.js +14 -2
- package/examples/jsm/math/Lut.js +111 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +76 -13
- package/examples/jsm/math/OBB.js +139 -46
- package/examples/jsm/math/Octree.js +132 -5
- package/examples/jsm/math/SimplexNoise.js +66 -42
- package/examples/jsm/misc/ConvexObjectBreaker.js +43 -25
- package/examples/jsm/misc/GPUComputationRenderer.js +92 -17
- package/examples/jsm/misc/Gyroscope.js +11 -0
- package/examples/jsm/misc/MD2Character.js +115 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +170 -8
- package/examples/jsm/misc/MorphAnimMesh.js +43 -0
- package/examples/jsm/misc/MorphBlendMesh.js +102 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +40 -15
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +33 -13
- package/examples/jsm/misc/RollerCoaster.js +52 -0
- package/examples/jsm/misc/Timer.js +79 -2
- package/examples/jsm/misc/TubePainter.js +53 -0
- package/examples/jsm/misc/Volume.js +108 -72
- package/examples/jsm/misc/VolumeSlice.js +88 -45
- package/examples/jsm/modifiers/CurveModifier.js +57 -34
- package/examples/jsm/modifiers/CurveModifierGPU.js +36 -17
- package/examples/jsm/modifiers/EdgeSplitModifier.js +18 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +20 -8
- package/examples/jsm/modifiers/TessellateModifier.js +33 -2
- package/examples/jsm/objects/GroundedSkybox.js +23 -5
- package/examples/jsm/objects/Lensflare.js +91 -2
- package/examples/jsm/objects/LensflareMesh.js +53 -2
- package/examples/jsm/objects/MarchingCubes.js +88 -5
- package/examples/jsm/objects/Reflector.js +70 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +39 -0
- package/examples/jsm/objects/Refractor.js +61 -0
- package/examples/jsm/objects/ShadowMesh.js +53 -4
- package/examples/jsm/objects/Sky.js +26 -9
- package/examples/jsm/objects/SkyMesh.js +60 -9
- package/examples/jsm/objects/Water.js +44 -5
- package/examples/jsm/objects/Water2.js +42 -3
- package/examples/jsm/objects/Water2Mesh.js +38 -3
- package/examples/jsm/objects/WaterMesh.js +94 -7
- package/examples/jsm/physics/AmmoPhysics.js +47 -0
- package/examples/jsm/physics/JoltPhysics.js +48 -0
- package/examples/jsm/physics/RapierPhysics.js +56 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +90 -38
- package/examples/jsm/postprocessing/BloomPass.js +125 -24
- package/examples/jsm/postprocessing/BokehPass.js +98 -22
- package/examples/jsm/postprocessing/ClearPass.js +53 -3
- package/examples/jsm/postprocessing/CubeTexturePass.js +81 -21
- package/examples/jsm/postprocessing/DotScreenPass.js +58 -10
- package/examples/jsm/postprocessing/EffectComposer.js +131 -0
- package/examples/jsm/postprocessing/FilmPass.js +53 -5
- package/examples/jsm/postprocessing/GTAOPass.js +191 -48
- package/examples/jsm/postprocessing/GlitchPass.js +84 -33
- package/examples/jsm/postprocessing/HalftonePass.js +64 -10
- package/examples/jsm/postprocessing/LUTPass.js +37 -8
- package/examples/jsm/postprocessing/MaskPass.js +90 -0
- package/examples/jsm/postprocessing/OutlinePass.js +266 -133
- package/examples/jsm/postprocessing/OutputPass.js +53 -14
- package/examples/jsm/postprocessing/Pass.js +98 -4
- package/examples/jsm/postprocessing/RenderPass.js +83 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +123 -45
- package/examples/jsm/postprocessing/RenderTransitionPass.js +119 -21
- package/examples/jsm/postprocessing/SAOPass.js +126 -53
- package/examples/jsm/postprocessing/SMAAPass.js +103 -71
- package/examples/jsm/postprocessing/SSAARenderPass.js +117 -35
- package/examples/jsm/postprocessing/SSAOPass.js +160 -47
- package/examples/jsm/postprocessing/SSRPass.js +230 -49
- package/examples/jsm/postprocessing/SavePass.js +68 -16
- package/examples/jsm/postprocessing/ShaderPass.js +64 -7
- package/examples/jsm/postprocessing/TAARenderPass.js +78 -24
- package/examples/jsm/postprocessing/TexturePass.js +71 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +113 -37
- package/examples/jsm/renderers/CSS2DRenderer.js +77 -1
- package/examples/jsm/renderers/CSS3DRenderer.js +99 -3
- package/examples/jsm/renderers/Projector.js +18 -2
- package/examples/jsm/renderers/SVGRenderer.js +124 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +9 -5
- package/examples/jsm/shaders/AfterimageShader.js +6 -4
- package/examples/jsm/shaders/BasicShader.js +6 -2
- package/examples/jsm/shaders/BleachBypassShader.js +8 -4
- package/examples/jsm/shaders/BlendShader.js +6 -2
- package/examples/jsm/shaders/BokehShader.js +7 -4
- package/examples/jsm/shaders/BokehShader2.js +7 -3
- package/examples/jsm/shaders/BrightnessContrastShader.js +8 -5
- package/examples/jsm/shaders/ColorCorrectionShader.js +6 -2
- package/examples/jsm/shaders/ColorifyShader.js +6 -2
- package/examples/jsm/shaders/ConvolutionShader.js +7 -39
- package/examples/jsm/shaders/CopyShader.js +6 -2
- package/examples/jsm/shaders/DOFMipMapShader.js +8 -4
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +7 -1
- package/examples/jsm/shaders/DigitalGlitch.js +7 -7
- package/examples/jsm/shaders/DotScreenShader.js +6 -4
- package/examples/jsm/shaders/ExposureShader.js +6 -2
- package/examples/jsm/shaders/FXAAShader.js +15 -7
- package/examples/jsm/shaders/FilmShader.js +10 -0
- package/examples/jsm/shaders/FocusShader.js +6 -4
- package/examples/jsm/shaders/FreiChenShader.js +7 -3
- package/examples/jsm/shaders/GTAOShader.js +33 -39
- package/examples/jsm/shaders/GammaCorrectionShader.js +8 -2
- package/examples/jsm/shaders/GodRaysShader.js +14 -5
- package/examples/jsm/shaders/HalftoneShader.js +11 -5
- package/examples/jsm/shaders/HorizontalBlurShader.js +9 -3
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +6 -2
- package/examples/jsm/shaders/HueSaturationShader.js +7 -3
- package/examples/jsm/shaders/KaleidoShader.js +8 -4
- package/examples/jsm/shaders/LuminosityHighPassShader.js +6 -5
- package/examples/jsm/shaders/LuminosityShader.js +6 -3
- package/examples/jsm/shaders/MirrorShader.js +7 -4
- package/examples/jsm/shaders/NormalMapShader.js +5 -3
- package/examples/jsm/shaders/OutputShader.js +11 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +21 -15
- package/examples/jsm/shaders/RGBShiftShader.js +5 -1
- package/examples/jsm/shaders/SAOShader.js +8 -2
- package/examples/jsm/shaders/SMAAShader.js +23 -1
- package/examples/jsm/shaders/SSAOShader.js +23 -5
- package/examples/jsm/shaders/SSRShader.js +25 -1
- package/examples/jsm/shaders/SepiaShader.js +6 -4
- package/examples/jsm/shaders/SobelOperatorShader.js +5 -2
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +10 -8
- package/examples/jsm/shaders/TechnicolorShader.js +7 -4
- package/examples/jsm/shaders/ToonShader.js +29 -7
- package/examples/jsm/shaders/TriangleBlurShader.js +6 -4
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +6 -3
- package/examples/jsm/shaders/VelocityShader.js +6 -2
- package/examples/jsm/shaders/VerticalBlurShader.js +6 -2
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +5 -1
- package/examples/jsm/shaders/VignetteShader.js +6 -4
- package/examples/jsm/shaders/VolumeShader.js +7 -1
- package/examples/jsm/shaders/WaterRefractionShader.js +8 -0
- package/examples/jsm/textures/FlakesTexture.js +12 -0
- package/examples/jsm/transpiler/Transpiler.js +31 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +1 -1
- package/examples/jsm/tsl/display/BloomNode.js +1 -1
- package/examples/jsm/tsl/display/PixelationPassNode.js +4 -4
- package/examples/jsm/tsl/display/SSRNode.js +1 -1
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +29 -3
- package/examples/jsm/tsl/math/Bayer.js +14 -1
- package/examples/jsm/tsl/utils/Raymarching.js +4 -2
- package/examples/jsm/utils/BufferGeometryUtils.js +88 -29
- package/examples/jsm/utils/CameraUtils.js +10 -7
- package/examples/jsm/utils/GeometryCompressionUtils.js +20 -30
- package/examples/jsm/utils/GeometryUtils.js +12 -13
- package/examples/jsm/utils/LDrawUtils.js +11 -4
- package/examples/jsm/utils/SceneOptimizer.js +66 -20
- package/examples/jsm/utils/SceneUtils.js +50 -3
- package/examples/jsm/utils/ShadowMapViewer.js +47 -24
- package/examples/jsm/utils/ShadowMapViewerGPU.js +47 -24
- package/examples/jsm/utils/SkeletonUtils.js +45 -0
- package/examples/jsm/utils/SortUtils.js +14 -5
- package/examples/jsm/utils/UVsDebug.js +9 -4
- package/examples/jsm/utils/WebGLTextureUtils.js +13 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +14 -0
- package/examples/jsm/utils/WorkerPool.js +65 -2
- package/examples/jsm/webxr/ARButton.js +18 -0
- package/examples/jsm/webxr/OculusHandModel.js +83 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +125 -0
- package/examples/jsm/webxr/Text2D.js +11 -0
- package/examples/jsm/webxr/VRButton.js +30 -0
- package/examples/jsm/webxr/XRButton.js +22 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +87 -3
- package/examples/jsm/webxr/XREstimatedLight.js +33 -3
- package/examples/jsm/webxr/XRHandMeshModel.js +35 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +92 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +42 -0
- package/examples/jsm/webxr/XRPlanes.js +17 -0
- package/package.json +1 -1
- package/src/Three.TSL.js +3 -1
- package/src/animation/AnimationAction.js +262 -30
- package/src/animation/AnimationClip.js +141 -2
- package/src/animation/AnimationMixer.js +99 -15
- package/src/animation/AnimationObjectGroup.js +41 -18
- package/src/animation/AnimationUtils.js +168 -18
- package/src/animation/KeyframeTrack.js +144 -10
- package/src/animation/PropertyBinding.js +77 -3
- package/src/animation/PropertyMixer.js +72 -5
- package/src/animation/tracks/BooleanKeyframeTrack.js +33 -6
- package/src/animation/tracks/ColorKeyframeTrack.js +26 -5
- package/src/animation/tracks/NumberKeyframeTrack.js +26 -2
- package/src/animation/tracks/QuaternionKeyframeTrack.js +30 -1
- package/src/animation/tracks/StringKeyframeTrack.js +33 -2
- package/src/animation/tracks/VectorKeyframeTrack.js +26 -2
- package/src/audio/AudioAnalyser.js +1 -1
- package/src/audio/AudioListener.js +2 -2
- package/src/audio/PositionalAudio.js +5 -5
- package/src/constants.js +1429 -5
- package/src/core/BufferAttribute.js +413 -3
- package/src/core/BufferGeometry.js +337 -1
- package/src/core/Clock.js +60 -0
- package/src/core/GLBufferAttribute.js +99 -0
- package/src/core/InstancedBufferAttribute.js +29 -0
- package/src/core/InstancedBufferGeometry.js +20 -0
- package/src/core/InstancedInterleavedBuffer.js +26 -0
- package/src/core/InterleavedBuffer.js +137 -3
- package/src/core/InterleavedBufferAttribute.js +197 -0
- package/src/core/Layers.js +71 -10
- package/src/core/Object3D.js +23 -0
- package/src/core/Raycaster.js +134 -1
- package/src/core/RenderTarget.js +166 -7
- package/src/core/RenderTarget3D.js +25 -0
- package/src/core/RenderTargetArray.js +18 -0
- package/src/core/Uniform.js +29 -0
- package/src/core/UniformsGroup.js +84 -2
- package/src/extras/Controls.js +16 -1
- package/src/extras/Earcut.js +3 -781
- package/src/extras/ImageUtils.js +3 -2
- package/src/extras/PMREMGenerator.js +22 -17
- package/src/extras/core/Curve.js +1 -1
- package/src/extras/core/Path.js +1 -1
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/ConeGeometry.js +2 -2
- package/src/geometries/CylinderGeometry.js +2 -2
- package/src/geometries/ExtrudeGeometry.js +71 -39
- package/src/geometries/LatheGeometry.js +1 -1
- package/src/lights/LightShadow.js +1 -1
- package/src/lights/webgpu/IESSpotLight.js +1 -1
- package/src/loaders/AnimationLoader.js +31 -0
- package/src/loaders/AudioLoader.js +31 -0
- package/src/loaders/BufferGeometryLoader.js +34 -0
- package/src/loaders/Cache.js +45 -0
- package/src/loaders/CompressedTextureLoader.js +36 -3
- package/src/loaders/CubeTextureLoader.js +45 -0
- package/src/loaders/DataTextureLoader.js +44 -3
- package/src/loaders/FileLoader.js +57 -1
- package/src/loaders/ImageBitmapLoader.js +57 -0
- package/src/loaders/ImageLoader.js +30 -0
- package/src/loaders/Loader.js +4 -6
- package/src/loaders/LoaderUtils.js +18 -36
- package/src/loaders/LoadingManager.js +142 -0
- package/src/loaders/MaterialLoader.js +57 -0
- package/src/loaders/ObjectLoader.js +53 -0
- package/src/loaders/TextureLoader.js +33 -0
- package/src/loaders/nodes/NodeLoader.js +6 -2
- package/src/loaders/nodes/NodeMaterialLoader.js +1 -1
- package/src/loaders/nodes/NodeObjectLoader.js +3 -3
- package/src/materials/LineBasicMaterial.js +74 -1
- package/src/materials/LineDashedMaterial.js +52 -0
- package/src/materials/Material.js +18 -3
- package/src/materials/MeshBasicMaterial.js +165 -0
- package/src/materials/MeshDepthMaterial.js +93 -0
- package/src/materials/MeshDistanceMaterial.js +76 -0
- package/src/materials/MeshLambertMaterial.js +273 -0
- package/src/materials/MeshMatcapMaterial.js +142 -0
- package/src/materials/MeshNormalMaterial.js +113 -0
- package/src/materials/MeshPhongMaterial.js +288 -0
- package/src/materials/MeshPhysicalMaterial.js +292 -1
- package/src/materials/MeshStandardMaterial.js +297 -0
- package/src/materials/MeshToonMaterial.js +218 -0
- package/src/materials/PointsMaterial.js +89 -0
- package/src/materials/RawShaderMaterial.js +25 -0
- package/src/materials/ShaderMaterial.js +215 -6
- package/src/materials/ShadowMaterial.js +54 -0
- package/src/materials/SpriteMaterial.js +82 -0
- package/src/materials/nodes/Line2NodeMaterial.js +1 -1
- package/src/materials/nodes/LineBasicNodeMaterial.js +2 -2
- package/src/materials/nodes/LineDashedNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshLambertNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshStandardNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshToonNodeMaterial.js +2 -2
- package/src/materials/nodes/NodeMaterial.js +7 -3
- package/src/materials/nodes/PointsNodeMaterial.js +1 -1
- package/src/materials/nodes/ShadowNodeMaterial.js +11 -2
- package/src/materials/nodes/SpriteNodeMaterial.js +1 -1
- package/src/materials/nodes/VolumeNodeMaterial.js +10 -1
- package/src/math/Color.js +1 -1
- package/src/math/MathUtils.js +223 -0
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/accessors/BatchNode.js +8 -8
- package/src/nodes/accessors/BuiltinNode.js +1 -1
- package/src/nodes/accessors/CubeTextureNode.js +1 -1
- package/src/nodes/accessors/InstanceNode.js +5 -5
- package/src/nodes/accessors/InstancedMeshNode.js +1 -1
- package/src/nodes/accessors/MorphNode.js +27 -23
- package/src/nodes/accessors/Normal.js +1 -1
- package/src/nodes/accessors/Object3DNode.js +12 -12
- package/src/nodes/accessors/ReferenceBaseNode.js +2 -2
- package/src/nodes/accessors/ReferenceNode.js +1 -1
- package/src/nodes/accessors/SkinningNode.js +46 -37
- package/src/nodes/accessors/StorageBufferNode.js +1 -1
- package/src/nodes/accessors/StorageTextureNode.js +3 -3
- package/src/nodes/accessors/Texture3DNode.js +1 -1
- package/src/nodes/accessors/TextureNode.js +25 -5
- package/src/nodes/accessors/TextureSizeNode.js +1 -1
- package/src/nodes/accessors/UniformArrayNode.js +2 -2
- package/src/nodes/code/CodeNode.js +4 -4
- package/src/nodes/code/ExpressionNode.js +4 -4
- package/src/nodes/code/FunctionCallNode.js +23 -3
- package/src/nodes/code/ScriptableNode.js +4 -4
- package/src/nodes/code/ScriptableValueNode.js +2 -2
- package/src/nodes/core/AssignNode.js +1 -1
- package/src/nodes/core/AttributeNode.js +1 -1
- package/src/nodes/core/BypassNode.js +1 -1
- package/src/nodes/core/CacheNode.js +1 -1
- package/src/nodes/core/ContextNode.js +1 -1
- package/src/nodes/core/InputNode.js +2 -2
- package/src/nodes/core/Node.js +14 -2
- package/src/nodes/core/NodeBuilder.js +86 -14
- package/src/nodes/core/StackNode.js +5 -5
- package/src/nodes/core/StructNode.js +1 -1
- package/src/nodes/core/StructTypeNode.js +2 -2
- package/src/nodes/core/VarNode.js +2 -8
- package/src/nodes/core/VaryingNode.js +3 -3
- package/src/nodes/display/BlendModes.js +4 -4
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/NormalMapNode.js +1 -1
- package/src/nodes/display/PosterizeNode.js +1 -1
- package/src/nodes/display/ScreenNode.js +3 -3
- package/src/nodes/display/ViewportDepthNode.js +2 -2
- package/src/nodes/display/ViewportDepthTextureNode.js +2 -2
- package/src/nodes/display/ViewportSharedTextureNode.js +2 -2
- package/src/nodes/display/ViewportTextureNode.js +4 -4
- package/src/nodes/functions/ShadowMaskModel.js +4 -4
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +6 -6
- package/src/nodes/geometry/RangeNode.js +1 -1
- package/src/nodes/gpgpu/AtomicFunctionNode.js +16 -40
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +30 -2
- package/src/nodes/lighting/AnalyticLightNode.js +9 -1
- package/src/nodes/lighting/LightsNode.js +3 -3
- package/src/nodes/lighting/ShadowNode.js +1 -1
- package/src/nodes/math/ConditionalNode.js +20 -3
- package/src/nodes/math/MathNode.js +83 -78
- package/src/nodes/math/OperatorNode.js +171 -82
- package/src/nodes/pmrem/PMREMNode.js +4 -4
- package/src/nodes/pmrem/PMREMUtils.js +2 -2
- package/src/nodes/tsl/TSLBase.js +2 -1
- package/src/nodes/tsl/TSLCore.js +115 -12
- package/src/nodes/utils/ArrayElementNode.js +3 -1
- package/src/nodes/utils/CubeMapNode.js +3 -3
- package/src/nodes/utils/DebugNode.js +70 -0
- package/src/nodes/utils/EquirectUVNode.js +2 -2
- package/src/nodes/utils/JoinNode.js +27 -2
- package/src/nodes/utils/LoopNode.js +58 -28
- package/src/nodes/utils/MaxMipLevelNode.js +1 -1
- package/src/nodes/utils/ReflectorNode.js +2 -2
- package/src/nodes/utils/RemapNode.js +6 -6
- package/src/nodes/utils/RotateNode.js +1 -1
- package/src/nodes/utils/SpriteSheetUVNode.js +3 -3
- package/src/nodes/utils/StorageArrayElementNode.js +1 -1
- package/src/nodes/utils/TriplanarTexturesNode.js +3 -3
- package/src/objects/BatchedMesh.js +4 -4
- package/src/objects/InstancedMesh.js +2 -2
- package/src/objects/LOD.js +1 -1
- package/src/objects/Skeleton.js +1 -1
- package/src/renderers/WebGL3DRenderTarget.js +25 -0
- package/src/renderers/WebGLArrayRenderTarget.js +25 -0
- package/src/renderers/WebGLCubeRenderTarget.js +39 -1
- package/src/renderers/WebGLRenderTarget.js +19 -0
- package/src/renderers/WebGLRenderer.js +617 -79
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Attributes.js +2 -2
- package/src/renderers/common/Backend.js +12 -3
- package/src/renderers/common/Background.js +1 -0
- package/src/renderers/common/Color4.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +13 -0
- package/src/renderers/common/PostProcessing.js +2 -0
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderList.js +2 -2
- package/src/renderers/common/RenderObject.js +1 -1
- package/src/renderers/common/RenderObjects.js +2 -2
- package/src/renderers/common/Renderer.js +52 -31
- package/src/renderers/common/XRManager.js +333 -10
- package/src/renderers/common/extras/PMREMGenerator.js +6 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +3 -3
- package/src/renderers/shaders/UniformsLib.js +1 -4
- package/src/renderers/shaders/UniformsUtils.js +1 -3
- package/src/renderers/webgl/WebGLBackground.js +4 -2
- package/src/renderers/webgl/WebGLState.js +9 -9
- package/src/renderers/webgl-fallback/WebGLBackend.js +25 -26
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +3 -12
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +67 -19
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +1 -1
- package/src/renderers/webgpu/WebGPUBackend.js +128 -87
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -11
- package/src/renderers/webgpu/WebGPURenderer.js +17 -11
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +4 -4
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +5 -3
- package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1 -1
- package/src/renderers/webxr/WebXRController.js +87 -2
- package/src/renderers/webxr/WebXRDepthSensing.js +49 -0
- package/src/renderers/webxr/WebXRManager.js +173 -1
- package/src/scenes/Scene.js +2 -1
- package/src/textures/CanvasTexture.js +28 -0
- package/src/textures/CompressedArrayTexture.js +57 -0
- package/src/textures/CompressedCubeTexture.js +29 -0
- package/src/textures/CompressedTexture.js +64 -6
- package/src/textures/CubeTexture.js +52 -4
- package/src/textures/Data3DTexture.js +77 -0
- package/src/textures/DataArrayTexture.js +93 -0
- package/src/textures/DataTexture.js +65 -0
- package/src/textures/DepthTexture.js +59 -9
- package/src/textures/FramebufferTexture.js +62 -0
- package/src/textures/Source.js +69 -0
- package/src/textures/Texture.js +5 -5
- package/src/textures/VideoFrameTexture.js +43 -6
- package/src/textures/VideoTexture.js +49 -4
- package/examples/jsm/geometries/ParametricGeometries.js +0 -254
|
@@ -59,9 +59,28 @@ const _transformation = {
|
|
|
59
59
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Fires when the camera has been transformed by the controls.
|
|
64
|
+
*
|
|
65
|
+
* @event ArcballControls#change
|
|
66
|
+
* @type {Object}
|
|
67
|
+
*/
|
|
63
68
|
const _changeEvent = { type: 'change' };
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Fires when an interaction was initiated.
|
|
72
|
+
*
|
|
73
|
+
* @event ArcballControls#start
|
|
74
|
+
* @type {Object}
|
|
75
|
+
*/
|
|
64
76
|
const _startEvent = { type: 'start' };
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Fires when an interaction has finished.
|
|
80
|
+
*
|
|
81
|
+
* @event ArcballControls#end
|
|
82
|
+
* @type {Object}
|
|
83
|
+
*/
|
|
65
84
|
const _endEvent = { type: 'end' };
|
|
66
85
|
|
|
67
86
|
const _raycaster = new Raycaster();
|
|
@@ -73,24 +92,65 @@ const _scalePointTemp = new Vector3();
|
|
|
73
92
|
|
|
74
93
|
const _EPS = 0.000001;
|
|
75
94
|
|
|
76
|
-
|
|
95
|
+
/**
|
|
96
|
+
* Arcball controls allow the camera to be controlled by a virtual trackball with full touch support and advanced navigation functionality.
|
|
97
|
+
* Cursor/finger positions and movements are mapped over a virtual trackball surface represented by a gizmo and mapped in intuitive and
|
|
98
|
+
* consistent camera movements. Dragging cursor/fingers will cause camera to orbit around the center of the trackball in a conservative
|
|
99
|
+
* way (returning to the starting point will make the camera to return to its starting orientation).
|
|
100
|
+
*
|
|
101
|
+
* In addition to supporting pan, zoom and pinch gestures, Arcball controls provide focus< functionality with a double click/tap for intuitively
|
|
102
|
+
* moving the object's point of interest in the center of the virtual trackball. Focus allows a much better inspection and navigation in complex
|
|
103
|
+
* environment. Moreover Arcball controls allow FOV manipulation (in a vertigo-style method) and z-rotation. Saving and restoring of Camera State
|
|
104
|
+
* is supported also through clipboard (use ctrl+c and ctrl+v shortcuts for copy and paste the state).
|
|
105
|
+
*
|
|
106
|
+
* Unlike {@link OrbitControls} and {@link TrackballControls}, `ArcballControls` doesn't require `update()` to be called externally in an
|
|
107
|
+
* animation loop when animations are on.
|
|
108
|
+
*
|
|
109
|
+
* @augments Controls
|
|
110
|
+
*/
|
|
77
111
|
class ArcballControls extends Controls {
|
|
78
112
|
|
|
79
113
|
/**
|
|
114
|
+
* Constructs a new controls instance.
|
|
80
115
|
*
|
|
81
|
-
* @param {Camera} camera
|
|
82
|
-
* @param {?
|
|
83
|
-
* @param {?Scene} [scene=null] The scene
|
|
116
|
+
* @param {Camera} camera - The camera to be controlled. The camera must not be a child of another object, unless that object is the scene itself.
|
|
117
|
+
* @param {?HTMLDOMElement} [domElement=null] - The HTML element used for event listeners.
|
|
118
|
+
* @param {?Scene} [scene=null] The scene rendered by the camera. If not given, gizmos cannot be shown.
|
|
84
119
|
*/
|
|
85
120
|
constructor( camera, domElement = null, scene = null ) {
|
|
86
121
|
|
|
87
122
|
super( camera, domElement );
|
|
88
123
|
|
|
124
|
+
/**
|
|
125
|
+
* The scene rendered by the camera. If not given, gizmos cannot be shown.
|
|
126
|
+
*
|
|
127
|
+
* @type {?Scene}
|
|
128
|
+
* @default null
|
|
129
|
+
*/
|
|
89
130
|
this.scene = scene;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The control's focus point.
|
|
134
|
+
*
|
|
135
|
+
* @type {Vector3}
|
|
136
|
+
*/
|
|
90
137
|
this.target = new Vector3();
|
|
91
138
|
this._currentTarget = new Vector3();
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The size of the gizmo relative to the screen width and height.
|
|
142
|
+
*
|
|
143
|
+
* @type {number}
|
|
144
|
+
* @default 0.67
|
|
145
|
+
*/
|
|
92
146
|
this.radiusFactor = 0.67;
|
|
93
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Holds the mouse actions of this controls. This property is maintained by the methods
|
|
150
|
+
* `setMouseAction()` and `unsetMouseAction()`.
|
|
151
|
+
*
|
|
152
|
+
* @type {Array<Object>}
|
|
153
|
+
*/
|
|
94
154
|
this.mouseActions = [];
|
|
95
155
|
this._mouseOp = null;
|
|
96
156
|
|
|
@@ -178,8 +238,13 @@ class ArcballControls extends Controls {
|
|
|
178
238
|
this._timeStart = - 1; //initial time
|
|
179
239
|
this._animationId = - 1;
|
|
180
240
|
|
|
181
|
-
|
|
182
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Duration of focus animations in ms.
|
|
243
|
+
*
|
|
244
|
+
* @type {number}
|
|
245
|
+
* @default 500
|
|
246
|
+
*/
|
|
247
|
+
this.focusAnimationTime = 500;
|
|
183
248
|
|
|
184
249
|
//rotate animation
|
|
185
250
|
this._timePrev = 0; //time at which previous rotate operation has been detected
|
|
@@ -191,28 +256,161 @@ class ArcballControls extends Controls {
|
|
|
191
256
|
this._wPrev = 0; //angular velocity of the previous rotate operation
|
|
192
257
|
this._wCurr = 0; //angular velocity of the current rotate operation
|
|
193
258
|
|
|
194
|
-
|
|
195
259
|
//parameters
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* If set to `true`, the camera's near and far values will be adjusted every time zoom is
|
|
263
|
+
* performed trying to maintain the same visible portion given by initial near and far
|
|
264
|
+
* values. Only works with perspective cameras.
|
|
265
|
+
*
|
|
266
|
+
* @type {boolean}
|
|
267
|
+
* @default false
|
|
268
|
+
*/
|
|
196
269
|
this.adjustNearFar = false;
|
|
197
|
-
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* The scaling factor used when performing zoom operation.
|
|
273
|
+
*
|
|
274
|
+
* @type {number}
|
|
275
|
+
* @default 1.1
|
|
276
|
+
*/
|
|
277
|
+
this.scaleFactor = 1.1;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* The damping inertia used if 'enableAnimations` is set to `true`.
|
|
281
|
+
*
|
|
282
|
+
* @type {number}
|
|
283
|
+
* @default 25
|
|
284
|
+
*/
|
|
198
285
|
this.dampingFactor = 25;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Maximum angular velocity allowed on rotation animation start.
|
|
289
|
+
*
|
|
290
|
+
* @type {number}
|
|
291
|
+
* @default 20
|
|
292
|
+
*/
|
|
293
|
+
this.wMax = 20;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Set to `true` to enable animations for rotation (damping) and focus operation.
|
|
297
|
+
*
|
|
298
|
+
* @type {boolean}
|
|
299
|
+
* @default true
|
|
300
|
+
*/
|
|
301
|
+
this.enableAnimations = true;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* If set to `true`, a grid will appear when panning operation is being performed
|
|
305
|
+
* (desktop interaction only).
|
|
306
|
+
*
|
|
307
|
+
* @type {boolean}
|
|
308
|
+
* @default false
|
|
309
|
+
*/
|
|
310
|
+
this.enableGrid = false;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Set to `true` to make zoom become cursor centered.
|
|
314
|
+
*
|
|
315
|
+
* @type {boolean}
|
|
316
|
+
* @default false
|
|
317
|
+
*/
|
|
318
|
+
this.cursorZoom = false;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* The minimum FOV in degrees.
|
|
322
|
+
*
|
|
323
|
+
* @type {number}
|
|
324
|
+
* @default 5
|
|
325
|
+
*/
|
|
203
326
|
this.minFov = 5;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* The maximum FOV in degrees.
|
|
330
|
+
*
|
|
331
|
+
* @type {number}
|
|
332
|
+
* @default 90
|
|
333
|
+
*/
|
|
204
334
|
this.maxFov = 90;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Speed of rotation.
|
|
338
|
+
*
|
|
339
|
+
* @type {number}
|
|
340
|
+
* @default 1
|
|
341
|
+
*/
|
|
205
342
|
this.rotateSpeed = 1;
|
|
206
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Enable or disable camera panning.
|
|
346
|
+
*
|
|
347
|
+
* @type {boolean}
|
|
348
|
+
* @default true
|
|
349
|
+
*/
|
|
207
350
|
this.enablePan = true;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Enable or disable camera rotation.
|
|
354
|
+
*
|
|
355
|
+
* @type {boolean}
|
|
356
|
+
* @default true
|
|
357
|
+
*/
|
|
208
358
|
this.enableRotate = true;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Enable or disable camera zoom.
|
|
362
|
+
*
|
|
363
|
+
* @type {boolean}
|
|
364
|
+
* @default true
|
|
365
|
+
*/
|
|
209
366
|
this.enableZoom = true;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Enable or disable gizmos.
|
|
370
|
+
*
|
|
371
|
+
* @type {boolean}
|
|
372
|
+
* @default true
|
|
373
|
+
*/
|
|
210
374
|
this.enableGizmos = true;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Enable or disable camera focusing on double-tap (or click) operations.
|
|
378
|
+
*
|
|
379
|
+
* @type {boolean}
|
|
380
|
+
* @default true
|
|
381
|
+
*/
|
|
211
382
|
this.enableFocus = true;
|
|
212
383
|
|
|
384
|
+
/**
|
|
385
|
+
* How far you can dolly in. For perspective cameras only.
|
|
386
|
+
*
|
|
387
|
+
* @type {number}
|
|
388
|
+
* @default 0
|
|
389
|
+
*/
|
|
213
390
|
this.minDistance = 0;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* How far you can dolly out. For perspective cameras only.
|
|
394
|
+
*
|
|
395
|
+
* @type {number}
|
|
396
|
+
* @default Infinity
|
|
397
|
+
*/
|
|
214
398
|
this.maxDistance = Infinity;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* How far you can zoom in. For orthographic cameras only.
|
|
402
|
+
*
|
|
403
|
+
* @type {number}
|
|
404
|
+
* @default 0
|
|
405
|
+
*/
|
|
215
406
|
this.minZoom = 0;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* How far you can zoom out. For orthographic cameras only.
|
|
410
|
+
*
|
|
411
|
+
* @type {number}
|
|
412
|
+
* @default Infinity
|
|
413
|
+
*/
|
|
216
414
|
this.maxZoom = Infinity;
|
|
217
415
|
|
|
218
416
|
//trackball parameters
|
|
@@ -243,13 +441,15 @@ class ArcballControls extends Controls {
|
|
|
243
441
|
|
|
244
442
|
if ( domElement !== null ) {
|
|
245
443
|
|
|
246
|
-
this.connect();
|
|
444
|
+
this.connect( domElement );
|
|
247
445
|
|
|
248
446
|
}
|
|
249
447
|
|
|
250
448
|
}
|
|
251
449
|
|
|
252
|
-
connect() {
|
|
450
|
+
connect( element ) {
|
|
451
|
+
|
|
452
|
+
super.connect( element );
|
|
253
453
|
|
|
254
454
|
this.domElement.style.touchAction = 'none';
|
|
255
455
|
this._devPxRatio = window.devicePixelRatio;
|
|
@@ -1044,9 +1244,11 @@ class ArcballControls extends Controls {
|
|
|
1044
1244
|
}
|
|
1045
1245
|
|
|
1046
1246
|
/**
|
|
1047
|
-
* Set _center's x/y coordinates
|
|
1048
|
-
*
|
|
1049
|
-
* @
|
|
1247
|
+
* Set _center's x/y coordinates.
|
|
1248
|
+
*
|
|
1249
|
+
* @private
|
|
1250
|
+
* @param {number} clientX - The x coordinate.
|
|
1251
|
+
* @param {number} clientY - The y coordinate.
|
|
1050
1252
|
*/
|
|
1051
1253
|
setCenter( clientX, clientY ) {
|
|
1052
1254
|
|
|
@@ -1056,7 +1258,9 @@ class ArcballControls extends Controls {
|
|
|
1056
1258
|
}
|
|
1057
1259
|
|
|
1058
1260
|
/**
|
|
1059
|
-
* Set default mouse actions
|
|
1261
|
+
* Set default mouse actions.
|
|
1262
|
+
*
|
|
1263
|
+
* @private
|
|
1060
1264
|
*/
|
|
1061
1265
|
initializeMouseActions() {
|
|
1062
1266
|
|
|
@@ -1075,10 +1279,12 @@ class ArcballControls extends Controls {
|
|
|
1075
1279
|
}
|
|
1076
1280
|
|
|
1077
1281
|
/**
|
|
1078
|
-
* Compare two mouse actions
|
|
1079
|
-
*
|
|
1080
|
-
* @
|
|
1081
|
-
* @
|
|
1282
|
+
* Compare two mouse actions.
|
|
1283
|
+
*
|
|
1284
|
+
* @private
|
|
1285
|
+
* @param {Object} action1 - The first mouse action.
|
|
1286
|
+
* @param {Object} action2 - The second mouse action.
|
|
1287
|
+
* @returns {boolean} `true` if action1 and action 2 are the same mouse action, `false` otherwise.
|
|
1082
1288
|
*/
|
|
1083
1289
|
compareMouseAction( action1, action2 ) {
|
|
1084
1290
|
|
|
@@ -1103,11 +1309,12 @@ class ArcballControls extends Controls {
|
|
|
1103
1309
|
}
|
|
1104
1310
|
|
|
1105
1311
|
/**
|
|
1106
|
-
* Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one
|
|
1107
|
-
*
|
|
1108
|
-
* @param {
|
|
1109
|
-
* @param {
|
|
1110
|
-
* @
|
|
1312
|
+
* Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one.
|
|
1313
|
+
*
|
|
1314
|
+
* @param {'PAN'|'ROTATE'|'ZOOM'|'FOV'} operation - The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV').
|
|
1315
|
+
* @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches.
|
|
1316
|
+
* @param {'CTRL'|'SHIFT'|null} [key=null] - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
|
|
1317
|
+
* @returns {boolean} `true` if the mouse action has been successfully added, `false` otherwise.
|
|
1111
1318
|
*/
|
|
1112
1319
|
setMouseAction( operation, mouse, key = null ) {
|
|
1113
1320
|
|
|
@@ -1184,10 +1391,11 @@ class ArcballControls extends Controls {
|
|
|
1184
1391
|
}
|
|
1185
1392
|
|
|
1186
1393
|
/**
|
|
1187
|
-
* Remove a mouse action by specifying its mouse/key combination
|
|
1188
|
-
*
|
|
1189
|
-
* @param {
|
|
1190
|
-
* @
|
|
1394
|
+
* Remove a mouse action by specifying its mouse/key combination.
|
|
1395
|
+
*
|
|
1396
|
+
* @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches.
|
|
1397
|
+
* @param {'CTRL'|'SHIFT'|null} key - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed.
|
|
1398
|
+
* @returns {boolean} `true` if the operation has been successfully removed, `false` otherwise.
|
|
1191
1399
|
*/
|
|
1192
1400
|
unsetMouseAction( mouse, key = null ) {
|
|
1193
1401
|
|
|
@@ -1207,10 +1415,12 @@ class ArcballControls extends Controls {
|
|
|
1207
1415
|
}
|
|
1208
1416
|
|
|
1209
1417
|
/**
|
|
1210
|
-
* Return the operation associated to a mouse/keyboard combination
|
|
1211
|
-
*
|
|
1212
|
-
* @
|
|
1213
|
-
* @
|
|
1418
|
+
* Return the operation associated to a mouse/keyboard combination.
|
|
1419
|
+
*
|
|
1420
|
+
* @private
|
|
1421
|
+
* @param {0|1|2|'WHEEL'} mouse - Mouse button index (0, 1, 2) or 'WHEEL' for wheel notches.
|
|
1422
|
+
* @param {'CTRL'|'SHIFT'|null} key - Keyboard modifier.
|
|
1423
|
+
* @returns {'PAN'|'ROTATE'|'ZOOM'|'FOV'|null} The operation if it has been found, `null` otherwise.
|
|
1214
1424
|
*/
|
|
1215
1425
|
getOpFromAction( mouse, key ) {
|
|
1216
1426
|
|
|
@@ -1247,10 +1457,12 @@ class ArcballControls extends Controls {
|
|
|
1247
1457
|
}
|
|
1248
1458
|
|
|
1249
1459
|
/**
|
|
1250
|
-
* Get the operation associated to mouse and key combination and returns the corresponding FSA state
|
|
1251
|
-
*
|
|
1252
|
-
* @
|
|
1253
|
-
* @
|
|
1460
|
+
* Get the operation associated to mouse and key combination and returns the corresponding FSA state.
|
|
1461
|
+
*
|
|
1462
|
+
* @private
|
|
1463
|
+
* @param {0|1|2} mouse - Mouse button index (0, 1, 2)
|
|
1464
|
+
* @param {'CTRL'|'SHIFT'|null} key - Keyboard modifier
|
|
1465
|
+
* @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination.
|
|
1254
1466
|
*/
|
|
1255
1467
|
getOpStateFromAction( mouse, key ) {
|
|
1256
1468
|
|
|
@@ -1287,10 +1499,12 @@ class ArcballControls extends Controls {
|
|
|
1287
1499
|
}
|
|
1288
1500
|
|
|
1289
1501
|
/**
|
|
1290
|
-
* Calculate the angle between two pointers
|
|
1291
|
-
*
|
|
1292
|
-
* @
|
|
1293
|
-
* @
|
|
1502
|
+
* Calculate the angle between two pointers.
|
|
1503
|
+
*
|
|
1504
|
+
* @private
|
|
1505
|
+
* @param {PointerEvent} p1 - The first pointer event.
|
|
1506
|
+
* @param {PointerEvent} p2 - The second pointer event.
|
|
1507
|
+
* @returns {number} The angle between two pointers in degrees.
|
|
1294
1508
|
*/
|
|
1295
1509
|
getAngle( p1, p2 ) {
|
|
1296
1510
|
|
|
@@ -1299,8 +1513,10 @@ class ArcballControls extends Controls {
|
|
|
1299
1513
|
}
|
|
1300
1514
|
|
|
1301
1515
|
/**
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1516
|
+
* Updates a PointerEvent inside current pointerevents array.
|
|
1517
|
+
*
|
|
1518
|
+
* @private
|
|
1519
|
+
* @param {PointerEvent} event - The pointer event.
|
|
1304
1520
|
*/
|
|
1305
1521
|
updateTouchEvent( event ) {
|
|
1306
1522
|
|
|
@@ -1318,8 +1534,10 @@ class ArcballControls extends Controls {
|
|
|
1318
1534
|
}
|
|
1319
1535
|
|
|
1320
1536
|
/**
|
|
1321
|
-
*
|
|
1322
|
-
*
|
|
1537
|
+
* Applies a transformation matrix, to the camera and gizmos.
|
|
1538
|
+
*
|
|
1539
|
+
* @private
|
|
1540
|
+
* @param {Object} transformation - Object containing matrices to apply to camera and gizmos.
|
|
1323
1541
|
*/
|
|
1324
1542
|
applyTransformMatrix( transformation ) {
|
|
1325
1543
|
|
|
@@ -1405,13 +1623,14 @@ class ArcballControls extends Controls {
|
|
|
1405
1623
|
}
|
|
1406
1624
|
|
|
1407
1625
|
/**
|
|
1408
|
-
*
|
|
1626
|
+
* Calculates the angular speed.
|
|
1409
1627
|
*
|
|
1410
|
-
* @
|
|
1411
|
-
* @param {number}
|
|
1412
|
-
* @param {number}
|
|
1413
|
-
* @param {number}
|
|
1414
|
-
* @
|
|
1628
|
+
* @private
|
|
1629
|
+
* @param {number} p0 - Position at t0.
|
|
1630
|
+
* @param {number} p1 - Position at t1.
|
|
1631
|
+
* @param {number} t0 - Initial time in milliseconds.
|
|
1632
|
+
* @param {number} t1 - Ending time in milliseconds.
|
|
1633
|
+
* @returns {number} The angular speed.
|
|
1415
1634
|
*/
|
|
1416
1635
|
calculateAngularSpeed( p0, p1, t0, t1 ) {
|
|
1417
1636
|
|
|
@@ -1428,10 +1647,12 @@ class ArcballControls extends Controls {
|
|
|
1428
1647
|
}
|
|
1429
1648
|
|
|
1430
1649
|
/**
|
|
1431
|
-
*
|
|
1432
|
-
*
|
|
1433
|
-
* @
|
|
1434
|
-
* @
|
|
1650
|
+
* Calculates the distance between two pointers.
|
|
1651
|
+
*
|
|
1652
|
+
* @private
|
|
1653
|
+
* @param {PointerEvent} p0 - The first pointer.
|
|
1654
|
+
* @param {PointerEvent} p1 - The second pointer.
|
|
1655
|
+
* @returns {number} The distance between the two pointers.
|
|
1435
1656
|
*/
|
|
1436
1657
|
calculatePointersDistance( p0, p1 ) {
|
|
1437
1658
|
|
|
@@ -1440,10 +1661,12 @@ class ArcballControls extends Controls {
|
|
|
1440
1661
|
}
|
|
1441
1662
|
|
|
1442
1663
|
/**
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
1445
|
-
* @
|
|
1446
|
-
* @
|
|
1664
|
+
* Calculates the rotation axis as the vector perpendicular between two vectors.
|
|
1665
|
+
*
|
|
1666
|
+
* @private
|
|
1667
|
+
* @param {Vector3} vec1 - The first vector.
|
|
1668
|
+
* @param {Vector3} vec2 - The second vector.
|
|
1669
|
+
* @returns {Vector3} The normalized rotation axis.
|
|
1447
1670
|
*/
|
|
1448
1671
|
calculateRotationAxis( vec1, vec2 ) {
|
|
1449
1672
|
|
|
@@ -1456,9 +1679,11 @@ class ArcballControls extends Controls {
|
|
|
1456
1679
|
}
|
|
1457
1680
|
|
|
1458
1681
|
/**
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1461
|
-
* @
|
|
1682
|
+
* Calculates the trackball radius so that gizmo's diameter will be 2/3 of the minimum side of the camera frustum.
|
|
1683
|
+
*
|
|
1684
|
+
* @private
|
|
1685
|
+
* @param {Camera} camera - The camera.
|
|
1686
|
+
* @returns {number} The trackball radius.
|
|
1462
1687
|
*/
|
|
1463
1688
|
calculateTbRadius( camera ) {
|
|
1464
1689
|
|
|
@@ -1479,10 +1704,12 @@ class ArcballControls extends Controls {
|
|
|
1479
1704
|
}
|
|
1480
1705
|
|
|
1481
1706
|
/**
|
|
1482
|
-
* Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in
|
|
1483
|
-
*
|
|
1484
|
-
* @
|
|
1485
|
-
* @param {
|
|
1707
|
+
* Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in.
|
|
1708
|
+
*
|
|
1709
|
+
* @private
|
|
1710
|
+
* @param {Vector3} point - The point of interest.
|
|
1711
|
+
* @param {number} size - Scale factor.
|
|
1712
|
+
* @param {number} [amount=1] - Amount of operation to be completed (used for focus animations, default is complete full operation).
|
|
1486
1713
|
*/
|
|
1487
1714
|
focus( point, size, amount = 1 ) {
|
|
1488
1715
|
|
|
@@ -1511,7 +1738,9 @@ class ArcballControls extends Controls {
|
|
|
1511
1738
|
}
|
|
1512
1739
|
|
|
1513
1740
|
/**
|
|
1514
|
-
*
|
|
1741
|
+
* Creates a grid if necessary and adds it to the scene.
|
|
1742
|
+
*
|
|
1743
|
+
* @private
|
|
1515
1744
|
*/
|
|
1516
1745
|
drawGrid() {
|
|
1517
1746
|
|
|
@@ -1562,9 +1791,6 @@ class ArcballControls extends Controls {
|
|
|
1562
1791
|
|
|
1563
1792
|
}
|
|
1564
1793
|
|
|
1565
|
-
/**
|
|
1566
|
-
* Remove all listeners, stop animations and clean scene
|
|
1567
|
-
*/
|
|
1568
1794
|
dispose() {
|
|
1569
1795
|
|
|
1570
1796
|
if ( this._animationId != - 1 ) {
|
|
@@ -1581,7 +1807,7 @@ class ArcballControls extends Controls {
|
|
|
1581
1807
|
}
|
|
1582
1808
|
|
|
1583
1809
|
/**
|
|
1584
|
-
*
|
|
1810
|
+
* Removes the grid from the scene.
|
|
1585
1811
|
*/
|
|
1586
1812
|
disposeGrid() {
|
|
1587
1813
|
|
|
@@ -1595,9 +1821,11 @@ class ArcballControls extends Controls {
|
|
|
1595
1821
|
}
|
|
1596
1822
|
|
|
1597
1823
|
/**
|
|
1598
|
-
*
|
|
1599
|
-
*
|
|
1600
|
-
* @
|
|
1824
|
+
* Computes the easing out cubic function for ease out effect in animation.
|
|
1825
|
+
*
|
|
1826
|
+
* @private
|
|
1827
|
+
* @param {number} t - The absolute progress of the animation in the bound of `0` (beginning of the) and `1` (ending of animation).
|
|
1828
|
+
* @returns {number} Result of easing out cubic at time `t`.
|
|
1601
1829
|
*/
|
|
1602
1830
|
easeOutCubic( t ) {
|
|
1603
1831
|
|
|
@@ -1606,8 +1834,9 @@ class ArcballControls extends Controls {
|
|
|
1606
1834
|
}
|
|
1607
1835
|
|
|
1608
1836
|
/**
|
|
1609
|
-
*
|
|
1610
|
-
*
|
|
1837
|
+
* Makes rotation gizmos more or less visible.
|
|
1838
|
+
*
|
|
1839
|
+
* @param {boolean} isActive - If set to `true`, gizmos are more visible.
|
|
1611
1840
|
*/
|
|
1612
1841
|
activateGizmos( isActive ) {
|
|
1613
1842
|
|
|
@@ -1632,12 +1861,13 @@ class ArcballControls extends Controls {
|
|
|
1632
1861
|
}
|
|
1633
1862
|
|
|
1634
1863
|
/**
|
|
1635
|
-
*
|
|
1864
|
+
* Calculates the cursor position in NDC.
|
|
1636
1865
|
*
|
|
1637
|
-
* @
|
|
1638
|
-
* @param {number}
|
|
1639
|
-
* @param {
|
|
1640
|
-
* @
|
|
1866
|
+
* @private
|
|
1867
|
+
* @param {number} cursorX - Cursor horizontal coordinate within the canvas.
|
|
1868
|
+
* @param {number} cursorY - Cursor vertical coordinate within the canvas.
|
|
1869
|
+
* @param {HTMLElement} canvas - The canvas where the renderer draws its output.
|
|
1870
|
+
* @returns {Vector2} Cursor normalized position inside the canvas.
|
|
1641
1871
|
*/
|
|
1642
1872
|
getCursorNDC( cursorX, cursorY, canvas ) {
|
|
1643
1873
|
|
|
@@ -1649,12 +1879,13 @@ class ArcballControls extends Controls {
|
|
|
1649
1879
|
}
|
|
1650
1880
|
|
|
1651
1881
|
/**
|
|
1652
|
-
*
|
|
1882
|
+
* Calculates the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas.
|
|
1653
1883
|
*
|
|
1654
|
-
* @
|
|
1655
|
-
* @param {number}
|
|
1656
|
-
* @param {
|
|
1657
|
-
* @
|
|
1884
|
+
* @private
|
|
1885
|
+
* @param {number} cursorX - Cursor horizontal coordinate within the canvas.
|
|
1886
|
+
* @param {number} cursorY - Cursor vertical coordinate within the canvas.
|
|
1887
|
+
* @param {HTMLElement} canvas - The canvas where the renderer draws its output.
|
|
1888
|
+
* @returns {Vector2} Cursor position inside the canvas.
|
|
1658
1889
|
*/
|
|
1659
1890
|
getCursorPosition( cursorX, cursorY, canvas ) {
|
|
1660
1891
|
|
|
@@ -1666,8 +1897,9 @@ class ArcballControls extends Controls {
|
|
|
1666
1897
|
}
|
|
1667
1898
|
|
|
1668
1899
|
/**
|
|
1669
|
-
*
|
|
1670
|
-
*
|
|
1900
|
+
* Sets the camera to be controlled. Must be called in order to set a new camera to be controlled.
|
|
1901
|
+
*
|
|
1902
|
+
* @param {Camera} camera - The camera to be controlled.
|
|
1671
1903
|
*/
|
|
1672
1904
|
setCamera( camera ) {
|
|
1673
1905
|
|
|
@@ -1709,8 +1941,9 @@ class ArcballControls extends Controls {
|
|
|
1709
1941
|
}
|
|
1710
1942
|
|
|
1711
1943
|
/**
|
|
1712
|
-
*
|
|
1713
|
-
*
|
|
1944
|
+
* Sets gizmos visibility.
|
|
1945
|
+
*
|
|
1946
|
+
* @param {boolean} value - Value of gizmos visibility.
|
|
1714
1947
|
*/
|
|
1715
1948
|
setGizmosVisible( value ) {
|
|
1716
1949
|
|
|
@@ -1720,8 +1953,9 @@ class ArcballControls extends Controls {
|
|
|
1720
1953
|
}
|
|
1721
1954
|
|
|
1722
1955
|
/**
|
|
1723
|
-
*
|
|
1724
|
-
*
|
|
1956
|
+
* Sets gizmos radius factor and redraws gizmos.
|
|
1957
|
+
*
|
|
1958
|
+
* @param {number} value - Value of radius factor.
|
|
1725
1959
|
*/
|
|
1726
1960
|
setTbRadius( value ) {
|
|
1727
1961
|
|
|
@@ -1744,9 +1978,11 @@ class ArcballControls extends Controls {
|
|
|
1744
1978
|
}
|
|
1745
1979
|
|
|
1746
1980
|
/**
|
|
1747
|
-
* Creates the rotation gizmos matching trackball center and radius
|
|
1748
|
-
*
|
|
1749
|
-
* @
|
|
1981
|
+
* Creates the rotation gizmos matching trackball center and radius.
|
|
1982
|
+
*
|
|
1983
|
+
* @private
|
|
1984
|
+
* @param {Vector3} tbCenter - The trackball center.
|
|
1985
|
+
* @param {number} tbRadius - The trackball radius.
|
|
1750
1986
|
*/
|
|
1751
1987
|
makeGizmos( tbCenter, tbRadius ) {
|
|
1752
1988
|
|
|
@@ -1814,11 +2050,13 @@ class ArcballControls extends Controls {
|
|
|
1814
2050
|
}
|
|
1815
2051
|
|
|
1816
2052
|
/**
|
|
1817
|
-
*
|
|
1818
|
-
*
|
|
1819
|
-
* @
|
|
1820
|
-
* @param {
|
|
1821
|
-
* @param {
|
|
2053
|
+
* Performs animation for focus operation.
|
|
2054
|
+
*
|
|
2055
|
+
* @private
|
|
2056
|
+
* @param {number} time - Instant in which this function is called as performance.now().
|
|
2057
|
+
* @param {Vector3} point - Point of interest for focus operation.
|
|
2058
|
+
* @param {Matrix4} cameraMatrix - Camera matrix.
|
|
2059
|
+
* @param {Matrix4} gizmoMatrix - Gizmos matrix.
|
|
1822
2060
|
*/
|
|
1823
2061
|
onFocusAnim( time, point, cameraMatrix, gizmoMatrix ) {
|
|
1824
2062
|
|
|
@@ -1880,10 +2118,12 @@ class ArcballControls extends Controls {
|
|
|
1880
2118
|
}
|
|
1881
2119
|
|
|
1882
2120
|
/**
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
1885
|
-
* @
|
|
1886
|
-
* @param {number}
|
|
2121
|
+
* Performs animation for rotation operation.
|
|
2122
|
+
*
|
|
2123
|
+
* @private
|
|
2124
|
+
* @param {number} time - Instant in which this function is called as performance.now().
|
|
2125
|
+
* @param {Vector3} rotationAxis - Rotation axis.
|
|
2126
|
+
* @param {number} w0 - Initial angular velocity.
|
|
1887
2127
|
*/
|
|
1888
2128
|
onRotationAnim( time, rotationAxis, w0 ) {
|
|
1889
2129
|
|
|
@@ -1947,11 +2187,12 @@ class ArcballControls extends Controls {
|
|
|
1947
2187
|
|
|
1948
2188
|
|
|
1949
2189
|
/**
|
|
1950
|
-
*
|
|
2190
|
+
* Performs pan operation moving camera between two points.
|
|
1951
2191
|
*
|
|
1952
|
-
* @
|
|
1953
|
-
* @param {Vector3}
|
|
1954
|
-
* @param {
|
|
2192
|
+
* @private
|
|
2193
|
+
* @param {Vector3} p0 - Initial point.
|
|
2194
|
+
* @param {Vector3} p1 - Ending point.
|
|
2195
|
+
* @param {boolean} [adjust=false] - If movement should be adjusted considering camera distance (Perspective only).
|
|
1955
2196
|
* @returns {Object}
|
|
1956
2197
|
*/
|
|
1957
2198
|
pan( p0, p1, adjust = false ) {
|
|
@@ -1983,7 +2224,7 @@ class ArcballControls extends Controls {
|
|
|
1983
2224
|
}
|
|
1984
2225
|
|
|
1985
2226
|
/**
|
|
1986
|
-
*
|
|
2227
|
+
* Resets the controls.
|
|
1987
2228
|
*/
|
|
1988
2229
|
reset() {
|
|
1989
2230
|
|
|
@@ -2020,10 +2261,12 @@ class ArcballControls extends Controls {
|
|
|
2020
2261
|
}
|
|
2021
2262
|
|
|
2022
2263
|
/**
|
|
2023
|
-
*
|
|
2024
|
-
*
|
|
2025
|
-
* @
|
|
2026
|
-
* @
|
|
2264
|
+
* Rotates the camera around an axis passing by trackball's center.
|
|
2265
|
+
*
|
|
2266
|
+
* @private
|
|
2267
|
+
* @param {Vector3} axis - Rotation axis.
|
|
2268
|
+
* @param {number} angle - Angle in radians.
|
|
2269
|
+
* @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera.
|
|
2027
2270
|
*/
|
|
2028
2271
|
rotate( axis, angle ) {
|
|
2029
2272
|
|
|
@@ -2042,6 +2285,9 @@ class ArcballControls extends Controls {
|
|
|
2042
2285
|
|
|
2043
2286
|
}
|
|
2044
2287
|
|
|
2288
|
+
/**
|
|
2289
|
+
* Copy the current state to clipboard (as a readable JSON text).
|
|
2290
|
+
*/
|
|
2045
2291
|
copyState() {
|
|
2046
2292
|
|
|
2047
2293
|
let state;
|
|
@@ -2080,6 +2326,10 @@ class ArcballControls extends Controls {
|
|
|
2080
2326
|
|
|
2081
2327
|
}
|
|
2082
2328
|
|
|
2329
|
+
/**
|
|
2330
|
+
* Set the controls state from the clipboard, assumes that the clipboard stores a JSON
|
|
2331
|
+
* text as saved from `copyState()`.
|
|
2332
|
+
*/
|
|
2083
2333
|
pasteState() {
|
|
2084
2334
|
|
|
2085
2335
|
const self = this;
|
|
@@ -2092,7 +2342,7 @@ class ArcballControls extends Controls {
|
|
|
2092
2342
|
}
|
|
2093
2343
|
|
|
2094
2344
|
/**
|
|
2095
|
-
*
|
|
2345
|
+
* Saves the current state of the control. This can later be recover with `reset()`.
|
|
2096
2346
|
*/
|
|
2097
2347
|
saveState() {
|
|
2098
2348
|
|
|
@@ -2112,11 +2362,13 @@ class ArcballControls extends Controls {
|
|
|
2112
2362
|
}
|
|
2113
2363
|
|
|
2114
2364
|
/**
|
|
2115
|
-
*
|
|
2116
|
-
*
|
|
2117
|
-
* @
|
|
2118
|
-
* @param {
|
|
2119
|
-
* @
|
|
2365
|
+
* Performs uniform scale operation around a given point.
|
|
2366
|
+
*
|
|
2367
|
+
* @private
|
|
2368
|
+
* @param {number} size - Scale factor.
|
|
2369
|
+
* @param {Vector3} point - Point around which scale.
|
|
2370
|
+
* @param {boolean} scaleGizmos - If gizmos should be scaled (Perspective only).
|
|
2371
|
+
* @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos.
|
|
2120
2372
|
*/
|
|
2121
2373
|
scale( size, point, scaleGizmos = true ) {
|
|
2122
2374
|
|
|
@@ -2228,8 +2480,10 @@ class ArcballControls extends Controls {
|
|
|
2228
2480
|
}
|
|
2229
2481
|
|
|
2230
2482
|
/**
|
|
2231
|
-
*
|
|
2232
|
-
*
|
|
2483
|
+
* Sets camera fov.
|
|
2484
|
+
*
|
|
2485
|
+
* @private
|
|
2486
|
+
* @param {number} value - The FOV to be set.
|
|
2233
2487
|
*/
|
|
2234
2488
|
setFov( value ) {
|
|
2235
2489
|
|
|
@@ -2243,10 +2497,11 @@ class ArcballControls extends Controls {
|
|
|
2243
2497
|
}
|
|
2244
2498
|
|
|
2245
2499
|
/**
|
|
2246
|
-
*
|
|
2500
|
+
* Sets values in transformation object.
|
|
2247
2501
|
*
|
|
2248
|
-
* @
|
|
2249
|
-
* @param {Matrix4} [
|
|
2502
|
+
* @private
|
|
2503
|
+
* @param {Matrix4} [camera=null] - Transformation to be applied to the camera.
|
|
2504
|
+
* @param {Matrix4} [gizmos=null] - Transformation to be applied to gizmos.
|
|
2250
2505
|
*/
|
|
2251
2506
|
setTransformationMatrices( camera = null, gizmos = null ) {
|
|
2252
2507
|
|
|
@@ -2289,11 +2544,12 @@ class ArcballControls extends Controls {
|
|
|
2289
2544
|
}
|
|
2290
2545
|
|
|
2291
2546
|
/**
|
|
2292
|
-
*
|
|
2547
|
+
* Rotates camera around its direction axis passing by a given point by a given angle.
|
|
2293
2548
|
*
|
|
2294
|
-
* @
|
|
2295
|
-
* @param {
|
|
2296
|
-
* @
|
|
2549
|
+
* @private
|
|
2550
|
+
* @param {Vector3} point - The point where the rotation axis is passing trough.
|
|
2551
|
+
* @param {number} angle - Angle in radians.
|
|
2552
|
+
* @returns {Object} The computed transformation matrix.
|
|
2297
2553
|
*/
|
|
2298
2554
|
zRotate( point, angle ) {
|
|
2299
2555
|
|
|
@@ -2315,7 +2571,12 @@ class ArcballControls extends Controls {
|
|
|
2315
2571
|
|
|
2316
2572
|
}
|
|
2317
2573
|
|
|
2318
|
-
|
|
2574
|
+
/**
|
|
2575
|
+
* Returns the raycaster that is used for user interaction. This object is shared between all
|
|
2576
|
+
* instances of `ArcballControls`.
|
|
2577
|
+
*
|
|
2578
|
+
* @returns {Raycaster} The internal raycaster.
|
|
2579
|
+
*/
|
|
2319
2580
|
getRaycaster() {
|
|
2320
2581
|
|
|
2321
2582
|
return _raycaster;
|
|
@@ -2324,11 +2585,12 @@ class ArcballControls extends Controls {
|
|
|
2324
2585
|
|
|
2325
2586
|
|
|
2326
2587
|
/**
|
|
2327
|
-
*
|
|
2588
|
+
* Unprojects the cursor on the 3D object surface.
|
|
2328
2589
|
*
|
|
2329
|
-
* @
|
|
2330
|
-
* @param {
|
|
2331
|
-
* @
|
|
2590
|
+
* @private
|
|
2591
|
+
* @param {Vector2} cursor - Cursor coordinates in NDC.
|
|
2592
|
+
* @param {Camera} camera - Virtual camera.
|
|
2593
|
+
* @returns {?Vector3} The point of intersection with the model, if exist, null otherwise.
|
|
2332
2594
|
*/
|
|
2333
2595
|
unprojectOnObj( cursor, camera ) {
|
|
2334
2596
|
|
|
@@ -2354,13 +2616,15 @@ class ArcballControls extends Controls {
|
|
|
2354
2616
|
}
|
|
2355
2617
|
|
|
2356
2618
|
/**
|
|
2357
|
-
* Unproject the cursor on the trackball surface
|
|
2358
|
-
*
|
|
2359
|
-
* @
|
|
2360
|
-
* @param {
|
|
2361
|
-
* @param {
|
|
2362
|
-
* @param {number}
|
|
2363
|
-
* @
|
|
2619
|
+
* Unproject the cursor on the trackball surface.
|
|
2620
|
+
*
|
|
2621
|
+
* @private
|
|
2622
|
+
* @param {Camera} camera - The virtual camera.
|
|
2623
|
+
* @param {number} cursorX - Cursor horizontal coordinate on screen.
|
|
2624
|
+
* @param {number} cursorY - Cursor vertical coordinate on screen.
|
|
2625
|
+
* @param {HTMLElement} canvas - The canvas where the renderer draws its output.
|
|
2626
|
+
* @param {number} tbRadius - The trackball radius.
|
|
2627
|
+
* @returns {Vector3} The unprojected point on the trackball surface.
|
|
2364
2628
|
*/
|
|
2365
2629
|
unprojectOnTbSurface( camera, cursorX, cursorY, canvas, tbRadius ) {
|
|
2366
2630
|
|
|
@@ -2484,13 +2748,15 @@ class ArcballControls extends Controls {
|
|
|
2484
2748
|
|
|
2485
2749
|
|
|
2486
2750
|
/**
|
|
2487
|
-
*
|
|
2488
|
-
*
|
|
2489
|
-
* @
|
|
2490
|
-
* @param {
|
|
2491
|
-
* @param {
|
|
2492
|
-
* @param {
|
|
2493
|
-
* @
|
|
2751
|
+
* Unprojects the cursor on the plane passing through the center of the trackball orthogonal to the camera.
|
|
2752
|
+
*
|
|
2753
|
+
* @private
|
|
2754
|
+
* @param {Camera} camera - The virtual camera.
|
|
2755
|
+
* @param {number} cursorX - Cursor horizontal coordinate on screen.
|
|
2756
|
+
* @param {number} cursorY - Cursor vertical coordinate on screen.
|
|
2757
|
+
* @param {HTMLElement} canvas - The canvas where the renderer draws its output.
|
|
2758
|
+
* @param {boolean} [initialDistance=false] - If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only).
|
|
2759
|
+
* @returns {Vector3} The unprojected point on the trackball plane.
|
|
2494
2760
|
*/
|
|
2495
2761
|
unprojectOnTbPlane( camera, cursorX, cursorY, canvas, initialDistance = false ) {
|
|
2496
2762
|
|
|
@@ -2564,7 +2830,9 @@ class ArcballControls extends Controls {
|
|
|
2564
2830
|
}
|
|
2565
2831
|
|
|
2566
2832
|
/**
|
|
2567
|
-
*
|
|
2833
|
+
* Updates camera and gizmos state.
|
|
2834
|
+
*
|
|
2835
|
+
* @private
|
|
2568
2836
|
*/
|
|
2569
2837
|
updateMatrixState() {
|
|
2570
2838
|
|
|
@@ -2587,9 +2855,11 @@ class ArcballControls extends Controls {
|
|
|
2587
2855
|
}
|
|
2588
2856
|
|
|
2589
2857
|
/**
|
|
2590
|
-
*
|
|
2591
|
-
*
|
|
2592
|
-
* @
|
|
2858
|
+
* Updates the trackball FSA.
|
|
2859
|
+
*
|
|
2860
|
+
* @private
|
|
2861
|
+
* @param {STATE} newState - New state of the FSA.
|
|
2862
|
+
* @param {boolean} updateMatrices - If matrices state should be updated.
|
|
2593
2863
|
*/
|
|
2594
2864
|
updateTbState( newState, updateMatrices ) {
|
|
2595
2865
|
|