@plastic-software/three 0.175.14 → 0.179.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/build/three.cjs +8402 -6787
- package/build/three.core.js +8007 -6688
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +397 -102
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +84 -27
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +6831 -2838
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +6648 -2838
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +1 -3
- package/examples/jsm/animation/AnimationClipCreator.js +1 -0
- package/examples/jsm/animation/CCDIKSolver.js +6 -3
- package/examples/jsm/capabilities/WebGL.js +1 -27
- package/examples/jsm/capabilities/WebGPU.js +2 -1
- package/examples/jsm/controls/ArcballControls.js +15 -4
- package/examples/jsm/controls/DragControls.js +1 -0
- package/examples/jsm/controls/FirstPersonControls.js +1 -0
- package/examples/jsm/controls/FlyControls.js +1 -0
- package/examples/jsm/controls/MapControls.js +1 -0
- package/examples/jsm/controls/OrbitControls.js +1 -0
- package/examples/jsm/controls/PointerLockControls.js +5 -3
- package/examples/jsm/controls/TrackballControls.js +1 -0
- package/examples/jsm/controls/TransformControls.js +62 -14
- package/examples/jsm/csm/CSM.js +2 -0
- package/examples/jsm/csm/CSMFrustum.js +2 -0
- package/examples/jsm/csm/CSMHelper.js +1 -0
- package/examples/jsm/csm/CSMShader.js +4 -1
- package/examples/jsm/csm/CSMShadowNode.js +22 -8
- package/examples/jsm/curves/CurveExtras.js +14 -0
- package/examples/jsm/curves/NURBSCurve.js +1 -0
- package/examples/jsm/curves/NURBSSurface.js +2 -0
- package/examples/jsm/curves/NURBSUtils.js +4 -1
- package/examples/jsm/curves/NURBSVolume.js +2 -0
- package/examples/jsm/effects/AnaglyphEffect.js +2 -0
- package/examples/jsm/effects/AsciiEffect.js +2 -0
- package/examples/jsm/effects/OutlineEffect.js +2 -0
- package/examples/jsm/effects/ParallaxBarrierEffect.js +2 -0
- package/examples/jsm/effects/StereoEffect.js +2 -0
- package/examples/jsm/environments/DebugEnvironment.js +1 -0
- package/examples/jsm/environments/RoomEnvironment.js +57 -38
- package/examples/jsm/exporters/DRACOExporter.js +4 -2
- package/examples/jsm/exporters/EXRExporter.js +2 -0
- package/examples/jsm/exporters/GLTFExporter.js +7 -4
- package/examples/jsm/exporters/KTX2Exporter.js +2 -0
- package/examples/jsm/exporters/OBJExporter.js +3 -1
- package/examples/jsm/exporters/PLYExporter.js +4 -2
- package/examples/jsm/exporters/STLExporter.js +2 -0
- package/examples/jsm/exporters/USDZExporter.js +679 -300
- package/examples/jsm/geometries/BoxLineGeometry.js +1 -0
- package/examples/jsm/geometries/ConvexGeometry.js +1 -0
- package/examples/jsm/geometries/DecalGeometry.js +1 -0
- package/examples/jsm/geometries/ParametricFunctions.js +4 -1
- package/examples/jsm/geometries/ParametricGeometry.js +1 -0
- package/examples/jsm/geometries/RoundedBoxGeometry.js +48 -8
- package/examples/jsm/geometries/TeapotGeometry.js +1 -0
- package/examples/jsm/geometries/TextGeometry.js +1 -0
- package/examples/jsm/helpers/LightProbeHelper.js +1 -0
- package/examples/jsm/helpers/LightProbeHelperGPU.js +1 -0
- package/examples/jsm/helpers/OctreeHelper.js +1 -0
- package/examples/jsm/helpers/PositionalAudioHelper.js +1 -0
- package/examples/jsm/helpers/RapierHelper.js +59 -0
- package/examples/jsm/helpers/RectAreaLightHelper.js +1 -0
- package/examples/jsm/helpers/TextureHelper.js +1 -0
- package/examples/jsm/helpers/TextureHelperGPU.js +5 -4
- package/examples/jsm/helpers/VertexNormalsHelper.js +1 -0
- package/examples/jsm/helpers/VertexTangentsHelper.js +1 -0
- package/examples/jsm/helpers/ViewHelper.js +1 -0
- package/examples/jsm/interactive/HTMLMesh.js +11 -2
- package/examples/jsm/interactive/InteractiveGroup.js +1 -0
- package/examples/jsm/interactive/SelectionBox.js +2 -0
- package/examples/jsm/interactive/SelectionHelper.js +2 -0
- package/examples/jsm/libs/meshopt_decoder.module.js +75 -58
- package/examples/jsm/lighting/TiledLighting.js +1 -0
- package/examples/jsm/lights/LightProbeGenerator.js +15 -3
- package/examples/jsm/lights/RectAreaLightTexturesLib.js +1 -0
- package/examples/jsm/lights/RectAreaLightUniformsLib.js +1 -0
- package/examples/jsm/lines/Line2.js +1 -0
- package/examples/jsm/lines/LineGeometry.js +1 -0
- package/examples/jsm/lines/LineMaterial.js +4 -4
- package/examples/jsm/lines/LineSegments2.js +1 -0
- package/examples/jsm/lines/LineSegmentsGeometry.js +1 -0
- package/examples/jsm/lines/Wireframe.js +1 -0
- package/examples/jsm/lines/WireframeGeometry2.js +1 -0
- package/examples/jsm/lines/webgpu/Line2.js +1 -0
- package/examples/jsm/lines/webgpu/LineSegments2.js +3 -1
- package/examples/jsm/lines/webgpu/Wireframe.js +1 -0
- package/examples/jsm/loaders/3DMLoader.js +1 -0
- package/examples/jsm/loaders/3MFLoader.js +1 -0
- package/examples/jsm/loaders/AMFLoader.js +1 -0
- package/examples/jsm/loaders/BVHLoader.js +1 -0
- package/examples/jsm/loaders/ColladaLoader.js +6 -5
- package/examples/jsm/loaders/DDSLoader.js +1 -0
- package/examples/jsm/loaders/DRACOLoader.js +2 -1
- package/examples/jsm/loaders/EXRLoader.js +211 -22
- package/examples/jsm/loaders/FBXLoader.js +25 -23
- package/examples/jsm/loaders/FontLoader.js +1 -0
- package/examples/jsm/loaders/GCodeLoader.js +1 -0
- package/examples/jsm/loaders/GLTFLoader.js +10 -82
- package/examples/jsm/loaders/HDRCubeTextureLoader.js +1 -0
- package/examples/jsm/loaders/IESLoader.js +1 -0
- package/examples/jsm/loaders/KMZLoader.js +1 -0
- package/examples/jsm/loaders/KTX2Loader.js +67 -26
- package/examples/jsm/loaders/KTXLoader.js +1 -0
- package/examples/jsm/loaders/LDrawLoader.js +55 -3
- package/examples/jsm/loaders/LUT3dlLoader.js +1 -0
- package/examples/jsm/loaders/LUTCubeLoader.js +1 -0
- package/examples/jsm/loaders/LUTImageLoader.js +1 -0
- package/examples/jsm/loaders/LWOLoader.js +1 -13
- package/examples/jsm/loaders/LottieLoader.js +15 -0
- package/examples/jsm/loaders/MD2Loader.js +1 -0
- package/examples/jsm/loaders/MDDLoader.js +1 -0
- package/examples/jsm/loaders/MTLLoader.js +4 -3
- package/examples/jsm/loaders/MaterialXLoader.js +213 -30
- package/examples/jsm/loaders/NRRDLoader.js +1 -0
- package/examples/jsm/loaders/OBJLoader.js +1 -0
- package/examples/jsm/loaders/PCDLoader.js +122 -19
- package/examples/jsm/loaders/PDBLoader.js +1 -0
- package/examples/jsm/loaders/PLYLoader.js +1 -0
- package/examples/jsm/loaders/PVRLoader.js +1 -0
- package/examples/jsm/loaders/RGBELoader.js +1 -0
- package/examples/jsm/loaders/RGBMLoader.js +1 -0
- package/examples/jsm/loaders/STLLoader.js +1 -0
- package/examples/jsm/loaders/SVGLoader.js +1 -0
- package/examples/jsm/loaders/TDSLoader.js +1 -0
- package/examples/jsm/loaders/TGALoader.js +1 -0
- package/examples/jsm/loaders/TIFFLoader.js +1 -0
- package/examples/jsm/loaders/TTFLoader.js +14 -1
- package/examples/jsm/loaders/USDLoader.js +219 -0
- package/examples/jsm/loaders/USDZLoader.js +4 -891
- package/examples/jsm/loaders/UltraHDRLoader.js +1 -0
- package/examples/jsm/loaders/VOXLoader.js +1 -0
- package/examples/jsm/loaders/VRMLLoader.js +3 -2
- package/examples/jsm/loaders/VTKLoader.js +1 -0
- package/examples/jsm/loaders/XYZLoader.js +1 -0
- package/examples/jsm/loaders/lwo/IFFParser.js +74 -74
- package/examples/jsm/loaders/usd/USDAParser.js +741 -0
- package/examples/jsm/loaders/usd/USDCParser.js +17 -0
- package/examples/jsm/materials/LDrawConditionalLineMaterial.js +1 -0
- package/examples/jsm/materials/LDrawConditionalLineNodeMaterial.js +1 -0
- package/examples/jsm/materials/MeshPostProcessingMaterial.js +1 -0
- package/examples/jsm/math/Capsule.js +2 -0
- package/examples/jsm/math/ColorConverter.js +1 -0
- package/examples/jsm/math/ConvexHull.js +2 -0
- package/examples/jsm/math/ImprovedNoise.js +19 -14
- package/examples/jsm/math/Lut.js +2 -0
- package/examples/jsm/math/MeshSurfaceSampler.js +2 -0
- package/examples/jsm/math/OBB.js +2 -0
- package/examples/jsm/math/Octree.js +20 -1
- package/examples/jsm/math/SimplexNoise.js +2 -0
- package/examples/jsm/misc/ConvexObjectBreaker.js +3 -1
- package/examples/jsm/misc/GPUComputationRenderer.js +2 -0
- package/examples/jsm/misc/Gyroscope.js +1 -0
- package/examples/jsm/misc/MD2Character.js +2 -0
- package/examples/jsm/misc/MD2CharacterComplex.js +5 -3
- package/examples/jsm/misc/MorphAnimMesh.js +1 -0
- package/examples/jsm/misc/MorphBlendMesh.js +1 -0
- package/examples/jsm/misc/ProgressiveLightMap.js +2 -0
- package/examples/jsm/misc/ProgressiveLightMapGPU.js +2 -0
- package/examples/jsm/misc/RollerCoaster.js +5 -0
- package/examples/jsm/misc/TubePainter.js +1 -0
- package/examples/jsm/misc/Volume.js +2 -0
- package/examples/jsm/misc/VolumeSlice.js +1 -0
- package/examples/jsm/modifiers/CurveModifier.js +3 -0
- package/examples/jsm/modifiers/CurveModifierGPU.js +2 -0
- package/examples/jsm/modifiers/EdgeSplitModifier.js +2 -0
- package/examples/jsm/modifiers/SimplifyModifier.js +2 -0
- package/examples/jsm/modifiers/TessellateModifier.js +2 -0
- package/examples/jsm/objects/GroundedSkybox.js +1 -0
- package/examples/jsm/objects/Lensflare.js +3 -0
- package/examples/jsm/objects/LensflareMesh.js +4 -3
- package/examples/jsm/objects/MarchingCubes.js +2 -0
- package/examples/jsm/objects/Reflector.js +1 -0
- package/examples/jsm/objects/ReflectorForSSRPass.js +1 -0
- package/examples/jsm/objects/Refractor.js +1 -0
- package/examples/jsm/objects/ShadowMesh.js +1 -0
- package/examples/jsm/objects/Sky.js +2 -1
- package/examples/jsm/objects/SkyMesh.js +22 -19
- package/examples/jsm/objects/Water.js +1 -0
- package/examples/jsm/objects/Water2.js +1 -0
- package/examples/jsm/objects/Water2Mesh.js +3 -1
- package/examples/jsm/objects/WaterMesh.js +2 -1
- package/examples/jsm/physics/AmmoPhysics.js +1 -0
- package/examples/jsm/physics/JoltPhysics.js +1 -0
- package/examples/jsm/physics/RapierPhysics.js +149 -13
- package/examples/jsm/postprocessing/AfterimagePass.js +20 -2
- package/examples/jsm/postprocessing/BloomPass.js +2 -1
- package/examples/jsm/postprocessing/BokehPass.js +2 -1
- package/examples/jsm/postprocessing/ClearPass.js +1 -0
- package/examples/jsm/postprocessing/CubeTexturePass.js +1 -0
- package/examples/jsm/postprocessing/DotScreenPass.js +1 -0
- package/examples/jsm/postprocessing/EffectComposer.js +4 -2
- package/examples/jsm/postprocessing/FXAAPass.js +40 -0
- package/examples/jsm/postprocessing/FilmPass.js +1 -0
- package/examples/jsm/postprocessing/GTAOPass.js +14 -12
- package/examples/jsm/postprocessing/GlitchPass.js +2 -1
- package/examples/jsm/postprocessing/HalftonePass.js +2 -1
- package/examples/jsm/postprocessing/LUTPass.js +1 -0
- package/examples/jsm/postprocessing/MaskPass.js +1 -0
- package/examples/jsm/postprocessing/OutlinePass.js +22 -19
- package/examples/jsm/postprocessing/OutputPass.js +1 -0
- package/examples/jsm/postprocessing/Pass.js +3 -1
- package/examples/jsm/postprocessing/RenderPass.js +1 -0
- package/examples/jsm/postprocessing/RenderPixelatedPass.js +2 -1
- package/examples/jsm/postprocessing/RenderTransitionPass.js +4 -3
- package/examples/jsm/postprocessing/SAOPass.js +3 -2
- package/examples/jsm/postprocessing/SMAAPass.js +3 -2
- package/examples/jsm/postprocessing/SSAARenderPass.js +2 -1
- package/examples/jsm/postprocessing/SSAOPass.js +12 -10
- package/examples/jsm/postprocessing/SSRPass.js +4 -3
- package/examples/jsm/postprocessing/SavePass.js +2 -1
- package/examples/jsm/postprocessing/ShaderPass.js +1 -0
- package/examples/jsm/postprocessing/TAARenderPass.js +1 -0
- package/examples/jsm/postprocessing/TexturePass.js +1 -0
- package/examples/jsm/postprocessing/UnrealBloomPass.js +2 -1
- package/examples/jsm/renderers/CSS2DRenderer.js +3 -0
- package/examples/jsm/renderers/CSS3DRenderer.js +4 -0
- package/examples/jsm/renderers/Projector.js +2 -0
- package/examples/jsm/renderers/SVGRenderer.js +3 -0
- package/examples/jsm/shaders/ACESFilmicToneMappingShader.js +4 -1
- package/examples/jsm/shaders/AfterimageShader.js +4 -1
- package/examples/jsm/shaders/BasicShader.js +4 -1
- package/examples/jsm/shaders/BleachBypassShader.js +4 -1
- package/examples/jsm/shaders/BlendShader.js +4 -1
- package/examples/jsm/shaders/BokehShader.js +4 -1
- package/examples/jsm/shaders/BokehShader2.js +4 -1
- package/examples/jsm/shaders/BrightnessContrastShader.js +4 -1
- package/examples/jsm/shaders/ColorCorrectionShader.js +4 -1
- package/examples/jsm/shaders/ColorifyShader.js +4 -1
- package/examples/jsm/shaders/ConvolutionShader.js +4 -1
- package/examples/jsm/shaders/CopyShader.js +4 -1
- package/examples/jsm/shaders/DOFMipMapShader.js +4 -1
- package/examples/jsm/shaders/DepthLimitedBlurShader.js +4 -1
- package/examples/jsm/shaders/DigitalGlitch.js +4 -1
- package/examples/jsm/shaders/DotScreenShader.js +4 -1
- package/examples/jsm/shaders/ExposureShader.js +4 -1
- package/examples/jsm/shaders/FXAAShader.js +4 -1
- package/examples/jsm/shaders/FilmShader.js +4 -1
- package/examples/jsm/shaders/FocusShader.js +4 -1
- package/examples/jsm/shaders/FreiChenShader.js +4 -1
- package/examples/jsm/shaders/GTAOShader.js +4 -1
- package/examples/jsm/shaders/GammaCorrectionShader.js +4 -1
- package/examples/jsm/shaders/GodRaysShader.js +4 -1
- package/examples/jsm/shaders/HalftoneShader.js +4 -1
- package/examples/jsm/shaders/HorizontalBlurShader.js +4 -1
- package/examples/jsm/shaders/HorizontalTiltShiftShader.js +4 -1
- package/examples/jsm/shaders/HueSaturationShader.js +4 -1
- package/examples/jsm/shaders/KaleidoShader.js +4 -1
- package/examples/jsm/shaders/LuminosityHighPassShader.js +4 -1
- package/examples/jsm/shaders/LuminosityShader.js +4 -1
- package/examples/jsm/shaders/MirrorShader.js +4 -1
- package/examples/jsm/shaders/NormalMapShader.js +4 -1
- package/examples/jsm/shaders/OutputShader.js +4 -1
- package/examples/jsm/shaders/PoissonDenoiseShader.js +4 -1
- package/examples/jsm/shaders/RGBShiftShader.js +4 -1
- package/examples/jsm/shaders/SAOShader.js +4 -1
- package/examples/jsm/shaders/SMAAShader.js +1 -0
- package/examples/jsm/shaders/SSAOShader.js +4 -1
- package/examples/jsm/shaders/SSRShader.js +1 -0
- package/examples/jsm/shaders/SepiaShader.js +4 -1
- package/examples/jsm/shaders/SobelOperatorShader.js +4 -1
- package/examples/jsm/shaders/SubsurfaceScatteringShader.js +4 -1
- package/examples/jsm/shaders/TechnicolorShader.js +4 -1
- package/examples/jsm/shaders/ToonShader.js +2 -1
- package/examples/jsm/shaders/TriangleBlurShader.js +4 -1
- package/examples/jsm/shaders/UnpackDepthRGBAShader.js +15 -3
- package/examples/jsm/shaders/VelocityShader.js +4 -1
- package/examples/jsm/shaders/VerticalBlurShader.js +4 -1
- package/examples/jsm/shaders/VerticalTiltShiftShader.js +4 -1
- package/examples/jsm/shaders/VignetteShader.js +4 -1
- package/examples/jsm/shaders/VolumeShader.js +5 -2
- package/examples/jsm/shaders/WaterRefractionShader.js +4 -1
- package/examples/jsm/textures/FlakesTexture.js +2 -0
- package/examples/jsm/transpiler/AST.js +381 -30
- package/examples/jsm/transpiler/GLSLDecoder.js +227 -88
- package/examples/jsm/transpiler/Linker.js +327 -0
- package/examples/jsm/transpiler/TSLEncoder.js +234 -85
- package/examples/jsm/transpiler/Transpiler.js +19 -1
- package/examples/jsm/transpiler/TranspilerUtils.js +29 -0
- package/examples/jsm/transpiler/WGSLEncoder.js +788 -0
- package/examples/jsm/tsl/display/AfterImageNode.js +2 -3
- package/examples/jsm/tsl/display/AnaglyphPassNode.js +1 -0
- package/examples/jsm/tsl/display/AnamorphicNode.js +5 -4
- package/examples/jsm/tsl/display/BloomNode.js +9 -7
- package/examples/jsm/tsl/display/ChromaticAberrationNode.js +206 -0
- package/examples/jsm/tsl/display/DenoiseNode.js +33 -33
- package/examples/jsm/tsl/display/DepthOfFieldNode.js +1 -0
- package/examples/jsm/tsl/display/DotScreenNode.js +1 -0
- package/examples/jsm/tsl/display/FXAANode.js +3 -2
- package/examples/jsm/tsl/display/FilmNode.js +1 -0
- package/examples/jsm/tsl/display/GTAONode.js +1 -0
- package/examples/jsm/tsl/display/GaussianBlurNode.js +9 -36
- package/examples/jsm/tsl/display/LensflareNode.js +1 -0
- package/examples/jsm/tsl/display/Lut3DNode.js +1 -0
- package/examples/jsm/tsl/display/OutlineNode.js +1 -0
- package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +1 -0
- package/examples/jsm/tsl/display/PixelationPassNode.js +1 -0
- package/examples/jsm/tsl/display/RGBShiftNode.js +1 -0
- package/examples/jsm/tsl/display/SMAANode.js +9 -8
- package/examples/jsm/tsl/display/SSAAPassNode.js +5 -4
- package/examples/jsm/tsl/display/SSRNode.js +1 -0
- package/examples/jsm/tsl/display/SobelOperatorNode.js +1 -0
- package/examples/jsm/tsl/display/StereoCompositePassNode.js +1 -0
- package/examples/jsm/tsl/display/StereoPassNode.js +1 -0
- package/examples/jsm/tsl/display/{TRAAPassNode.js → TRAANode.js} +184 -174
- package/examples/jsm/tsl/display/TransitionNode.js +1 -0
- package/examples/jsm/tsl/display/hashBlur.js +28 -6
- package/examples/jsm/tsl/lighting/TiledLightsNode.js +5 -4
- package/examples/jsm/tsl/math/Bayer.js +4 -1
- package/examples/jsm/tsl/shadows/TileShadowNode.js +456 -0
- package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +212 -0
- package/examples/jsm/tsl/utils/Raymarching.js +6 -3
- package/examples/jsm/utils/BufferGeometryUtils.js +4 -1
- package/examples/jsm/utils/CameraUtils.js +4 -1
- package/examples/jsm/utils/GeometryCompressionUtils.js +4 -1
- package/examples/jsm/utils/GeometryUtils.js +4 -1
- package/examples/jsm/utils/LDrawUtils.js +2 -0
- package/examples/jsm/utils/SceneOptimizer.js +2 -0
- package/examples/jsm/utils/SceneUtils.js +4 -1
- package/examples/jsm/utils/ShadowMapViewer.js +2 -0
- package/examples/jsm/utils/ShadowMapViewerGPU.js +2 -0
- package/examples/jsm/utils/SkeletonUtils.js +4 -1
- package/examples/jsm/utils/SortUtils.js +4 -1
- package/examples/jsm/utils/UVsDebug.js +4 -1
- package/examples/jsm/utils/WebGLTextureUtils.js +4 -1
- package/examples/jsm/utils/WebGPUTextureUtils.js +4 -1
- package/examples/jsm/utils/WorkerPool.js +2 -0
- package/examples/jsm/webxr/ARButton.js +1 -0
- package/examples/jsm/webxr/OculusHandModel.js +1 -0
- package/examples/jsm/webxr/OculusHandPointerModel.js +1 -0
- package/examples/jsm/webxr/Text2D.js +4 -1
- package/examples/jsm/webxr/VRButton.js +1 -0
- package/examples/jsm/webxr/XRButton.js +1 -0
- package/examples/jsm/webxr/XRControllerModelFactory.js +2 -0
- package/examples/jsm/webxr/XREstimatedLight.js +1 -0
- package/examples/jsm/webxr/XRHandMeshModel.js +2 -0
- package/examples/jsm/webxr/XRHandModelFactory.js +2 -0
- package/examples/jsm/webxr/XRHandPrimitiveModel.js +2 -0
- package/examples/jsm/webxr/XRPlanes.js +1 -0
- package/package.json +6 -4
- package/src/Three.Core.js +2 -1
- package/src/Three.TSL.js +83 -26
- package/src/Three.WebGPU.Nodes.js +1 -0
- package/src/Three.WebGPU.js +3 -0
- package/src/animation/KeyframeTrack.js +1 -1
- package/src/animation/tracks/BooleanKeyframeTrack.js +1 -1
- package/src/animation/tracks/StringKeyframeTrack.js +1 -1
- package/src/audio/AudioListener.js +13 -10
- package/src/cameras/ArrayCamera.js +9 -1
- package/src/cameras/Camera.js +14 -0
- package/src/cameras/OrthographicCamera.js +1 -1
- package/src/cameras/PerspectiveCamera.js +1 -1
- package/src/constants.js +47 -20
- package/src/core/BufferAttribute.js +3 -3
- package/src/core/BufferGeometry.js +2 -5
- package/src/core/Clock.js +2 -8
- package/src/core/GLBufferAttribute.js +13 -1
- package/src/core/Object3D.js +23 -22
- package/src/core/RenderTarget.js +65 -21
- package/src/core/RenderTarget3D.js +1 -0
- package/{examples/jsm/misc → src/core}/Timer.js +4 -40
- package/src/extras/PMREMGenerator.js +11 -0
- package/src/extras/TextureUtils.js +1 -5
- package/src/extras/core/Curve.js +1 -1
- package/src/extras/core/Path.js +22 -22
- package/src/geometries/CapsuleGeometry.js +167 -17
- package/src/geometries/ExtrudeGeometry.js +39 -29
- package/src/helpers/ArrowHelper.js +2 -2
- package/src/helpers/CameraHelper.js +41 -11
- package/src/helpers/SkeletonHelper.js +36 -7
- package/src/lights/LightShadow.js +34 -7
- package/src/lights/PointLightShadow.js +1 -1
- package/src/lights/SpotLightShadow.js +9 -1
- package/src/lights/webgpu/ProjectorLight.js +46 -0
- package/src/loaders/BufferGeometryLoader.js +1 -10
- package/src/loaders/FileLoader.js +27 -4
- package/src/loaders/ImageBitmapLoader.js +48 -9
- package/src/loaders/ImageLoader.js +55 -8
- package/src/loaders/Loader.js +14 -0
- package/src/loaders/LoadingManager.js +23 -0
- package/src/loaders/ObjectLoader.js +44 -16
- package/src/loaders/nodes/NodeObjectLoader.js +2 -2
- package/src/materials/Material.js +1 -7
- package/src/materials/MeshBasicMaterial.js +1 -1
- package/src/materials/nodes/Line2NodeMaterial.js +0 -8
- package/src/materials/nodes/MeshBasicNodeMaterial.js +4 -3
- package/src/materials/nodes/MeshMatcapNodeMaterial.js +1 -1
- package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
- package/src/materials/nodes/MeshPhysicalNodeMaterial.js +2 -1
- package/src/materials/nodes/MeshSSSNodeMaterial.js +2 -2
- package/src/materials/nodes/NodeMaterial.js +106 -20
- package/src/materials/nodes/PointsNodeMaterial.js +5 -0
- package/src/materials/nodes/manager/NodeMaterialObserver.js +107 -4
- package/src/math/Box3.js +28 -0
- package/src/math/Color.js +7 -7
- package/src/math/ColorManagement.js +22 -3
- package/src/math/Frustum.js +25 -9
- package/src/math/FrustumArray.js +258 -0
- package/src/math/Line3.js +129 -2
- package/src/math/Matrix4.js +48 -27
- package/src/math/Quaternion.js +1 -1
- package/src/math/Ray.js +2 -0
- package/src/math/Sphere.js +28 -0
- package/src/math/Spherical.js +2 -2
- package/src/nodes/Nodes.js +3 -3
- package/src/nodes/TSL.js +6 -3
- package/src/nodes/accessors/AccessorsUtils.js +7 -8
- package/src/nodes/accessors/Bitangent.js +54 -26
- package/src/nodes/accessors/Camera.js +40 -13
- package/src/nodes/accessors/CubeTextureNode.js +50 -2
- package/src/nodes/accessors/InstanceNode.js +5 -4
- package/src/nodes/accessors/Lights.js +2 -2
- package/src/nodes/accessors/MaterialNode.js +4 -0
- package/src/nodes/accessors/ModelNode.js +1 -1
- package/src/nodes/accessors/Normal.js +110 -24
- package/src/nodes/accessors/Object3DNode.js +7 -8
- package/src/nodes/accessors/Position.js +14 -4
- package/src/nodes/accessors/ReferenceBaseNode.js +1 -1
- package/src/nodes/accessors/ReferenceNode.js +19 -4
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SceneNode.js +1 -1
- package/src/nodes/accessors/SkinningNode.js +3 -2
- package/src/nodes/accessors/StorageBufferNode.js +25 -0
- package/src/nodes/accessors/StorageTextureNode.js +15 -4
- package/src/nodes/accessors/Tangent.js +25 -17
- package/src/nodes/accessors/TangentUtils.js +46 -0
- package/src/nodes/accessors/TextureBicubic.js +21 -3
- package/src/nodes/accessors/TextureNode.js +71 -8
- package/src/nodes/accessors/UniformArrayNode.js +0 -16
- package/src/nodes/accessors/VelocityNode.js +1 -0
- package/src/nodes/accessors/VertexColorNode.js +4 -4
- package/src/nodes/code/CodeNode.js +8 -11
- package/src/nodes/core/ArrayNode.js +12 -0
- package/src/nodes/core/AssignNode.js +30 -5
- package/src/nodes/core/AttributeNode.js +2 -2
- package/src/nodes/core/ContextNode.js +27 -4
- package/src/nodes/core/Node.js +83 -22
- package/src/nodes/core/NodeBuilder.js +273 -49
- package/src/nodes/core/NodeUtils.js +46 -1
- package/src/nodes/core/NodeVarying.js +19 -1
- package/src/nodes/core/PropertyNode.js +8 -12
- package/src/nodes/core/StackNode.js +171 -26
- package/src/nodes/core/StructTypeNode.js +26 -4
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/UniformNode.js +63 -5
- package/src/nodes/core/VarNode.js +102 -4
- package/src/nodes/core/VaryingNode.js +45 -24
- package/src/nodes/display/BlendModes.js +42 -1
- package/src/nodes/display/ColorSpaceNode.js +4 -27
- package/src/nodes/display/FrontFacingNode.js +34 -2
- package/src/nodes/display/NormalMapNode.js +19 -50
- package/src/nodes/display/PassNode.js +165 -20
- package/src/nodes/display/ScreenNode.js +0 -26
- package/src/nodes/display/ViewportTextureNode.js +67 -7
- package/src/nodes/functions/BSDF/BRDF_GGX.js +2 -6
- package/src/nodes/functions/BSDF/BRDF_Sheen.js +4 -4
- package/src/nodes/functions/PhongLightingModel.js +3 -3
- package/src/nodes/functions/PhysicalLightingModel.js +16 -16
- package/src/nodes/functions/ShadowMaskModel.js +5 -1
- package/src/nodes/functions/material/getGeometryRoughness.js +2 -2
- package/src/nodes/functions/material/getParallaxCorrectNormal.js +1 -1
- package/src/nodes/gpgpu/AtomicFunctionNode.js +28 -10
- package/src/nodes/gpgpu/BarrierNode.js +3 -3
- package/src/nodes/gpgpu/ComputeNode.js +68 -24
- package/src/nodes/gpgpu/WorkgroupInfoNode.js +28 -3
- package/src/nodes/lighting/AnalyticLightNode.js +7 -13
- package/src/nodes/lighting/EnvironmentNode.js +5 -5
- package/src/nodes/lighting/HemisphereLightNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +2 -1
- package/src/nodes/lighting/LightsNode.js +29 -11
- package/src/nodes/lighting/ProjectorLightNode.js +91 -0
- package/src/nodes/lighting/ShadowBaseNode.js +1 -12
- package/src/nodes/lighting/ShadowFilterNode.js +274 -0
- package/src/nodes/lighting/ShadowNode.js +174 -242
- package/src/nodes/lighting/SpotLightNode.js +44 -7
- package/src/nodes/materialx/MaterialXNodes.js +131 -2
- package/src/nodes/materialx/lib/mx_noise.js +166 -2
- package/src/nodes/math/ConditionalNode.js +1 -20
- package/src/nodes/math/MathNode.js +146 -75
- package/src/nodes/math/OperatorNode.js +129 -119
- package/src/nodes/shapes/Shapes.js +5 -4
- package/src/nodes/tsl/TSLBase.js +1 -0
- package/src/nodes/tsl/TSLCore.js +222 -72
- package/src/nodes/utils/DebugNode.js +16 -4
- package/src/nodes/utils/Discard.js +2 -2
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/EventNode.js +83 -0
- package/src/nodes/utils/LoopNode.js +64 -34
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/RTTNode.js +22 -5
- package/src/nodes/utils/ReflectorNode.js +77 -7
- package/src/nodes/utils/SampleNode.js +81 -0
- package/src/nodes/utils/TriplanarTextures.js +65 -0
- package/src/objects/BatchedMesh.js +20 -6
- package/src/objects/Mesh.js +9 -0
- package/src/objects/Skeleton.js +1 -1
- package/src/objects/Sprite.js +9 -0
- package/src/renderers/WebGL3DRenderTarget.js +1 -0
- package/src/renderers/WebGLArrayRenderTarget.js +1 -0
- package/src/renderers/WebGLCubeRenderTarget.js +2 -4
- package/src/renderers/WebGLRenderer.js +45 -32
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Background.js +13 -2
- package/src/renderers/common/Bindings.js +19 -18
- package/src/renderers/common/Color4.js +2 -2
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/PostProcessing.js +60 -5
- package/src/renderers/common/RenderList.js +0 -4
- package/src/renderers/common/RenderObject.js +80 -4
- package/src/renderers/common/Renderer.js +133 -22
- package/src/renderers/common/SampledTexture.js +3 -71
- package/src/renderers/common/Sampler.js +79 -0
- package/src/renderers/common/Storage3DTexture.js +100 -0
- package/src/renderers/common/StorageArrayTexture.js +84 -0
- package/src/renderers/common/StorageTexture.js +19 -0
- package/src/renderers/common/Textures.js +34 -24
- package/src/renderers/common/TimestampQueryPool.js +1 -0
- package/src/renderers/common/Uniform.js +1 -1
- package/src/renderers/common/UniformsGroup.js +14 -18
- package/src/renderers/common/XRManager.js +183 -35
- package/src/renderers/common/XRRenderTarget.js +21 -4
- package/src/renderers/common/extras/PMREMGenerator.js +30 -23
- package/src/renderers/common/nodes/NodeSampledTexture.js +0 -12
- package/src/renderers/common/nodes/Nodes.js +13 -3
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +20 -2
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/depth.glsl.js +11 -2
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLCapabilities.js +2 -2
- package/src/renderers/webgl/WebGLMaterials.js +6 -6
- package/src/renderers/webgl/WebGLProgram.js +22 -16
- package/src/renderers/webgl/WebGLPrograms.js +8 -6
- package/src/renderers/webgl/WebGLShadowMap.js +14 -3
- package/src/renderers/webgl/WebGLState.js +4 -4
- package/src/renderers/webgl/WebGLTextures.js +163 -11
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +261 -94
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +75 -9
- package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +4 -0
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +1 -0
- package/src/renderers/webgl-fallback/utils/WebGLState.js +4 -4
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +44 -29
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +22 -21
- package/src/renderers/webgpu/WebGPUBackend.js +505 -143
- package/src/renderers/webgpu/WebGPURenderer.js +7 -0
- package/src/renderers/webgpu/nodes/BasicNodeLibrary.js +4 -1
- package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +4 -1
- package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +129 -96
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +3 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +9 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +58 -31
- package/src/renderers/webgpu/utils/WebGPUConstants.js +8 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +39 -9
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +50 -108
- package/src/renderers/webgpu/utils/WebGPUUtils.js +2 -17
- package/src/renderers/webxr/WebXRController.js +1 -1
- package/src/renderers/webxr/WebXRDepthSensing.js +6 -10
- package/src/renderers/webxr/WebXRManager.js +70 -9
- package/src/textures/DepthTexture.js +6 -10
- package/src/textures/ExternalTexture.js +45 -0
- package/src/textures/FramebufferTexture.js +2 -2
- package/src/textures/Source.js +32 -0
- package/src/textures/Texture.js +118 -1
- package/src/textures/VideoTexture.js +31 -3
- package/examples/jsm/effects/PeppersGhostEffect.js +0 -172
- package/src/core/RenderTargetArray.js +0 -40
- package/src/nodes/utils/EquirectUVNode.js +0 -65
- package/src/nodes/utils/MatcapUVNode.js +0 -49
- package/src/nodes/utils/TriplanarTexturesNode.js +0 -148
|
@@ -21,17 +21,23 @@ import XRManager from './XRManager.js';
|
|
|
21
21
|
import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
22
22
|
|
|
23
23
|
import { Scene } from '../../scenes/Scene.js';
|
|
24
|
+
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
24
25
|
import { Frustum } from '../../math/Frustum.js';
|
|
26
|
+
import { FrustumArray } from '../../math/FrustumArray.js';
|
|
25
27
|
import { Matrix4 } from '../../math/Matrix4.js';
|
|
26
28
|
import { Vector2 } from '../../math/Vector2.js';
|
|
27
29
|
import { Vector4 } from '../../math/Vector4.js';
|
|
28
30
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
29
|
-
import { DoubleSide, BackSide, FrontSide, SRGBColorSpace, NoToneMapping, LinearFilter,
|
|
31
|
+
import { DoubleSide, BackSide, FrontSide, SRGBColorSpace, NoToneMapping, LinearFilter, HalfFloatType, RGBAFormat, PCFShadowMap } from '../../constants.js';
|
|
32
|
+
|
|
33
|
+
import { highpModelNormalViewMatrix, highpModelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
30
34
|
|
|
31
35
|
const _scene = /*@__PURE__*/ new Scene();
|
|
32
36
|
const _drawingBufferSize = /*@__PURE__*/ new Vector2();
|
|
33
37
|
const _screen = /*@__PURE__*/ new Vector4();
|
|
34
38
|
const _frustum = /*@__PURE__*/ new Frustum();
|
|
39
|
+
const _frustumArray = /*@__PURE__*/ new FrustumArray();
|
|
40
|
+
|
|
35
41
|
const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
|
|
36
42
|
const _vector4 = /*@__PURE__*/ new Vector4();
|
|
37
43
|
|
|
@@ -54,6 +60,7 @@ class Renderer {
|
|
|
54
60
|
* @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
|
|
55
61
|
* @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
|
|
56
62
|
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
|
|
63
|
+
* @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
|
|
57
64
|
*/
|
|
58
65
|
|
|
59
66
|
/**
|
|
@@ -84,7 +91,8 @@ class Renderer {
|
|
|
84
91
|
antialias = false,
|
|
85
92
|
samples = 0,
|
|
86
93
|
getFallback = null,
|
|
87
|
-
colorBufferType = HalfFloatType
|
|
94
|
+
colorBufferType = HalfFloatType,
|
|
95
|
+
multiview = false
|
|
88
96
|
} = parameters;
|
|
89
97
|
|
|
90
98
|
/**
|
|
@@ -225,7 +233,15 @@ class Renderer {
|
|
|
225
233
|
*/
|
|
226
234
|
this.info = new Info();
|
|
227
235
|
|
|
228
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Stores override nodes for specific transformations or calculations.
|
|
238
|
+
* These nodes can be used to replace default behavior in the rendering pipeline.
|
|
239
|
+
*
|
|
240
|
+
* @type {Object}
|
|
241
|
+
* @property {?Node} modelViewMatrix - An override node for the model-view matrix.
|
|
242
|
+
* @property {?Node} modelNormalViewMatrix - An override node for the model normal view matrix.
|
|
243
|
+
*/
|
|
244
|
+
this.overrideNodes = {
|
|
229
245
|
modelViewMatrix: null,
|
|
230
246
|
modelNormalViewMatrix: null
|
|
231
247
|
};
|
|
@@ -676,7 +692,7 @@ class Renderer {
|
|
|
676
692
|
*
|
|
677
693
|
* @type {XRManager}
|
|
678
694
|
*/
|
|
679
|
-
this.xr = new XRManager( this );
|
|
695
|
+
this.xr = new XRManager( this, multiview );
|
|
680
696
|
|
|
681
697
|
/**
|
|
682
698
|
* Debug configuration.
|
|
@@ -977,6 +993,43 @@ class Renderer {
|
|
|
977
993
|
|
|
978
994
|
}
|
|
979
995
|
|
|
996
|
+
/**
|
|
997
|
+
* Enables or disables high precision for model-view and normal-view matrices.
|
|
998
|
+
* When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance.
|
|
999
|
+
*
|
|
1000
|
+
* NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`.
|
|
1001
|
+
*
|
|
1002
|
+
* @param {boolean} value - Whether to enable or disable high precision.
|
|
1003
|
+
* @type {boolean}
|
|
1004
|
+
*/
|
|
1005
|
+
set highPrecision( value ) {
|
|
1006
|
+
|
|
1007
|
+
if ( value === true ) {
|
|
1008
|
+
|
|
1009
|
+
this.overrideNodes.modelViewMatrix = highpModelViewMatrix;
|
|
1010
|
+
this.overrideNodes.modelNormalViewMatrix = highpModelNormalViewMatrix;
|
|
1011
|
+
|
|
1012
|
+
} else if ( this.highPrecision ) {
|
|
1013
|
+
|
|
1014
|
+
this.overrideNodes.modelViewMatrix = null;
|
|
1015
|
+
this.overrideNodes.modelNormalViewMatrix = null;
|
|
1016
|
+
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Returns whether high precision is enabled or not.
|
|
1023
|
+
*
|
|
1024
|
+
* @return {boolean} Whether high precision is enabled or not.
|
|
1025
|
+
* @type {boolean}
|
|
1026
|
+
*/
|
|
1027
|
+
get highPrecision() {
|
|
1028
|
+
|
|
1029
|
+
return this.overrideNodes.modelViewMatrix === highpModelViewMatrix && this.overrideNodes.modelNormalViewMatrix === highpModelNormalViewMatrix;
|
|
1030
|
+
|
|
1031
|
+
}
|
|
1032
|
+
|
|
980
1033
|
/**
|
|
981
1034
|
* Sets the given MRT configuration.
|
|
982
1035
|
*
|
|
@@ -1158,7 +1211,7 @@ class Renderer {
|
|
|
1158
1211
|
const { currentToneMapping, currentColorSpace } = this;
|
|
1159
1212
|
|
|
1160
1213
|
const useToneMapping = currentToneMapping !== NoToneMapping;
|
|
1161
|
-
const useColorSpace = currentColorSpace !==
|
|
1214
|
+
const useColorSpace = currentColorSpace !== ColorManagement.workingColorSpace;
|
|
1162
1215
|
|
|
1163
1216
|
if ( useToneMapping === false && useColorSpace === false ) return null;
|
|
1164
1217
|
|
|
@@ -1174,7 +1227,7 @@ class Renderer {
|
|
|
1174
1227
|
stencilBuffer: stencil,
|
|
1175
1228
|
type: this._colorBufferType,
|
|
1176
1229
|
format: RGBAFormat,
|
|
1177
|
-
colorSpace:
|
|
1230
|
+
colorSpace: ColorManagement.workingColorSpace,
|
|
1178
1231
|
generateMipmaps: false,
|
|
1179
1232
|
minFilter: LinearFilter,
|
|
1180
1233
|
magFilter: LinearFilter,
|
|
@@ -1187,14 +1240,28 @@ class Renderer {
|
|
|
1187
1240
|
|
|
1188
1241
|
}
|
|
1189
1242
|
|
|
1243
|
+
const outputRenderTarget = this.getOutputRenderTarget();
|
|
1244
|
+
|
|
1190
1245
|
frameBufferTarget.depthBuffer = depth;
|
|
1191
1246
|
frameBufferTarget.stencilBuffer = stencil;
|
|
1192
|
-
|
|
1247
|
+
if ( outputRenderTarget !== null ) {
|
|
1248
|
+
|
|
1249
|
+
frameBufferTarget.setSize( outputRenderTarget.width, outputRenderTarget.height, outputRenderTarget.depth );
|
|
1250
|
+
|
|
1251
|
+
} else {
|
|
1252
|
+
|
|
1253
|
+
frameBufferTarget.setSize( width, height, 1 );
|
|
1254
|
+
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1193
1257
|
frameBufferTarget.viewport.copy( this._viewport );
|
|
1194
1258
|
frameBufferTarget.scissor.copy( this._scissor );
|
|
1195
1259
|
frameBufferTarget.viewport.multiplyScalar( this._pixelRatio );
|
|
1196
1260
|
frameBufferTarget.scissor.multiplyScalar( this._pixelRatio );
|
|
1197
1261
|
frameBufferTarget.scissorTest = this._scissorTest;
|
|
1262
|
+
frameBufferTarget.multiview = outputRenderTarget !== null ? outputRenderTarget.multiview : false;
|
|
1263
|
+
frameBufferTarget.resolveDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.resolveDepthBuffer : true;
|
|
1264
|
+
frameBufferTarget._autoAllocateDepthBuffer = outputRenderTarget !== null ? outputRenderTarget._autoAllocateDepthBuffer : false;
|
|
1198
1265
|
|
|
1199
1266
|
return frameBufferTarget;
|
|
1200
1267
|
|
|
@@ -1341,8 +1408,14 @@ class Renderer {
|
|
|
1341
1408
|
|
|
1342
1409
|
//
|
|
1343
1410
|
|
|
1344
|
-
|
|
1345
|
-
|
|
1411
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
1412
|
+
|
|
1413
|
+
if ( ! camera.isArrayCamera ) {
|
|
1414
|
+
|
|
1415
|
+
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
1416
|
+
frustum.setFromProjectionMatrix( _projScreenMatrix, camera.coordinateSystem, camera.reversedDepth );
|
|
1417
|
+
|
|
1418
|
+
}
|
|
1346
1419
|
|
|
1347
1420
|
const renderList = this._renderLists.get( scene, camera );
|
|
1348
1421
|
renderList.begin();
|
|
@@ -1396,6 +1469,7 @@ class Renderer {
|
|
|
1396
1469
|
|
|
1397
1470
|
//
|
|
1398
1471
|
|
|
1472
|
+
renderContext.camera = camera;
|
|
1399
1473
|
this.backend.beginRender( renderContext );
|
|
1400
1474
|
|
|
1401
1475
|
// process render lists
|
|
@@ -1443,6 +1517,15 @@ class Renderer {
|
|
|
1443
1517
|
|
|
1444
1518
|
}
|
|
1445
1519
|
|
|
1520
|
+
_setXRLayerSize( width, height ) {
|
|
1521
|
+
|
|
1522
|
+
this._width = width;
|
|
1523
|
+
this._height = height;
|
|
1524
|
+
|
|
1525
|
+
this.setViewport( 0, 0, width, height );
|
|
1526
|
+
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1446
1529
|
/**
|
|
1447
1530
|
* The output pass performs tone mapping and color space conversion.
|
|
1448
1531
|
*
|
|
@@ -2048,8 +2131,8 @@ class Renderer {
|
|
|
2048
2131
|
}
|
|
2049
2132
|
|
|
2050
2133
|
/**
|
|
2051
|
-
* The current
|
|
2052
|
-
* the
|
|
2134
|
+
* The current tone mapping of the renderer. When not producing screen output,
|
|
2135
|
+
* the tone mapping is always `NoToneMapping`.
|
|
2053
2136
|
*
|
|
2054
2137
|
* @type {number}
|
|
2055
2138
|
*/
|
|
@@ -2060,14 +2143,14 @@ class Renderer {
|
|
|
2060
2143
|
}
|
|
2061
2144
|
|
|
2062
2145
|
/**
|
|
2063
|
-
* The current
|
|
2064
|
-
* the
|
|
2146
|
+
* The current color space of the renderer. When not producing screen output,
|
|
2147
|
+
* the color space is always the working color space.
|
|
2065
2148
|
*
|
|
2066
2149
|
* @type {string}
|
|
2067
2150
|
*/
|
|
2068
2151
|
get currentColorSpace() {
|
|
2069
2152
|
|
|
2070
|
-
return this.isOutputTarget ? this.outputColorSpace :
|
|
2153
|
+
return this.isOutputTarget ? this.outputColorSpace : ColorManagement.workingColorSpace;
|
|
2071
2154
|
|
|
2072
2155
|
}
|
|
2073
2156
|
|
|
@@ -2163,6 +2246,21 @@ class Renderer {
|
|
|
2163
2246
|
|
|
2164
2247
|
}
|
|
2165
2248
|
|
|
2249
|
+
/**
|
|
2250
|
+
* Resets the renderer to the initial state before WebXR started.
|
|
2251
|
+
*
|
|
2252
|
+
*/
|
|
2253
|
+
_resetXRState() {
|
|
2254
|
+
|
|
2255
|
+
this.backend.setXRTarget( null );
|
|
2256
|
+
this.setOutputRenderTarget( null );
|
|
2257
|
+
this.setRenderTarget( null );
|
|
2258
|
+
|
|
2259
|
+
this._frameBufferTarget.dispose();
|
|
2260
|
+
this._frameBufferTarget = null;
|
|
2261
|
+
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2166
2264
|
/**
|
|
2167
2265
|
* Callback for {@link Renderer#setRenderObjectFunction}.
|
|
2168
2266
|
*
|
|
@@ -2211,9 +2309,10 @@ class Renderer {
|
|
|
2211
2309
|
* if the renderer has been initialized.
|
|
2212
2310
|
*
|
|
2213
2311
|
* @param {Node|Array<Node>} computeNodes - The compute node(s).
|
|
2312
|
+
* @param {Array<number>|number} [dispatchSizeOrCount=null] - Array with [ x, y, z ] values for dispatch or a single number for the count.
|
|
2214
2313
|
* @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized.
|
|
2215
2314
|
*/
|
|
2216
|
-
compute( computeNodes ) {
|
|
2315
|
+
compute( computeNodes, dispatchSizeOrCount = null ) {
|
|
2217
2316
|
|
|
2218
2317
|
if ( this._isDeviceLost === true ) return;
|
|
2219
2318
|
|
|
@@ -2292,7 +2391,7 @@ class Renderer {
|
|
|
2292
2391
|
const computeBindings = bindings.getForCompute( computeNode );
|
|
2293
2392
|
const computePipeline = pipelines.getForCompute( computeNode, computeBindings );
|
|
2294
2393
|
|
|
2295
|
-
backend.compute( computeNodes, computeNode, computeBindings, computePipeline );
|
|
2394
|
+
backend.compute( computeNodes, computeNode, computeBindings, computePipeline, dispatchSizeOrCount );
|
|
2296
2395
|
|
|
2297
2396
|
}
|
|
2298
2397
|
|
|
@@ -2309,13 +2408,14 @@ class Renderer {
|
|
|
2309
2408
|
*
|
|
2310
2409
|
* @async
|
|
2311
2410
|
* @param {Node|Array<Node>} computeNodes - The compute node(s).
|
|
2411
|
+
* @param {Array<number>|number} [dispatchSizeOrCount=null] - Array with [ x, y, z ] values for dispatch or a single number for the count.
|
|
2312
2412
|
* @return {Promise} A Promise that resolve when the compute has finished.
|
|
2313
2413
|
*/
|
|
2314
|
-
async computeAsync( computeNodes ) {
|
|
2414
|
+
async computeAsync( computeNodes, dispatchSizeOrCount = null ) {
|
|
2315
2415
|
|
|
2316
2416
|
if ( this._initialized === false ) await this.init();
|
|
2317
2417
|
|
|
2318
|
-
this.compute( computeNodes );
|
|
2418
|
+
this.compute( computeNodes, dispatchSizeOrCount );
|
|
2319
2419
|
|
|
2320
2420
|
}
|
|
2321
2421
|
|
|
@@ -2545,7 +2645,9 @@ class Renderer {
|
|
|
2545
2645
|
|
|
2546
2646
|
} else if ( object.isSprite ) {
|
|
2547
2647
|
|
|
2548
|
-
|
|
2648
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
2649
|
+
|
|
2650
|
+
if ( ! object.frustumCulled || frustum.intersectsSprite( object, camera ) ) {
|
|
2549
2651
|
|
|
2550
2652
|
if ( this.sortObjects === true ) {
|
|
2551
2653
|
|
|
@@ -2569,7 +2671,9 @@ class Renderer {
|
|
|
2569
2671
|
|
|
2570
2672
|
} else if ( object.isMesh || object.isLine || object.isPoints ) {
|
|
2571
2673
|
|
|
2572
|
-
|
|
2674
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
2675
|
+
|
|
2676
|
+
if ( ! object.frustumCulled || frustum.intersectsObject( object, camera ) ) {
|
|
2573
2677
|
|
|
2574
2678
|
const { geometry, material } = object;
|
|
2575
2679
|
|
|
@@ -2791,6 +2895,13 @@ class Renderer {
|
|
|
2791
2895
|
|
|
2792
2896
|
}
|
|
2793
2897
|
|
|
2898
|
+
if ( material.castShadowPositionNode && material.castShadowPositionNode.isNode ) {
|
|
2899
|
+
|
|
2900
|
+
overridePositionNode = overrideMaterial.positionNode;
|
|
2901
|
+
overrideMaterial.positionNode = material.castShadowPositionNode;
|
|
2902
|
+
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2794
2905
|
}
|
|
2795
2906
|
|
|
2796
2907
|
material = overrideMaterial;
|
|
@@ -2853,7 +2964,7 @@ class Renderer {
|
|
|
2853
2964
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
2854
2965
|
* @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
2855
2966
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
2856
|
-
* @param {
|
|
2967
|
+
* @param {string} [passId] - An optional ID for identifying the pass.
|
|
2857
2968
|
*/
|
|
2858
2969
|
_renderObjectDirect( object, material, scene, camera, lightsNode, group, clippingContext, passId ) {
|
|
2859
2970
|
|
|
@@ -2908,7 +3019,7 @@ class Renderer {
|
|
|
2908
3019
|
* @param {LightsNode} lightsNode - The current lights node.
|
|
2909
3020
|
* @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`.
|
|
2910
3021
|
* @param {ClippingContext} clippingContext - The clipping context.
|
|
2911
|
-
* @param {
|
|
3022
|
+
* @param {string} [passId] - An optional ID for identifying the pass.
|
|
2912
3023
|
*/
|
|
2913
3024
|
_createObjectPipeline( object, material, scene, camera, lightsNode, group, clippingContext, passId ) {
|
|
2914
3025
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Sampler from './Sampler.js';
|
|
2
2
|
|
|
3
3
|
let _id = 0;
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ let _id = 0;
|
|
|
8
8
|
* @private
|
|
9
9
|
* @augments Binding
|
|
10
10
|
*/
|
|
11
|
-
class SampledTexture extends
|
|
11
|
+
class SampledTexture extends Sampler {
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Constructs a new sampled texture.
|
|
@@ -18,7 +18,7 @@ class SampledTexture extends Binding {
|
|
|
18
18
|
*/
|
|
19
19
|
constructor( name, texture ) {
|
|
20
20
|
|
|
21
|
-
super( name );
|
|
21
|
+
super( name, texture );
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* This identifier.
|
|
@@ -27,20 +27,6 @@ class SampledTexture extends Binding {
|
|
|
27
27
|
*/
|
|
28
28
|
this.id = _id ++;
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
* The texture this binding is referring to.
|
|
32
|
-
*
|
|
33
|
-
* @type {?Texture}
|
|
34
|
-
*/
|
|
35
|
-
this.texture = texture;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* The binding's version.
|
|
39
|
-
*
|
|
40
|
-
* @type {number}
|
|
41
|
-
*/
|
|
42
|
-
this.version = texture ? texture.version : 0;
|
|
43
|
-
|
|
44
30
|
/**
|
|
45
31
|
* Whether the texture is a storage texture or not.
|
|
46
32
|
*
|
|
@@ -49,15 +35,6 @@ class SampledTexture extends Binding {
|
|
|
49
35
|
*/
|
|
50
36
|
this.store = false;
|
|
51
37
|
|
|
52
|
-
/**
|
|
53
|
-
* The binding's generation which is an additional version
|
|
54
|
-
* qualifier.
|
|
55
|
-
*
|
|
56
|
-
* @type {?number}
|
|
57
|
-
* @default null
|
|
58
|
-
*/
|
|
59
|
-
this.generation = null;
|
|
60
|
-
|
|
61
38
|
/**
|
|
62
39
|
* This flag can be used for type testing.
|
|
63
40
|
*
|
|
@@ -69,51 +46,6 @@ class SampledTexture extends Binding {
|
|
|
69
46
|
|
|
70
47
|
}
|
|
71
48
|
|
|
72
|
-
/**
|
|
73
|
-
* Returns `true` whether this binding requires an update for the
|
|
74
|
-
* given generation.
|
|
75
|
-
*
|
|
76
|
-
* @param {number} generation - The generation.
|
|
77
|
-
* @return {boolean} Whether an update is required or not.
|
|
78
|
-
*/
|
|
79
|
-
needsBindingsUpdate( generation ) {
|
|
80
|
-
|
|
81
|
-
const { texture } = this;
|
|
82
|
-
|
|
83
|
-
if ( generation !== this.generation ) {
|
|
84
|
-
|
|
85
|
-
this.generation = generation;
|
|
86
|
-
|
|
87
|
-
return true;
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return texture.isVideoTexture;
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Updates the binding.
|
|
97
|
-
*
|
|
98
|
-
* @return {boolean} Whether the texture has been updated and must be
|
|
99
|
-
* uploaded to the GPU.
|
|
100
|
-
*/
|
|
101
|
-
update() {
|
|
102
|
-
|
|
103
|
-
const { texture, version } = this;
|
|
104
|
-
|
|
105
|
-
if ( version !== texture.version ) {
|
|
106
|
-
|
|
107
|
-
this.version = texture.version;
|
|
108
|
-
|
|
109
|
-
return true;
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return false;
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
49
|
}
|
|
118
50
|
|
|
119
51
|
/**
|
|
@@ -18,6 +18,17 @@ class Sampler extends Binding {
|
|
|
18
18
|
|
|
19
19
|
super( name );
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* This function is called when the texture is disposed.
|
|
23
|
+
* @type {function}
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
this._onDisposeTexture = () => {
|
|
27
|
+
|
|
28
|
+
this.texture = null;
|
|
29
|
+
|
|
30
|
+
};
|
|
31
|
+
|
|
21
32
|
/**
|
|
22
33
|
* The texture the sampler is referring to.
|
|
23
34
|
*
|
|
@@ -32,6 +43,15 @@ class Sampler extends Binding {
|
|
|
32
43
|
*/
|
|
33
44
|
this.version = texture ? texture.version : 0;
|
|
34
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The binding's generation which is an additional version
|
|
48
|
+
* qualifier.
|
|
49
|
+
*
|
|
50
|
+
* @type {?number}
|
|
51
|
+
* @default null
|
|
52
|
+
*/
|
|
53
|
+
this.generation = null;
|
|
54
|
+
|
|
35
55
|
/**
|
|
36
56
|
* This flag can be used for type testing.
|
|
37
57
|
*
|
|
@@ -43,6 +63,65 @@ class Sampler extends Binding {
|
|
|
43
63
|
|
|
44
64
|
}
|
|
45
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Sets the texture of this sampler.
|
|
68
|
+
* @param {?Texture} value - The texture to set.
|
|
69
|
+
*/
|
|
70
|
+
set texture( value ) {
|
|
71
|
+
|
|
72
|
+
if ( this._texture === value ) return;
|
|
73
|
+
|
|
74
|
+
if ( this._texture ) {
|
|
75
|
+
|
|
76
|
+
this._texture.removeEventListener( 'dispose', this._onDisposeTexture );
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this._texture = value;
|
|
81
|
+
|
|
82
|
+
this.generation = null;
|
|
83
|
+
this.version = 0;
|
|
84
|
+
|
|
85
|
+
if ( this._texture ) {
|
|
86
|
+
|
|
87
|
+
this._texture.addEventListener( 'dispose', this._onDisposeTexture );
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Gets the texture of this sampler.
|
|
95
|
+
* @return {?Texture} The texture.
|
|
96
|
+
*/
|
|
97
|
+
get texture() {
|
|
98
|
+
|
|
99
|
+
return this._texture;
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Updates the binding.
|
|
105
|
+
*
|
|
106
|
+
* @return {boolean} Whether the texture has been updated and must be
|
|
107
|
+
* uploaded to the GPU.
|
|
108
|
+
*/
|
|
109
|
+
update() {
|
|
110
|
+
|
|
111
|
+
const { texture, version } = this;
|
|
112
|
+
|
|
113
|
+
if ( version !== texture.version ) {
|
|
114
|
+
|
|
115
|
+
this.version = texture.version;
|
|
116
|
+
|
|
117
|
+
return true;
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return false;
|
|
122
|
+
|
|
123
|
+
}
|
|
124
|
+
|
|
46
125
|
}
|
|
47
126
|
|
|
48
127
|
export default Sampler;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Texture } from '../../textures/Texture.js';
|
|
2
|
+
import { LinearFilter, ClampToEdgeWrapping } from '../../constants.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This special type of texture is intended for compute shaders.
|
|
6
|
+
* It can be used to compute the data of a texture with a compute shader.
|
|
7
|
+
*
|
|
8
|
+
* Note: This type of texture can only be used with `WebGPURenderer`
|
|
9
|
+
* and a WebGPU backend.
|
|
10
|
+
*
|
|
11
|
+
* @augments Texture
|
|
12
|
+
*/
|
|
13
|
+
class Storage3DTexture extends Texture {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a new storage texture.
|
|
17
|
+
*
|
|
18
|
+
* @param {number} [width=1] - The storage texture's width.
|
|
19
|
+
* @param {number} [height=1] - The storage texture's height.
|
|
20
|
+
* @param {number} [depth=1] - The storage texture's depth.
|
|
21
|
+
*/
|
|
22
|
+
constructor( width = 1, height = 1, depth = 1 ) {
|
|
23
|
+
|
|
24
|
+
super();
|
|
25
|
+
|
|
26
|
+
//inherited from texture. Must be false for 3DTexture
|
|
27
|
+
this.isArrayTexture = false;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The image object which just represents the texture's dimension.
|
|
31
|
+
*
|
|
32
|
+
* @type {{width: number, height: number, depth: number}}
|
|
33
|
+
*/
|
|
34
|
+
this.image = { width, height, depth };
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The default `magFilter` for storage textures is `THREE.LinearFilter`.
|
|
38
|
+
*
|
|
39
|
+
* @type {number}
|
|
40
|
+
*/
|
|
41
|
+
this.magFilter = LinearFilter;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The default `minFilter` for storage textures is `THREE.LinearFilter`.
|
|
45
|
+
*
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
this.minFilter = LinearFilter;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* This defines how the texture is wrapped in the depth direction and corresponds to
|
|
52
|
+
* *W* in UVW mapping.
|
|
53
|
+
*
|
|
54
|
+
* @type {number}
|
|
55
|
+
*/
|
|
56
|
+
this.wrapR = ClampToEdgeWrapping;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* This flag can be used for type testing.
|
|
60
|
+
*
|
|
61
|
+
* @type {boolean}
|
|
62
|
+
* @readonly
|
|
63
|
+
* @default true
|
|
64
|
+
*/
|
|
65
|
+
this.isStorageTexture = true;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Indicates whether this texture is a 3D texture.
|
|
69
|
+
*
|
|
70
|
+
* @type {boolean}
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
this.is3DTexture = true;
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Sets the size of the storage 3d texture.
|
|
79
|
+
*
|
|
80
|
+
* @param {number} width - The new width of the storage texture.
|
|
81
|
+
* @param {number} height - The new height of the storage texture.
|
|
82
|
+
* @param {number} depth - The new depth of the storage texture.
|
|
83
|
+
*/
|
|
84
|
+
setSize( width, height, depth ) {
|
|
85
|
+
|
|
86
|
+
if ( this.image.width !== width || this.image.height !== height || this.image.depth !== depth ) {
|
|
87
|
+
|
|
88
|
+
this.image.width = width;
|
|
89
|
+
this.image.height = height;
|
|
90
|
+
this.image.depth = depth;
|
|
91
|
+
|
|
92
|
+
this.dispose();
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export default Storage3DTexture;
|