@plastic-software/three 0.175.13 → 0.178.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 +3 -3
- package/build/three.cjs +7747 -6792
- package/build/three.core.js +7371 -6576
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +190 -30
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +19 -11
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +4989 -2235
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +5082 -2469
- package/build/three.webgpu.nodes.min.js +1 -1
- package/examples/jsm/Addons.js +0 -1
- 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 +1 -0
- 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 +18 -4
- 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 +49 -35
- 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 +12 -10
- 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 +2 -1
- 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 +7 -0
- 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/lighting/TiledLighting.js +1 -0
- package/examples/jsm/lights/LightProbeGenerator.js +1 -0
- 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 +1 -0
- 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 +1 -0
- 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 +1 -0
- package/examples/jsm/loaders/USDZLoader.js +1 -0
- 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/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/Timer.js +2 -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 +1 -0
- 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 +20 -17
- 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 +139 -12
- 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 +4 -3
- 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 +5 -2
- 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 +2 -1
- 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 +4 -1
- 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 +226 -87
- 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 +1 -0
- 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 +4 -29
- 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 +5 -4
- 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 +4 -3
- 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 +1 -1
- package/src/Three.TSL.js +18 -10
- package/src/Three.WebGPU.Nodes.js +1 -0
- package/src/Three.WebGPU.js +3 -0
- package/src/audio/AudioListener.js +13 -10
- package/src/cameras/ArrayCamera.js +9 -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/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/SkeletonHelper.js +1 -1
- package/src/lights/LightShadow.js +14 -0
- 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 +2 -2
- package/src/loaders/ImageBitmapLoader.js +25 -9
- package/src/loaders/ImageLoader.js +55 -8
- 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/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 +105 -19
- package/src/materials/nodes/manager/NodeMaterialObserver.js +20 -2
- 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 +6 -1
- package/src/math/FrustumArray.js +253 -0
- package/src/math/Quaternion.js +1 -1
- package/src/math/Ray.js +2 -0
- package/src/math/Sphere.js +28 -0
- package/src/nodes/Nodes.js +2 -3
- package/src/nodes/TSL.js +5 -3
- package/src/nodes/accessors/AccessorsUtils.js +7 -8
- package/src/nodes/accessors/Bitangent.js +54 -26
- package/src/nodes/accessors/Camera.js +31 -4
- 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 +102 -16
- 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 +1 -1
- package/src/nodes/accessors/ReflectVector.js +3 -3
- package/src/nodes/accessors/SkinningNode.js +3 -2
- package/src/nodes/accessors/StorageBufferNode.js +25 -0
- package/src/nodes/accessors/StorageTextureNode.js +14 -3
- 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 +59 -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/AssignNode.js +27 -5
- package/src/nodes/core/AttributeNode.js +2 -2
- package/src/nodes/core/ContextNode.js +7 -3
- package/src/nodes/core/Node.js +69 -20
- package/src/nodes/core/NodeBuilder.js +248 -29
- package/src/nodes/core/NodeUtils.js +42 -0
- package/src/nodes/core/NodeVarying.js +19 -1
- package/src/nodes/core/PropertyNode.js +8 -12
- package/src/nodes/core/StackNode.js +129 -26
- package/src/nodes/core/StructTypeNode.js +26 -4
- package/src/nodes/core/SubBuildNode.js +89 -0
- package/src/nodes/core/VarNode.js +11 -2
- 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 +18 -19
- package/src/nodes/display/ScreenNode.js +0 -26
- 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 +14 -14
- 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 +1 -1
- 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 +78 -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/lib/mx_noise.js +1 -1
- package/src/nodes/math/ConditionalNode.js +0 -19
- package/src/nodes/math/MathNode.js +68 -21
- package/src/nodes/math/OperatorNode.js +108 -98
- package/src/nodes/shapes/Shapes.js +5 -4
- package/src/nodes/tsl/TSLBase.js +1 -0
- package/src/nodes/tsl/TSLCore.js +160 -65
- package/src/nodes/utils/DebugNode.js +15 -3
- package/src/nodes/utils/Discard.js +2 -2
- package/src/nodes/utils/EquirectUV.js +27 -0
- package/src/nodes/utils/LoopNode.js +64 -34
- package/src/nodes/utils/MatcapUV.js +22 -0
- package/src/nodes/utils/RTTNode.js +13 -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 +16 -4
- 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 +25 -11
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Background.js +13 -2
- package/src/renderers/common/CubeRenderTarget.js +1 -1
- package/src/renderers/common/RenderList.js +0 -4
- package/src/renderers/common/RenderObject.js +80 -4
- package/src/renderers/common/Renderer.js +116 -8
- package/src/renderers/common/Storage3DTexture.js +79 -0
- package/src/renderers/common/StorageArrayTexture.js +63 -0
- package/src/renderers/common/Textures.js +15 -21
- 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 +157 -27
- package/src/renderers/common/XRRenderTarget.js +21 -4
- package/src/renderers/common/extras/PMREMGenerator.js +30 -23
- package/src/renderers/common/nodes/Nodes.js +13 -3
- package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +1 -1
- package/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.js +1 -1
- package/src/renderers/shaders/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/webgl/WebGLAttributes.js +4 -0
- package/src/renderers/webgl/WebGLPrograms.js +4 -2
- package/src/renderers/webgl/WebGLShadowMap.js +3 -2
- package/src/renderers/webgl/WebGLState.js +4 -4
- package/src/renderers/webgl/WebGLTextures.js +144 -4
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +244 -87
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +73 -7
- 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 +451 -128
- 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 +86 -33
- 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 +28 -5
- package/src/renderers/webgpu/utils/WebGPUConstants.js +8 -2
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +38 -8
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +45 -50
- package/src/renderers/webxr/WebXRController.js +1 -1
- package/src/renderers/webxr/WebXRManager.js +2 -1
- package/src/textures/DepthTexture.js +6 -10
- package/src/textures/Source.js +22 -0
- package/src/textures/Texture.js +118 -1
- package/src/textures/VideoTexture.js +1 -1
- 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
|
@@ -171,6 +171,16 @@ class RenderObject {
|
|
|
171
171
|
*/
|
|
172
172
|
this.attributes = null;
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* An object holding the version of the
|
|
176
|
+
* attributes. The keys are the attribute names
|
|
177
|
+
* and the values are the attribute versions.
|
|
178
|
+
*
|
|
179
|
+
* @type {?Object<string, number>}
|
|
180
|
+
* @default null
|
|
181
|
+
*/
|
|
182
|
+
this.attributesId = null;
|
|
183
|
+
|
|
174
184
|
/**
|
|
175
185
|
* A reference to a render pipeline the render
|
|
176
186
|
* object is processed with.
|
|
@@ -290,7 +300,7 @@ class RenderObject {
|
|
|
290
300
|
|
|
291
301
|
/**
|
|
292
302
|
* An event listener which is executed when `dispose()` is called on
|
|
293
|
-
* the render object
|
|
303
|
+
* the material of this render object.
|
|
294
304
|
*
|
|
295
305
|
* @method
|
|
296
306
|
*/
|
|
@@ -300,7 +310,23 @@ class RenderObject {
|
|
|
300
310
|
|
|
301
311
|
};
|
|
302
312
|
|
|
313
|
+
/**
|
|
314
|
+
* An event listener which is executed when `dispose()` is called on
|
|
315
|
+
* the geometry of this render object.
|
|
316
|
+
*
|
|
317
|
+
* @method
|
|
318
|
+
*/
|
|
319
|
+
this.onGeometryDispose = () => {
|
|
320
|
+
|
|
321
|
+
// clear geometry cache attributes
|
|
322
|
+
|
|
323
|
+
this.attributes = null;
|
|
324
|
+
this.attributesId = null;
|
|
325
|
+
|
|
326
|
+
};
|
|
327
|
+
|
|
303
328
|
this.material.addEventListener( 'dispose', this.onMaterialDispose );
|
|
329
|
+
this.geometry.addEventListener( 'dispose', this.onGeometryDispose );
|
|
304
330
|
|
|
305
331
|
}
|
|
306
332
|
|
|
@@ -439,6 +465,7 @@ class RenderObject {
|
|
|
439
465
|
|
|
440
466
|
this.geometry = geometry;
|
|
441
467
|
this.attributes = null;
|
|
468
|
+
this.attributesId = null;
|
|
442
469
|
|
|
443
470
|
}
|
|
444
471
|
|
|
@@ -458,9 +485,25 @@ class RenderObject {
|
|
|
458
485
|
const attributes = [];
|
|
459
486
|
const vertexBuffers = new Set();
|
|
460
487
|
|
|
488
|
+
const attributesId = {};
|
|
489
|
+
|
|
461
490
|
for ( const nodeAttribute of nodeAttributes ) {
|
|
462
491
|
|
|
463
|
-
|
|
492
|
+
let attribute;
|
|
493
|
+
|
|
494
|
+
if ( nodeAttribute.node && nodeAttribute.node.attribute ) {
|
|
495
|
+
|
|
496
|
+
// node attribute
|
|
497
|
+
attribute = nodeAttribute.node.attribute;
|
|
498
|
+
|
|
499
|
+
} else {
|
|
500
|
+
|
|
501
|
+
// geometry attribute
|
|
502
|
+
attribute = geometry.getAttribute( nodeAttribute.name );
|
|
503
|
+
|
|
504
|
+
attributesId[ nodeAttribute.name ] = attribute.version;
|
|
505
|
+
|
|
506
|
+
}
|
|
464
507
|
|
|
465
508
|
if ( attribute === undefined ) continue;
|
|
466
509
|
|
|
@@ -472,6 +515,7 @@ class RenderObject {
|
|
|
472
515
|
}
|
|
473
516
|
|
|
474
517
|
this.attributes = attributes;
|
|
518
|
+
this.attributesId = attributesId;
|
|
475
519
|
this.vertexBuffers = Array.from( vertexBuffers.values() );
|
|
476
520
|
|
|
477
521
|
return attributes;
|
|
@@ -509,7 +553,18 @@ class RenderObject {
|
|
|
509
553
|
|
|
510
554
|
const index = this.getIndex();
|
|
511
555
|
const hasIndex = ( index !== null );
|
|
512
|
-
|
|
556
|
+
|
|
557
|
+
let instanceCount = 1;
|
|
558
|
+
|
|
559
|
+
if ( geometry.isInstancedBufferGeometry === true ) {
|
|
560
|
+
|
|
561
|
+
instanceCount = geometry.instanceCount;
|
|
562
|
+
|
|
563
|
+
} else if ( object.count !== undefined ) {
|
|
564
|
+
|
|
565
|
+
instanceCount = Math.max( 0, object.count );
|
|
566
|
+
|
|
567
|
+
}
|
|
513
568
|
|
|
514
569
|
if ( instanceCount === 0 ) return null;
|
|
515
570
|
|
|
@@ -725,7 +780,27 @@ class RenderObject {
|
|
|
725
780
|
*/
|
|
726
781
|
get needsGeometryUpdate() {
|
|
727
782
|
|
|
728
|
-
|
|
783
|
+
if ( this.geometry.id !== this.object.geometry.id ) return true;
|
|
784
|
+
|
|
785
|
+
if ( this.attributes !== null ) {
|
|
786
|
+
|
|
787
|
+
const attributesId = this.attributesId;
|
|
788
|
+
|
|
789
|
+
for ( const name in attributesId ) {
|
|
790
|
+
|
|
791
|
+
const attribute = this.geometry.getAttribute( name );
|
|
792
|
+
|
|
793
|
+
if ( attribute === undefined || attributesId[ name ] !== attribute.id ) {
|
|
794
|
+
|
|
795
|
+
return true;
|
|
796
|
+
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
return false;
|
|
729
804
|
|
|
730
805
|
}
|
|
731
806
|
|
|
@@ -803,6 +878,7 @@ class RenderObject {
|
|
|
803
878
|
dispose() {
|
|
804
879
|
|
|
805
880
|
this.material.removeEventListener( 'dispose', this.onMaterialDispose );
|
|
881
|
+
this.geometry.removeEventListener( 'dispose', this.onGeometryDispose );
|
|
806
882
|
|
|
807
883
|
this.onDispose();
|
|
808
884
|
|
|
@@ -22,16 +22,21 @@ import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
|
|
|
22
22
|
|
|
23
23
|
import { Scene } from '../../scenes/Scene.js';
|
|
24
24
|
import { Frustum } from '../../math/Frustum.js';
|
|
25
|
+
import { FrustumArray } from '../../math/FrustumArray.js';
|
|
25
26
|
import { Matrix4 } from '../../math/Matrix4.js';
|
|
26
27
|
import { Vector2 } from '../../math/Vector2.js';
|
|
27
28
|
import { Vector4 } from '../../math/Vector4.js';
|
|
28
29
|
import { RenderTarget } from '../../core/RenderTarget.js';
|
|
29
30
|
import { DoubleSide, BackSide, FrontSide, SRGBColorSpace, NoToneMapping, LinearFilter, LinearSRGBColorSpace, HalfFloatType, RGBAFormat, PCFShadowMap } from '../../constants.js';
|
|
30
31
|
|
|
32
|
+
import { highpModelNormalViewMatrix, highpModelViewMatrix } from '../../nodes/accessors/ModelNode.js';
|
|
33
|
+
|
|
31
34
|
const _scene = /*@__PURE__*/ new Scene();
|
|
32
35
|
const _drawingBufferSize = /*@__PURE__*/ new Vector2();
|
|
33
36
|
const _screen = /*@__PURE__*/ new Vector4();
|
|
34
37
|
const _frustum = /*@__PURE__*/ new Frustum();
|
|
38
|
+
const _frustumArray = /*@__PURE__*/ new FrustumArray();
|
|
39
|
+
|
|
35
40
|
const _projScreenMatrix = /*@__PURE__*/ new Matrix4();
|
|
36
41
|
const _vector4 = /*@__PURE__*/ new Vector4();
|
|
37
42
|
|
|
@@ -54,6 +59,7 @@ class Renderer {
|
|
|
54
59
|
* @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.
|
|
55
60
|
* @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best
|
|
56
61
|
* quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though.
|
|
62
|
+
* @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported.
|
|
57
63
|
*/
|
|
58
64
|
|
|
59
65
|
/**
|
|
@@ -84,7 +90,8 @@ class Renderer {
|
|
|
84
90
|
antialias = false,
|
|
85
91
|
samples = 0,
|
|
86
92
|
getFallback = null,
|
|
87
|
-
colorBufferType = HalfFloatType
|
|
93
|
+
colorBufferType = HalfFloatType,
|
|
94
|
+
multiview = false
|
|
88
95
|
} = parameters;
|
|
89
96
|
|
|
90
97
|
/**
|
|
@@ -225,7 +232,15 @@ class Renderer {
|
|
|
225
232
|
*/
|
|
226
233
|
this.info = new Info();
|
|
227
234
|
|
|
228
|
-
|
|
235
|
+
/**
|
|
236
|
+
* Stores override nodes for specific transformations or calculations.
|
|
237
|
+
* These nodes can be used to replace default behavior in the rendering pipeline.
|
|
238
|
+
*
|
|
239
|
+
* @type {Object}
|
|
240
|
+
* @property {?Node} modelViewMatrix - An override node for the model-view matrix.
|
|
241
|
+
* @property {?Node} modelNormalViewMatrix - An override node for the model normal view matrix.
|
|
242
|
+
*/
|
|
243
|
+
this.overrideNodes = {
|
|
229
244
|
modelViewMatrix: null,
|
|
230
245
|
modelNormalViewMatrix: null
|
|
231
246
|
};
|
|
@@ -676,7 +691,7 @@ class Renderer {
|
|
|
676
691
|
*
|
|
677
692
|
* @type {XRManager}
|
|
678
693
|
*/
|
|
679
|
-
this.xr = new XRManager( this );
|
|
694
|
+
this.xr = new XRManager( this, multiview );
|
|
680
695
|
|
|
681
696
|
/**
|
|
682
697
|
* Debug configuration.
|
|
@@ -977,6 +992,43 @@ class Renderer {
|
|
|
977
992
|
|
|
978
993
|
}
|
|
979
994
|
|
|
995
|
+
/**
|
|
996
|
+
* Enables or disables high precision for model-view and normal-view matrices.
|
|
997
|
+
* When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance.
|
|
998
|
+
*
|
|
999
|
+
* NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`.
|
|
1000
|
+
*
|
|
1001
|
+
* @param {boolean} value - Whether to enable or disable high precision.
|
|
1002
|
+
* @type {boolean}
|
|
1003
|
+
*/
|
|
1004
|
+
set highPrecision( value ) {
|
|
1005
|
+
|
|
1006
|
+
if ( value === true ) {
|
|
1007
|
+
|
|
1008
|
+
this.overrideNodes.modelViewMatrix = highpModelViewMatrix;
|
|
1009
|
+
this.overrideNodes.modelNormalViewMatrix = highpModelNormalViewMatrix;
|
|
1010
|
+
|
|
1011
|
+
} else if ( this.highPrecision ) {
|
|
1012
|
+
|
|
1013
|
+
this.overrideNodes.modelViewMatrix = null;
|
|
1014
|
+
this.overrideNodes.modelNormalViewMatrix = null;
|
|
1015
|
+
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Returns whether high precision is enabled or not.
|
|
1022
|
+
*
|
|
1023
|
+
* @return {boolean} Whether high precision is enabled or not.
|
|
1024
|
+
* @type {boolean}
|
|
1025
|
+
*/
|
|
1026
|
+
get highPrecision() {
|
|
1027
|
+
|
|
1028
|
+
return this.overrideNodes.modelViewMatrix === highpModelViewMatrix && this.overrideNodes.modelNormalViewMatrix === highpModelNormalViewMatrix;
|
|
1029
|
+
|
|
1030
|
+
}
|
|
1031
|
+
|
|
980
1032
|
/**
|
|
981
1033
|
* Sets the given MRT configuration.
|
|
982
1034
|
*
|
|
@@ -1187,14 +1239,28 @@ class Renderer {
|
|
|
1187
1239
|
|
|
1188
1240
|
}
|
|
1189
1241
|
|
|
1242
|
+
const outputRenderTarget = this.getOutputRenderTarget();
|
|
1243
|
+
|
|
1190
1244
|
frameBufferTarget.depthBuffer = depth;
|
|
1191
1245
|
frameBufferTarget.stencilBuffer = stencil;
|
|
1192
|
-
|
|
1246
|
+
if ( outputRenderTarget !== null ) {
|
|
1247
|
+
|
|
1248
|
+
frameBufferTarget.setSize( outputRenderTarget.width, outputRenderTarget.height, outputRenderTarget.depth );
|
|
1249
|
+
|
|
1250
|
+
} else {
|
|
1251
|
+
|
|
1252
|
+
frameBufferTarget.setSize( width, height, 1 );
|
|
1253
|
+
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1193
1256
|
frameBufferTarget.viewport.copy( this._viewport );
|
|
1194
1257
|
frameBufferTarget.scissor.copy( this._scissor );
|
|
1195
1258
|
frameBufferTarget.viewport.multiplyScalar( this._pixelRatio );
|
|
1196
1259
|
frameBufferTarget.scissor.multiplyScalar( this._pixelRatio );
|
|
1197
1260
|
frameBufferTarget.scissorTest = this._scissorTest;
|
|
1261
|
+
frameBufferTarget.multiview = outputRenderTarget !== null ? outputRenderTarget.multiview : false;
|
|
1262
|
+
frameBufferTarget.resolveDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.resolveDepthBuffer : true;
|
|
1263
|
+
frameBufferTarget._autoAllocateDepthBuffer = outputRenderTarget !== null ? outputRenderTarget._autoAllocateDepthBuffer : false;
|
|
1198
1264
|
|
|
1199
1265
|
return frameBufferTarget;
|
|
1200
1266
|
|
|
@@ -1341,8 +1407,14 @@ class Renderer {
|
|
|
1341
1407
|
|
|
1342
1408
|
//
|
|
1343
1409
|
|
|
1344
|
-
|
|
1345
|
-
|
|
1410
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
1411
|
+
|
|
1412
|
+
if ( ! camera.isArrayCamera ) {
|
|
1413
|
+
|
|
1414
|
+
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
|
|
1415
|
+
frustum.setFromProjectionMatrix( _projScreenMatrix, coordinateSystem );
|
|
1416
|
+
|
|
1417
|
+
}
|
|
1346
1418
|
|
|
1347
1419
|
const renderList = this._renderLists.get( scene, camera );
|
|
1348
1420
|
renderList.begin();
|
|
@@ -1396,6 +1468,7 @@ class Renderer {
|
|
|
1396
1468
|
|
|
1397
1469
|
//
|
|
1398
1470
|
|
|
1471
|
+
renderContext.camera = camera;
|
|
1399
1472
|
this.backend.beginRender( renderContext );
|
|
1400
1473
|
|
|
1401
1474
|
// process render lists
|
|
@@ -1443,6 +1516,15 @@ class Renderer {
|
|
|
1443
1516
|
|
|
1444
1517
|
}
|
|
1445
1518
|
|
|
1519
|
+
_setXRLayerSize( width, height ) {
|
|
1520
|
+
|
|
1521
|
+
this._width = width;
|
|
1522
|
+
this._height = height;
|
|
1523
|
+
|
|
1524
|
+
this.setViewport( 0, 0, width, height );
|
|
1525
|
+
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1446
1528
|
/**
|
|
1447
1529
|
* The output pass performs tone mapping and color space conversion.
|
|
1448
1530
|
*
|
|
@@ -2163,6 +2245,21 @@ class Renderer {
|
|
|
2163
2245
|
|
|
2164
2246
|
}
|
|
2165
2247
|
|
|
2248
|
+
/**
|
|
2249
|
+
* Resets the renderer to the initial state before WebXR started.
|
|
2250
|
+
*
|
|
2251
|
+
*/
|
|
2252
|
+
_resetXRState() {
|
|
2253
|
+
|
|
2254
|
+
this.backend.setXRTarget( null );
|
|
2255
|
+
this.setOutputRenderTarget( null );
|
|
2256
|
+
this.setRenderTarget( null );
|
|
2257
|
+
|
|
2258
|
+
this._frameBufferTarget.dispose();
|
|
2259
|
+
this._frameBufferTarget = null;
|
|
2260
|
+
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2166
2263
|
/**
|
|
2167
2264
|
* Callback for {@link Renderer#setRenderObjectFunction}.
|
|
2168
2265
|
*
|
|
@@ -2545,7 +2642,9 @@ class Renderer {
|
|
|
2545
2642
|
|
|
2546
2643
|
} else if ( object.isSprite ) {
|
|
2547
2644
|
|
|
2548
|
-
|
|
2645
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
2646
|
+
|
|
2647
|
+
if ( ! object.frustumCulled || frustum.intersectsSprite( object, camera ) ) {
|
|
2549
2648
|
|
|
2550
2649
|
if ( this.sortObjects === true ) {
|
|
2551
2650
|
|
|
@@ -2569,7 +2668,9 @@ class Renderer {
|
|
|
2569
2668
|
|
|
2570
2669
|
} else if ( object.isMesh || object.isLine || object.isPoints ) {
|
|
2571
2670
|
|
|
2572
|
-
|
|
2671
|
+
const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
|
|
2672
|
+
|
|
2673
|
+
if ( ! object.frustumCulled || frustum.intersectsObject( object, camera ) ) {
|
|
2573
2674
|
|
|
2574
2675
|
const { geometry, material } = object;
|
|
2575
2676
|
|
|
@@ -2791,6 +2892,13 @@ class Renderer {
|
|
|
2791
2892
|
|
|
2792
2893
|
}
|
|
2793
2894
|
|
|
2895
|
+
if ( material.castShadowPositionNode && material.castShadowPositionNode.isNode ) {
|
|
2896
|
+
|
|
2897
|
+
overridePositionNode = overrideMaterial.positionNode;
|
|
2898
|
+
overrideMaterial.positionNode = material.castShadowPositionNode;
|
|
2899
|
+
|
|
2900
|
+
}
|
|
2901
|
+
|
|
2794
2902
|
}
|
|
2795
2903
|
|
|
2796
2904
|
material = overrideMaterial;
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
|
|
79
|
+
export default Storage3DTexture;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Texture } from '../../textures/Texture.js';
|
|
2
|
+
import { LinearFilter } 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 StorageArrayTexture 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
|
|
27
|
+
this.isArrayTexture = true;
|
|
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 flag can be used for type testing.
|
|
52
|
+
*
|
|
53
|
+
* @type {boolean}
|
|
54
|
+
* @readonly
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
this.isStorageTexture = true;
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default StorageArrayTexture;
|
|
@@ -2,7 +2,7 @@ import DataMap from './DataMap.js';
|
|
|
2
2
|
|
|
3
3
|
import { Vector3 } from '../../math/Vector3.js';
|
|
4
4
|
import { DepthTexture } from '../../textures/DepthTexture.js';
|
|
5
|
-
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type,
|
|
5
|
+
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedByteType } from '../../constants.js';
|
|
6
6
|
|
|
7
7
|
const _size = /*@__PURE__*/ new Vector3();
|
|
8
8
|
|
|
@@ -77,10 +77,13 @@ class Textures extends DataMap {
|
|
|
77
77
|
if ( depthTexture === undefined && useDepthTexture ) {
|
|
78
78
|
|
|
79
79
|
depthTexture = new DepthTexture();
|
|
80
|
+
|
|
80
81
|
depthTexture.format = renderTarget.stencilBuffer ? DepthStencilFormat : DepthFormat;
|
|
81
82
|
depthTexture.type = renderTarget.stencilBuffer ? UnsignedInt248Type : UnsignedIntType; // FloatType
|
|
82
83
|
depthTexture.image.width = mipWidth;
|
|
83
84
|
depthTexture.image.height = mipHeight;
|
|
85
|
+
depthTexture.image.depth = size.depth;
|
|
86
|
+
depthTexture.isArrayTexture = renderTarget.multiview === true && size.depth > 1;
|
|
84
87
|
|
|
85
88
|
depthTextureMips[ activeMipmapLevel ] = depthTexture;
|
|
86
89
|
|
|
@@ -95,6 +98,7 @@ class Textures extends DataMap {
|
|
|
95
98
|
depthTexture.needsUpdate = true;
|
|
96
99
|
depthTexture.image.width = mipWidth;
|
|
97
100
|
depthTexture.image.height = mipHeight;
|
|
101
|
+
depthTexture.image.depth = depthTexture.isArrayTexture ? depthTexture.image.depth : 1;
|
|
98
102
|
|
|
99
103
|
}
|
|
100
104
|
|
|
@@ -330,8 +334,6 @@ class Textures extends DataMap {
|
|
|
330
334
|
|
|
331
335
|
this._destroyTexture( texture );
|
|
332
336
|
|
|
333
|
-
this.info.memory.textures --;
|
|
334
|
-
|
|
335
337
|
};
|
|
336
338
|
|
|
337
339
|
texture.addEventListener( 'dispose', onDispose );
|
|
@@ -420,21 +422,7 @@ class Textures extends DataMap {
|
|
|
420
422
|
*/
|
|
421
423
|
needsMipmaps( texture ) {
|
|
422
424
|
|
|
423
|
-
return
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Returns `true` if the given texture is an environment map.
|
|
429
|
-
*
|
|
430
|
-
* @param {Texture} texture - The texture.
|
|
431
|
-
* @return {boolean} Whether the given texture is an environment map or not.
|
|
432
|
-
*/
|
|
433
|
-
isEnvironmentTexture( texture ) {
|
|
434
|
-
|
|
435
|
-
const mapping = texture.mapping;
|
|
436
|
-
|
|
437
|
-
return ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) || ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping );
|
|
425
|
+
return texture.isCompressedTexture === true || texture.generateMipmaps;
|
|
438
426
|
|
|
439
427
|
}
|
|
440
428
|
|
|
@@ -446,10 +434,16 @@ class Textures extends DataMap {
|
|
|
446
434
|
*/
|
|
447
435
|
_destroyTexture( texture ) {
|
|
448
436
|
|
|
449
|
-
this.
|
|
450
|
-
|
|
437
|
+
if ( this.has( texture ) === true ) {
|
|
438
|
+
|
|
439
|
+
this.backend.destroySampler( texture );
|
|
440
|
+
this.backend.destroyTexture( texture );
|
|
451
441
|
|
|
452
|
-
|
|
442
|
+
this.delete( texture );
|
|
443
|
+
|
|
444
|
+
this.info.memory.textures --;
|
|
445
|
+
|
|
446
|
+
}
|
|
453
447
|
|
|
454
448
|
}
|
|
455
449
|
|
|
@@ -129,38 +129,34 @@ class UniformsGroup extends UniformBuffer {
|
|
|
129
129
|
*/
|
|
130
130
|
get byteLength() {
|
|
131
131
|
|
|
132
|
+
const bytesPerElement = this.bytesPerElement;
|
|
133
|
+
|
|
132
134
|
let offset = 0; // global buffer offset in bytes
|
|
133
135
|
|
|
134
136
|
for ( let i = 0, l = this.uniforms.length; i < l; i ++ ) {
|
|
135
137
|
|
|
136
138
|
const uniform = this.uniforms[ i ];
|
|
137
139
|
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
// offset within a single chunk in bytes
|
|
141
|
-
|
|
142
|
-
const chunkOffset = offset % GPU_CHUNK_BYTES;
|
|
143
|
-
const remainingSizeInChunk = GPU_CHUNK_BYTES - chunkOffset;
|
|
144
|
-
|
|
145
|
-
// conformance tests
|
|
146
|
-
|
|
147
|
-
if ( chunkOffset !== 0 && ( remainingSizeInChunk - boundary ) < 0 ) {
|
|
148
|
-
|
|
149
|
-
// check for chunk overflow
|
|
140
|
+
const boundary = uniform.boundary;
|
|
141
|
+
const itemSize = uniform.itemSize * bytesPerElement; // size of the uniform in bytes
|
|
150
142
|
|
|
151
|
-
|
|
143
|
+
const chunkOffset = offset % GPU_CHUNK_BYTES; // offset in the current chunk
|
|
144
|
+
const chunkPadding = chunkOffset % boundary; // required padding to match boundary
|
|
145
|
+
const chunkStart = chunkOffset + chunkPadding; // start position in the current chunk for the data
|
|
152
146
|
|
|
153
|
-
|
|
147
|
+
offset += chunkPadding;
|
|
154
148
|
|
|
155
|
-
|
|
149
|
+
// Check for chunk overflow
|
|
150
|
+
if ( chunkStart !== 0 && ( GPU_CHUNK_BYTES - chunkStart ) < itemSize ) {
|
|
156
151
|
|
|
157
|
-
|
|
152
|
+
// Add padding to the end of the chunk
|
|
153
|
+
offset += ( GPU_CHUNK_BYTES - chunkStart );
|
|
158
154
|
|
|
159
155
|
}
|
|
160
156
|
|
|
161
|
-
uniform.offset =
|
|
157
|
+
uniform.offset = offset / bytesPerElement;
|
|
162
158
|
|
|
163
|
-
offset +=
|
|
159
|
+
offset += itemSize;
|
|
164
160
|
|
|
165
161
|
}
|
|
166
162
|
|