super-three 0.181.0 → 0.184.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/LICENSE +1 -1
- package/README.md +3 -4
- package/build/three.cjs +13152 -11354
- package/build/three.core.js +12319 -11539
- package/build/three.core.min.js +2 -2
- package/build/three.module.js +1808 -781
- package/build/three.module.min.js +2 -2
- package/build/three.tsl.js +27 -13
- package/build/three.tsl.min.js +2 -2
- package/build/three.webgpu.js +10523 -6263
- package/build/three.webgpu.min.js +2 -2
- package/build/three.webgpu.nodes.js +10484 -6262
- package/build/three.webgpu.nodes.min.js +2 -2
- package/examples/jsm/Addons.js +11 -3
- package/examples/jsm/animation/CCDIKSolver.js +7 -3
- package/examples/jsm/controls/ArcballControls.js +7 -4
- package/examples/jsm/controls/DragControls.js +2 -2
- package/examples/jsm/controls/FirstPersonControls.js +58 -54
- package/examples/jsm/controls/FlyControls.js +4 -0
- package/examples/jsm/controls/MapControls.js +55 -1
- package/examples/jsm/controls/OrbitControls.js +111 -8
- package/examples/jsm/controls/TrackballControls.js +8 -8
- package/examples/jsm/controls/TransformControls.js +34 -2
- package/examples/jsm/csm/CSM.js +2 -1
- package/examples/jsm/csm/CSMShadowNode.js +6 -2
- package/examples/jsm/effects/AnaglyphEffect.js +102 -7
- package/examples/jsm/environments/ColorEnvironment.js +59 -0
- package/examples/jsm/environments/RoomEnvironment.js +3 -0
- package/examples/jsm/exporters/EXRExporter.js +1 -1
- package/examples/jsm/exporters/GLTFExporter.js +152 -9
- package/examples/jsm/exporters/USDZExporter.js +22 -3
- package/examples/jsm/geometries/DecalGeometry.js +1 -1
- package/examples/jsm/geometries/TextGeometry.js +18 -0
- package/examples/jsm/helpers/AnimationPathHelper.js +302 -0
- package/examples/jsm/helpers/LightProbeGridHelper.js +221 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -1
- package/examples/jsm/helpers/TextureHelperGPU.js +1 -1
- package/examples/jsm/helpers/ViewHelper.js +67 -8
- package/examples/jsm/inspector/Extension.js +13 -0
- package/examples/jsm/inspector/Inspector.js +203 -88
- package/examples/jsm/inspector/RendererInspector.js +14 -4
- package/examples/jsm/inspector/extensions/extensions.json +6 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +916 -0
- package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +281 -0
- package/examples/jsm/inspector/tabs/Console.js +41 -7
- package/examples/jsm/inspector/tabs/Memory.js +128 -0
- package/examples/jsm/inspector/tabs/Parameters.js +51 -3
- package/examples/jsm/inspector/tabs/Performance.js +4 -4
- package/examples/jsm/inspector/tabs/Settings.js +264 -0
- package/examples/jsm/inspector/tabs/Timeline.js +1611 -0
- package/examples/jsm/inspector/tabs/Viewer.js +107 -5
- package/examples/jsm/inspector/ui/Graph.js +2 -2
- package/examples/jsm/inspector/ui/List.js +1 -1
- package/examples/jsm/inspector/ui/Profiler.js +1936 -34
- package/examples/jsm/inspector/ui/Style.js +1044 -31
- package/examples/jsm/inspector/ui/Tab.js +222 -3
- package/examples/jsm/inspector/ui/Values.js +55 -2
- package/examples/jsm/inspector/ui/utils.js +13 -0
- package/examples/jsm/interaction/InteractionManager.js +226 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +9 -8
- package/examples/jsm/lighting/DynamicLighting.js +82 -0
- package/examples/jsm/lighting/LightProbeGrid.js +651 -0
- package/examples/jsm/lines/LineMaterial.js +7 -1
- package/examples/jsm/loaders/3DMLoader.js +5 -4
- package/examples/jsm/loaders/3MFLoader.js +2 -2
- package/examples/jsm/loaders/AMFLoader.js +2 -2
- package/examples/jsm/loaders/ColladaLoader.js +24 -4026
- package/examples/jsm/loaders/DRACOLoader.js +5 -5
- package/examples/jsm/loaders/EXRLoader.js +687 -48
- package/examples/jsm/loaders/FBXLoader.js +235 -37
- package/examples/jsm/loaders/GCodeLoader.js +34 -8
- package/examples/jsm/loaders/GLTFLoader.js +146 -178
- package/examples/jsm/loaders/HDRLoader.js +1 -2
- package/examples/jsm/loaders/KMZLoader.js +5 -5
- package/examples/jsm/loaders/KTX2Loader.js +27 -5
- package/examples/jsm/loaders/LDrawLoader.js +41 -50
- package/examples/jsm/loaders/LWOLoader.js +7 -39
- package/examples/jsm/loaders/NRRDLoader.js +2 -2
- package/examples/jsm/loaders/PCDLoader.js +4 -2
- package/examples/jsm/loaders/SVGLoader.js +2 -2
- package/examples/jsm/loaders/TDSLoader.js +0 -2
- package/examples/jsm/loaders/TGALoader.js +0 -2
- package/examples/jsm/loaders/USDLoader.js +100 -40
- package/examples/jsm/loaders/UltraHDRLoader.js +285 -160
- package/examples/jsm/loaders/VOXLoader.js +660 -117
- package/examples/jsm/loaders/VRMLLoader.js +79 -2
- package/examples/jsm/loaders/VTKLoader.js +42 -25
- package/examples/jsm/loaders/collada/ColladaComposer.js +3044 -0
- package/examples/jsm/loaders/collada/ColladaParser.js +1977 -0
- package/examples/jsm/loaders/usd/USDAParser.js +450 -363
- package/examples/jsm/loaders/usd/USDCParser.js +1867 -6
- package/examples/jsm/loaders/usd/USDComposer.js +4594 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +2 -2
- package/examples/jsm/materials/WoodNodeMaterial.js +11 -11
- package/examples/jsm/math/Octree.js +131 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/RollerCoaster.js +42 -4
- package/examples/jsm/misc/Volume.js +0 -1
- package/examples/jsm/misc/VolumeSlice.js +0 -1
- package/examples/jsm/modifiers/TessellateModifier.js +1 -1
- package/examples/jsm/objects/LensflareMesh.js +1 -1
- package/examples/jsm/objects/Reflector.js +73 -25
- package/examples/jsm/objects/Sky.js +90 -6
- package/examples/jsm/objects/SkyMesh.js +150 -16
- package/examples/jsm/objects/Water.js +4 -3
- package/examples/jsm/objects/Water2.js +5 -3
- package/examples/jsm/objects/WaterMesh.js +5 -7
- package/examples/jsm/physics/AmmoPhysics.js +12 -7
- package/examples/jsm/physics/JoltPhysics.js +10 -6
- package/examples/jsm/physics/RapierPhysics.js +9 -5
- package/examples/jsm/postprocessing/EffectComposer.js +7 -5
- package/examples/jsm/postprocessing/OutputPass.js +9 -0
- package/examples/jsm/postprocessing/RenderPass.js +10 -0
- package/examples/jsm/postprocessing/RenderTransitionPass.js +1 -1
- package/examples/jsm/postprocessing/UnrealBloomPass.js +48 -18
- package/examples/jsm/renderers/CSS3DRenderer.js +1 -1
- package/examples/jsm/renderers/Projector.js +246 -28
- package/examples/jsm/renderers/SVGRenderer.js +174 -60
- package/examples/jsm/shaders/GTAOShader.js +19 -6
- package/examples/jsm/shaders/HalftoneShader.js +12 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +6 -2
- package/examples/jsm/shaders/SAOShader.js +17 -4
- package/examples/jsm/shaders/SSAOShader.js +11 -1
- package/examples/jsm/shaders/SSRShader.js +6 -5
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +2 -4
- package/examples/jsm/shaders/VignetteShader.js +1 -1
- package/examples/jsm/transpiler/AST.js +44 -0
- package/examples/jsm/transpiler/GLSLDecoder.js +63 -6
- package/examples/jsm/transpiler/ShaderToyDecoder.js +2 -0
- package/examples/jsm/transpiler/TSLEncoder.js +46 -3
- package/examples/jsm/transpiler/TranspilerUtils.js +3 -3
- package/examples/jsm/transpiler/WGSLEncoder.js +27 -0
- package/examples/jsm/tsl/WebGLNodesHandler.js +605 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +11 -1
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +458 -16
- package/examples/jsm/tsl/display/AnamorphicNode.js +12 -1
- package/examples/jsm/tsl/display/BilateralBlurNode.js +374 -0
- package/examples/jsm/tsl/display/BloomNode.js +16 -6
- package/examples/jsm/tsl/display/CRT.js +150 -0
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +3 -36
- package/examples/jsm/tsl/display/DenoiseNode.js +1 -1
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +1 -1
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -1
- package/examples/jsm/tsl/display/FSR1Node.js +477 -0
- package/examples/jsm/tsl/display/FXAANode.js +2 -2
- package/examples/jsm/tsl/display/GTAONode.js +6 -4
- package/examples/jsm/tsl/display/GaussianBlurNode.js +21 -2
- package/examples/jsm/tsl/display/GodraysNode.js +615 -0
- package/examples/jsm/tsl/display/LensflareNode.js +1 -1
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -1
- package/examples/jsm/tsl/display/OutlineNode.js +69 -19
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +2 -2
- package/examples/jsm/tsl/display/PixelationPassNode.js +7 -6
- package/examples/jsm/tsl/display/RGBShiftNode.js +2 -2
- package/examples/jsm/tsl/display/RetroPassNode.js +263 -0
- package/examples/jsm/tsl/display/SMAANode.js +2 -2
- package/examples/jsm/tsl/display/SSAAPassNode.js +2 -2
- package/examples/jsm/tsl/display/SSGINode.js +8 -24
- package/examples/jsm/tsl/display/SSRNode.js +8 -8
- package/examples/jsm/tsl/display/SSSNode.js +6 -4
- package/examples/jsm/tsl/display/Shape.js +29 -0
- package/examples/jsm/tsl/display/SharpenNode.js +283 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +2 -2
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +8 -1
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -2
- package/examples/jsm/tsl/display/TAAUNode.js +835 -0
- package/examples/jsm/tsl/display/TRAANode.js +315 -126
- package/examples/jsm/tsl/display/TransitionNode.js +1 -1
- package/examples/jsm/tsl/display/depthAwareBlend.js +80 -0
- package/examples/jsm/tsl/display/radialBlur.js +68 -0
- package/examples/jsm/tsl/lighting/DynamicLightsNode.js +300 -0
- package/examples/jsm/tsl/lighting/data/AmbientLightDataNode.js +61 -0
- package/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.js +111 -0
- package/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.js +99 -0
- package/examples/jsm/tsl/lighting/data/PointLightDataNode.js +134 -0
- package/examples/jsm/tsl/lighting/data/SpotLightDataNode.js +161 -0
- package/examples/jsm/tsl/math/Bayer.js +53 -3
- package/examples/jsm/utils/BufferGeometryUtils.js +2 -3
- package/examples/jsm/utils/ColorUtils.js +76 -0
- package/examples/jsm/utils/LDrawUtils.js +1 -1
- package/examples/jsm/utils/ShadowMapViewer.js +24 -10
- package/examples/jsm/utils/ShadowMapViewerGPU.js +1 -1
- package/examples/jsm/utils/SkeletonUtils.js +14 -8
- package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
- package/examples/jsm/webxr/XRHandMeshModel.js +36 -10
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -1
- package/package.json +24 -30
- package/src/Three.Core.js +3 -1
- package/src/Three.TSL.js +25 -11
- package/src/Three.WebGPU.Nodes.js +5 -0
- package/src/Three.WebGPU.js +9 -0
- package/src/Three.js +1 -0
- package/src/animation/AnimationAction.js +12 -2
- package/src/animation/AnimationClip.js +1 -1
- package/src/animation/AnimationMixer.js +6 -0
- package/src/animation/AnimationUtils.js +1 -12
- package/src/animation/KeyframeTrack.js +47 -8
- package/src/animation/PropertyMixer.js +4 -4
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/ColorKeyframeTrack.js +1 -1
- package/src/animation/tracks/NumberKeyframeTrack.js +1 -1
- package/src/animation/tracks/QuaternionKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/animation/tracks/VectorKeyframeTrack.js +1 -1
- package/src/audio/Audio.js +1 -1
- package/src/audio/AudioContext.js +2 -2
- package/src/audio/AudioListener.js +5 -3
- package/src/cameras/Camera.js +32 -2
- package/src/cameras/CubeCamera.js +20 -0
- package/src/constants.js +90 -5
- package/src/core/BufferAttribute.js +13 -1
- package/src/core/BufferGeometry.js +14 -2
- package/src/core/Clock.js +7 -0
- package/src/core/Object3D.js +52 -4
- package/src/core/Raycaster.js +2 -2
- package/src/core/RenderTarget.js +4 -4
- package/src/extras/PMREMGenerator.js +7 -18
- package/src/extras/TextureUtils.js +5 -1
- package/src/extras/curves/CatmullRomCurve3.js +3 -2
- package/src/geometries/ExtrudeGeometry.js +2 -2
- package/src/geometries/PolyhedronGeometry.js +1 -1
- package/src/geometries/TorusGeometry.js +8 -3
- package/src/helpers/CameraHelper.js +3 -0
- package/src/helpers/DirectionalLightHelper.js +4 -1
- package/src/helpers/HemisphereLightHelper.js +3 -0
- package/src/helpers/PointLightHelper.js +1 -25
- package/src/helpers/SpotLightHelper.js +3 -0
- package/src/lights/DirectionalLight.js +13 -0
- package/src/lights/HemisphereLight.js +10 -0
- package/src/lights/Light.js +1 -11
- package/src/lights/LightProbe.js +0 -15
- package/src/lights/LightShadow.js +15 -6
- package/src/lights/PointLight.js +15 -0
- package/src/lights/PointLightShadow.js +0 -86
- package/src/lights/SpotLight.js +22 -1
- package/src/lights/webgpu/IESSpotLight.js +2 -1
- package/src/loaders/AudioLoader.js +11 -1
- package/src/loaders/Cache.js +28 -0
- package/src/loaders/DataTextureLoader.js +6 -4
- package/src/loaders/FileLoader.js +2 -3
- package/src/loaders/ImageBitmapLoader.js +12 -9
- package/src/loaders/Loader.js +6 -0
- package/src/loaders/MaterialLoader.js +3 -2
- package/src/loaders/ObjectLoader.js +46 -6
- package/src/loaders/nodes/NodeLoader.js +2 -2
- package/src/loaders/nodes/NodeObjectLoader.js +18 -0
- package/src/materials/Material.js +2 -0
- package/src/materials/MeshLambertMaterial.js +9 -0
- package/src/materials/MeshPhongMaterial.js +9 -0
- package/src/materials/MeshToonMaterial.js +1 -1
- package/src/materials/ShaderMaterial.js +20 -1
- package/src/materials/nodes/Line2NodeMaterial.js +34 -7
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +5 -2
- package/src/materials/nodes/MeshStandardNodeMaterial.js +5 -4
- package/src/materials/nodes/NodeMaterial.js +45 -25
- package/src/materials/nodes/manager/NodeMaterialObserver.js +191 -86
- package/src/math/Line3.js +6 -5
- package/src/math/MathUtils.js +10 -10
- package/src/math/Matrix2.js +13 -9
- package/src/math/Matrix3.js +13 -9
- package/src/math/Matrix4.js +87 -74
- package/src/math/Plane.js +4 -3
- package/src/math/Quaternion.js +3 -29
- package/src/math/Sphere.js +1 -1
- package/src/math/Triangle.js +1 -1
- package/src/math/Vector2.js +11 -7
- package/src/math/Vector3.js +15 -13
- package/src/math/Vector4.js +13 -9
- package/src/math/interpolants/BezierInterpolant.js +108 -0
- package/src/nodes/Nodes.js +86 -68
- package/src/nodes/TSL.js +7 -7
- package/src/nodes/accessors/Arrays.js +1 -1
- package/src/nodes/accessors/BatchNode.js +10 -10
- package/src/nodes/accessors/Bitangent.js +5 -5
- package/src/nodes/accessors/BufferAttributeNode.js +107 -15
- package/src/nodes/accessors/BufferNode.js +29 -2
- package/src/nodes/accessors/Camera.js +149 -28
- package/src/nodes/accessors/ClippingNode.js +4 -4
- package/src/nodes/accessors/CubeTextureNode.js +27 -2
- package/src/nodes/accessors/InstanceNode.js +148 -43
- package/src/nodes/accessors/MaterialNode.js +9 -1
- package/src/nodes/accessors/MaterialProperties.js +2 -5
- package/src/nodes/accessors/MaterialReferenceNode.js +1 -2
- package/src/nodes/accessors/ModelNode.js +1 -1
- package/src/nodes/accessors/Normal.js +11 -11
- package/src/nodes/accessors/Object3DNode.js +1 -1
- package/src/nodes/accessors/Position.js +34 -2
- package/src/nodes/accessors/ReferenceBaseNode.js +6 -6
- package/src/nodes/accessors/ReferenceNode.js +8 -8
- package/src/nodes/accessors/RendererReferenceNode.js +1 -2
- package/src/nodes/accessors/SceneProperties.js +47 -0
- package/src/nodes/accessors/SkinningNode.js +27 -26
- package/src/nodes/accessors/StorageBufferNode.js +14 -25
- package/src/nodes/accessors/StorageTextureNode.js +40 -9
- package/src/nodes/accessors/Tangent.js +4 -14
- package/src/nodes/accessors/Texture3DNode.js +32 -35
- package/src/nodes/accessors/TextureNode.js +67 -23
- package/src/nodes/accessors/UniformArrayNode.js +6 -4
- package/src/nodes/accessors/UserDataNode.js +1 -2
- package/src/nodes/accessors/VertexColorNode.js +1 -2
- package/src/nodes/code/FunctionCallNode.js +1 -1
- package/src/nodes/code/FunctionNode.js +2 -3
- package/src/nodes/core/ArrayNode.js +21 -2
- package/src/nodes/core/AssignNode.js +3 -3
- package/src/nodes/core/AttributeNode.js +3 -3
- package/src/nodes/core/BypassNode.js +1 -1
- package/src/nodes/core/ContextNode.js +104 -5
- package/src/nodes/core/IndexNode.js +2 -1
- package/src/nodes/core/InputNode.js +1 -1
- package/src/nodes/core/InspectorNode.js +1 -1
- package/src/nodes/core/IsolateNode.js +1 -1
- package/src/nodes/core/MRTNode.js +48 -2
- package/src/nodes/core/Node.js +112 -15
- package/src/nodes/core/NodeBuilder.js +284 -66
- package/src/nodes/core/NodeError.js +28 -0
- package/src/nodes/core/NodeFrame.js +12 -4
- package/src/nodes/core/NodeUtils.js +11 -9
- package/src/nodes/core/OutputStructNode.js +12 -10
- package/src/nodes/core/ParameterNode.js +4 -4
- package/src/nodes/core/PropertyNode.js +19 -3
- package/src/nodes/core/StackNode.js +66 -17
- package/src/nodes/core/StackTrace.js +139 -0
- package/src/nodes/core/StructNode.js +17 -3
- package/src/nodes/core/StructTypeNode.js +12 -18
- package/src/nodes/core/SubBuildNode.js +2 -2
- package/src/nodes/core/UniformGroupNode.js +36 -6
- package/src/nodes/core/UniformNode.js +21 -5
- package/src/nodes/core/VarNode.js +48 -23
- package/src/nodes/core/VaryingNode.js +2 -19
- package/src/nodes/display/BlendModes.js +0 -64
- package/src/nodes/display/ColorAdjustment.js +17 -0
- package/src/nodes/display/ColorSpaceNode.js +3 -3
- package/src/nodes/display/NormalMapNode.js +39 -4
- package/src/nodes/display/PassNode.js +125 -16
- package/src/nodes/display/RenderOutputNode.js +7 -7
- package/src/nodes/display/ScreenNode.js +4 -2
- package/src/nodes/display/ToneMappingNode.js +1 -1
- package/src/nodes/display/ToonOutlinePassNode.js +2 -2
- package/src/nodes/display/ViewportDepthNode.js +52 -4
- package/src/nodes/display/ViewportDepthTextureNode.js +11 -15
- package/src/nodes/display/ViewportTextureNode.js +39 -11
- package/src/nodes/fog/Fog.js +18 -35
- package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +3 -3
- package/src/nodes/functions/BSDF/DFGLUT.js +56 -0
- package/src/nodes/functions/BSDF/EnvironmentBRDF.js +2 -2
- package/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js +2 -2
- package/src/nodes/functions/PhysicalLightingModel.js +126 -45
- package/src/nodes/geometry/RangeNode.js +5 -3
- package/src/nodes/gpgpu/AtomicFunctionNode.js +1 -1
- package/src/nodes/gpgpu/BarrierNode.js +9 -0
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +2 -3
- package/src/nodes/gpgpu/ComputeNode.js +74 -48
- package/src/nodes/gpgpu/SubgroupFunctionNode.js +2 -2
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +4 -4
- package/src/nodes/lighting/AnalyticLightNode.js +53 -0
- package/src/nodes/lighting/EnvironmentNode.js +28 -3
- package/src/nodes/lighting/LightsNode.js +7 -28
- package/src/nodes/lighting/PointShadowNode.js +162 -149
- package/src/nodes/lighting/ShadowFilterNode.js +53 -65
- package/src/nodes/lighting/ShadowNode.js +120 -42
- package/src/nodes/math/BitcastNode.js +1 -1
- package/src/nodes/math/BitcountNode.js +433 -0
- package/src/nodes/math/ConditionalNode.js +3 -3
- package/src/nodes/math/MathNode.js +76 -41
- package/src/nodes/math/OperatorNode.js +3 -2
- package/src/nodes/math/PackFloatNode.js +98 -0
- package/src/nodes/math/UnpackFloatNode.js +96 -0
- package/src/nodes/pmrem/PMREMNode.js +1 -1
- package/src/nodes/pmrem/PMREMUtils.js +9 -15
- package/src/nodes/tsl/TSLBase.js +1 -1
- package/src/nodes/tsl/TSLCore.js +38 -17
- package/src/nodes/utils/ArrayElementNode.js +14 -1
- package/src/nodes/utils/ConvertNode.js +1 -1
- package/src/nodes/utils/DebugNode.js +12 -12
- package/src/nodes/utils/EventNode.js +31 -2
- package/src/nodes/utils/FlipNode.js +1 -1
- package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
- package/src/nodes/utils/JoinNode.js +3 -3
- package/src/nodes/utils/LoopNode.js +1 -1
- package/src/nodes/utils/MemberNode.js +2 -2
- package/src/nodes/utils/Packing.js +13 -1
- package/src/nodes/utils/PostProcessingUtils.js +33 -1
- package/src/nodes/utils/RTTNode.js +1 -1
- package/src/nodes/utils/ReflectorNode.js +3 -4
- package/src/nodes/utils/Remap.js +48 -0
- package/src/nodes/utils/RotateNode.js +1 -1
- package/src/nodes/utils/SampleNode.js +1 -1
- package/src/nodes/utils/SetNode.js +1 -1
- package/src/nodes/utils/SplitNode.js +1 -1
- package/src/nodes/utils/SpriteSheetUV.js +35 -0
- package/src/nodes/utils/UVUtils.js +28 -0
- package/src/objects/BatchedMesh.js +44 -16
- package/src/objects/InstancedMesh.js +30 -3
- package/src/objects/Line.js +1 -1
- package/src/objects/Mesh.js +1 -1
- package/src/objects/Points.js +1 -1
- package/src/objects/Skeleton.js +9 -0
- package/src/objects/SkinnedMesh.js +26 -9
- package/src/renderers/WebGLRenderer.js +329 -145
- package/src/renderers/common/Animation.js +3 -3
- package/src/renderers/common/Attributes.js +15 -1
- package/src/renderers/common/Backend.js +29 -8
- package/src/renderers/common/Background.js +26 -13
- package/src/renderers/common/BindGroup.js +1 -16
- package/src/renderers/common/Binding.js +11 -0
- package/src/renderers/common/Bindings.js +29 -14
- package/src/renderers/common/BlendMode.js +143 -0
- package/src/renderers/common/Buffer.js +40 -0
- package/src/renderers/common/BundleGroup.js +1 -1
- package/src/renderers/common/ChainMap.js +30 -6
- package/src/renderers/common/ComputePipeline.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +51 -7
- package/src/renderers/common/Geometries.js +29 -3
- package/src/renderers/common/Info.js +333 -4
- package/src/renderers/common/InspectorBase.js +6 -1
- package/src/renderers/common/Lighting.js +5 -21
- package/src/renderers/common/Pipelines.js +40 -7
- package/src/renderers/common/PostProcessing.js +8 -206
- package/src/renderers/common/ReadbackBuffer.js +78 -0
- package/src/renderers/common/RenderBundle.js +3 -1
- package/src/renderers/common/RenderBundles.js +7 -3
- package/src/renderers/common/RenderContext.js +16 -0
- package/src/renderers/common/RenderContexts.js +33 -49
- package/src/renderers/common/RenderLists.js +2 -1
- package/src/renderers/common/RenderObject.js +17 -5
- package/src/renderers/common/RenderObjectPipeline.js +40 -0
- package/src/renderers/common/RenderObjects.js +21 -5
- package/src/renderers/common/RenderPipeline.js +232 -17
- package/src/renderers/common/Renderer.js +481 -117
- package/src/renderers/common/Sampler.js +4 -4
- package/src/renderers/common/StorageBuffer.js +13 -1
- package/src/renderers/common/Textures.js +89 -4
- package/src/renderers/common/TimestampQueryPool.js +5 -3
- package/src/renderers/common/Uniform.js +8 -0
- package/src/renderers/common/UniformsGroup.js +62 -1
- package/src/renderers/common/XRManager.js +37 -29
- package/src/renderers/common/extras/PMREMGenerator.js +25 -23
- package/src/renderers/common/nodes/NodeBuilderState.js +1 -1
- package/src/renderers/common/nodes/{Nodes.js → NodeManager.js} +242 -99
- package/src/renderers/common/nodes/NodeStorageBuffer.js +13 -2
- package/src/renderers/common/nodes/NodeUniformBuffer.js +52 -0
- package/src/renderers/shaders/DFGLUTData.js +19 -34
- package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +2 -2
- package/src/renderers/shaders/ShaderChunk/color_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.js +1 -5
- package/src/renderers/shaders/ShaderChunk/color_vertex.glsl.js +8 -10
- package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +8 -12
- package/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.js +80 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +13 -2
- package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +6 -0
- package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +6 -2
- package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +2 -0
- package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +8 -4
- package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +112 -53
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +7 -0
- package/src/renderers/shaders/ShaderChunk/packing.glsl.js +20 -4
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +0 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +225 -186
- package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +12 -2
- package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk.js +5 -3
- package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +3 -0
- package/src/renderers/shaders/ShaderLib/{distanceRGBA.glsl.js → distance.glsl.js} +1 -2
- package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -2
- package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -1
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -9
- package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +0 -1
- package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/vsm.glsl.js +4 -6
- package/src/renderers/shaders/ShaderLib.js +7 -6
- package/src/renderers/shaders/UniformsLib.js +7 -5
- package/src/renderers/shaders/UniformsUtils.js +27 -5
- package/src/renderers/webgl/WebGLAnimation.js +2 -1
- package/src/renderers/webgl/WebGLBackground.js +15 -15
- package/src/renderers/webgl/WebGLBindingStates.js +99 -27
- package/src/renderers/webgl/WebGLBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLCapabilities.js +9 -4
- package/src/renderers/webgl/WebGLEnvironments.js +228 -0
- package/src/renderers/webgl/WebGLGeometries.js +10 -7
- package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +0 -32
- package/src/renderers/webgl/WebGLLights.js +18 -1
- package/src/renderers/webgl/WebGLMaterials.js +24 -13
- package/src/renderers/webgl/WebGLObjects.js +3 -1
- package/src/renderers/webgl/WebGLOutput.js +270 -0
- package/src/renderers/webgl/WebGLProgram.js +49 -109
- package/src/renderers/webgl/WebGLPrograms.js +63 -51
- package/src/renderers/webgl/WebGLRenderLists.js +15 -0
- package/src/renderers/webgl/WebGLRenderStates.js +13 -2
- package/src/renderers/webgl/WebGLShadowMap.js +188 -24
- package/src/renderers/webgl/WebGLState.js +75 -37
- package/src/renderers/webgl/WebGLTextures.js +215 -54
- package/src/renderers/webgl/WebGLUniforms.js +40 -3
- package/src/renderers/webgl/WebGLUniformsGroups.js +19 -0
- package/src/renderers/webgl/WebGLUtils.js +6 -2
- package/src/renderers/webgl-fallback/WebGLBackend.js +253 -82
- package/src/renderers/webgl-fallback/WebGLBufferRenderer.js +0 -41
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +173 -74
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +53 -19
- package/src/renderers/webgl-fallback/utils/WebGLCapabilities.js +25 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +223 -6
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +68 -53
- package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +10 -10
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +6 -2
- package/src/renderers/webgpu/WebGPUBackend.js +260 -140
- package/src/renderers/webgpu/WebGPURenderer.js +2 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +366 -90
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +107 -34
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +357 -200
- package/src/renderers/webgpu/utils/WebGPUCapabilities.js +48 -0
- package/src/renderers/webgpu/utils/WebGPUConstants.js +10 -0
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +61 -23
- package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +152 -200
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +156 -59
- package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +7 -7
- package/src/renderers/webgpu/utils/WebGPUUtils.js +33 -11
- package/src/renderers/webxr/WebXRController.js +12 -0
- package/src/renderers/webxr/WebXRManager.js +4 -2
- package/src/textures/CubeDepthTexture.js +76 -0
- package/src/textures/HTMLTexture.js +74 -0
- package/src/textures/Source.js +2 -2
- package/src/textures/Texture.js +16 -5
- package/src/utils.js +280 -3
- package/examples/jsm/materials/MeshGouraudMaterial.js +0 -434
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +0 -167
- package/examples/jsm/shaders/GodRaysShader.js +0 -333
- package/src/nodes/accessors/SceneNode.js +0 -145
- package/src/nodes/code/ScriptableNode.js +0 -726
- package/src/nodes/code/ScriptableValueNode.js +0 -253
- package/src/nodes/display/PosterizeNode.js +0 -65
- package/src/nodes/functions/BSDF/DFGApprox.js +0 -71
- package/src/nodes/utils/RemapNode.js +0 -125
- package/src/nodes/utils/SpriteSheetUVNode.js +0 -90
- package/src/renderers/webgl/WebGLCubeMaps.js +0 -99
- package/src/renderers/webgl/WebGLCubeUVMaps.js +0 -134
package/examples/jsm/Addons.js
CHANGED
|
@@ -30,6 +30,7 @@ export * from './effects/OutlineEffect.js';
|
|
|
30
30
|
export * from './effects/ParallaxBarrierEffect.js';
|
|
31
31
|
export * from './effects/StereoEffect.js';
|
|
32
32
|
|
|
33
|
+
export * from './environments/ColorEnvironment.js';
|
|
33
34
|
export * from './environments/DebugEnvironment.js';
|
|
34
35
|
export * from './environments/RoomEnvironment.js';
|
|
35
36
|
|
|
@@ -51,9 +52,11 @@ export * from './geometries/RoundedBoxGeometry.js';
|
|
|
51
52
|
export * from './geometries/TeapotGeometry.js';
|
|
52
53
|
export * from './geometries/TextGeometry.js';
|
|
53
54
|
|
|
55
|
+
export * from './helpers/AnimationPathHelper.js';
|
|
54
56
|
export * from './helpers/LightProbeHelper.js';
|
|
55
57
|
export * from './helpers/OctreeHelper.js';
|
|
56
58
|
export * from './helpers/PositionalAudioHelper.js';
|
|
59
|
+
export * from './helpers/RapierHelper.js';
|
|
57
60
|
export * from './helpers/RectAreaLightHelper.js';
|
|
58
61
|
export * from './helpers/TextureHelper.js';
|
|
59
62
|
export * from './helpers/VertexNormalsHelper.js';
|
|
@@ -98,6 +101,7 @@ export * from './loaders/KTXLoader.js';
|
|
|
98
101
|
export * from './loaders/LDrawLoader.js';
|
|
99
102
|
export * from './loaders/LUT3dlLoader.js';
|
|
100
103
|
export * from './loaders/LUTCubeLoader.js';
|
|
104
|
+
export * from './loaders/LUTImageLoader.js';
|
|
101
105
|
export * from './loaders/LWOLoader.js';
|
|
102
106
|
export * from './loaders/LottieLoader.js';
|
|
103
107
|
export * from './loaders/MD2Loader.js';
|
|
@@ -123,12 +127,11 @@ export * from './loaders/VRMLLoader.js';
|
|
|
123
127
|
export * from './loaders/VTKLoader.js';
|
|
124
128
|
export * from './loaders/XYZLoader.js';
|
|
125
129
|
|
|
126
|
-
export * from './materials/MeshGouraudMaterial.js';
|
|
127
130
|
export * from './materials/LDrawConditionalLineMaterial.js';
|
|
128
|
-
export * from './materials/MeshPostProcessingMaterial.js';
|
|
129
131
|
|
|
130
132
|
export * from './math/Capsule.js';
|
|
131
133
|
export * from './math/ColorConverter.js';
|
|
134
|
+
export * as ColorSpaces from './math/ColorSpaces.js';
|
|
132
135
|
export * from './math/ConvexHull.js';
|
|
133
136
|
export * from './math/ImprovedNoise.js';
|
|
134
137
|
export * from './math/Lut.js';
|
|
@@ -167,6 +170,7 @@ export * from './objects/Water.js';
|
|
|
167
170
|
export { Water as Water2 } from './objects/Water2.js';
|
|
168
171
|
|
|
169
172
|
export * from './physics/AmmoPhysics.js';
|
|
173
|
+
export * from './physics/JoltPhysics.js';
|
|
170
174
|
export * from './physics/RapierPhysics.js';
|
|
171
175
|
|
|
172
176
|
export * from './postprocessing/AfterimagePass.js';
|
|
@@ -176,6 +180,7 @@ export * from './postprocessing/ClearPass.js';
|
|
|
176
180
|
export * from './postprocessing/CubeTexturePass.js';
|
|
177
181
|
export * from './postprocessing/DotScreenPass.js';
|
|
178
182
|
export * from './postprocessing/EffectComposer.js';
|
|
183
|
+
export * from './postprocessing/FXAAPass.js';
|
|
179
184
|
export * from './postprocessing/FilmPass.js';
|
|
180
185
|
export * from './postprocessing/GlitchPass.js';
|
|
181
186
|
export * from './postprocessing/GTAOPass.js';
|
|
@@ -187,6 +192,7 @@ export * from './postprocessing/OutputPass.js';
|
|
|
187
192
|
export * from './postprocessing/Pass.js';
|
|
188
193
|
export * from './postprocessing/RenderPass.js';
|
|
189
194
|
export * from './postprocessing/RenderPixelatedPass.js';
|
|
195
|
+
export * from './postprocessing/RenderTransitionPass.js';
|
|
190
196
|
export * from './postprocessing/SAOPass.js';
|
|
191
197
|
export * from './postprocessing/SMAAPass.js';
|
|
192
198
|
export * from './postprocessing/SSAARenderPass.js';
|
|
@@ -225,7 +231,6 @@ export * from './shaders/FilmShader.js';
|
|
|
225
231
|
export * from './shaders/FocusShader.js';
|
|
226
232
|
export * from './shaders/FreiChenShader.js';
|
|
227
233
|
export * from './shaders/GammaCorrectionShader.js';
|
|
228
|
-
export * from './shaders/GodRaysShader.js';
|
|
229
234
|
export * from './shaders/GTAOShader.js';
|
|
230
235
|
export * from './shaders/HalftoneShader.js';
|
|
231
236
|
export * from './shaders/HorizontalBlurShader.js';
|
|
@@ -237,6 +242,7 @@ export * from './shaders/LuminosityShader.js';
|
|
|
237
242
|
export * from './shaders/MirrorShader.js';
|
|
238
243
|
export * from './shaders/NormalMapShader.js';
|
|
239
244
|
export * from './shaders/OutputShader.js';
|
|
245
|
+
export * from './shaders/PoissonDenoiseShader.js';
|
|
240
246
|
export * from './shaders/RGBShiftShader.js';
|
|
241
247
|
export * from './shaders/SAOShader.js';
|
|
242
248
|
export * from './shaders/SMAAShader.js';
|
|
@@ -260,9 +266,11 @@ export * from './textures/FlakesTexture.js';
|
|
|
260
266
|
|
|
261
267
|
export * as BufferGeometryUtils from './utils/BufferGeometryUtils.js';
|
|
262
268
|
export * as CameraUtils from './utils/CameraUtils.js';
|
|
269
|
+
export * as ColorUtils from './utils/ColorUtils.js';
|
|
263
270
|
export * as GeometryCompressionUtils from './utils/GeometryCompressionUtils.js';
|
|
264
271
|
export * as GeometryUtils from './utils/GeometryUtils.js';
|
|
265
272
|
export * from './utils/LDrawUtils.js';
|
|
273
|
+
export * from './utils/SceneOptimizer.js';
|
|
266
274
|
export * as SceneUtils from './utils/SceneUtils.js';
|
|
267
275
|
export * from './utils/ShadowMapViewer.js';
|
|
268
276
|
export * as SkeletonUtils from './utils/SkeletonUtils.js';
|
|
@@ -50,7 +50,7 @@ class CCDIKSolver {
|
|
|
50
50
|
/**
|
|
51
51
|
* The IK objects.
|
|
52
52
|
*
|
|
53
|
-
* @type {
|
|
53
|
+
* @type {Array<CCDIKSolver~IK>}
|
|
54
54
|
*/
|
|
55
55
|
this.iks = iks;
|
|
56
56
|
|
|
@@ -204,7 +204,11 @@ class CCDIKSolver {
|
|
|
204
204
|
|
|
205
205
|
if ( c > 1.0 ) c = 1.0;
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
// preserve sign of the rotation along the limitation axis,
|
|
208
|
+
// otherwise negative rotations get mirrored to positive
|
|
209
|
+
const dot = link.quaternion.x * limitation.x + link.quaternion.y * limitation.y + link.quaternion.z * limitation.z;
|
|
210
|
+
const sign = dot < 0 ? - 1 : 1;
|
|
211
|
+
const c2 = sign * math.sqrt( 1 - c * c );
|
|
208
212
|
link.quaternion.set( limitation.x * c2,
|
|
209
213
|
limitation.y * c2,
|
|
210
214
|
limitation.z * c2,
|
|
@@ -357,7 +361,7 @@ class CCDIKHelper extends Object3D {
|
|
|
357
361
|
/**
|
|
358
362
|
* The helpers sphere geometry.
|
|
359
363
|
*
|
|
360
|
-
* @type {
|
|
364
|
+
* @type {SphereGeometry}
|
|
361
365
|
*/
|
|
362
366
|
this.sphereGeometry = new SphereGeometry( sphereSize, 16, 8 );
|
|
363
367
|
|
|
@@ -98,9 +98,9 @@ const _EPS = 0.000001;
|
|
|
98
98
|
* consistent camera movements. Dragging cursor/fingers will cause camera to orbit around the center of the trackball in a conservative
|
|
99
99
|
* way (returning to the starting point will make the camera return to its starting orientation).
|
|
100
100
|
*
|
|
101
|
-
* In addition to supporting pan, zoom and pinch gestures,
|
|
102
|
-
*
|
|
103
|
-
*
|
|
101
|
+
* In addition to supporting pan, zoom and pinch gestures, double clicking/tapping focuses on a point, intuitively moving the object's
|
|
102
|
+
* point of interest to the center of the virtual trackball. Focus allows a much better inspection and navigation in complex environment.
|
|
103
|
+
* Moreover Arcball controls allow FOV manipulation (in a vertigo-style method) and z-rotation. Saving and restoring of Camera State
|
|
104
104
|
* is supported also through clipboard (use ctrl+c and ctrl+v shortcuts for copy and paste the state).
|
|
105
105
|
*
|
|
106
106
|
* Unlike {@link OrbitControls} and {@link TrackballControls}, `ArcballControls` doesn't require `update()` to be called externally in an
|
|
@@ -453,7 +453,6 @@ class ArcballControls extends Controls {
|
|
|
453
453
|
|
|
454
454
|
super.connect( element );
|
|
455
455
|
|
|
456
|
-
this.domElement.style.touchAction = 'none';
|
|
457
456
|
this._devPxRatio = window.devicePixelRatio;
|
|
458
457
|
|
|
459
458
|
this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
|
|
@@ -463,6 +462,8 @@ class ArcballControls extends Controls {
|
|
|
463
462
|
|
|
464
463
|
window.addEventListener( 'resize', this._onWindowResize );
|
|
465
464
|
|
|
465
|
+
this.domElement.style.touchAction = 'none'; // Disable touch scroll
|
|
466
|
+
|
|
466
467
|
}
|
|
467
468
|
|
|
468
469
|
disconnect() {
|
|
@@ -477,6 +478,8 @@ class ArcballControls extends Controls {
|
|
|
477
478
|
|
|
478
479
|
window.removeEventListener( 'resize', this._onWindowResize );
|
|
479
480
|
|
|
481
|
+
this.domElement.style.touchAction = ''; // Restore touch scroll
|
|
482
|
+
|
|
480
483
|
}
|
|
481
484
|
|
|
482
485
|
onSinglePanStart( event, operation ) {
|
|
@@ -139,7 +139,7 @@ class DragControls extends Controls {
|
|
|
139
139
|
this.domElement.addEventListener( 'pointerleave', this._onPointerCancel );
|
|
140
140
|
this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
|
|
141
141
|
|
|
142
|
-
this.domElement.style.touchAction = 'none'; //
|
|
142
|
+
this.domElement.style.touchAction = 'none'; // Disable touch scroll
|
|
143
143
|
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -151,7 +151,7 @@ class DragControls extends Controls {
|
|
|
151
151
|
this.domElement.removeEventListener( 'pointerleave', this._onPointerCancel );
|
|
152
152
|
this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
|
|
153
153
|
|
|
154
|
-
this.domElement.style.touchAction = '
|
|
154
|
+
this.domElement.style.touchAction = ''; // Restore touch scroll
|
|
155
155
|
this.domElement.style.cursor = '';
|
|
156
156
|
|
|
157
157
|
}
|
|
@@ -60,14 +60,6 @@ class FirstPersonControls extends Controls {
|
|
|
60
60
|
*/
|
|
61
61
|
this.autoForward = false;
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* Whether it's possible to look around or not.
|
|
65
|
-
*
|
|
66
|
-
* @type {boolean}
|
|
67
|
-
* @default true
|
|
68
|
-
*/
|
|
69
|
-
this.activeLook = true;
|
|
70
|
-
|
|
71
63
|
/**
|
|
72
64
|
* Whether or not the camera's height influences the forward movement speed.
|
|
73
65
|
* Use the properties `heightCoef`, `heightMin` and `heightMax` for configuration.
|
|
@@ -141,14 +133,16 @@ class FirstPersonControls extends Controls {
|
|
|
141
133
|
this._pointerX = 0;
|
|
142
134
|
this._pointerY = 0;
|
|
143
135
|
|
|
136
|
+
this._pointerDownX = 0;
|
|
137
|
+
this._pointerDownY = 0;
|
|
138
|
+
|
|
139
|
+
this._pointerCount = 0;
|
|
140
|
+
|
|
144
141
|
this._moveForward = false;
|
|
145
142
|
this._moveBackward = false;
|
|
146
143
|
this._moveLeft = false;
|
|
147
144
|
this._moveRight = false;
|
|
148
145
|
|
|
149
|
-
this._viewHalfX = 0;
|
|
150
|
-
this._viewHalfY = 0;
|
|
151
|
-
|
|
152
146
|
this._lat = 0;
|
|
153
147
|
this._lon = 0;
|
|
154
148
|
|
|
@@ -167,8 +161,6 @@ class FirstPersonControls extends Controls {
|
|
|
167
161
|
|
|
168
162
|
this.connect( domElement );
|
|
169
163
|
|
|
170
|
-
this.handleResize();
|
|
171
|
-
|
|
172
164
|
}
|
|
173
165
|
|
|
174
166
|
this._setOrientation();
|
|
@@ -187,6 +179,8 @@ class FirstPersonControls extends Controls {
|
|
|
187
179
|
this.domElement.addEventListener( 'pointerup', this._onPointerUp );
|
|
188
180
|
this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
|
|
189
181
|
|
|
182
|
+
this.domElement.style.touchAction = 'none'; // Disable touch scroll
|
|
183
|
+
|
|
190
184
|
}
|
|
191
185
|
|
|
192
186
|
disconnect() {
|
|
@@ -199,6 +193,8 @@ class FirstPersonControls extends Controls {
|
|
|
199
193
|
this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
|
|
200
194
|
this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
|
|
201
195
|
|
|
196
|
+
this.domElement.style.touchAction = ''; // Restore touch scroll
|
|
197
|
+
|
|
202
198
|
}
|
|
203
199
|
|
|
204
200
|
dispose() {
|
|
@@ -207,25 +203,6 @@ class FirstPersonControls extends Controls {
|
|
|
207
203
|
|
|
208
204
|
}
|
|
209
205
|
|
|
210
|
-
/**
|
|
211
|
-
* Must be called if the application window is resized.
|
|
212
|
-
*/
|
|
213
|
-
handleResize() {
|
|
214
|
-
|
|
215
|
-
if ( this.domElement === document ) {
|
|
216
|
-
|
|
217
|
-
this._viewHalfX = window.innerWidth / 2;
|
|
218
|
-
this._viewHalfY = window.innerHeight / 2;
|
|
219
|
-
|
|
220
|
-
} else {
|
|
221
|
-
|
|
222
|
-
this._viewHalfX = this.domElement.offsetWidth / 2;
|
|
223
|
-
this._viewHalfY = this.domElement.offsetHeight / 2;
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
206
|
/**
|
|
230
207
|
* Rotates the camera towards the defined target position.
|
|
231
208
|
*
|
|
@@ -282,13 +259,7 @@ class FirstPersonControls extends Controls {
|
|
|
282
259
|
if ( this._moveUp ) this.object.translateY( actualMoveSpeed );
|
|
283
260
|
if ( this._moveDown ) this.object.translateY( - actualMoveSpeed );
|
|
284
261
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if ( ! this.activeLook ) {
|
|
288
|
-
|
|
289
|
-
actualLookSpeed = 0;
|
|
290
|
-
|
|
291
|
-
}
|
|
262
|
+
const actualLookSpeed = delta * this.lookSpeed;
|
|
292
263
|
|
|
293
264
|
let verticalLookRatio = 1;
|
|
294
265
|
|
|
@@ -298,8 +269,12 @@ class FirstPersonControls extends Controls {
|
|
|
298
269
|
|
|
299
270
|
}
|
|
300
271
|
|
|
301
|
-
|
|
302
|
-
|
|
272
|
+
if ( this.mouseDragOn ) {
|
|
273
|
+
|
|
274
|
+
this._lon -= this._pointerX * actualLookSpeed;
|
|
275
|
+
if ( this.lookVertical ) this._lat -= this._pointerY * actualLookSpeed * verticalLookRatio;
|
|
276
|
+
|
|
277
|
+
}
|
|
303
278
|
|
|
304
279
|
this._lat = Math.max( - 85, Math.min( 85, this._lat ) );
|
|
305
280
|
|
|
@@ -332,6 +307,15 @@ class FirstPersonControls extends Controls {
|
|
|
332
307
|
|
|
333
308
|
}
|
|
334
309
|
|
|
310
|
+
/**
|
|
311
|
+
* @deprecated, r184. This method is no longer needed.
|
|
312
|
+
*/
|
|
313
|
+
handleResize() {
|
|
314
|
+
|
|
315
|
+
console.warn( 'THREE.FirstPersonControls: handleResize() has been removed.' );
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
|
|
335
319
|
}
|
|
336
320
|
|
|
337
321
|
function onPointerDown( event ) {
|
|
@@ -342,7 +326,16 @@ function onPointerDown( event ) {
|
|
|
342
326
|
|
|
343
327
|
}
|
|
344
328
|
|
|
345
|
-
|
|
329
|
+
this.domElement.setPointerCapture( event.pointerId );
|
|
330
|
+
|
|
331
|
+
this._pointerCount ++;
|
|
332
|
+
|
|
333
|
+
if ( event.pointerType === 'touch' ) {
|
|
334
|
+
|
|
335
|
+
this._moveForward = this._pointerCount === 1;
|
|
336
|
+
this._moveBackward = this._pointerCount >= 2;
|
|
337
|
+
|
|
338
|
+
} else {
|
|
346
339
|
|
|
347
340
|
switch ( event.button ) {
|
|
348
341
|
|
|
@@ -353,13 +346,28 @@ function onPointerDown( event ) {
|
|
|
353
346
|
|
|
354
347
|
}
|
|
355
348
|
|
|
349
|
+
this._pointerDownX = event.pageX;
|
|
350
|
+
this._pointerDownY = event.pageY;
|
|
351
|
+
|
|
352
|
+
this._pointerX = 0;
|
|
353
|
+
this._pointerY = 0;
|
|
354
|
+
|
|
356
355
|
this.mouseDragOn = true;
|
|
357
356
|
|
|
358
357
|
}
|
|
359
358
|
|
|
360
359
|
function onPointerUp( event ) {
|
|
361
360
|
|
|
362
|
-
|
|
361
|
+
this.domElement.releasePointerCapture( event.pointerId );
|
|
362
|
+
|
|
363
|
+
this._pointerCount --;
|
|
364
|
+
|
|
365
|
+
if ( event.pointerType === 'touch' ) {
|
|
366
|
+
|
|
367
|
+
this._moveForward = this._pointerCount === 1;
|
|
368
|
+
this._moveBackward = false;
|
|
369
|
+
|
|
370
|
+
} else {
|
|
363
371
|
|
|
364
372
|
switch ( event.button ) {
|
|
365
373
|
|
|
@@ -370,23 +378,19 @@ function onPointerUp( event ) {
|
|
|
370
378
|
|
|
371
379
|
}
|
|
372
380
|
|
|
373
|
-
this.
|
|
381
|
+
this._pointerX = 0;
|
|
382
|
+
this._pointerY = 0;
|
|
383
|
+
|
|
384
|
+
if ( this._pointerCount === 0 ) this.mouseDragOn = false;
|
|
374
385
|
|
|
375
386
|
}
|
|
376
387
|
|
|
377
388
|
function onPointerMove( event ) {
|
|
378
389
|
|
|
379
|
-
if ( this.
|
|
390
|
+
if ( this.mouseDragOn === false ) return;
|
|
380
391
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
} else {
|
|
385
|
-
|
|
386
|
-
this._pointerX = event.pageX - this.domElement.offsetLeft - this._viewHalfX;
|
|
387
|
-
this._pointerY = event.pageY - this.domElement.offsetTop - this._viewHalfY;
|
|
388
|
-
|
|
389
|
-
}
|
|
392
|
+
this._pointerX = event.pageX - this._pointerDownX;
|
|
393
|
+
this._pointerY = event.pageY - this._pointerDownY;
|
|
390
394
|
|
|
391
395
|
}
|
|
392
396
|
|
|
@@ -109,6 +109,8 @@ class FlyControls extends Controls {
|
|
|
109
109
|
this.domElement.addEventListener( 'pointercancel', this._onPointerCancel );
|
|
110
110
|
this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
|
|
111
111
|
|
|
112
|
+
this.domElement.style.touchAction = 'none'; // Disable touch scroll
|
|
113
|
+
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
disconnect() {
|
|
@@ -122,6 +124,8 @@ class FlyControls extends Controls {
|
|
|
122
124
|
this.domElement.removeEventListener( 'pointercancel', this._onPointerCancel );
|
|
123
125
|
this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
|
|
124
126
|
|
|
127
|
+
this.domElement.style.touchAction = ''; // Restore touch scroll
|
|
128
|
+
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
dispose() {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { MOUSE, TOUCH } from 'three';
|
|
1
|
+
import { MOUSE, TOUCH, Plane, Raycaster, Vector2, Vector3 } from 'three';
|
|
2
2
|
|
|
3
3
|
import { OrbitControls } from './OrbitControls.js';
|
|
4
4
|
|
|
5
|
+
const _plane = new Plane();
|
|
6
|
+
const _raycaster = new Raycaster();
|
|
7
|
+
const _mouse = new Vector2();
|
|
8
|
+
const _panCurrent = new Vector3();
|
|
9
|
+
|
|
5
10
|
/**
|
|
6
11
|
* This class is intended for transforming a camera over a map from bird's eye perspective.
|
|
7
12
|
* The class shares its implementation with {@link OrbitControls} but uses a specific preset
|
|
@@ -55,6 +60,55 @@ class MapControls extends OrbitControls {
|
|
|
55
60
|
*/
|
|
56
61
|
this.touches = { ONE: TOUCH.PAN, TWO: TOUCH.DOLLY_ROTATE };
|
|
57
62
|
|
|
63
|
+
this._panWorldStart = new Vector3();
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
_handleMouseDownPan( event ) {
|
|
68
|
+
|
|
69
|
+
super._handleMouseDownPan( event );
|
|
70
|
+
|
|
71
|
+
this._panOffset.set( 0, 0, 0 );
|
|
72
|
+
|
|
73
|
+
if ( this.screenSpacePanning === true ) return;
|
|
74
|
+
|
|
75
|
+
_plane.setFromNormalAndCoplanarPoint( this.object.up, this.target );
|
|
76
|
+
|
|
77
|
+
const element = this.domElement;
|
|
78
|
+
const rect = element.getBoundingClientRect();
|
|
79
|
+
_mouse.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1;
|
|
80
|
+
_mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
|
|
81
|
+
|
|
82
|
+
_raycaster.setFromCamera( _mouse, this.object );
|
|
83
|
+
_raycaster.ray.intersectPlane( _plane, this._panWorldStart );
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_handleMouseMovePan( event ) {
|
|
88
|
+
|
|
89
|
+
if ( this.screenSpacePanning === true ) {
|
|
90
|
+
|
|
91
|
+
super._handleMouseMovePan( event );
|
|
92
|
+
return;
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const element = this.domElement;
|
|
97
|
+
const rect = element.getBoundingClientRect();
|
|
98
|
+
_mouse.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1;
|
|
99
|
+
_mouse.y = - ( ( event.clientY - rect.top ) / rect.height ) * 2 + 1;
|
|
100
|
+
|
|
101
|
+
_raycaster.setFromCamera( _mouse, this.object );
|
|
102
|
+
|
|
103
|
+
if ( _raycaster.ray.intersectPlane( _plane, _panCurrent ) ) {
|
|
104
|
+
|
|
105
|
+
_panCurrent.sub( this._panWorldStart );
|
|
106
|
+
this._panOffset.copy( _panCurrent ).negate();
|
|
107
|
+
|
|
108
|
+
this.update();
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
58
112
|
}
|
|
59
113
|
|
|
60
114
|
}
|
|
@@ -391,6 +391,8 @@ class OrbitControls extends Controls {
|
|
|
391
391
|
*/
|
|
392
392
|
this.zoom0 = this.object.zoom;
|
|
393
393
|
|
|
394
|
+
this._cursorStyle = 'auto';
|
|
395
|
+
|
|
394
396
|
// the target DOM element for key events
|
|
395
397
|
this._domElementKeyEvents = null;
|
|
396
398
|
|
|
@@ -462,6 +464,34 @@ class OrbitControls extends Controls {
|
|
|
462
464
|
|
|
463
465
|
}
|
|
464
466
|
|
|
467
|
+
/**
|
|
468
|
+
* Defines the visual representation of the cursor.
|
|
469
|
+
*
|
|
470
|
+
* @type {('auto'|'grab')}
|
|
471
|
+
* @default 'auto'
|
|
472
|
+
*/
|
|
473
|
+
set cursorStyle( type ) {
|
|
474
|
+
|
|
475
|
+
this._cursorStyle = type;
|
|
476
|
+
|
|
477
|
+
if ( type === 'grab' ) {
|
|
478
|
+
|
|
479
|
+
this.domElement.style.cursor = 'grab';
|
|
480
|
+
|
|
481
|
+
} else {
|
|
482
|
+
|
|
483
|
+
this.domElement.style.cursor = 'auto';
|
|
484
|
+
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
get cursorStyle() {
|
|
490
|
+
|
|
491
|
+
return this._cursorStyle;
|
|
492
|
+
|
|
493
|
+
}
|
|
494
|
+
|
|
465
495
|
connect( element ) {
|
|
466
496
|
|
|
467
497
|
super.connect( element );
|
|
@@ -475,15 +505,15 @@ class OrbitControls extends Controls {
|
|
|
475
505
|
const document = this.domElement.getRootNode(); // offscreen canvas compatibility
|
|
476
506
|
document.addEventListener( 'keydown', this._interceptControlDown, { passive: true, capture: true } );
|
|
477
507
|
|
|
478
|
-
this.domElement.style.touchAction = 'none'; //
|
|
508
|
+
this.domElement.style.touchAction = 'none'; // Disable touch scroll
|
|
479
509
|
|
|
480
510
|
}
|
|
481
511
|
|
|
482
512
|
disconnect() {
|
|
483
513
|
|
|
484
514
|
this.domElement.removeEventListener( 'pointerdown', this._onPointerDown );
|
|
485
|
-
this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
|
|
486
|
-
this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
|
|
515
|
+
this.domElement.ownerDocument.removeEventListener( 'pointermove', this._onPointerMove );
|
|
516
|
+
this.domElement.ownerDocument.removeEventListener( 'pointerup', this._onPointerUp );
|
|
487
517
|
this.domElement.removeEventListener( 'pointercancel', this._onPointerUp );
|
|
488
518
|
|
|
489
519
|
this.domElement.removeEventListener( 'wheel', this._onMouseWheel );
|
|
@@ -494,7 +524,7 @@ class OrbitControls extends Controls {
|
|
|
494
524
|
const document = this.domElement.getRootNode(); // offscreen canvas compatibility
|
|
495
525
|
document.removeEventListener( 'keydown', this._interceptControlDown, { capture: true } );
|
|
496
526
|
|
|
497
|
-
this.domElement.style.touchAction = '
|
|
527
|
+
this.domElement.style.touchAction = ''; // Restore touch scroll
|
|
498
528
|
|
|
499
529
|
}
|
|
500
530
|
|
|
@@ -594,6 +624,67 @@ class OrbitControls extends Controls {
|
|
|
594
624
|
|
|
595
625
|
}
|
|
596
626
|
|
|
627
|
+
/**
|
|
628
|
+
* Programmatically pan the camera.
|
|
629
|
+
*
|
|
630
|
+
* @param {number} deltaX - The horizontal pan amount in pixels.
|
|
631
|
+
* @param {number} deltaY - The vertical pan amount in pixels.
|
|
632
|
+
*/
|
|
633
|
+
pan( deltaX, deltaY ) {
|
|
634
|
+
|
|
635
|
+
this._pan( deltaX, deltaY );
|
|
636
|
+
this.update();
|
|
637
|
+
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* Programmatically dolly in (zoom in for perspective camera).
|
|
642
|
+
*
|
|
643
|
+
* @param {number} dollyScale - The dolly scale factor.
|
|
644
|
+
*/
|
|
645
|
+
dollyIn( dollyScale ) {
|
|
646
|
+
|
|
647
|
+
this._dollyIn( dollyScale );
|
|
648
|
+
this.update();
|
|
649
|
+
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Programmatically dolly out (zoom out for perspective camera).
|
|
654
|
+
*
|
|
655
|
+
* @param {number} dollyScale - The dolly scale factor.
|
|
656
|
+
*/
|
|
657
|
+
dollyOut( dollyScale ) {
|
|
658
|
+
|
|
659
|
+
this._dollyOut( dollyScale );
|
|
660
|
+
this.update();
|
|
661
|
+
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Programmatically rotate the camera left (around the vertical axis).
|
|
666
|
+
*
|
|
667
|
+
* @param {number} angle - The rotation angle in radians.
|
|
668
|
+
*/
|
|
669
|
+
rotateLeft( angle ) {
|
|
670
|
+
|
|
671
|
+
this._rotateLeft( angle );
|
|
672
|
+
this.update();
|
|
673
|
+
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Programmatically rotate the camera up (around the horizontal axis).
|
|
678
|
+
*
|
|
679
|
+
* @param {number} angle - The rotation angle in radians.
|
|
680
|
+
*/
|
|
681
|
+
rotateUp( angle ) {
|
|
682
|
+
|
|
683
|
+
this._rotateUp( angle );
|
|
684
|
+
this.update();
|
|
685
|
+
|
|
686
|
+
}
|
|
687
|
+
|
|
597
688
|
update( deltaTime = null ) {
|
|
598
689
|
|
|
599
690
|
const position = this.object.position;
|
|
@@ -1458,8 +1549,8 @@ function onPointerDown( event ) {
|
|
|
1458
1549
|
|
|
1459
1550
|
this.domElement.setPointerCapture( event.pointerId );
|
|
1460
1551
|
|
|
1461
|
-
this.domElement.addEventListener( 'pointermove', this._onPointerMove );
|
|
1462
|
-
this.domElement.addEventListener( 'pointerup', this._onPointerUp );
|
|
1552
|
+
this.domElement.ownerDocument.addEventListener( 'pointermove', this._onPointerMove );
|
|
1553
|
+
this.domElement.ownerDocument.addEventListener( 'pointerup', this._onPointerUp );
|
|
1463
1554
|
|
|
1464
1555
|
}
|
|
1465
1556
|
|
|
@@ -1481,6 +1572,12 @@ function onPointerDown( event ) {
|
|
|
1481
1572
|
|
|
1482
1573
|
}
|
|
1483
1574
|
|
|
1575
|
+
if ( this._cursorStyle === 'grab' ) {
|
|
1576
|
+
|
|
1577
|
+
this.domElement.style.cursor = 'grabbing';
|
|
1578
|
+
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1484
1581
|
}
|
|
1485
1582
|
|
|
1486
1583
|
function onPointerMove( event ) {
|
|
@@ -1509,13 +1606,19 @@ function onPointerUp( event ) {
|
|
|
1509
1606
|
|
|
1510
1607
|
this.domElement.releasePointerCapture( event.pointerId );
|
|
1511
1608
|
|
|
1512
|
-
this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
|
|
1513
|
-
this.domElement.removeEventListener( 'pointerup', this._onPointerUp );
|
|
1609
|
+
this.domElement.ownerDocument.removeEventListener( 'pointermove', this._onPointerMove );
|
|
1610
|
+
this.domElement.ownerDocument.removeEventListener( 'pointerup', this._onPointerUp );
|
|
1514
1611
|
|
|
1515
1612
|
this.dispatchEvent( _endEvent );
|
|
1516
1613
|
|
|
1517
1614
|
this.state = _STATE.NONE;
|
|
1518
1615
|
|
|
1616
|
+
if ( this._cursorStyle === 'grab' ) {
|
|
1617
|
+
|
|
1618
|
+
this.domElement.style.cursor = 'grab';
|
|
1619
|
+
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1519
1622
|
break;
|
|
1520
1623
|
|
|
1521
1624
|
case 1:
|