super-three 0.157.1 → 0.160.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/README.md +6 -4
- package/build/three.cjs +3100 -1537
- package/build/three.js +3100 -1537
- package/build/three.min.js +1 -1
- package/build/three.module.js +3093 -1538
- package/build/three.module.min.js +1 -1
- package/examples/jsm/Addons.js +291 -0
- package/examples/jsm/controls/FlyControls.js +26 -0
- package/examples/jsm/controls/OrbitControls.js +62 -41
- package/examples/jsm/controls/TransformControls.js +27 -11
- package/examples/jsm/csm/CSMShader.js +53 -48
- package/examples/jsm/exporters/GLTFExporter.js +151 -3
- package/examples/jsm/exporters/USDZExporter.js +27 -19
- package/examples/jsm/geometries/InstancedPointsGeometry.js +174 -0
- package/examples/jsm/geometries/SDFGeometryGenerator.js +144 -0
- package/examples/jsm/helpers/TextureHelper.js +237 -0
- package/examples/jsm/interactive/HTMLMesh.js +9 -2
- package/examples/jsm/libs/lottie_canvas.module.js +6 -1
- package/examples/jsm/libs/opentype.module.js +13 -75
- package/examples/jsm/libs/surfaceNet.js +201 -0
- package/examples/jsm/lines/LineMaterial.js +16 -33
- package/examples/jsm/loaders/ColladaLoader.js +0 -6
- package/examples/jsm/loaders/DRACOLoader.js +4 -3
- package/examples/jsm/loaders/FBXLoader.js +294 -124
- package/examples/jsm/loaders/GLTFLoader.js +83 -6
- package/examples/jsm/loaders/LUTImageLoader.js +162 -0
- package/examples/jsm/loaders/MaterialXLoader.js +73 -54
- package/examples/jsm/loaders/NRRDLoader.js +0 -13
- package/examples/jsm/loaders/SVGLoader.js +4 -4
- package/examples/jsm/loaders/USDZLoader.js +3 -17
- package/examples/jsm/loaders/lwo/IFFParser.js +89 -93
- package/examples/jsm/materials/MeshGouraudMaterial.js +2 -0
- package/examples/jsm/math/Capsule.js +0 -55
- package/examples/jsm/math/Octree.js +85 -7
- package/examples/jsm/misc/Timer.js +119 -0
- package/examples/jsm/misc/TubePainter.js +3 -6
- package/examples/jsm/modifiers/CurveModifier.js +20 -2
- package/examples/jsm/modifiers/SimplifyModifier.js +103 -11
- package/examples/jsm/modifiers/TessellateModifier.js +3 -3
- package/examples/jsm/nodes/Nodes.js +16 -12
- package/examples/jsm/nodes/accessors/CameraNode.js +18 -2
- package/examples/jsm/nodes/accessors/CubeTextureNode.js +5 -73
- package/examples/jsm/nodes/accessors/InstanceNode.js +3 -3
- package/examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js +21 -0
- package/examples/jsm/nodes/accessors/MaterialNode.js +68 -31
- package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +11 -2
- package/examples/jsm/nodes/accessors/ModelNode.js +1 -2
- package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +12 -3
- package/examples/jsm/nodes/accessors/MorphNode.js +191 -16
- package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
- package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
- package/examples/jsm/nodes/accessors/ReferenceNode.js +25 -1
- package/examples/jsm/nodes/accessors/SkinningNode.js +13 -3
- package/examples/jsm/nodes/accessors/TextureNode.js +123 -37
- package/examples/jsm/nodes/code/CodeNode.js +3 -3
- package/examples/jsm/nodes/code/FunctionNode.js +1 -1
- package/examples/jsm/nodes/core/AssignNode.js +72 -0
- package/examples/jsm/nodes/core/AttributeNode.js +7 -1
- package/examples/jsm/nodes/core/CacheNode.js +4 -1
- package/examples/jsm/nodes/core/ConstNode.js +1 -1
- package/examples/jsm/nodes/core/LightingModel.js +3 -1
- package/examples/jsm/nodes/core/Node.js +13 -15
- package/examples/jsm/nodes/core/NodeBuilder.js +209 -42
- package/examples/jsm/nodes/core/NodeFrame.js +10 -8
- package/examples/jsm/nodes/core/NodeUniform.js +12 -0
- package/examples/jsm/nodes/core/NodeUtils.js +7 -9
- package/examples/jsm/nodes/core/OutputStructNode.js +4 -4
- package/examples/jsm/nodes/core/ParameterNode.js +33 -0
- package/examples/jsm/nodes/core/PropertyNode.js +15 -6
- package/examples/jsm/nodes/core/StackNode.js +7 -17
- package/examples/jsm/nodes/core/StructTypeNode.js +4 -4
- package/examples/jsm/nodes/core/TempNode.js +1 -1
- package/examples/jsm/nodes/core/UniformGroup.js +13 -0
- package/examples/jsm/nodes/core/UniformGroupNode.js +36 -0
- package/examples/jsm/nodes/core/UniformNode.js +17 -0
- package/examples/jsm/nodes/core/VarNode.js +7 -34
- package/examples/jsm/nodes/core/VaryingNode.js +3 -7
- package/examples/jsm/nodes/display/BumpMapNode.js +35 -13
- package/examples/jsm/nodes/display/ColorAdjustmentNode.js +6 -10
- package/examples/jsm/nodes/display/GaussianBlurNode.js +170 -0
- package/examples/jsm/nodes/display/NormalMapNode.js +3 -1
- package/examples/jsm/nodes/display/PassNode.js +182 -0
- package/examples/jsm/nodes/display/ViewportDepthNode.js +31 -3
- package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +2 -2
- package/examples/jsm/nodes/display/ViewportNode.js +17 -10
- package/examples/jsm/nodes/functions/BSDF/BRDF_Sheen.js +20 -6
- package/examples/jsm/nodes/functions/BSDF/DFGApprox.js +8 -7
- package/examples/jsm/nodes/functions/BSDF/D_GGX.js +8 -3
- package/examples/jsm/nodes/functions/BSDF/Schlick_to_F0.js +8 -0
- package/examples/jsm/nodes/functions/BSDF/V_GGX_SmithCorrelated.js +8 -0
- package/examples/jsm/nodes/functions/PhysicalLightingModel.js +93 -43
- package/examples/jsm/nodes/gpgpu/ComputeNode.js +2 -2
- package/examples/jsm/nodes/lighting/AmbientLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/AnalyticLightNode.js +55 -6
- package/examples/jsm/nodes/lighting/DirectionalLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -18
- package/examples/jsm/nodes/lighting/LightingContextNode.js +21 -57
- package/examples/jsm/nodes/lighting/LightsNode.js +80 -20
- package/examples/jsm/nodes/lighting/PointLightNode.js +1 -1
- package/examples/jsm/nodes/lighting/SpotLightNode.js +1 -1
- package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +162 -0
- package/examples/jsm/nodes/materials/Line2NodeMaterial.js +76 -77
- package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +5 -5
- package/examples/jsm/nodes/materials/Materials.js +1 -0
- package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -0
- package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
- package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +47 -20
- package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +6 -6
- package/examples/jsm/nodes/materials/NodeMaterial.js +82 -60
- package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -10
- package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
- package/examples/jsm/nodes/materialx/MaterialXNodes.js +10 -10
- package/examples/jsm/nodes/materialx/lib/mx_hsv.js +128 -54
- package/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -618
- package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +24 -14
- package/examples/jsm/nodes/math/MathNode.js +2 -0
- package/examples/jsm/nodes/math/OperatorNode.js +24 -27
- package/examples/jsm/nodes/shadernode/ShaderNode.js +158 -10
- package/examples/jsm/nodes/utils/ArrayElementNode.js +2 -0
- package/examples/jsm/nodes/utils/DiscardNode.js +3 -2
- package/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -0
- package/examples/jsm/nodes/utils/JoinNode.js +11 -1
- package/examples/jsm/nodes/utils/LoopNode.js +36 -24
- package/examples/jsm/nodes/utils/RemapNode.js +2 -2
- package/examples/jsm/nodes/utils/SplitNode.js +10 -2
- package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +3 -3
- package/examples/jsm/objects/InstancedPoints.js +21 -0
- package/examples/jsm/objects/Lensflare.js +20 -0
- package/examples/jsm/objects/QuadMesh.js +60 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +3 -0
- package/examples/jsm/objects/Refractor.js +3 -0
- package/examples/jsm/objects/Sky.js +5 -3
- package/examples/jsm/objects/Water.js +5 -2
- package/examples/jsm/objects/Water2.js +3 -0
- package/examples/jsm/physics/AmmoPhysics.js +21 -0
- package/examples/jsm/physics/RapierPhysics.js +21 -0
- package/examples/jsm/postprocessing/BokehPass.js +3 -2
- package/examples/jsm/postprocessing/GTAOPass.js +572 -0
- package/examples/jsm/postprocessing/LUTPass.js +2 -1
- package/examples/jsm/postprocessing/OutputPass.js +3 -0
- package/examples/jsm/postprocessing/Pass.js +14 -3
- package/examples/jsm/postprocessing/SAOPass.js +0 -1
- package/examples/jsm/postprocessing/SMAAPass.js +0 -2
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -2
- package/examples/jsm/renderers/CSS3DRenderer.js +3 -9
- package/examples/jsm/renderers/SVGRenderer.js +9 -6
- package/examples/jsm/renderers/common/Animation.js +10 -21
- package/examples/jsm/renderers/common/Backend.js +19 -3
- package/examples/jsm/renderers/common/Background.js +20 -22
- package/examples/jsm/renderers/common/Bindings.js +31 -22
- package/examples/jsm/renderers/common/ChainMap.js +3 -3
- package/examples/jsm/renderers/common/Color4.js +37 -0
- package/examples/jsm/renderers/common/Geometries.js +4 -4
- package/examples/jsm/renderers/common/Info.js +12 -2
- package/examples/jsm/renderers/common/Pipelines.js +3 -51
- package/examples/jsm/renderers/common/PostProcessing.js +25 -0
- package/examples/jsm/renderers/common/RenderContext.js +1 -1
- package/examples/jsm/renderers/common/RenderContexts.js +1 -1
- package/examples/jsm/renderers/common/RenderObject.js +21 -2
- package/examples/jsm/renderers/common/RenderObjects.js +5 -3
- package/examples/jsm/renderers/common/Renderer.js +137 -37
- package/examples/jsm/renderers/common/StorageTexture.js +1 -0
- package/examples/jsm/renderers/common/Textures.js +8 -37
- package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +10 -2
- package/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -0
- package/examples/jsm/renderers/common/nodes/Nodes.js +121 -19
- package/examples/jsm/renderers/webgl/WebGLBackend.js +366 -67
- package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +183 -38
- package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +92 -5
- package/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -0
- package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +11 -1
- package/examples/jsm/renderers/webgl/utils/WebGLState.js +14 -2
- package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +71 -2
- package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +42 -0
- package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +33 -3
- package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +4 -14
- package/examples/jsm/renderers/webgpu/WebGPUBackend.js +188 -137
- package/examples/jsm/renderers/webgpu/WebGPURenderer.js +1 -1
- package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +241 -90
- package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -10
- package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +11 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +2 -3
- package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +88 -6
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +2 -0
- package/examples/jsm/shaders/AfterimageShader.js +2 -0
- package/examples/jsm/shaders/BasicShader.js +2 -0
- package/examples/jsm/shaders/BlendShader.js +2 -0
- package/examples/jsm/shaders/BokehShader.js +2 -0
- package/examples/jsm/shaders/BokehShader2.js +4 -0
- package/examples/jsm/shaders/BrightnessContrastShader.js +2 -0
- package/examples/jsm/shaders/ColorCorrectionShader.js +2 -0
- package/examples/jsm/shaders/DOFMipMapShader.js +2 -0
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +5 -0
- package/examples/jsm/shaders/FXAAShader.js +135 -133
- package/examples/jsm/shaders/FilmShader.js +1 -1
- package/examples/jsm/shaders/FocusShader.js +2 -0
- package/examples/jsm/shaders/FreiChenShader.js +2 -0
- package/examples/jsm/shaders/GTAOShader.js +424 -0
- package/examples/jsm/shaders/GodRaysShader.js +8 -0
- package/examples/jsm/shaders/HalftoneShader.js +2 -0
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +2 -0
- package/examples/jsm/shaders/HueSaturationShader.js +2 -0
- package/examples/jsm/shaders/KaleidoShader.js +2 -0
- package/examples/jsm/shaders/LuminosityHighPassShader.js +2 -0
- package/examples/jsm/shaders/LuminosityShader.js +2 -0
- package/examples/jsm/shaders/MMDToonShader.js +2 -0
- package/examples/jsm/shaders/MirrorShader.js +2 -0
- package/examples/jsm/shaders/NormalMapShader.js +2 -0
- package/examples/jsm/shaders/OutputShader.js +8 -5
- package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
- package/examples/jsm/shaders/SAOShader.js +7 -3
- package/examples/jsm/shaders/SMAAShader.js +6 -0
- package/examples/jsm/shaders/SSAOShader.js +8 -3
- package/examples/jsm/shaders/SSRShader.js +6 -0
- package/examples/jsm/shaders/SobelOperatorShader.js +2 -0
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +2 -0
- package/examples/jsm/shaders/TechnicolorShader.js +2 -0
- package/examples/jsm/shaders/TriangleBlurShader.js +2 -0
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -0
- package/examples/jsm/shaders/VelocityShader.js +2 -0
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +2 -0
- package/examples/jsm/shaders/WaterRefractionShader.js +2 -0
- package/examples/jsm/transpiler/AST.js +270 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +941 -0
- package/examples/jsm/transpiler/ShaderToyDecoder.js +49 -0
- package/examples/jsm/transpiler/TSLEncoder.js +715 -0
- package/examples/jsm/transpiler/Transpiler.js +18 -0
- package/examples/jsm/utils/SortUtils.js +158 -0
- package/examples/jsm/utils/TextureUtils.js +33 -21
- package/examples/jsm/webxr/ARButton.js +14 -0
- package/examples/jsm/webxr/VRButton.js +24 -9
- package/examples/jsm/webxr/XRButton.js +27 -11
- package/examples/jsm/webxr/XREstimatedLight.js +1 -1
- package/package.json +8 -6
- package/src/Three.js +1 -0
- package/src/constants.js +8 -1
- package/src/core/BufferAttribute.js +21 -2
- package/src/core/InterleavedBuffer.js +21 -1
- package/src/core/Object3D.js +60 -12
- package/src/core/UniformsGroup.js +7 -1
- package/src/extras/PMREMGenerator.js +7 -1
- package/src/extras/curves/LineCurve3.js +4 -0
- package/src/loaders/AudioLoader.js +1 -1
- package/src/loaders/BufferGeometryLoader.js +0 -7
- package/src/loaders/ImageBitmapLoader.js +25 -1
- package/src/loaders/MaterialLoader.js +10 -2
- package/src/loaders/ObjectLoader.js +49 -0
- package/src/materials/Material.js +27 -13
- package/src/materials/ShaderMaterial.js +2 -1
- package/src/math/Box3.js +35 -18
- package/src/math/ColorManagement.js +0 -16
- package/src/math/Quaternion.js +5 -4
- package/src/math/Sphere.js +2 -0
- package/src/math/Triangle.js +17 -5
- package/src/math/Vector3.js +11 -12
- package/src/objects/BatchedMesh.js +1020 -0
- package/src/objects/Skeleton.js +1 -3
- package/src/objects/SkinnedMesh.js +6 -7
- package/src/renderers/WebGL3DRenderTarget.js +2 -2
- package/src/renderers/WebGLArrayRenderTarget.js +2 -2
- package/src/renderers/WebGLRenderer.js +165 -43
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +8 -0
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -0
- package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
- package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +3 -2
- package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +0 -5
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +31 -4
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +9 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +8 -6
- package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +9 -17
- package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +84 -0
- package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk.js +4 -0
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +3 -0
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -2
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +3 -0
- package/src/renderers/webgl/WebGLAttributes.js +39 -5
- package/src/renderers/webgl/WebGLBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
- package/src/renderers/webgl/WebGLExtensions.js +1 -0
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +31 -0
- package/src/renderers/webgl/WebGLLights.js +11 -2
- package/src/renderers/webgl/WebGLProgram.js +100 -51
- package/src/renderers/webgl/WebGLPrograms.js +8 -0
- package/src/renderers/webgl/WebGLShadowMap.js +35 -0
- package/src/renderers/webgl/WebGLState.js +25 -4
- package/src/renderers/webgl/WebGLTextures.js +7 -11
- package/src/renderers/webgl/WebGLUniforms.js +11 -1
- package/src/renderers/webgl/WebGLUniformsGroups.js +72 -93
- package/src/renderers/webxr/WebXRManager.js +16 -0
- package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +0 -76
- package/examples/jsm/nodes/accessors/LineMaterialNode.js +0 -29
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
export * from './animation/AnimationClipCreator.js';
|
|
2
|
+
export * from './animation/CCDIKSolver.js';
|
|
3
|
+
export * from './animation/MMDAnimationHelper.js';
|
|
4
|
+
export * from './animation/MMDPhysics.js';
|
|
5
|
+
|
|
6
|
+
export * from './cameras/CinematicCamera.js';
|
|
7
|
+
|
|
8
|
+
export { default as WebGL } from './capabilities/WebGL.js';
|
|
9
|
+
|
|
10
|
+
export * from './controls/ArcballControls.js';
|
|
11
|
+
export * from './controls/DragControls.js';
|
|
12
|
+
export * from './controls/FirstPersonControls.js';
|
|
13
|
+
export * from './controls/FlyControls.js';
|
|
14
|
+
export * from './controls/MapControls.js';
|
|
15
|
+
export * from './controls/OrbitControls.js';
|
|
16
|
+
export * from './controls/PointerLockControls.js';
|
|
17
|
+
export * from './controls/TrackballControls.js';
|
|
18
|
+
export * from './controls/TransformControls.js';
|
|
19
|
+
|
|
20
|
+
export * from './csm/CSM.js';
|
|
21
|
+
export * from './csm/CSMFrustum.js';
|
|
22
|
+
export * from './csm/CSMHelper.js';
|
|
23
|
+
export * from './csm/CSMShader.js';
|
|
24
|
+
|
|
25
|
+
export * as Curves from './curves/CurveExtras.js';
|
|
26
|
+
export * from './curves/NURBSCurve.js';
|
|
27
|
+
export * from './curves/NURBSSurface.js';
|
|
28
|
+
export * as NURBSUtils from './curves/NURBSUtils.js';
|
|
29
|
+
|
|
30
|
+
export * from './effects/AnaglyphEffect.js';
|
|
31
|
+
export * from './effects/AsciiEffect.js';
|
|
32
|
+
export * from './effects/OutlineEffect.js';
|
|
33
|
+
export * from './effects/ParallaxBarrierEffect.js';
|
|
34
|
+
export * from './effects/PeppersGhostEffect.js';
|
|
35
|
+
export * from './effects/StereoEffect.js';
|
|
36
|
+
|
|
37
|
+
export * from './environments/DebugEnvironment.js';
|
|
38
|
+
export * from './environments/RoomEnvironment.js';
|
|
39
|
+
|
|
40
|
+
export * from './exporters/DRACOExporter.js';
|
|
41
|
+
export * from './exporters/EXRExporter.js';
|
|
42
|
+
export * from './exporters/GLTFExporter.js';
|
|
43
|
+
export * from './exporters/KTX2Exporter.js';
|
|
44
|
+
export * from './exporters/MMDExporter.js';
|
|
45
|
+
export * from './exporters/OBJExporter.js';
|
|
46
|
+
export * from './exporters/PLYExporter.js';
|
|
47
|
+
export * from './exporters/STLExporter.js';
|
|
48
|
+
export * from './exporters/USDZExporter.js';
|
|
49
|
+
|
|
50
|
+
export * from './geometries/BoxLineGeometry.js';
|
|
51
|
+
export * from './geometries/ConvexGeometry.js';
|
|
52
|
+
export * from './geometries/DecalGeometry.js';
|
|
53
|
+
export * from './geometries/ParametricGeometries.js';
|
|
54
|
+
export * from './geometries/ParametricGeometry.js';
|
|
55
|
+
export * from './geometries/RoundedBoxGeometry.js';
|
|
56
|
+
export * from './geometries/TeapotGeometry.js';
|
|
57
|
+
export * from './geometries/TextGeometry.js';
|
|
58
|
+
|
|
59
|
+
export * from './helpers/LightProbeHelper.js';
|
|
60
|
+
export * from './helpers/OctreeHelper.js';
|
|
61
|
+
export * from './helpers/PositionalAudioHelper.js';
|
|
62
|
+
export * from './helpers/RectAreaLightHelper.js';
|
|
63
|
+
export * from './helpers/TextureHelper.js';
|
|
64
|
+
export * from './helpers/VertexNormalsHelper.js';
|
|
65
|
+
export * from './helpers/VertexTangentsHelper.js';
|
|
66
|
+
export * from './helpers/ViewHelper.js';
|
|
67
|
+
|
|
68
|
+
export * from './interactive/HTMLMesh.js';
|
|
69
|
+
export * from './interactive/InteractiveGroup.js';
|
|
70
|
+
export * from './interactive/SelectionBox.js';
|
|
71
|
+
export * from './interactive/SelectionHelper.js';
|
|
72
|
+
|
|
73
|
+
export { default as IESSpotLight } from './lights/IESSpotLight.js';
|
|
74
|
+
export * from './lights/LightProbeGenerator.js';
|
|
75
|
+
export * from './lights/RectAreaLightUniformsLib.js';
|
|
76
|
+
|
|
77
|
+
export * from './lines/Line2.js';
|
|
78
|
+
export * from './lines/LineGeometry.js';
|
|
79
|
+
export * from './lines/LineMaterial.js';
|
|
80
|
+
export * from './lines/LineSegments2.js';
|
|
81
|
+
export * from './lines/LineSegmentsGeometry.js';
|
|
82
|
+
export * from './lines/Wireframe.js';
|
|
83
|
+
export * from './lines/WireframeGeometry2.js';
|
|
84
|
+
|
|
85
|
+
export * from './loaders/3DMLoader.js';
|
|
86
|
+
export * from './loaders/3MFLoader.js';
|
|
87
|
+
export * from './loaders/AMFLoader.js';
|
|
88
|
+
export * from './loaders/BVHLoader.js';
|
|
89
|
+
export * from './loaders/ColladaLoader.js';
|
|
90
|
+
export * from './loaders/DDSLoader.js';
|
|
91
|
+
export * from './loaders/DRACOLoader.js';
|
|
92
|
+
export * from './loaders/EXRLoader.js';
|
|
93
|
+
export * from './loaders/FBXLoader.js';
|
|
94
|
+
export * from './loaders/FontLoader.js';
|
|
95
|
+
export * from './loaders/GCodeLoader.js';
|
|
96
|
+
export * from './loaders/GLTFLoader.js';
|
|
97
|
+
export * from './loaders/HDRCubeTextureLoader.js';
|
|
98
|
+
export * from './loaders/IESLoader.js';
|
|
99
|
+
export * from './loaders/KMZLoader.js';
|
|
100
|
+
export * from './loaders/KTX2Loader.js';
|
|
101
|
+
export * from './loaders/KTXLoader.js';
|
|
102
|
+
export * from './loaders/LDrawLoader.js';
|
|
103
|
+
export * from './loaders/LUT3dlLoader.js';
|
|
104
|
+
export * from './loaders/LUTCubeLoader.js';
|
|
105
|
+
export * from './loaders/LWOLoader.js';
|
|
106
|
+
export * from './loaders/LogLuvLoader.js';
|
|
107
|
+
export * from './loaders/LottieLoader.js';
|
|
108
|
+
export * from './loaders/MD2Loader.js';
|
|
109
|
+
export * from './loaders/MDDLoader.js';
|
|
110
|
+
export * from './loaders/MMDLoader.js';
|
|
111
|
+
export * from './loaders/MTLLoader.js';
|
|
112
|
+
export * from './loaders/NRRDLoader.js';
|
|
113
|
+
export * from './loaders/OBJLoader.js';
|
|
114
|
+
export * from './loaders/PCDLoader.js';
|
|
115
|
+
export * from './loaders/PDBLoader.js';
|
|
116
|
+
export * from './loaders/PLYLoader.js';
|
|
117
|
+
export * from './loaders/PVRLoader.js';
|
|
118
|
+
export * from './loaders/RGBELoader.js';
|
|
119
|
+
export * from './loaders/RGBMLoader.js';
|
|
120
|
+
export * from './loaders/STLLoader.js';
|
|
121
|
+
export * from './loaders/SVGLoader.js';
|
|
122
|
+
export * from './loaders/TDSLoader.js';
|
|
123
|
+
export * from './loaders/TGALoader.js';
|
|
124
|
+
export * from './loaders/TIFFLoader.js';
|
|
125
|
+
export * from './loaders/TTFLoader.js';
|
|
126
|
+
export * from './loaders/TiltLoader.js';
|
|
127
|
+
export * from './loaders/USDZLoader.js';
|
|
128
|
+
export * from './loaders/VOXLoader.js';
|
|
129
|
+
export * from './loaders/VRMLLoader.js';
|
|
130
|
+
export * from './loaders/VTKLoader.js';
|
|
131
|
+
export * from './loaders/XYZLoader.js';
|
|
132
|
+
|
|
133
|
+
export * from './materials/MeshGouraudMaterial.js';
|
|
134
|
+
|
|
135
|
+
export * from './math/Capsule.js';
|
|
136
|
+
export * from './math/ColorConverter.js';
|
|
137
|
+
export * from './math/ConvexHull.js';
|
|
138
|
+
export * from './math/ImprovedNoise.js';
|
|
139
|
+
export * from './math/Lut.js';
|
|
140
|
+
export * from './math/MeshSurfaceSampler.js';
|
|
141
|
+
export * from './math/OBB.js';
|
|
142
|
+
export * from './math/Octree.js';
|
|
143
|
+
export * from './math/SimplexNoise.js';
|
|
144
|
+
|
|
145
|
+
export * from './misc/ConvexObjectBreaker.js';
|
|
146
|
+
export * from './misc/GPUComputationRenderer.js';
|
|
147
|
+
export * from './misc/Gyroscope.js';
|
|
148
|
+
export * from './misc/MD2Character.js';
|
|
149
|
+
export * from './misc/MD2CharacterComplex.js';
|
|
150
|
+
export * from './misc/MorphAnimMesh.js';
|
|
151
|
+
export * from './misc/MorphBlendMesh.js';
|
|
152
|
+
export * from './misc/ProgressiveLightMap.js';
|
|
153
|
+
export * from './misc/RollerCoaster.js';
|
|
154
|
+
export * from './misc/TubePainter.js';
|
|
155
|
+
export * from './misc/Volume.js';
|
|
156
|
+
export * from './misc/VolumeSlice.js';
|
|
157
|
+
|
|
158
|
+
export * from './modifiers/CurveModifier.js';
|
|
159
|
+
export * from './modifiers/EdgeSplitModifier.js';
|
|
160
|
+
export * from './modifiers/SimplifyModifier.js';
|
|
161
|
+
export * from './modifiers/TessellateModifier.js';
|
|
162
|
+
|
|
163
|
+
export * from './objects/GroundProjectedSkybox.js';
|
|
164
|
+
export * from './objects/Lensflare.js';
|
|
165
|
+
export * from './objects/MarchingCubes.js';
|
|
166
|
+
export * from './objects/Reflector.js';
|
|
167
|
+
export * from './objects/ReflectorForSSRPass.js';
|
|
168
|
+
export * from './objects/Refractor.js';
|
|
169
|
+
export * from './objects/ShadowMesh.js';
|
|
170
|
+
export * from './objects/Sky.js';
|
|
171
|
+
export * from './objects/Water.js';
|
|
172
|
+
export { Water as Water2 } from './objects/Water2.js';
|
|
173
|
+
|
|
174
|
+
export * from './physics/AmmoPhysics.js';
|
|
175
|
+
export * from './physics/RapierPhysics.js';
|
|
176
|
+
|
|
177
|
+
export * from './postprocessing/AfterimagePass.js';
|
|
178
|
+
export * from './postprocessing/BloomPass.js';
|
|
179
|
+
export * from './postprocessing/BokehPass.js';
|
|
180
|
+
export * from './postprocessing/ClearPass.js';
|
|
181
|
+
export * from './postprocessing/CubeTexturePass.js';
|
|
182
|
+
export * from './postprocessing/DotScreenPass.js';
|
|
183
|
+
export * from './postprocessing/EffectComposer.js';
|
|
184
|
+
export * from './postprocessing/FilmPass.js';
|
|
185
|
+
export * from './postprocessing/GlitchPass.js';
|
|
186
|
+
export * from './postprocessing/HalftonePass.js';
|
|
187
|
+
export * from './postprocessing/LUTPass.js';
|
|
188
|
+
export * from './postprocessing/MaskPass.js';
|
|
189
|
+
export * from './postprocessing/OutlinePass.js';
|
|
190
|
+
export * from './postprocessing/OutputPass.js';
|
|
191
|
+
export * from './postprocessing/Pass.js';
|
|
192
|
+
export * from './postprocessing/RenderPass.js';
|
|
193
|
+
export * from './postprocessing/RenderPixelatedPass.js';
|
|
194
|
+
export * from './postprocessing/SAOPass.js';
|
|
195
|
+
export * from './postprocessing/SMAAPass.js';
|
|
196
|
+
export * from './postprocessing/SSAARenderPass.js';
|
|
197
|
+
export * from './postprocessing/SSAOPass.js';
|
|
198
|
+
export * from './postprocessing/SSRPass.js';
|
|
199
|
+
export * from './postprocessing/SavePass.js';
|
|
200
|
+
export * from './postprocessing/ShaderPass.js';
|
|
201
|
+
export * from './postprocessing/TAARenderPass.js';
|
|
202
|
+
export * from './postprocessing/TexturePass.js';
|
|
203
|
+
export * from './postprocessing/UnrealBloomPass.js';
|
|
204
|
+
|
|
205
|
+
export * from './renderers/CSS2DRenderer.js';
|
|
206
|
+
export * from './renderers/CSS3DRenderer.js';
|
|
207
|
+
export * from './renderers/Projector.js';
|
|
208
|
+
export * from './renderers/SVGRenderer.js';
|
|
209
|
+
|
|
210
|
+
export * from './shaders/ACESFilmicToneMappingShader.js';
|
|
211
|
+
export * from './shaders/AfterimageShader.js';
|
|
212
|
+
export * from './shaders/BasicShader.js';
|
|
213
|
+
export * from './shaders/BleachBypassShader.js';
|
|
214
|
+
export * from './shaders/BlendShader.js';
|
|
215
|
+
export * from './shaders/BokehShader.js';
|
|
216
|
+
export { BokehShader as BokehShader2 } from './shaders/BokehShader2.js';
|
|
217
|
+
export * from './shaders/BrightnessContrastShader.js';
|
|
218
|
+
export * from './shaders/ColorCorrectionShader.js';
|
|
219
|
+
export * from './shaders/ColorifyShader.js';
|
|
220
|
+
export * from './shaders/ConvolutionShader.js';
|
|
221
|
+
export * from './shaders/CopyShader.js';
|
|
222
|
+
export * from './shaders/DOFMipMapShader.js';
|
|
223
|
+
export * from './shaders/DepthLimitedBlurShader.js';
|
|
224
|
+
export * from './shaders/DigitalGlitch.js';
|
|
225
|
+
export * from './shaders/DotScreenShader.js';
|
|
226
|
+
export * from './shaders/ExposureShader.js';
|
|
227
|
+
export * from './shaders/FXAAShader.js';
|
|
228
|
+
export * from './shaders/FilmShader.js';
|
|
229
|
+
export * from './shaders/FocusShader.js';
|
|
230
|
+
export * from './shaders/FreiChenShader.js';
|
|
231
|
+
export * from './shaders/GammaCorrectionShader.js';
|
|
232
|
+
export * from './shaders/GodRaysShader.js';
|
|
233
|
+
export * from './shaders/HalftoneShader.js';
|
|
234
|
+
export * from './shaders/HorizontalBlurShader.js';
|
|
235
|
+
export * from './shaders/HorizontalTiltShiftShader.js';
|
|
236
|
+
export * from './shaders/HueSaturationShader.js';
|
|
237
|
+
export * from './shaders/KaleidoShader.js';
|
|
238
|
+
export * from './shaders/LuminosityHighPassShader.js';
|
|
239
|
+
export * from './shaders/LuminosityShader.js';
|
|
240
|
+
export * from './shaders/MMDToonShader.js';
|
|
241
|
+
export * from './shaders/MirrorShader.js';
|
|
242
|
+
export * from './shaders/NormalMapShader.js';
|
|
243
|
+
export * from './shaders/OutputShader.js';
|
|
244
|
+
export * from './shaders/RGBShiftShader.js';
|
|
245
|
+
export * from './shaders/SAOShader.js';
|
|
246
|
+
export * from './shaders/SMAAShader.js';
|
|
247
|
+
export * from './shaders/SSAOShader.js';
|
|
248
|
+
export * from './shaders/SSRShader.js';
|
|
249
|
+
export * from './shaders/SepiaShader.js';
|
|
250
|
+
export * from './shaders/SobelOperatorShader.js';
|
|
251
|
+
export * from './shaders/SubsurfaceScatteringShader.js';
|
|
252
|
+
export * from './shaders/TechnicolorShader.js';
|
|
253
|
+
export * from './shaders/ToonShader.js';
|
|
254
|
+
export * from './shaders/TriangleBlurShader.js';
|
|
255
|
+
export * from './shaders/UnpackDepthRGBAShader.js';
|
|
256
|
+
export * from './shaders/VelocityShader.js';
|
|
257
|
+
export * from './shaders/VerticalBlurShader.js';
|
|
258
|
+
export * from './shaders/VerticalTiltShiftShader.js';
|
|
259
|
+
export * from './shaders/VignetteShader.js';
|
|
260
|
+
export * from './shaders/VolumeShader.js';
|
|
261
|
+
export * from './shaders/WaterRefractionShader.js';
|
|
262
|
+
|
|
263
|
+
export * from './textures/FlakesTexture.js';
|
|
264
|
+
|
|
265
|
+
export * as BufferGeometryUtils from './utils/BufferGeometryUtils.js';
|
|
266
|
+
export * as CameraUtils from './utils/CameraUtils.js';
|
|
267
|
+
export * from './utils/GPUStatsPanel.js';
|
|
268
|
+
export * as GeometryCompressionUtils from './utils/GeometryCompressionUtils.js';
|
|
269
|
+
export * as GeometryUtils from './utils/GeometryUtils.js';
|
|
270
|
+
export * from './utils/LDrawUtils.js';
|
|
271
|
+
export * from './utils/PackedPhongMaterial.js';
|
|
272
|
+
export * as SceneUtils from './utils/SceneUtils.js';
|
|
273
|
+
export * from './utils/ShadowMapViewer.js';
|
|
274
|
+
export * as SkeletonUtils from './utils/SkeletonUtils.js';
|
|
275
|
+
export * as SortUtils from './utils/SortUtils.js';
|
|
276
|
+
export * from './utils/TextureUtils.js';
|
|
277
|
+
export * from './utils/UVsDebug.js';
|
|
278
|
+
export * from './utils/WorkerPool.js';
|
|
279
|
+
|
|
280
|
+
export * from './webxr/ARButton.js';
|
|
281
|
+
export * from './webxr/OculusHandModel.js';
|
|
282
|
+
export * from './webxr/OculusHandPointerModel.js';
|
|
283
|
+
export * from './webxr/Text2D.js';
|
|
284
|
+
export * from './webxr/VRButton.js';
|
|
285
|
+
export * from './webxr/XRButton.js';
|
|
286
|
+
export * from './webxr/XRControllerModelFactory.js';
|
|
287
|
+
export * from './webxr/XREstimatedLight.js';
|
|
288
|
+
export * from './webxr/XRHandMeshModel.js';
|
|
289
|
+
export * from './webxr/XRHandModelFactory.js';
|
|
290
|
+
export * from './webxr/XRHandPrimitiveModel.js';
|
|
291
|
+
export * from './webxr/XRPlanes.js';
|
|
@@ -186,6 +186,29 @@ class FlyControls extends EventDispatcher {
|
|
|
186
186
|
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
+
this.pointercancel = function () {
|
|
190
|
+
|
|
191
|
+
if ( this.enabled === false ) return;
|
|
192
|
+
|
|
193
|
+
if ( this.dragToLook ) {
|
|
194
|
+
|
|
195
|
+
this.status = 0;
|
|
196
|
+
|
|
197
|
+
this.moveState.yawLeft = this.moveState.pitchDown = 0;
|
|
198
|
+
|
|
199
|
+
} else {
|
|
200
|
+
|
|
201
|
+
this.moveState.forward = 0;
|
|
202
|
+
this.moveState.back = 0;
|
|
203
|
+
|
|
204
|
+
this.updateMovementVector();
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
this.updateRotationVector();
|
|
209
|
+
|
|
210
|
+
};
|
|
211
|
+
|
|
189
212
|
this.contextMenu = function ( event ) {
|
|
190
213
|
|
|
191
214
|
if ( this.enabled === false ) return;
|
|
@@ -269,6 +292,7 @@ class FlyControls extends EventDispatcher {
|
|
|
269
292
|
this.domElement.removeEventListener( 'pointerdown', _pointerdown );
|
|
270
293
|
this.domElement.removeEventListener( 'pointermove', _pointermove );
|
|
271
294
|
this.domElement.removeEventListener( 'pointerup', _pointerup );
|
|
295
|
+
this.domElement.removeEventListener( 'pointercancel', _pointercancel );
|
|
272
296
|
|
|
273
297
|
window.removeEventListener( 'keydown', _keydown );
|
|
274
298
|
window.removeEventListener( 'keyup', _keyup );
|
|
@@ -279,6 +303,7 @@ class FlyControls extends EventDispatcher {
|
|
|
279
303
|
const _pointermove = this.pointermove.bind( this );
|
|
280
304
|
const _pointerdown = this.pointerdown.bind( this );
|
|
281
305
|
const _pointerup = this.pointerup.bind( this );
|
|
306
|
+
const _pointercancel = this.pointercancel.bind( this );
|
|
282
307
|
const _keydown = this.keydown.bind( this );
|
|
283
308
|
const _keyup = this.keyup.bind( this );
|
|
284
309
|
|
|
@@ -286,6 +311,7 @@ class FlyControls extends EventDispatcher {
|
|
|
286
311
|
this.domElement.addEventListener( 'pointerdown', _pointerdown );
|
|
287
312
|
this.domElement.addEventListener( 'pointermove', _pointermove );
|
|
288
313
|
this.domElement.addEventListener( 'pointerup', _pointerup );
|
|
314
|
+
this.domElement.addEventListener( 'pointercancel', _pointercancel );
|
|
289
315
|
|
|
290
316
|
window.addEventListener( 'keydown', _keydown );
|
|
291
317
|
window.addEventListener( 'keyup', _keyup );
|
|
@@ -41,6 +41,9 @@ class OrbitControls extends EventDispatcher {
|
|
|
41
41
|
// "target" sets the location of focus, where the object orbits around
|
|
42
42
|
this.target = new Vector3();
|
|
43
43
|
|
|
44
|
+
// Sets the 3D cursor (similar to Blender), from which the maxTargetRadius takes effect
|
|
45
|
+
this.cursor = new Vector3();
|
|
46
|
+
|
|
44
47
|
// How far you can dolly in and out ( PerspectiveCamera only )
|
|
45
48
|
this.minDistance = 0;
|
|
46
49
|
this.maxDistance = Infinity;
|
|
@@ -49,6 +52,10 @@ class OrbitControls extends EventDispatcher {
|
|
|
49
52
|
this.minZoom = 0;
|
|
50
53
|
this.maxZoom = Infinity;
|
|
51
54
|
|
|
55
|
+
// Limit camera target within a spherical area around the cursor
|
|
56
|
+
this.minTargetRadius = 0;
|
|
57
|
+
this.maxTargetRadius = Infinity;
|
|
58
|
+
|
|
52
59
|
// How far you can orbit vertically, upper and lower limits.
|
|
53
60
|
// Range is 0 to Math.PI radians.
|
|
54
61
|
this.minPolarAngle = 0; // radians
|
|
@@ -249,6 +256,11 @@ class OrbitControls extends EventDispatcher {
|
|
|
249
256
|
|
|
250
257
|
}
|
|
251
258
|
|
|
259
|
+
// Limit the target distance from the cursor to create a sphere around the center of interest
|
|
260
|
+
scope.target.sub( scope.cursor );
|
|
261
|
+
scope.target.clampLength( scope.minTargetRadius, scope.maxTargetRadius );
|
|
262
|
+
scope.target.add( scope.cursor );
|
|
263
|
+
|
|
252
264
|
// adjust the camera position based on zoom only if we're not zooming to the cursor or if it's an ortho camera
|
|
253
265
|
// we adjust zoom later in these cases
|
|
254
266
|
if ( scope.zoomToCursor && performCursorZoom || scope.object.isOrthographicCamera ) {
|
|
@@ -261,7 +273,6 @@ class OrbitControls extends EventDispatcher {
|
|
|
261
273
|
|
|
262
274
|
}
|
|
263
275
|
|
|
264
|
-
|
|
265
276
|
offset.setFromSpherical( spherical );
|
|
266
277
|
|
|
267
278
|
// rotate offset back to "camera-up-vector-is-up" space
|
|
@@ -387,8 +398,6 @@ class OrbitControls extends EventDispatcher {
|
|
|
387
398
|
lastQuaternion.copy( scope.object.quaternion );
|
|
388
399
|
lastTargetPosition.copy( scope.target );
|
|
389
400
|
|
|
390
|
-
zoomChanged = false;
|
|
391
|
-
|
|
392
401
|
return true;
|
|
393
402
|
|
|
394
403
|
}
|
|
@@ -483,9 +492,10 @@ class OrbitControls extends EventDispatcher {
|
|
|
483
492
|
|
|
484
493
|
}
|
|
485
494
|
|
|
486
|
-
function getZoomScale() {
|
|
495
|
+
function getZoomScale( delta ) {
|
|
487
496
|
|
|
488
|
-
|
|
497
|
+
const normalized_delta = Math.abs( delta ) / ( 100 * ( window.devicePixelRatio | 0 ) );
|
|
498
|
+
return Math.pow( 0.95, scope.zoomSpeed * normalized_delta );
|
|
489
499
|
|
|
490
500
|
}
|
|
491
501
|
|
|
@@ -612,7 +622,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
612
622
|
|
|
613
623
|
}
|
|
614
624
|
|
|
615
|
-
function
|
|
625
|
+
function updateZoomParameters( x, y ) {
|
|
616
626
|
|
|
617
627
|
if ( ! scope.zoomToCursor ) {
|
|
618
628
|
|
|
@@ -623,13 +633,13 @@ class OrbitControls extends EventDispatcher {
|
|
|
623
633
|
performCursorZoom = true;
|
|
624
634
|
|
|
625
635
|
const rect = scope.domElement.getBoundingClientRect();
|
|
626
|
-
const
|
|
627
|
-
const
|
|
636
|
+
const dx = x - rect.left;
|
|
637
|
+
const dy = y - rect.top;
|
|
628
638
|
const w = rect.width;
|
|
629
639
|
const h = rect.height;
|
|
630
640
|
|
|
631
|
-
mouse.x = (
|
|
632
|
-
mouse.y = - (
|
|
641
|
+
mouse.x = ( dx / w ) * 2 - 1;
|
|
642
|
+
mouse.y = - ( dy / h ) * 2 + 1;
|
|
633
643
|
|
|
634
644
|
dollyDirection.set( mouse.x, mouse.y, 1 ).unproject( scope.object ).sub( scope.object.position ).normalize();
|
|
635
645
|
|
|
@@ -653,7 +663,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
653
663
|
|
|
654
664
|
function handleMouseDownDolly( event ) {
|
|
655
665
|
|
|
656
|
-
|
|
666
|
+
updateZoomParameters( event.clientX, event.clientX );
|
|
657
667
|
dollyStart.set( event.clientX, event.clientY );
|
|
658
668
|
|
|
659
669
|
}
|
|
@@ -690,11 +700,11 @@ class OrbitControls extends EventDispatcher {
|
|
|
690
700
|
|
|
691
701
|
if ( dollyDelta.y > 0 ) {
|
|
692
702
|
|
|
693
|
-
dollyOut( getZoomScale() );
|
|
703
|
+
dollyOut( getZoomScale( dollyDelta.y ) );
|
|
694
704
|
|
|
695
705
|
} else if ( dollyDelta.y < 0 ) {
|
|
696
706
|
|
|
697
|
-
dollyIn( getZoomScale() );
|
|
707
|
+
dollyIn( getZoomScale( dollyDelta.y ) );
|
|
698
708
|
|
|
699
709
|
}
|
|
700
710
|
|
|
@@ -720,15 +730,15 @@ class OrbitControls extends EventDispatcher {
|
|
|
720
730
|
|
|
721
731
|
function handleMouseWheel( event ) {
|
|
722
732
|
|
|
723
|
-
|
|
733
|
+
updateZoomParameters( event.clientX, event.clientY );
|
|
724
734
|
|
|
725
735
|
if ( event.deltaY < 0 ) {
|
|
726
736
|
|
|
727
|
-
dollyIn( getZoomScale() );
|
|
737
|
+
dollyIn( getZoomScale( event.deltaY ) );
|
|
728
738
|
|
|
729
739
|
} else if ( event.deltaY > 0 ) {
|
|
730
740
|
|
|
731
|
-
dollyOut( getZoomScale() );
|
|
741
|
+
dollyOut( getZoomScale( event.deltaY ) );
|
|
732
742
|
|
|
733
743
|
}
|
|
734
744
|
|
|
@@ -816,16 +826,18 @@ class OrbitControls extends EventDispatcher {
|
|
|
816
826
|
|
|
817
827
|
}
|
|
818
828
|
|
|
819
|
-
function handleTouchStartRotate() {
|
|
829
|
+
function handleTouchStartRotate( event ) {
|
|
820
830
|
|
|
821
831
|
if ( pointers.length === 1 ) {
|
|
822
832
|
|
|
823
|
-
rotateStart.set(
|
|
833
|
+
rotateStart.set( event.pageX, event.pageY );
|
|
824
834
|
|
|
825
835
|
} else {
|
|
826
836
|
|
|
827
|
-
const
|
|
828
|
-
|
|
837
|
+
const position = getSecondPointerPosition( event );
|
|
838
|
+
|
|
839
|
+
const x = 0.5 * ( event.pageX + position.x );
|
|
840
|
+
const y = 0.5 * ( event.pageY + position.y );
|
|
829
841
|
|
|
830
842
|
rotateStart.set( x, y );
|
|
831
843
|
|
|
@@ -833,16 +845,18 @@ class OrbitControls extends EventDispatcher {
|
|
|
833
845
|
|
|
834
846
|
}
|
|
835
847
|
|
|
836
|
-
function handleTouchStartPan() {
|
|
848
|
+
function handleTouchStartPan( event ) {
|
|
837
849
|
|
|
838
850
|
if ( pointers.length === 1 ) {
|
|
839
851
|
|
|
840
|
-
panStart.set(
|
|
852
|
+
panStart.set( event.pageX, event.pageY );
|
|
841
853
|
|
|
842
854
|
} else {
|
|
843
855
|
|
|
844
|
-
const
|
|
845
|
-
|
|
856
|
+
const position = getSecondPointerPosition( event );
|
|
857
|
+
|
|
858
|
+
const x = 0.5 * ( event.pageX + position.x );
|
|
859
|
+
const y = 0.5 * ( event.pageY + position.y );
|
|
846
860
|
|
|
847
861
|
panStart.set( x, y );
|
|
848
862
|
|
|
@@ -850,10 +864,12 @@ class OrbitControls extends EventDispatcher {
|
|
|
850
864
|
|
|
851
865
|
}
|
|
852
866
|
|
|
853
|
-
function handleTouchStartDolly() {
|
|
867
|
+
function handleTouchStartDolly( event ) {
|
|
854
868
|
|
|
855
|
-
const
|
|
856
|
-
|
|
869
|
+
const position = getSecondPointerPosition( event );
|
|
870
|
+
|
|
871
|
+
const dx = event.pageX - position.x;
|
|
872
|
+
const dy = event.pageY - position.y;
|
|
857
873
|
|
|
858
874
|
const distance = Math.sqrt( dx * dx + dy * dy );
|
|
859
875
|
|
|
@@ -861,19 +877,19 @@ class OrbitControls extends EventDispatcher {
|
|
|
861
877
|
|
|
862
878
|
}
|
|
863
879
|
|
|
864
|
-
function handleTouchStartDollyPan() {
|
|
880
|
+
function handleTouchStartDollyPan( event ) {
|
|
865
881
|
|
|
866
|
-
if ( scope.enableZoom ) handleTouchStartDolly();
|
|
882
|
+
if ( scope.enableZoom ) handleTouchStartDolly( event );
|
|
867
883
|
|
|
868
|
-
if ( scope.enablePan ) handleTouchStartPan();
|
|
884
|
+
if ( scope.enablePan ) handleTouchStartPan( event );
|
|
869
885
|
|
|
870
886
|
}
|
|
871
887
|
|
|
872
|
-
function handleTouchStartDollyRotate() {
|
|
888
|
+
function handleTouchStartDollyRotate( event ) {
|
|
873
889
|
|
|
874
|
-
if ( scope.enableZoom ) handleTouchStartDolly();
|
|
890
|
+
if ( scope.enableZoom ) handleTouchStartDolly( event );
|
|
875
891
|
|
|
876
|
-
if ( scope.enableRotate ) handleTouchStartRotate();
|
|
892
|
+
if ( scope.enableRotate ) handleTouchStartRotate( event );
|
|
877
893
|
|
|
878
894
|
}
|
|
879
895
|
|
|
@@ -948,6 +964,11 @@ class OrbitControls extends EventDispatcher {
|
|
|
948
964
|
|
|
949
965
|
dollyStart.copy( dollyEnd );
|
|
950
966
|
|
|
967
|
+
const centerX = ( event.pageX + position.x ) * 0.5;
|
|
968
|
+
const centerY = ( event.pageY + position.y ) * 0.5;
|
|
969
|
+
|
|
970
|
+
updateZoomParameters( centerX, centerY );
|
|
971
|
+
|
|
951
972
|
}
|
|
952
973
|
|
|
953
974
|
function handleTouchMoveDollyPan( event ) {
|
|
@@ -1199,7 +1220,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
1199
1220
|
|
|
1200
1221
|
if ( scope.enableRotate === false ) return;
|
|
1201
1222
|
|
|
1202
|
-
handleTouchStartRotate();
|
|
1223
|
+
handleTouchStartRotate( event );
|
|
1203
1224
|
|
|
1204
1225
|
state = STATE.TOUCH_ROTATE;
|
|
1205
1226
|
|
|
@@ -1209,7 +1230,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
1209
1230
|
|
|
1210
1231
|
if ( scope.enablePan === false ) return;
|
|
1211
1232
|
|
|
1212
|
-
handleTouchStartPan();
|
|
1233
|
+
handleTouchStartPan( event );
|
|
1213
1234
|
|
|
1214
1235
|
state = STATE.TOUCH_PAN;
|
|
1215
1236
|
|
|
@@ -1231,7 +1252,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
1231
1252
|
|
|
1232
1253
|
if ( scope.enableZoom === false && scope.enablePan === false ) return;
|
|
1233
1254
|
|
|
1234
|
-
handleTouchStartDollyPan();
|
|
1255
|
+
handleTouchStartDollyPan( event );
|
|
1235
1256
|
|
|
1236
1257
|
state = STATE.TOUCH_DOLLY_PAN;
|
|
1237
1258
|
|
|
@@ -1241,7 +1262,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
1241
1262
|
|
|
1242
1263
|
if ( scope.enableZoom === false && scope.enableRotate === false ) return;
|
|
1243
1264
|
|
|
1244
|
-
handleTouchStartDollyRotate();
|
|
1265
|
+
handleTouchStartDollyRotate( event );
|
|
1245
1266
|
|
|
1246
1267
|
state = STATE.TOUCH_DOLLY_ROTATE;
|
|
1247
1268
|
|
|
@@ -1333,7 +1354,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
1333
1354
|
|
|
1334
1355
|
function addPointer( event ) {
|
|
1335
1356
|
|
|
1336
|
-
pointers.push( event );
|
|
1357
|
+
pointers.push( event.pointerId );
|
|
1337
1358
|
|
|
1338
1359
|
}
|
|
1339
1360
|
|
|
@@ -1343,7 +1364,7 @@ class OrbitControls extends EventDispatcher {
|
|
|
1343
1364
|
|
|
1344
1365
|
for ( let i = 0; i < pointers.length; i ++ ) {
|
|
1345
1366
|
|
|
1346
|
-
if ( pointers[ i ]
|
|
1367
|
+
if ( pointers[ i ] == event.pointerId ) {
|
|
1347
1368
|
|
|
1348
1369
|
pointers.splice( i, 1 );
|
|
1349
1370
|
return;
|
|
@@ -1371,9 +1392,9 @@ class OrbitControls extends EventDispatcher {
|
|
|
1371
1392
|
|
|
1372
1393
|
function getSecondPointerPosition( event ) {
|
|
1373
1394
|
|
|
1374
|
-
const
|
|
1395
|
+
const pointerId = ( event.pointerId === pointers[ 0 ] ) ? pointers[ 1 ] : pointers[ 0 ];
|
|
1375
1396
|
|
|
1376
|
-
return pointerPositions[
|
|
1397
|
+
return pointerPositions[ pointerId ];
|
|
1377
1398
|
|
|
1378
1399
|
}
|
|
1379
1400
|
|
|
@@ -465,17 +465,9 @@ class TransformControls extends Object3D {
|
|
|
465
465
|
|
|
466
466
|
const ROTATION_SPEED = 20 / this.worldPosition.distanceTo( _tempVector.setFromMatrixPosition( this.camera.matrixWorld ) );
|
|
467
467
|
|
|
468
|
-
|
|
468
|
+
let _inPlaneRotation = false;
|
|
469
469
|
|
|
470
|
-
|
|
471
|
-
this.rotationAngle = this.pointEnd.angleTo( this.pointStart );
|
|
472
|
-
|
|
473
|
-
this._startNorm.copy( this.pointStart ).normalize();
|
|
474
|
-
this._endNorm.copy( this.pointEnd ).normalize();
|
|
475
|
-
|
|
476
|
-
this.rotationAngle *= ( this._endNorm.cross( this._startNorm ).dot( this.eye ) < 0 ? 1 : - 1 );
|
|
477
|
-
|
|
478
|
-
} else if ( axis === 'XYZE' ) {
|
|
470
|
+
if ( axis === 'XYZE' ) {
|
|
479
471
|
|
|
480
472
|
this.rotationAxis.copy( this._offset ).cross( this.eye ).normalize();
|
|
481
473
|
this.rotationAngle = this._offset.dot( _tempVector.copy( this.rotationAxis ).cross( this.eye ) ) * ROTATION_SPEED;
|
|
@@ -492,7 +484,31 @@ class TransformControls extends Object3D {
|
|
|
492
484
|
|
|
493
485
|
}
|
|
494
486
|
|
|
495
|
-
|
|
487
|
+
_tempVector.cross( this.eye );
|
|
488
|
+
|
|
489
|
+
// When _tempVector is 0 after cross with this.eye the vectors are parallel and should use in-plane rotation logic.
|
|
490
|
+
if ( _tempVector.length() === 0 ) {
|
|
491
|
+
|
|
492
|
+
_inPlaneRotation = true;
|
|
493
|
+
|
|
494
|
+
} else {
|
|
495
|
+
|
|
496
|
+
this.rotationAngle = this._offset.dot( _tempVector.normalize() ) * ROTATION_SPEED;
|
|
497
|
+
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if ( axis === 'E' || _inPlaneRotation ) {
|
|
504
|
+
|
|
505
|
+
this.rotationAxis.copy( this.eye );
|
|
506
|
+
this.rotationAngle = this.pointEnd.angleTo( this.pointStart );
|
|
507
|
+
|
|
508
|
+
this._startNorm.copy( this.pointStart ).normalize();
|
|
509
|
+
this._endNorm.copy( this.pointEnd ).normalize();
|
|
510
|
+
|
|
511
|
+
this.rotationAngle *= ( this._endNorm.cross( this._startNorm ).dot( this.eye ) < 0 ? 1 : - 1 );
|
|
496
512
|
|
|
497
513
|
}
|
|
498
514
|
|