@plastic-software/three 0.174.0 → 0.175.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/three.cjs +10744 -1476
- package/build/three.core.js +9633 -1096
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +918 -189
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +4 -2
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +2658 -1697
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +2654 -1709
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -1
- package/examples/jsm/animation/AnimationClipCreator.js +57 -6
- package/examples/jsm/animation/CCDIKSolver.js +93 -39
- package/examples/jsm/capabilities/WebGL.js +28 -3
- package/examples/jsm/capabilities/WebGPU.js +16 -6
- package/examples/jsm/controls/ArcballControls.js +424 -154
- package/examples/jsm/controls/DragControls.js +93 -2
- package/examples/jsm/controls/FirstPersonControls.js +113 -4
- package/examples/jsm/controls/FlyControls.js +49 -2
- package/examples/jsm/controls/MapControls.js +42 -9
- package/examples/jsm/controls/OrbitControls.js +345 -42
- package/examples/jsm/controls/PointerLockControls.js +111 -9
- package/examples/jsm/controls/TrackballControls.js +159 -8
- package/examples/jsm/controls/TransformControls.js +252 -6
- package/examples/jsm/csm/CSM.js +226 -15
- package/examples/jsm/csm/CSMFrustum.js +52 -0
- package/examples/jsm/csm/CSMHelper.js +47 -0
- package/examples/jsm/csm/CSMShader.js +10 -1
- package/examples/jsm/csm/CSMShadowNode.js +156 -13
- package/examples/jsm/curves/CurveExtras.js +289 -31
- package/examples/jsm/curves/NURBSCurve.js +57 -14
- package/examples/jsm/curves/NURBSSurface.js +50 -6
- package/examples/jsm/curves/NURBSUtils.js +96 -112
- package/examples/jsm/curves/NURBSVolume.js +22 -4
- package/examples/jsm/effects/AnaglyphEffect.js +30 -0
- package/examples/jsm/effects/AsciiEffect.js +60 -15
- package/examples/jsm/effects/OutlineEffect.js +59 -111
- package/examples/jsm/effects/ParallaxBarrierEffect.js +28 -0
- package/examples/jsm/effects/PeppersGhostEffect.js +21 -2
- package/examples/jsm/effects/StereoEffect.js +29 -0
- package/examples/jsm/environments/DebugEnvironment.js +49 -0
- package/examples/jsm/environments/RoomEnvironment.js +23 -4
- package/examples/jsm/exporters/DRACOExporter.js +53 -13
- package/examples/jsm/exporters/EXRExporter.js +37 -8
- package/examples/jsm/exporters/GLTFExporter.js +171 -48
- package/examples/jsm/exporters/KTX2Exporter.js +20 -0
- package/examples/jsm/exporters/OBJExporter.js +18 -0
- package/examples/jsm/exporters/PLYExporter.js +39 -9
- package/examples/jsm/exporters/STLExporter.js +25 -5
- package/examples/jsm/exporters/USDZExporter.js +70 -3
- package/examples/jsm/geometries/BoxLineGeometry.js +22 -0
- package/examples/jsm/geometries/ConvexGeometry.js +18 -0
- package/examples/jsm/geometries/DecalGeometry.js +20 -9
- package/examples/jsm/geometries/ParametricFunctions.js +97 -0
- package/examples/jsm/geometries/ParametricGeometry.js +37 -5
- package/examples/jsm/geometries/RoundedBoxGeometry.js +21 -0
- package/examples/jsm/geometries/TeapotGeometry.js +22 -38
- package/examples/jsm/geometries/TextGeometry.js +44 -16
- package/examples/jsm/helpers/LightProbeHelper.js +35 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +36 -0
- package/examples/jsm/helpers/OctreeHelper.js +35 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +35 -3
- package/examples/jsm/helpers/TextureHelper.js +27 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +28 -0
- package/examples/jsm/helpers/VertexNormalsHelper.js +58 -2
- package/examples/jsm/helpers/VertexTangentsHelper.js +46 -2
- package/examples/jsm/helpers/ViewHelper.js +75 -1
- package/examples/jsm/interactive/HTMLMesh.js +25 -0
- package/examples/jsm/interactive/InteractiveGroup.js +65 -5
- package/examples/jsm/interactive/SelectionBox.js +74 -9
- package/examples/jsm/interactive/SelectionHelper.js +71 -29
- package/examples/jsm/libs/motion-controllers.module.js +1 -1
- package/examples/jsm/lighting/TiledLighting.js +23 -0
- package/examples/jsm/lights/LightProbeGenerator.js +26 -1
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +48 -13
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +15 -0
- package/examples/jsm/lines/Line2.js +36 -0
- package/examples/jsm/lines/LineGeometry.js +52 -0
- package/examples/jsm/lines/LineMaterial.js +95 -0
- package/examples/jsm/lines/LineSegments2.js +51 -2
- package/examples/jsm/lines/LineSegmentsGeometry.js +62 -8
- package/examples/jsm/lines/Wireframe.js +38 -2
- package/examples/jsm/lines/WireframeGeometry2.js +24 -0
- package/examples/jsm/lines/webgpu/Line2.js +25 -1
- package/examples/jsm/lines/webgpu/LineSegments2.js +44 -6
- package/examples/jsm/lines/webgpu/Wireframe.js +30 -2
- package/examples/jsm/loaders/3DMLoader.js +71 -2
- package/examples/jsm/loaders/3MFLoader.js +41 -3
- package/examples/jsm/loaders/AMFLoader.js +31 -12
- package/examples/jsm/loaders/BVHLoader.js +57 -11
- package/examples/jsm/loaders/ColladaLoader.js +35 -0
- package/examples/jsm/loaders/DDSLoader.js +24 -0
- package/examples/jsm/loaders/DRACOLoader.js +73 -1
- package/examples/jsm/loaders/EXRLoader.js +40 -8
- package/examples/jsm/loaders/FBXLoader.js +42 -14
- package/examples/jsm/loaders/FontLoader.js +60 -2
- package/examples/jsm/loaders/GCodeLoader.js +33 -5
- package/examples/jsm/loaders/GLTFLoader.js +218 -5
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +48 -0
- package/examples/jsm/loaders/IESLoader.js +41 -0
- package/examples/jsm/loaders/KMZLoader.js +32 -0
- package/examples/jsm/loaders/KTX2Loader.js +86 -18
- package/examples/jsm/loaders/KTXLoader.js +26 -6
- package/examples/jsm/loaders/LDrawLoader.js +115 -5
- package/examples/jsm/loaders/LUT3dlLoader.js +46 -10
- package/examples/jsm/loaders/LUTCubeLoader.js +45 -9
- package/examples/jsm/loaders/LUTImageLoader.js +78 -38
- package/examples/jsm/loaders/LWOLoader.js +46 -7
- package/examples/jsm/loaders/LottieLoader.js +37 -0
- package/examples/jsm/loaders/MD2Loader.js +36 -1
- package/examples/jsm/loaders/MDDLoader.js +56 -12
- package/examples/jsm/loaders/MTLLoader.js +38 -33
- package/examples/jsm/loaders/MaterialXLoader.js +33 -0
- package/examples/jsm/loaders/NRRDLoader.js +36 -5
- package/examples/jsm/loaders/OBJLoader.js +48 -1
- package/examples/jsm/loaders/PCDLoader.js +47 -0
- package/examples/jsm/loaders/PDBLoader.js +40 -2
- package/examples/jsm/loaders/PLYLoader.js +62 -32
- package/examples/jsm/loaders/PVRLoader.js +23 -5
- package/examples/jsm/loaders/RGBELoader.js +38 -5
- package/examples/jsm/loaders/RGBMLoader.js +67 -1
- package/examples/jsm/loaders/STLLoader.js +47 -38
- package/examples/jsm/loaders/SVGLoader.js +113 -20
- package/examples/jsm/loaders/TDSLoader.js +81 -61
- package/examples/jsm/loaders/TGALoader.js +22 -0
- package/examples/jsm/loaders/TIFFLoader.js +22 -0
- package/examples/jsm/loaders/TTFLoader.js +36 -2
- package/examples/jsm/loaders/USDZLoader.js +34 -1
- package/examples/jsm/loaders/UltraHDRLoader.js +58 -12
- package/examples/jsm/loaders/VOXLoader.js +57 -0
- package/examples/jsm/loaders/VRMLLoader.js +32 -1
- package/examples/jsm/loaders/VTKLoader.js +38 -0
- package/examples/jsm/loaders/XYZLoader.js +35 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +39 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +39 -0
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +24 -2
- package/examples/jsm/math/Capsule.js +89 -14
- package/examples/jsm/math/ColorConverter.js +21 -0
- package/examples/jsm/math/ColorSpaces.js +53 -0
- package/examples/jsm/math/ConvexHull.js +514 -92
- package/examples/jsm/math/ImprovedNoise.js +14 -2
- package/examples/jsm/math/Lut.js +111 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +76 -13
- package/examples/jsm/math/OBB.js +139 -46
- package/examples/jsm/math/Octree.js +132 -5
- package/examples/jsm/math/SimplexNoise.js +66 -42
- package/examples/jsm/misc/ConvexObjectBreaker.js +43 -25
- package/examples/jsm/misc/GPUComputationRenderer.js +92 -17
- package/examples/jsm/misc/Gyroscope.js +11 -0
- package/examples/jsm/misc/MD2Character.js +115 -2
- package/examples/jsm/misc/MD2CharacterComplex.js +170 -8
- package/examples/jsm/misc/MorphAnimMesh.js +43 -0
- package/examples/jsm/misc/MorphBlendMesh.js +102 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +40 -15
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +33 -13
- package/examples/jsm/misc/RollerCoaster.js +52 -0
- package/examples/jsm/misc/Timer.js +79 -2
- package/examples/jsm/misc/TubePainter.js +53 -0
- package/examples/jsm/misc/Volume.js +108 -72
- package/examples/jsm/misc/VolumeSlice.js +88 -45
- package/examples/jsm/modifiers/CurveModifier.js +57 -34
- package/examples/jsm/modifiers/CurveModifierGPU.js +36 -17
- package/examples/jsm/modifiers/EdgeSplitModifier.js +18 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +20 -8
- package/examples/jsm/modifiers/TessellateModifier.js +33 -2
- package/examples/jsm/objects/GroundedSkybox.js +23 -5
- package/examples/jsm/objects/Lensflare.js +91 -2
- package/examples/jsm/objects/LensflareMesh.js +53 -2
- package/examples/jsm/objects/MarchingCubes.js +88 -5
- package/examples/jsm/objects/Reflector.js +70 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +39 -0
- package/examples/jsm/objects/Refractor.js +61 -0
- package/examples/jsm/objects/ShadowMesh.js +53 -4
- package/examples/jsm/objects/Sky.js +26 -9
- package/examples/jsm/objects/SkyMesh.js +60 -9
- package/examples/jsm/objects/Water.js +44 -5
- package/examples/jsm/objects/Water2.js +42 -3
- package/examples/jsm/objects/Water2Mesh.js +38 -3
- package/examples/jsm/objects/WaterMesh.js +94 -7
- package/examples/jsm/physics/AmmoPhysics.js +47 -0
- package/examples/jsm/physics/JoltPhysics.js +48 -0
- package/examples/jsm/physics/RapierPhysics.js +56 -0
- package/examples/jsm/postprocessing/AfterimagePass.js +90 -38
- package/examples/jsm/postprocessing/BloomPass.js +125 -24
- package/examples/jsm/postprocessing/BokehPass.js +98 -22
- package/examples/jsm/postprocessing/ClearPass.js +53 -3
- package/examples/jsm/postprocessing/CubeTexturePass.js +81 -21
- package/examples/jsm/postprocessing/DotScreenPass.js +58 -10
- package/examples/jsm/postprocessing/EffectComposer.js +131 -0
- package/examples/jsm/postprocessing/FilmPass.js +53 -5
- package/examples/jsm/postprocessing/GTAOPass.js +191 -48
- package/examples/jsm/postprocessing/GlitchPass.js +84 -33
- package/examples/jsm/postprocessing/HalftonePass.js +64 -10
- package/examples/jsm/postprocessing/LUTPass.js +37 -8
- package/examples/jsm/postprocessing/MaskPass.js +90 -0
- package/examples/jsm/postprocessing/OutlinePass.js +266 -133
- package/examples/jsm/postprocessing/OutputPass.js +53 -14
- package/examples/jsm/postprocessing/Pass.js +98 -4
- package/examples/jsm/postprocessing/RenderPass.js +83 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +123 -45
- package/examples/jsm/postprocessing/RenderTransitionPass.js +119 -21
- package/examples/jsm/postprocessing/SAOPass.js +126 -53
- package/examples/jsm/postprocessing/SMAAPass.js +103 -71
- package/examples/jsm/postprocessing/SSAARenderPass.js +117 -35
- package/examples/jsm/postprocessing/SSAOPass.js +160 -47
- package/examples/jsm/postprocessing/SSRPass.js +230 -49
- package/examples/jsm/postprocessing/SavePass.js +68 -16
- package/examples/jsm/postprocessing/ShaderPass.js +64 -7
- package/examples/jsm/postprocessing/TAARenderPass.js +78 -24
- package/examples/jsm/postprocessing/TexturePass.js +71 -8
- package/examples/jsm/postprocessing/UnrealBloomPass.js +113 -37
- package/examples/jsm/renderers/CSS2DRenderer.js +77 -1
- package/examples/jsm/renderers/CSS3DRenderer.js +99 -3
- package/examples/jsm/renderers/Projector.js +18 -2
- package/examples/jsm/renderers/SVGRenderer.js +124 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +9 -5
- package/examples/jsm/shaders/AfterimageShader.js +6 -4
- package/examples/jsm/shaders/BasicShader.js +6 -2
- package/examples/jsm/shaders/BleachBypassShader.js +8 -4
- package/examples/jsm/shaders/BlendShader.js +6 -2
- package/examples/jsm/shaders/BokehShader.js +7 -4
- package/examples/jsm/shaders/BokehShader2.js +7 -3
- package/examples/jsm/shaders/BrightnessContrastShader.js +8 -5
- package/examples/jsm/shaders/ColorCorrectionShader.js +6 -2
- package/examples/jsm/shaders/ColorifyShader.js +6 -2
- package/examples/jsm/shaders/ConvolutionShader.js +7 -39
- package/examples/jsm/shaders/CopyShader.js +6 -2
- package/examples/jsm/shaders/DOFMipMapShader.js +8 -4
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +7 -1
- package/examples/jsm/shaders/DigitalGlitch.js +7 -7
- package/examples/jsm/shaders/DotScreenShader.js +6 -4
- package/examples/jsm/shaders/ExposureShader.js +6 -2
- package/examples/jsm/shaders/FXAAShader.js +15 -7
- package/examples/jsm/shaders/FilmShader.js +10 -0
- package/examples/jsm/shaders/FocusShader.js +6 -4
- package/examples/jsm/shaders/FreiChenShader.js +7 -3
- package/examples/jsm/shaders/GTAOShader.js +33 -39
- package/examples/jsm/shaders/GammaCorrectionShader.js +8 -2
- package/examples/jsm/shaders/GodRaysShader.js +14 -5
- package/examples/jsm/shaders/HalftoneShader.js +11 -5
- package/examples/jsm/shaders/HorizontalBlurShader.js +9 -3
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +6 -2
- package/examples/jsm/shaders/HueSaturationShader.js +7 -3
- package/examples/jsm/shaders/KaleidoShader.js +8 -4
- package/examples/jsm/shaders/LuminosityHighPassShader.js +6 -5
- package/examples/jsm/shaders/LuminosityShader.js +6 -3
- package/examples/jsm/shaders/MirrorShader.js +7 -4
- package/examples/jsm/shaders/NormalMapShader.js +5 -3
- package/examples/jsm/shaders/OutputShader.js +11 -0
- package/examples/jsm/shaders/PoissonDenoiseShader.js +21 -15
- package/examples/jsm/shaders/RGBShiftShader.js +5 -1
- package/examples/jsm/shaders/SAOShader.js +8 -2
- package/examples/jsm/shaders/SMAAShader.js +23 -1
- package/examples/jsm/shaders/SSAOShader.js +23 -5
- package/examples/jsm/shaders/SSRShader.js +25 -1
- package/examples/jsm/shaders/SepiaShader.js +6 -4
- package/examples/jsm/shaders/SobelOperatorShader.js +5 -2
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +10 -8
- package/examples/jsm/shaders/TechnicolorShader.js +7 -4
- package/examples/jsm/shaders/ToonShader.js +29 -7
- package/examples/jsm/shaders/TriangleBlurShader.js +6 -4
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +6 -3
- package/examples/jsm/shaders/VelocityShader.js +6 -2
- package/examples/jsm/shaders/VerticalBlurShader.js +6 -2
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +5 -1
- package/examples/jsm/shaders/VignetteShader.js +6 -4
- package/examples/jsm/shaders/VolumeShader.js +7 -1
- package/examples/jsm/shaders/WaterRefractionShader.js +8 -0
- package/examples/jsm/textures/FlakesTexture.js +12 -0
- package/examples/jsm/transpiler/Transpiler.js +31 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +1 -1
- package/examples/jsm/tsl/display/BloomNode.js +1 -1
- package/examples/jsm/tsl/display/PixelationPassNode.js +4 -4
- package/examples/jsm/tsl/display/SSRNode.js +1 -1
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +29 -3
- package/examples/jsm/tsl/math/Bayer.js +14 -1
- package/examples/jsm/tsl/utils/Raymarching.js +4 -2
- package/examples/jsm/utils/BufferGeometryUtils.js +88 -29
- package/examples/jsm/utils/CameraUtils.js +10 -7
- package/examples/jsm/utils/GeometryCompressionUtils.js +20 -30
- package/examples/jsm/utils/GeometryUtils.js +12 -13
- package/examples/jsm/utils/LDrawUtils.js +11 -4
- package/examples/jsm/utils/SceneOptimizer.js +66 -20
- package/examples/jsm/utils/SceneUtils.js +50 -3
- package/examples/jsm/utils/ShadowMapViewer.js +47 -24
- package/examples/jsm/utils/ShadowMapViewerGPU.js +47 -24
- package/examples/jsm/utils/SkeletonUtils.js +45 -0
- package/examples/jsm/utils/SortUtils.js +14 -5
- package/examples/jsm/utils/UVsDebug.js +9 -4
- package/examples/jsm/utils/WebGLTextureUtils.js +13 -0
- package/examples/jsm/utils/WebGPUTextureUtils.js +14 -0
- package/examples/jsm/utils/WorkerPool.js +65 -2
- package/examples/jsm/webxr/ARButton.js +18 -0
- package/examples/jsm/webxr/OculusHandModel.js +83 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +125 -0
- package/examples/jsm/webxr/Text2D.js +11 -0
- package/examples/jsm/webxr/VRButton.js +30 -0
- package/examples/jsm/webxr/XRButton.js +22 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +87 -3
- package/examples/jsm/webxr/XREstimatedLight.js +33 -3
- package/examples/jsm/webxr/XRHandMeshModel.js +35 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +92 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +42 -0
- package/examples/jsm/webxr/XRPlanes.js +17 -0
- package/package.json +1 -1
- package/src/Three.TSL.js +3 -1
- package/src/animation/AnimationAction.js +262 -30
- package/src/animation/AnimationClip.js +141 -2
- package/src/animation/AnimationMixer.js +99 -15
- package/src/animation/AnimationObjectGroup.js +41 -18
- package/src/animation/AnimationUtils.js +168 -18
- package/src/animation/KeyframeTrack.js +144 -10
- package/src/animation/PropertyBinding.js +77 -3
- package/src/animation/PropertyMixer.js +72 -5
- package/src/animation/tracks/BooleanKeyframeTrack.js +33 -6
- package/src/animation/tracks/ColorKeyframeTrack.js +26 -5
- package/src/animation/tracks/NumberKeyframeTrack.js +26 -2
- package/src/animation/tracks/QuaternionKeyframeTrack.js +30 -1
- package/src/animation/tracks/StringKeyframeTrack.js +33 -2
- package/src/animation/tracks/VectorKeyframeTrack.js +26 -2
- package/src/audio/AudioAnalyser.js +1 -1
- package/src/audio/AudioListener.js +2 -2
- package/src/audio/PositionalAudio.js +5 -5
- package/src/constants.js +1432 -5
- package/src/core/BufferAttribute.js +413 -3
- package/src/core/BufferGeometry.js +337 -1
- package/src/core/Clock.js +60 -0
- package/src/core/GLBufferAttribute.js +99 -0
- package/src/core/InstancedBufferAttribute.js +29 -0
- package/src/core/InstancedBufferGeometry.js +20 -0
- package/src/core/InstancedInterleavedBuffer.js +26 -0
- package/src/core/InterleavedBuffer.js +137 -3
- package/src/core/InterleavedBufferAttribute.js +197 -0
- package/src/core/Layers.js +71 -10
- package/src/core/Object3D.js +23 -0
- package/src/core/Raycaster.js +134 -1
- package/src/core/RenderTarget.js +166 -7
- package/src/core/RenderTarget3D.js +25 -0
- package/src/core/RenderTargetArray.js +18 -0
- package/src/core/Uniform.js +29 -0
- package/src/core/UniformsGroup.js +84 -2
- package/src/extras/Controls.js +16 -1
- package/src/extras/Earcut.js +3 -781
- package/src/extras/ImageUtils.js +3 -2
- package/src/extras/PMREMGenerator.js +22 -17
- package/src/extras/core/Curve.js +1 -1
- package/src/extras/core/Path.js +1 -1
- package/src/extras/lib/earcut.js +685 -0
- package/src/geometries/ConeGeometry.js +2 -2
- package/src/geometries/CylinderGeometry.js +2 -2
- package/src/geometries/ExtrudeGeometry.js +71 -39
- package/src/geometries/LatheGeometry.js +1 -1
- package/src/lights/LightShadow.js +1 -1
- package/src/lights/webgpu/IESSpotLight.js +1 -1
- package/src/loaders/AnimationLoader.js +31 -0
- package/src/loaders/AudioLoader.js +31 -0
- package/src/loaders/BufferGeometryLoader.js +34 -0
- package/src/loaders/Cache.js +45 -0
- package/src/loaders/CompressedTextureLoader.js +36 -3
- package/src/loaders/CubeTextureLoader.js +45 -0
- package/src/loaders/DataTextureLoader.js +44 -3
- package/src/loaders/FileLoader.js +57 -1
- package/src/loaders/ImageBitmapLoader.js +57 -0
- package/src/loaders/ImageLoader.js +30 -0
- package/src/loaders/Loader.js +4 -6
- package/src/loaders/LoaderUtils.js +18 -36
- package/src/loaders/LoadingManager.js +142 -0
- package/src/loaders/MaterialLoader.js +57 -0
- package/src/loaders/ObjectLoader.js +58 -1
- package/src/loaders/TextureLoader.js +33 -0
- package/src/loaders/nodes/NodeLoader.js +6 -2
- package/src/loaders/nodes/NodeMaterialLoader.js +1 -1
- package/src/loaders/nodes/NodeObjectLoader.js +3 -3
- package/src/materials/LineBasicMaterial.js +74 -1
- package/src/materials/LineDashedMaterial.js +52 -0
- package/src/materials/Material.js +18 -3
- package/src/materials/MeshBasicMaterial.js +165 -0
- package/src/materials/MeshDepthMaterial.js +93 -0
- package/src/materials/MeshDistanceMaterial.js +76 -0
- package/src/materials/MeshLambertMaterial.js +273 -0
- package/src/materials/MeshMatcapMaterial.js +142 -0
- package/src/materials/MeshNormalMaterial.js +113 -0
- package/src/materials/MeshPhongMaterial.js +288 -0
- package/src/materials/MeshPhysicalMaterial.js +292 -1
- package/src/materials/MeshStandardMaterial.js +297 -0
- package/src/materials/MeshToonMaterial.js +218 -0
- package/src/materials/PointsMaterial.js +89 -0
- package/src/materials/RawShaderMaterial.js +25 -0
- package/src/materials/ShaderMaterial.js +215 -6
- package/src/materials/ShadowMaterial.js +54 -0
- package/src/materials/SpriteMaterial.js +82 -0
- package/src/materials/nodes/Line2NodeMaterial.js +1 -1
- package/src/materials/nodes/LineBasicNodeMaterial.js +2 -2
- package/src/materials/nodes/LineDashedNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshLambertNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhongNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshSSSNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshStandardNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshToonNodeMaterial.js +2 -2
- package/src/materials/nodes/NodeMaterial.js +7 -3
- package/src/materials/nodes/PointsNodeMaterial.js +1 -1
- package/src/materials/nodes/ShadowNodeMaterial.js +11 -2
- package/src/materials/nodes/SpriteNodeMaterial.js +1 -1
- package/src/materials/nodes/VolumeNodeMaterial.js +10 -1
- package/src/math/Color.js +1 -1
- package/src/math/MathUtils.js +223 -0
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/accessors/BatchNode.js +8 -8
- package/src/nodes/accessors/BuiltinNode.js +1 -1
- package/src/nodes/accessors/CubeTextureNode.js +1 -1
- package/src/nodes/accessors/InstanceNode.js +5 -5
- package/src/nodes/accessors/InstancedMeshNode.js +1 -1
- package/src/nodes/accessors/MorphNode.js +27 -23
- package/src/nodes/accessors/Normal.js +1 -1
- package/src/nodes/accessors/Object3DNode.js +12 -12
- package/src/nodes/accessors/ReferenceBaseNode.js +2 -2
- package/src/nodes/accessors/ReferenceNode.js +1 -1
- package/src/nodes/accessors/SkinningNode.js +46 -37
- package/src/nodes/accessors/StorageBufferNode.js +1 -1
- package/src/nodes/accessors/StorageTextureNode.js +3 -3
- package/src/nodes/accessors/Texture3DNode.js +1 -1
- package/src/nodes/accessors/TextureNode.js +25 -5
- package/src/nodes/accessors/TextureSizeNode.js +1 -1
- package/src/nodes/accessors/UniformArrayNode.js +2 -2
- package/src/nodes/code/CodeNode.js +4 -4
- package/src/nodes/code/ExpressionNode.js +4 -4
- package/src/nodes/code/FunctionCallNode.js +23 -3
- package/src/nodes/code/ScriptableNode.js +4 -4
- package/src/nodes/code/ScriptableValueNode.js +2 -2
- package/src/nodes/core/AssignNode.js +1 -1
- package/src/nodes/core/AttributeNode.js +1 -1
- package/src/nodes/core/BypassNode.js +1 -1
- package/src/nodes/core/CacheNode.js +1 -1
- package/src/nodes/core/ContextNode.js +1 -1
- package/src/nodes/core/InputNode.js +2 -2
- package/src/nodes/core/Node.js +14 -2
- package/src/nodes/core/NodeBuilder.js +86 -14
- package/src/nodes/core/StackNode.js +5 -5
- package/src/nodes/core/StructNode.js +1 -1
- package/src/nodes/core/StructTypeNode.js +2 -2
- package/src/nodes/core/VarNode.js +2 -8
- package/src/nodes/core/VaryingNode.js +3 -3
- package/src/nodes/display/BlendModes.js +4 -4
- package/src/nodes/display/BumpMapNode.js +1 -1
- package/src/nodes/display/NormalMapNode.js +1 -1
- package/src/nodes/display/PosterizeNode.js +1 -1
- package/src/nodes/display/ScreenNode.js +3 -3
- package/src/nodes/display/ViewportDepthNode.js +2 -2
- package/src/nodes/display/ViewportDepthTextureNode.js +2 -2
- package/src/nodes/display/ViewportSharedTextureNode.js +2 -2
- package/src/nodes/display/ViewportTextureNode.js +4 -4
- package/src/nodes/functions/ShadowMaskModel.js +4 -4
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +6 -6
- package/src/nodes/geometry/RangeNode.js +1 -1
- package/src/nodes/gpgpu/AtomicFunctionNode.js +16 -40
- package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
- package/src/nodes/gpgpu/ComputeNode.js +30 -2
- package/src/nodes/lighting/AnalyticLightNode.js +9 -1
- package/src/nodes/lighting/LightsNode.js +3 -3
- package/src/nodes/lighting/ShadowNode.js +1 -1
- package/src/nodes/math/ConditionalNode.js +20 -3
- package/src/nodes/math/MathNode.js +83 -78
- package/src/nodes/math/OperatorNode.js +171 -82
- package/src/nodes/pmrem/PMREMNode.js +4 -4
- package/src/nodes/pmrem/PMREMUtils.js +2 -2
- package/src/nodes/tsl/TSLBase.js +2 -1
- package/src/nodes/tsl/TSLCore.js +115 -12
- package/src/nodes/utils/ArrayElementNode.js +3 -1
- package/src/nodes/utils/CubeMapNode.js +3 -3
- package/src/nodes/utils/DebugNode.js +70 -0
- package/src/nodes/utils/EquirectUVNode.js +2 -2
- package/src/nodes/utils/JoinNode.js +27 -2
- package/src/nodes/utils/LoopNode.js +58 -28
- package/src/nodes/utils/MaxMipLevelNode.js +1 -1
- package/src/nodes/utils/ReflectorNode.js +2 -2
- package/src/nodes/utils/RemapNode.js +6 -6
- package/src/nodes/utils/RotateNode.js +1 -1
- package/src/nodes/utils/SpriteSheetUVNode.js +3 -3
- package/src/nodes/utils/StorageArrayElementNode.js +1 -1
- package/src/nodes/utils/TriplanarTexturesNode.js +3 -3
- package/src/objects/BatchedMesh.js +4 -4
- package/src/objects/InstancedMesh.js +2 -2
- package/src/objects/LOD.js +1 -1
- package/src/objects/Skeleton.js +1 -1
- package/src/renderers/WebGL3DRenderTarget.js +25 -0
- package/src/renderers/WebGLArrayRenderTarget.js +25 -0
- package/src/renderers/WebGLCubeRenderTarget.js +39 -1
- package/src/renderers/WebGLRenderTarget.js +19 -0
- package/src/renderers/WebGLRenderer.js +617 -79
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Attributes.js +2 -2
- package/src/renderers/common/Backend.js +12 -3
- package/src/renderers/common/Background.js +1 -0
- package/src/renderers/common/Color4.js +1 -1
- package/src/renderers/common/CubeRenderTarget.js +13 -0
- package/src/renderers/common/PostProcessing.js +2 -0
- package/src/renderers/common/QuadMesh.js +2 -0
- package/src/renderers/common/RenderList.js +2 -2
- package/src/renderers/common/RenderObject.js +1 -1
- package/src/renderers/common/RenderObjects.js +2 -2
- package/src/renderers/common/Renderer.js +52 -31
- package/src/renderers/common/XRManager.js +333 -10
- package/src/renderers/common/extras/PMREMGenerator.js +6 -0
- package/src/renderers/common/nodes/NodeBuilderState.js +3 -3
- package/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.js +10 -1
- package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +8 -1
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +5 -1
- package/src/renderers/shaders/ShaderChunk/common.glsl.js +82 -0
- package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +22 -2
- package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +12 -1
- package/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.js +8 -2
- package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +31 -11
- package/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +5 -1
- package/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +2 -1
- package/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.js +12 -1
- package/src/renderers/shaders/ShaderChunk/triplanar_fragment.glsl.js +20 -0
- package/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js +52 -7
- package/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js +25 -6
- package/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js +19 -7
- package/src/renderers/shaders/ShaderChunk.js +2 -0
- package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -0
- package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -0
- package/src/renderers/shaders/UniformsLib.js +6 -5
- package/src/renderers/shaders/UniformsUtils.js +1 -3
- package/src/renderers/webgl/WebGLBackground.js +4 -2
- package/src/renderers/webgl/WebGLMaterials.js +12 -0
- package/src/renderers/webgl/WebGLProgram.js +25 -5
- package/src/renderers/webgl/WebGLPrograms.js +21 -7
- package/src/renderers/webgl/WebGLState.js +9 -9
- package/src/renderers/webgl-fallback/WebGLBackend.js +25 -26
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +3 -12
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +67 -19
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +1 -1
- package/src/renderers/webgpu/WebGPUBackend.js +128 -87
- package/src/renderers/webgpu/WebGPURenderer.Nodes.js +1 -11
- package/src/renderers/webgpu/WebGPURenderer.js +17 -11
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +4 -4
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +5 -3
- package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +1 -1
- package/src/renderers/webxr/WebXRController.js +87 -2
- package/src/renderers/webxr/WebXRDepthSensing.js +49 -0
- package/src/renderers/webxr/WebXRManager.js +173 -1
- package/src/scenes/Scene.js +2 -1
- package/src/textures/CanvasTexture.js +28 -0
- package/src/textures/CompressedArrayTexture.js +57 -0
- package/src/textures/CompressedCubeTexture.js +29 -0
- package/src/textures/CompressedTexture.js +64 -6
- package/src/textures/CubeTexture.js +52 -4
- package/src/textures/Data3DTexture.js +77 -0
- package/src/textures/DataArrayTexture.js +93 -0
- package/src/textures/DataTexture.js +65 -0
- package/src/textures/DepthTexture.js +59 -9
- package/src/textures/FramebufferTexture.js +62 -0
- package/src/textures/Source.js +69 -0
- package/src/textures/Texture.js +5 -5
- package/src/textures/VideoFrameTexture.js +43 -6
- package/src/textures/VideoTexture.js +49 -4
- package/examples/jsm/geometries/ParametricGeometries.js +0 -254
|
@@ -5,13 +5,40 @@ import {
|
|
|
5
5
|
LineBasicMaterial
|
|
6
6
|
} from 'three';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A helper for visualizing an Octree.
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* const helper = new OctreeHelper( octree );
|
|
13
|
+
* scene.add( helper );
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @augments LineSegments
|
|
17
|
+
*/
|
|
8
18
|
class OctreeHelper extends LineSegments {
|
|
9
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Constructs a new Octree helper.
|
|
22
|
+
*
|
|
23
|
+
* @param {Octree} octree - The octree to visualize.
|
|
24
|
+
* @param {number|Color|string} [color=0xffff00] - The helper's color.
|
|
25
|
+
*/
|
|
10
26
|
constructor( octree, color = 0xffff00 ) {
|
|
11
27
|
|
|
12
28
|
super( new BufferGeometry(), new LineBasicMaterial( { color: color, toneMapped: false } ) );
|
|
13
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The octree to visualize.
|
|
32
|
+
*
|
|
33
|
+
* @type {Octree}
|
|
34
|
+
*/
|
|
14
35
|
this.octree = octree;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The helper's color.
|
|
39
|
+
*
|
|
40
|
+
* @type {number|Color|string}
|
|
41
|
+
*/
|
|
15
42
|
this.color = color;
|
|
16
43
|
|
|
17
44
|
this.type = 'OctreeHelper';
|
|
@@ -20,6 +47,10 @@ class OctreeHelper extends LineSegments {
|
|
|
20
47
|
|
|
21
48
|
}
|
|
22
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Updates the helper. This method must be called whenever the Octree's
|
|
52
|
+
* structure is changed.
|
|
53
|
+
*/
|
|
23
54
|
update() {
|
|
24
55
|
|
|
25
56
|
const vertices = [];
|
|
@@ -61,6 +92,10 @@ class OctreeHelper extends LineSegments {
|
|
|
61
92
|
|
|
62
93
|
}
|
|
63
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
97
|
+
* method whenever this instance is no longer used in your app.
|
|
98
|
+
*/
|
|
64
99
|
dispose() {
|
|
65
100
|
|
|
66
101
|
this.geometry.dispose();
|
|
@@ -6,8 +6,32 @@ import {
|
|
|
6
6
|
MathUtils
|
|
7
7
|
} from 'three';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* This helper displays the directional cone of a positional audio.
|
|
11
|
+
*
|
|
12
|
+
* `PositionalAudioHelper` must be added as a child of the positional audio.
|
|
13
|
+
*
|
|
14
|
+
* ```js
|
|
15
|
+
* const positionalAudio = new THREE.PositionalAudio( listener );
|
|
16
|
+
* positionalAudio.setDirectionalCone( 180, 230, 0.1 );
|
|
17
|
+
* scene.add( positionalAudio );
|
|
18
|
+
*
|
|
19
|
+
* const helper = new PositionalAudioHelper( positionalAudio );
|
|
20
|
+
* positionalAudio.add( helper );
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @augments Line
|
|
24
|
+
*/
|
|
9
25
|
class PositionalAudioHelper extends Line {
|
|
10
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Constructs a new positional audio helper.
|
|
29
|
+
*
|
|
30
|
+
* @param {PositionalAudio} audio - The audio to visualize.
|
|
31
|
+
* @param {number} [range=1] - The range of the directional cone.
|
|
32
|
+
* @param {number} [divisionsInnerAngle=16] - The number of divisions of the inner part of the directional cone.
|
|
33
|
+
* @param {number} [divisionsOuterAngle=2] The number of divisions of the outer part of the directional cone.
|
|
34
|
+
*/
|
|
11
35
|
constructor( audio, range = 1, divisionsInnerAngle = 16, divisionsOuterAngle = 2 ) {
|
|
12
36
|
|
|
13
37
|
const geometry = new BufferGeometry();
|
|
@@ -20,16 +44,47 @@ class PositionalAudioHelper extends Line {
|
|
|
20
44
|
|
|
21
45
|
super( geometry, [ materialOuterAngle, materialInnerAngle ] );
|
|
22
46
|
|
|
47
|
+
/**
|
|
48
|
+
* The audio to visualize.
|
|
49
|
+
*
|
|
50
|
+
* @type {PositionalAudio}
|
|
51
|
+
*/
|
|
23
52
|
this.audio = audio;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The range of the directional cone.
|
|
56
|
+
*
|
|
57
|
+
* @type {number}
|
|
58
|
+
* @default 1
|
|
59
|
+
*/
|
|
24
60
|
this.range = range;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The number of divisions of the inner part of the directional cone.
|
|
64
|
+
*
|
|
65
|
+
* @type {number}
|
|
66
|
+
* @default 16
|
|
67
|
+
*/
|
|
25
68
|
this.divisionsInnerAngle = divisionsInnerAngle;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The number of divisions of the outer part of the directional cone.
|
|
72
|
+
*
|
|
73
|
+
* @type {number}
|
|
74
|
+
* @default 2
|
|
75
|
+
*/
|
|
26
76
|
this.divisionsOuterAngle = divisionsOuterAngle;
|
|
77
|
+
|
|
27
78
|
this.type = 'PositionalAudioHelper';
|
|
28
79
|
|
|
29
80
|
this.update();
|
|
30
81
|
|
|
31
82
|
}
|
|
32
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Updates the helper. This method must be called whenever the directional cone
|
|
86
|
+
* of the positional audio is changed.
|
|
87
|
+
*/
|
|
33
88
|
update() {
|
|
34
89
|
|
|
35
90
|
const audio = this.audio;
|
|
@@ -95,6 +150,10 @@ class PositionalAudioHelper extends Line {
|
|
|
95
150
|
|
|
96
151
|
}
|
|
97
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
155
|
+
* method whenever this instance is no longer used in your app.
|
|
156
|
+
*/
|
|
98
157
|
dispose() {
|
|
99
158
|
|
|
100
159
|
this.geometry.dispose();
|
|
@@ -9,11 +9,27 @@ import {
|
|
|
9
9
|
} from 'three';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Creates a visual aid for rect area lights.
|
|
13
|
+
*
|
|
14
|
+
* `RectAreaLightHelper` must be added as a child of the light.
|
|
15
|
+
*
|
|
16
|
+
* ```js
|
|
17
|
+
* const light = new THREE.RectAreaLight( 0xffffbb, 1.0, 5, 5 );
|
|
18
|
+
* const helper = new RectAreaLightHelper( light );
|
|
19
|
+
* light.add( helper );
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @augments Line
|
|
13
23
|
*/
|
|
14
|
-
|
|
15
24
|
class RectAreaLightHelper extends Line {
|
|
16
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Constructs a new rect area light helper.
|
|
28
|
+
*
|
|
29
|
+
* @param {RectAreaLight} light - The light to visualize.
|
|
30
|
+
* @param {number|Color|string} [color] - The helper's color.
|
|
31
|
+
* If this is not the set, the helper will take the color of the light.
|
|
32
|
+
*/
|
|
17
33
|
constructor( light, color ) {
|
|
18
34
|
|
|
19
35
|
const positions = [ 1, 1, 0, - 1, 1, 0, - 1, - 1, 0, 1, - 1, 0, 1, 1, 0 ];
|
|
@@ -26,8 +42,20 @@ class RectAreaLightHelper extends Line {
|
|
|
26
42
|
|
|
27
43
|
super( geometry, material );
|
|
28
44
|
|
|
45
|
+
/**
|
|
46
|
+
* The light to visualize.
|
|
47
|
+
*
|
|
48
|
+
* @type {RectAreaLight}
|
|
49
|
+
*/
|
|
29
50
|
this.light = light;
|
|
30
|
-
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The helper's color. If `undefined`, the helper will take the color of the light.
|
|
54
|
+
*
|
|
55
|
+
* @type {number|Color|string|undefined}
|
|
56
|
+
*/
|
|
57
|
+
this.color = color;
|
|
58
|
+
|
|
31
59
|
this.type = 'RectAreaLightHelper';
|
|
32
60
|
|
|
33
61
|
//
|
|
@@ -71,6 +99,10 @@ class RectAreaLightHelper extends Line {
|
|
|
71
99
|
|
|
72
100
|
}
|
|
73
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
104
|
+
* method whenever this instance is no longer used in your app.
|
|
105
|
+
*/
|
|
74
106
|
dispose() {
|
|
75
107
|
|
|
76
108
|
this.geometry.dispose();
|
|
@@ -9,8 +9,26 @@ import {
|
|
|
9
9
|
} from 'three';
|
|
10
10
|
import { mergeGeometries } from '../utils/BufferGeometryUtils.js';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* A helper that can be used to display any type of texture for
|
|
14
|
+
* debugging purposes. Depending on the type of texture (2D, 3D, Array),
|
|
15
|
+
* the helper becomes a plane or box mesh.
|
|
16
|
+
*
|
|
17
|
+
* This helper can only be used with {@link WebGLRenderer}.
|
|
18
|
+
* When using {@link WebGPURenderer}, import from `TextureHelperGPU.js`.
|
|
19
|
+
*
|
|
20
|
+
* @augments Mesh
|
|
21
|
+
*/
|
|
12
22
|
class TextureHelper extends Mesh {
|
|
13
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Constructs a new texture helper.
|
|
26
|
+
*
|
|
27
|
+
* @param {Texture} texture - The texture to visualize.
|
|
28
|
+
* @param {number} [width=1] - The helper's width.
|
|
29
|
+
* @param {number} [height=1] - The helper's height.
|
|
30
|
+
* @param {number} [depth=1] - The helper's depth.
|
|
31
|
+
*/
|
|
14
32
|
constructor( texture, width = 1, height = 1, depth = 1 ) {
|
|
15
33
|
|
|
16
34
|
const material = new ShaderMaterial( {
|
|
@@ -81,11 +99,20 @@ class TextureHelper extends Mesh {
|
|
|
81
99
|
|
|
82
100
|
super( geometry, material );
|
|
83
101
|
|
|
102
|
+
/**
|
|
103
|
+
* The texture to visualize.
|
|
104
|
+
*
|
|
105
|
+
* @type {Texture}
|
|
106
|
+
*/
|
|
84
107
|
this.texture = texture;
|
|
85
108
|
this.type = 'TextureHelper';
|
|
86
109
|
|
|
87
110
|
}
|
|
88
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
114
|
+
* method whenever this instance is no longer used in your app.
|
|
115
|
+
*/
|
|
89
116
|
dispose() {
|
|
90
117
|
|
|
91
118
|
this.geometry.dispose();
|
|
@@ -10,8 +10,27 @@ import {
|
|
|
10
10
|
import { texture as textureNode, cubeTexture, texture3D, float, vec4, attribute } from 'three/tsl';
|
|
11
11
|
import { mergeGeometries } from '../utils/BufferGeometryUtils.js';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* A helper that can be used to display any type of texture for
|
|
15
|
+
* debugging purposes. Depending on the type of texture (2D, 3D, Array),
|
|
16
|
+
* the helper becomes a plane or box mesh.
|
|
17
|
+
*
|
|
18
|
+
* This helper can only be used with {@link WebGPURenderer}.
|
|
19
|
+
* When using {@link WebGLRenderer}, import from `TextureHelper.js`.
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
* @augments Mesh
|
|
23
|
+
*/
|
|
13
24
|
class TextureHelper extends Mesh {
|
|
14
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Constructs a new texture helper.
|
|
28
|
+
*
|
|
29
|
+
* @param {Texture} texture - The texture to visualize.
|
|
30
|
+
* @param {number} [width=1] - The helper's width.
|
|
31
|
+
* @param {number} [height=1] - The helper's height.
|
|
32
|
+
* @param {number} [depth=1] - The helper's depth.
|
|
33
|
+
*/
|
|
15
34
|
constructor( texture, width = 1, height = 1, depth = 1 ) {
|
|
16
35
|
|
|
17
36
|
const material = new NodeMaterial();
|
|
@@ -51,11 +70,20 @@ class TextureHelper extends Mesh {
|
|
|
51
70
|
|
|
52
71
|
super( geometry, material );
|
|
53
72
|
|
|
73
|
+
/**
|
|
74
|
+
* The texture to visualize.
|
|
75
|
+
*
|
|
76
|
+
* @type {Texture}
|
|
77
|
+
*/
|
|
54
78
|
this.texture = texture;
|
|
55
79
|
this.type = 'TextureHelper';
|
|
56
80
|
|
|
57
81
|
}
|
|
58
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
85
|
+
* method whenever this instance is no longer used in your app.
|
|
86
|
+
*/
|
|
59
87
|
dispose() {
|
|
60
88
|
|
|
61
89
|
this.geometry.dispose();
|
|
@@ -11,8 +11,32 @@ const _v1 = new Vector3();
|
|
|
11
11
|
const _v2 = new Vector3();
|
|
12
12
|
const _normalMatrix = new Matrix3();
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Visualizes an object's vertex normals.
|
|
16
|
+
*
|
|
17
|
+
* Requires that normals have been specified in the geometry as a buffer attribute or
|
|
18
|
+
* have been calculated using {@link BufferGeometry#computeVertexNormals}.
|
|
19
|
+
* ```js
|
|
20
|
+
* const geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 );
|
|
21
|
+
* const material = new THREE.MeshStandardMaterial();
|
|
22
|
+
* const mesh = new THREE.Mesh( geometry, material );
|
|
23
|
+
* scene.add( mesh );
|
|
24
|
+
*
|
|
25
|
+
* const helper = new VertexNormalsHelper( mesh, 1, 0xff0000 );
|
|
26
|
+
* scene.add( helper );
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @augments LineSegments
|
|
30
|
+
*/
|
|
14
31
|
class VertexNormalsHelper extends LineSegments {
|
|
15
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Constructs a new vertex normals helper.
|
|
35
|
+
*
|
|
36
|
+
* @param {Object3D} object - The object for which to visualize vertex normals.
|
|
37
|
+
* @param {number} [size=1] - The helper's size.
|
|
38
|
+
* @param {number|Color|string} [color=0xff0000] - The helper's color.
|
|
39
|
+
*/
|
|
16
40
|
constructor( object, size = 1, color = 0xff0000 ) {
|
|
17
41
|
|
|
18
42
|
const geometry = new BufferGeometry();
|
|
@@ -24,20 +48,48 @@ class VertexNormalsHelper extends LineSegments {
|
|
|
24
48
|
|
|
25
49
|
super( geometry, new LineBasicMaterial( { color, toneMapped: false } ) );
|
|
26
50
|
|
|
51
|
+
/**
|
|
52
|
+
* The object for which to visualize vertex normals.
|
|
53
|
+
*
|
|
54
|
+
* @type {Object3D}
|
|
55
|
+
*/
|
|
27
56
|
this.object = object;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The helper's size.
|
|
60
|
+
*
|
|
61
|
+
* @type {number}
|
|
62
|
+
* @default 1
|
|
63
|
+
*/
|
|
28
64
|
this.size = size;
|
|
29
|
-
this.type = 'VertexNormalsHelper';
|
|
30
65
|
|
|
31
|
-
|
|
66
|
+
this.type = 'VertexNormalsHelper';
|
|
32
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Overwritten and set to `false` since the object's world transformation
|
|
70
|
+
* is encoded in the helper's geometry data.
|
|
71
|
+
*
|
|
72
|
+
* @type {boolean}
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
33
75
|
this.matrixAutoUpdate = false;
|
|
34
76
|
|
|
77
|
+
/**
|
|
78
|
+
* This flag can be used for type testing.
|
|
79
|
+
*
|
|
80
|
+
* @type {boolean}
|
|
81
|
+
* @readonly
|
|
82
|
+
* @default true
|
|
83
|
+
*/
|
|
35
84
|
this.isVertexNormalsHelper = true;
|
|
36
85
|
|
|
37
86
|
this.update();
|
|
38
87
|
|
|
39
88
|
}
|
|
40
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Updates the vertex normals preview based on the object's world transform.
|
|
92
|
+
*/
|
|
41
93
|
update() {
|
|
42
94
|
|
|
43
95
|
this.object.updateMatrixWorld( true );
|
|
@@ -86,6 +138,10 @@ class VertexNormalsHelper extends LineSegments {
|
|
|
86
138
|
|
|
87
139
|
}
|
|
88
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
143
|
+
* method whenever this instance is no longer used in your app.
|
|
144
|
+
*/
|
|
89
145
|
dispose() {
|
|
90
146
|
|
|
91
147
|
this.geometry.dispose();
|
|
@@ -9,8 +9,27 @@ import {
|
|
|
9
9
|
const _v1 = new Vector3();
|
|
10
10
|
const _v2 = new Vector3();
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Visualizes an object's vertex tangents.
|
|
14
|
+
*
|
|
15
|
+
* Requires that tangents have been specified in the geometry as a buffer attribute or
|
|
16
|
+
* have been calculated using {@link BufferGeometry#computeTangents}.
|
|
17
|
+
* ```js
|
|
18
|
+
* const helper = new VertexTangentsHelper( mesh, 1, 0xff0000 );
|
|
19
|
+
* scene.add( helper );
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @augments LineSegments
|
|
23
|
+
*/
|
|
12
24
|
class VertexTangentsHelper extends LineSegments {
|
|
13
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Constructs a new vertex tangents helper.
|
|
28
|
+
*
|
|
29
|
+
* @param {Object3D} object - The object for which to visualize vertex tangents.
|
|
30
|
+
* @param {number} [size=1] - The helper's size.
|
|
31
|
+
* @param {number|Color|string} [color=0xff0000] - The helper's color.
|
|
32
|
+
*/
|
|
14
33
|
constructor( object, size = 1, color = 0x00ffff ) {
|
|
15
34
|
|
|
16
35
|
const geometry = new BufferGeometry();
|
|
@@ -22,18 +41,39 @@ class VertexTangentsHelper extends LineSegments {
|
|
|
22
41
|
|
|
23
42
|
super( geometry, new LineBasicMaterial( { color, toneMapped: false } ) );
|
|
24
43
|
|
|
44
|
+
/**
|
|
45
|
+
* The object for which to visualize vertex tangents.
|
|
46
|
+
*
|
|
47
|
+
* @type {Object3D}
|
|
48
|
+
*/
|
|
25
49
|
this.object = object;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The helper's size.
|
|
53
|
+
*
|
|
54
|
+
* @type {number}
|
|
55
|
+
* @default 1
|
|
56
|
+
*/
|
|
26
57
|
this.size = size;
|
|
27
|
-
this.type = 'VertexTangentsHelper';
|
|
28
58
|
|
|
29
|
-
|
|
59
|
+
this.type = 'VertexTangentsHelper';
|
|
30
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Overwritten and set to `false` since the object's world transformation
|
|
63
|
+
* is encoded in the helper's geometry data.
|
|
64
|
+
*
|
|
65
|
+
* @type {boolean}
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
31
68
|
this.matrixAutoUpdate = false;
|
|
32
69
|
|
|
33
70
|
this.update();
|
|
34
71
|
|
|
35
72
|
}
|
|
36
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Updates the vertex normals preview based on the object's world transform.
|
|
76
|
+
*/
|
|
37
77
|
update() {
|
|
38
78
|
|
|
39
79
|
this.object.updateMatrixWorld( true );
|
|
@@ -76,6 +116,10 @@ class VertexTangentsHelper extends LineSegments {
|
|
|
76
116
|
|
|
77
117
|
}
|
|
78
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
121
|
+
* method whenever this instance is no longer used in your app.
|
|
122
|
+
*/
|
|
79
123
|
dispose() {
|
|
80
124
|
|
|
81
125
|
this.geometry.dispose();
|
|
@@ -17,15 +17,51 @@ import {
|
|
|
17
17
|
Vector4
|
|
18
18
|
} from 'three';
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* A special type of helper that visualizes the camera's transformation
|
|
22
|
+
* in a small viewport area as an axes helper. Such a helper is often wanted
|
|
23
|
+
* in 3D modeling tools or scene editors like the [three.js editor]{@link https://threejs.org/editor}.
|
|
24
|
+
*
|
|
25
|
+
* The helper allows to click on the X, Y and Z axes which animates the camera
|
|
26
|
+
* so it looks along the selected axis.
|
|
27
|
+
*
|
|
28
|
+
* @augments Object3D
|
|
29
|
+
*/
|
|
20
30
|
class ViewHelper extends Object3D {
|
|
21
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Constructs a new view helper.
|
|
34
|
+
*
|
|
35
|
+
* @param {Camera} camera - The camera whose transformation should be visualized.
|
|
36
|
+
* @param {HTMLDOMElement} [domElement] - The DOM element that is used to render the view.
|
|
37
|
+
*/
|
|
22
38
|
constructor( camera, domElement ) {
|
|
23
39
|
|
|
24
40
|
super();
|
|
25
41
|
|
|
42
|
+
/**
|
|
43
|
+
* This flag can be used for type testing.
|
|
44
|
+
*
|
|
45
|
+
* @type {boolean}
|
|
46
|
+
* @readonly
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
26
49
|
this.isViewHelper = true;
|
|
27
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Whether the helper is currently animating or not.
|
|
53
|
+
*
|
|
54
|
+
* @type {boolean}
|
|
55
|
+
* @readonly
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
28
58
|
this.animating = false;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The helper's center point.
|
|
62
|
+
*
|
|
63
|
+
* @type {Vector3}
|
|
64
|
+
*/
|
|
29
65
|
this.center = new Vector3();
|
|
30
66
|
|
|
31
67
|
const color1 = new Color( '#ff4466' );
|
|
@@ -104,6 +140,12 @@ class ViewHelper extends Object3D {
|
|
|
104
140
|
const dim = 128;
|
|
105
141
|
const turnRate = 2 * Math.PI; // turn rate in angles per second
|
|
106
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Renders the helper in a separate view in the bottom-right corner
|
|
145
|
+
* of the viewport.
|
|
146
|
+
*
|
|
147
|
+
* @param {WebGLRenderer|WebGPURenderer} renderer - The renderer.
|
|
148
|
+
*/
|
|
107
149
|
this.render = function ( renderer ) {
|
|
108
150
|
|
|
109
151
|
this.quaternion.copy( camera.quaternion ).invert();
|
|
@@ -115,11 +157,12 @@ class ViewHelper extends Object3D {
|
|
|
115
157
|
//
|
|
116
158
|
|
|
117
159
|
const x = domElement.offsetWidth - dim;
|
|
160
|
+
const y = renderer.isWebGPURenderer ? domElement.offsetHeight - dim : 0;
|
|
118
161
|
|
|
119
162
|
renderer.clearDepth();
|
|
120
163
|
|
|
121
164
|
renderer.getViewport( viewport );
|
|
122
|
-
renderer.setViewport( x,
|
|
165
|
+
renderer.setViewport( x, y, dim, dim );
|
|
123
166
|
|
|
124
167
|
renderer.render( this, orthoCamera );
|
|
125
168
|
|
|
@@ -135,6 +178,13 @@ class ViewHelper extends Object3D {
|
|
|
135
178
|
const viewport = new Vector4();
|
|
136
179
|
let radius = 0;
|
|
137
180
|
|
|
181
|
+
/**
|
|
182
|
+
* This method should be called when a click or pointer event
|
|
183
|
+
* has happened in the app.
|
|
184
|
+
*
|
|
185
|
+
* @param {PointerEvent} event - The event to process.
|
|
186
|
+
* @return {boolean} Whether an intersection with the helper has been detected or not.
|
|
187
|
+
*/
|
|
138
188
|
this.handleClick = function ( event ) {
|
|
139
189
|
|
|
140
190
|
if ( this.animating === true ) return false;
|
|
@@ -168,6 +218,13 @@ class ViewHelper extends Object3D {
|
|
|
168
218
|
|
|
169
219
|
};
|
|
170
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Sets labels for each axis. By default, they are unlabeled.
|
|
223
|
+
*
|
|
224
|
+
* @param {string|undefined} labelX - The label for the x-axis.
|
|
225
|
+
* @param {string|undefined} labelY - The label for the y-axis.
|
|
226
|
+
* @param {string|undefined} labelZ - The label for the z-axis.
|
|
227
|
+
*/
|
|
171
228
|
this.setLabels = function ( labelX, labelY, labelZ ) {
|
|
172
229
|
|
|
173
230
|
options.labelX = labelX;
|
|
@@ -178,6 +235,13 @@ class ViewHelper extends Object3D {
|
|
|
178
235
|
|
|
179
236
|
};
|
|
180
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Sets the label style. Has no effect when the axes are unlabeled.
|
|
240
|
+
*
|
|
241
|
+
* @param {string} [font='24px Arial'] - The label font.
|
|
242
|
+
* @param {string} [color='#000000'] - The label color.
|
|
243
|
+
* @param {number} [radius=14] - The label radius.
|
|
244
|
+
*/
|
|
181
245
|
this.setLabelStyle = function ( font, color, radius ) {
|
|
182
246
|
|
|
183
247
|
options.font = font;
|
|
@@ -188,6 +252,12 @@ class ViewHelper extends Object3D {
|
|
|
188
252
|
|
|
189
253
|
};
|
|
190
254
|
|
|
255
|
+
/**
|
|
256
|
+
* Updates the helper. This method should be called in the app's animation
|
|
257
|
+
* loop.
|
|
258
|
+
*
|
|
259
|
+
* @param {number} delta - The delta time in seconds.
|
|
260
|
+
*/
|
|
191
261
|
this.update = function ( delta ) {
|
|
192
262
|
|
|
193
263
|
const step = delta * turnRate;
|
|
@@ -209,6 +279,10 @@ class ViewHelper extends Object3D {
|
|
|
209
279
|
|
|
210
280
|
};
|
|
211
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Frees the GPU-related resources allocated by this instance. Call this
|
|
284
|
+
* method whenever this instance is no longer used in your app.
|
|
285
|
+
*/
|
|
212
286
|
this.dispose = function () {
|
|
213
287
|
|
|
214
288
|
geometry.dispose();
|
|
@@ -8,8 +8,29 @@ import {
|
|
|
8
8
|
Color
|
|
9
9
|
} from 'three';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* This class can be used to render a DOM element onto a canvas and use it as a texture
|
|
13
|
+
* for a plane mesh.
|
|
14
|
+
*
|
|
15
|
+
* A typical use case for this class is to render the GUI of `lil-gui` as a texture so it
|
|
16
|
+
* is compatible for VR.
|
|
17
|
+
*
|
|
18
|
+
* ```js
|
|
19
|
+
* const gui = new GUI( { width: 300 } ); // create lil-gui instance
|
|
20
|
+
*
|
|
21
|
+
* const mesh = new HTMLMesh( gui.domElement );
|
|
22
|
+
* scene.add( mesh );
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @augments Mesh
|
|
26
|
+
*/
|
|
11
27
|
class HTMLMesh extends Mesh {
|
|
12
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Constructs a new HTML mesh.
|
|
31
|
+
*
|
|
32
|
+
* @param {HTMLElement} dom - The DOM element to display as a plane mesh.
|
|
33
|
+
*/
|
|
13
34
|
constructor( dom ) {
|
|
14
35
|
|
|
15
36
|
const texture = new HTMLTexture( dom );
|
|
@@ -30,6 +51,10 @@ class HTMLMesh extends Mesh {
|
|
|
30
51
|
this.addEventListener( 'mouseup', onEvent );
|
|
31
52
|
this.addEventListener( 'click', onEvent );
|
|
32
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Frees the GPU-related resources allocated by this instance and removes all event listeners.
|
|
56
|
+
* Call this method whenever this instance is no longer used in your app.
|
|
57
|
+
*/
|
|
33
58
|
this.dispose = function () {
|
|
34
59
|
|
|
35
60
|
geometry.dispose();
|