super-three 0.176.0 → 0.177.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 +7631 -6743
- package/build/three.core.js +7496 -6758
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +172 -22
- package/build/three.module.min.js +1 -1
- package/build/three.tsl.js +14 -6
- package/build/three.tsl.min.js +1 -1
- package/build/three.webgpu.js +3948 -1678
- package/build/three.webgpu.min.js +1 -1
- package/build/three.webgpu.nodes.js +3941 -1678
- 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 -0
- package/examples/jsm/capabilities/WebGPU.js +1 -0
- package/examples/jsm/controls/ArcballControls.js +14 -3
- 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 +1 -0
- 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 +1 -0
- 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 +5 -4
- 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 +24 -22
- 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 +58 -1
- 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 +5 -6
- 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/GLSLDecoder.js +1 -2
- package/examples/jsm/transpiler/TSLEncoder.js +52 -8
- package/examples/jsm/transpiler/Transpiler.js +2 -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/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 +2 -27
- 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 +3 -2
- 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 +13 -5
- package/src/Three.WebGPU.Nodes.js +1 -0
- package/src/Three.WebGPU.js +1 -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 +1 -1
- package/src/core/BufferGeometry.js +2 -5
- package/src/core/Object3D.js +22 -21
- 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/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/ImageBitmapLoader.js +21 -5
- 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/NodeMaterial.js +81 -18
- 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/FrustumArray.js +253 -0
- package/src/math/Ray.js +2 -0
- package/src/math/Sphere.js +28 -0
- package/src/nodes/Nodes.js +1 -0
- package/src/nodes/TSL.js +1 -0
- package/src/nodes/accessors/Bitangent.js +31 -9
- 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 +26 -6
- package/src/nodes/accessors/Object3DNode.js +6 -7
- 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/SkinningNode.js +3 -2
- package/src/nodes/accessors/StorageBufferNode.js +25 -0
- package/src/nodes/accessors/StorageTextureNode.js +14 -3
- package/src/nodes/accessors/TextureNode.js +59 -8
- 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/CacheNode.js +14 -0
- package/src/nodes/core/ContextNode.js +7 -3
- package/src/nodes/core/Node.js +68 -19
- package/src/nodes/core/NodeBuilder.js +100 -12
- 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 +127 -2
- package/src/nodes/core/StructTypeNode.js +26 -4
- package/src/nodes/core/VarNode.js +11 -2
- package/src/nodes/core/VaryingNode.js +40 -21
- package/src/nodes/display/BlendModes.js +42 -1
- package/src/nodes/display/ColorSpaceNode.js +4 -27
- package/src/nodes/display/PassNode.js +8 -11
- package/src/nodes/functions/ShadowMaskModel.js +5 -1
- 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/HemisphereLightNode.js +2 -2
- package/src/nodes/lighting/IESSpotLightNode.js +2 -1
- package/src/nodes/lighting/LightsNode.js +25 -7
- 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 +172 -240
- package/src/nodes/lighting/SpotLightNode.js +44 -7
- package/src/nodes/materialx/lib/mx_noise.js +1 -1
- package/src/nodes/math/MathNode.js +56 -20
- package/src/nodes/math/OperatorNode.js +109 -82
- package/src/nodes/shapes/Shapes.js +5 -4
- package/src/nodes/tsl/TSLCore.js +140 -49
- package/src/nodes/utils/DebugNode.js +15 -3
- package/src/nodes/utils/Discard.js +2 -2
- package/src/nodes/utils/LoopNode.js +64 -17
- package/src/nodes/utils/ReflectorNode.js +67 -4
- 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 +21 -10
- package/src/renderers/common/Animation.js +2 -2
- package/src/renderers/common/Background.js +11 -0
- package/src/renderers/common/RenderList.js +0 -4
- package/src/renderers/common/RenderObject.js +12 -1
- package/src/renderers/common/Renderer.js +116 -8
- 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 +154 -25
- package/src/renderers/common/extras/PMREMGenerator.js +29 -22
- 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/ShaderLib/background.glsl.js +1 -1
- package/src/renderers/webgl/WebGLShadowMap.js +3 -2
- package/src/renderers/webgl/WebGLTextures.js +143 -4
- package/src/renderers/webgl/WebGLUtils.js +1 -3
- package/src/renderers/webgl-fallback/WebGLBackend.js +170 -34
- package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +75 -7
- package/src/renderers/webgl-fallback/utils/WebGLConstants.js +1 -0
- package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +42 -29
- package/src/renderers/webgl-fallback/utils/WebGLUtils.js +22 -21
- package/src/renderers/webgpu/WebGPUBackend.js +442 -127
- 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 +75 -27
- package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +3 -0
- package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +3 -1
- package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +18 -5
- package/src/renderers/webgpu/utils/WebGPUConstants.js +1 -1
- package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +34 -4
- package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +44 -49
- 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
|
@@ -746,6 +746,114 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
746
746
|
|
|
747
747
|
}
|
|
748
748
|
|
|
749
|
+
function getRow( index, rowLength, componentStride ) {
|
|
750
|
+
|
|
751
|
+
return Math.floor( Math.floor( index / componentStride ) / rowLength );
|
|
752
|
+
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
function updateTexture( texture, image, glFormat, glType ) {
|
|
756
|
+
|
|
757
|
+
const componentStride = 4; // only RGBA supported
|
|
758
|
+
|
|
759
|
+
const updateRanges = texture.updateRanges;
|
|
760
|
+
|
|
761
|
+
if ( updateRanges.length === 0 ) {
|
|
762
|
+
|
|
763
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
|
|
764
|
+
|
|
765
|
+
} else {
|
|
766
|
+
|
|
767
|
+
// Before applying update ranges, we merge any adjacent / overlapping
|
|
768
|
+
// ranges to reduce load on `gl.texSubImage2D`. Empirically, this has led
|
|
769
|
+
// to performance improvements for applications which make heavy use of
|
|
770
|
+
// update ranges. Likely due to GPU command overhead.
|
|
771
|
+
//
|
|
772
|
+
// Note that to reduce garbage collection between frames, we merge the
|
|
773
|
+
// update ranges in-place. This is safe because this method will clear the
|
|
774
|
+
// update ranges once updated.
|
|
775
|
+
|
|
776
|
+
updateRanges.sort( ( a, b ) => a.start - b.start );
|
|
777
|
+
|
|
778
|
+
// To merge the update ranges in-place, we work from left to right in the
|
|
779
|
+
// existing updateRanges array, merging ranges. This may result in a final
|
|
780
|
+
// array which is smaller than the original. This index tracks the last
|
|
781
|
+
// index representing a merged range, any data after this index can be
|
|
782
|
+
// trimmed once the merge algorithm is completed.
|
|
783
|
+
let mergeIndex = 0;
|
|
784
|
+
|
|
785
|
+
for ( let i = 1; i < updateRanges.length; i ++ ) {
|
|
786
|
+
|
|
787
|
+
const previousRange = updateRanges[ mergeIndex ];
|
|
788
|
+
const range = updateRanges[ i ];
|
|
789
|
+
|
|
790
|
+
// Only merge if in the same row and overlapping/adjacent
|
|
791
|
+
const previousEnd = previousRange.start + previousRange.count;
|
|
792
|
+
const currentRow = getRow( range.start, image.width, componentStride );
|
|
793
|
+
const previousRow = getRow( previousRange.start, image.width, componentStride );
|
|
794
|
+
|
|
795
|
+
// We add one here to merge adjacent ranges. This is safe because ranges
|
|
796
|
+
// operate over positive integers.
|
|
797
|
+
if (
|
|
798
|
+
range.start <= previousEnd + 1 &&
|
|
799
|
+
currentRow === previousRow &&
|
|
800
|
+
getRow( range.start + range.count - 1, image.width, componentStride ) === currentRow // ensure range doesn't spill
|
|
801
|
+
) {
|
|
802
|
+
|
|
803
|
+
previousRange.count = Math.max(
|
|
804
|
+
previousRange.count,
|
|
805
|
+
range.start + range.count - previousRange.start
|
|
806
|
+
);
|
|
807
|
+
|
|
808
|
+
} else {
|
|
809
|
+
|
|
810
|
+
++ mergeIndex;
|
|
811
|
+
updateRanges[ mergeIndex ] = range;
|
|
812
|
+
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// Trim the array to only contain the merged ranges.
|
|
819
|
+
updateRanges.length = mergeIndex + 1;
|
|
820
|
+
|
|
821
|
+
const currentUnpackRowLen = _gl.getParameter( _gl.UNPACK_ROW_LENGTH );
|
|
822
|
+
const currentUnpackSkipPixels = _gl.getParameter( _gl.UNPACK_SKIP_PIXELS );
|
|
823
|
+
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
|
|
824
|
+
|
|
825
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
|
|
826
|
+
|
|
827
|
+
for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
|
|
828
|
+
|
|
829
|
+
const range = updateRanges[ i ];
|
|
830
|
+
|
|
831
|
+
const pixelStart = Math.floor( range.start / componentStride );
|
|
832
|
+
const pixelCount = Math.ceil( range.count / componentStride );
|
|
833
|
+
|
|
834
|
+
const x = pixelStart % image.width;
|
|
835
|
+
const y = Math.floor( pixelStart / image.width );
|
|
836
|
+
|
|
837
|
+
// Assumes update ranges refer to contiguous memory
|
|
838
|
+
const width = pixelCount;
|
|
839
|
+
const height = 1;
|
|
840
|
+
|
|
841
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, x );
|
|
842
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, y );
|
|
843
|
+
|
|
844
|
+
state.texSubImage2D( _gl.TEXTURE_2D, 0, x, y, width, height, glFormat, glType, image.data );
|
|
845
|
+
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
texture.clearUpdateRanges();
|
|
849
|
+
|
|
850
|
+
_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, currentUnpackRowLen );
|
|
851
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, currentUnpackSkipPixels );
|
|
852
|
+
_gl.pixelStorei( _gl.UNPACK_SKIP_ROWS, currentUnpackSkipRows );
|
|
853
|
+
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
749
857
|
function setDeferTextureUploads( deferFlag ) {
|
|
750
858
|
|
|
751
859
|
_deferTextureUploads = deferFlag;
|
|
@@ -896,7 +1004,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
896
1004
|
|
|
897
1005
|
if ( dataReady ) {
|
|
898
1006
|
|
|
899
|
-
|
|
1007
|
+
updateTexture( texture, image, glFormat, glType );
|
|
900
1008
|
|
|
901
1009
|
}
|
|
902
1010
|
|
|
@@ -1795,7 +1903,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1795
1903
|
|
|
1796
1904
|
if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );
|
|
1797
1905
|
|
|
1798
|
-
|
|
1906
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
1907
|
+
|
|
1908
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
1909
|
+
|
|
1910
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer[ 0 ], renderTarget );
|
|
1911
|
+
|
|
1912
|
+
} else {
|
|
1913
|
+
|
|
1914
|
+
setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget );
|
|
1915
|
+
|
|
1916
|
+
}
|
|
1799
1917
|
|
|
1800
1918
|
} else {
|
|
1801
1919
|
|
|
@@ -1826,7 +1944,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
1826
1944
|
|
|
1827
1945
|
} else {
|
|
1828
1946
|
|
|
1829
|
-
|
|
1947
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
1948
|
+
|
|
1949
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
1950
|
+
|
|
1951
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );
|
|
1952
|
+
|
|
1953
|
+
} else {
|
|
1954
|
+
|
|
1955
|
+
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
1956
|
+
|
|
1957
|
+
}
|
|
1830
1958
|
|
|
1831
1959
|
if ( renderTargetProperties.__webglDepthbuffer === undefined ) {
|
|
1832
1960
|
|
|
@@ -2162,7 +2290,18 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
2162
2290
|
}
|
|
2163
2291
|
|
|
2164
2292
|
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer );
|
|
2165
|
-
|
|
2293
|
+
|
|
2294
|
+
const mipmaps = renderTarget.texture.mipmaps;
|
|
2295
|
+
|
|
2296
|
+
if ( mipmaps && mipmaps.length > 0 ) {
|
|
2297
|
+
|
|
2298
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] );
|
|
2299
|
+
|
|
2300
|
+
} else {
|
|
2301
|
+
|
|
2302
|
+
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer );
|
|
2303
|
+
|
|
2304
|
+
}
|
|
2166
2305
|
|
|
2167
2306
|
for ( let i = 0; i < textures.length; i ++ ) {
|
|
2168
2307
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat,
|
|
1
|
+
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat } from '../../constants.js';
|
|
2
2
|
import { ColorManagement } from '../../math/ColorManagement.js';
|
|
3
3
|
|
|
4
4
|
function WebGLUtils( gl, extensions ) {
|
|
@@ -25,8 +25,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
25
25
|
if ( p === AlphaFormat ) return gl.ALPHA;
|
|
26
26
|
if ( p === RGBFormat ) return gl.RGB;
|
|
27
27
|
if ( p === RGBAFormat ) return gl.RGBA;
|
|
28
|
-
if ( p === LuminanceFormat ) return gl.LUMINANCE;
|
|
29
|
-
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
|
|
30
28
|
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
|
|
31
29
|
if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
|
|
32
30
|
|
|
@@ -13,8 +13,11 @@ import { WebGLBufferRenderer } from './WebGLBufferRenderer.js';
|
|
|
13
13
|
|
|
14
14
|
import { warnOnce } from '../../utils.js';
|
|
15
15
|
import { WebGLCoordinateSystem } from '../../constants.js';
|
|
16
|
+
import { Vector2 } from '../../math/Vector2.js';
|
|
16
17
|
import WebGLTimestampQueryPool from './utils/WebGLTimestampQueryPool.js';
|
|
17
18
|
|
|
19
|
+
const _drawingBufferSize = /*@__PURE__*/ new Vector2();
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* A backend implementation targeting WebGL 2.
|
|
20
23
|
*
|
|
@@ -264,6 +267,7 @@ class WebGLBackend extends Backend {
|
|
|
264
267
|
this.extensions.get( 'WEBGL_multisampled_render_to_texture' );
|
|
265
268
|
this.extensions.get( 'WEBGL_render_shared_exponent' );
|
|
266
269
|
this.extensions.get( 'WEBGL_multi_draw' );
|
|
270
|
+
this.extensions.get( 'OVR_multiview2' );
|
|
267
271
|
|
|
268
272
|
this.disjoint = this.extensions.get( 'EXT_disjoint_timer_query_webgl2' );
|
|
269
273
|
this.parallel = this.extensions.get( 'KHR_parallel_shader_compile' );
|
|
@@ -360,7 +364,7 @@ class WebGLBackend extends Backend {
|
|
|
360
364
|
|
|
361
365
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
362
366
|
// are midframe flushes and an external depth texture.
|
|
363
|
-
if ( ( this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) && renderTarget.autoAllocateDepthBuffer ) {
|
|
367
|
+
if ( ( this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) && renderTarget.autoAllocateDepthBuffer === true && renderTarget.multiview === false ) {
|
|
364
368
|
|
|
365
369
|
console.warn( 'THREE.WebGLBackend: Render-to-texture extension was disabled because an external texture was provided' );
|
|
366
370
|
|
|
@@ -440,7 +444,7 @@ class WebGLBackend extends Backend {
|
|
|
440
444
|
*/
|
|
441
445
|
beginRender( renderContext ) {
|
|
442
446
|
|
|
443
|
-
const { state
|
|
447
|
+
const { state } = this;
|
|
444
448
|
const renderContextData = this.get( renderContext );
|
|
445
449
|
|
|
446
450
|
//
|
|
@@ -451,7 +455,8 @@ class WebGLBackend extends Backend {
|
|
|
451
455
|
|
|
452
456
|
} else {
|
|
453
457
|
|
|
454
|
-
|
|
458
|
+
const { width, height } = this.getDrawingBufferSize( _drawingBufferSize );
|
|
459
|
+
state.viewport( 0, 0, width, height );
|
|
455
460
|
|
|
456
461
|
}
|
|
457
462
|
|
|
@@ -471,10 +476,8 @@ class WebGLBackend extends Backend {
|
|
|
471
476
|
this._currentContext = renderContext;
|
|
472
477
|
|
|
473
478
|
this._setFramebuffer( renderContext );
|
|
474
|
-
|
|
475
479
|
this.clear( renderContext.clearColor, renderContext.clearDepth, renderContext.clearStencil, renderContext, false );
|
|
476
480
|
|
|
477
|
-
|
|
478
481
|
const occlusionQueryCount = renderContext.occlusionQueryCount;
|
|
479
482
|
|
|
480
483
|
if ( occlusionQueryCount > 0 ) {
|
|
@@ -545,9 +548,9 @@ class WebGLBackend extends Backend {
|
|
|
545
548
|
|
|
546
549
|
const renderTargetContextData = this.get( renderContext.renderTarget );
|
|
547
550
|
|
|
548
|
-
const { samples } = renderContext.renderTarget;
|
|
551
|
+
const { resolveDepthBuffer, samples } = renderContext.renderTarget;
|
|
549
552
|
|
|
550
|
-
if ( samples > 0 && this.
|
|
553
|
+
if ( samples > 0 && this._useMultisampledExtension( renderContext.renderTarget ) === false ) {
|
|
551
554
|
|
|
552
555
|
const fb = renderTargetContextData.framebuffers[ renderContext.getCacheKey() ];
|
|
553
556
|
|
|
@@ -592,8 +595,13 @@ class WebGLBackend extends Backend {
|
|
|
592
595
|
|
|
593
596
|
}
|
|
594
597
|
|
|
595
|
-
}
|
|
598
|
+
} else if ( resolveDepthBuffer === false && renderTargetContextData.framebuffers ) {
|
|
596
599
|
|
|
600
|
+
const fb = renderTargetContextData.framebuffers[ renderContext.getCacheKey() ];
|
|
601
|
+
state.bindFramebuffer( gl.DRAW_FRAMEBUFFER, fb );
|
|
602
|
+
gl.invalidateFramebuffer( gl.DRAW_FRAMEBUFFER, renderTargetContextData.depthInvalidationArray );
|
|
603
|
+
|
|
604
|
+
}
|
|
597
605
|
|
|
598
606
|
}
|
|
599
607
|
|
|
@@ -607,7 +615,8 @@ class WebGLBackend extends Backend {
|
|
|
607
615
|
|
|
608
616
|
} else {
|
|
609
617
|
|
|
610
|
-
|
|
618
|
+
const { width, height } = this.getDrawingBufferSize( _drawingBufferSize );
|
|
619
|
+
state.viewport( 0, 0, width, height );
|
|
611
620
|
|
|
612
621
|
}
|
|
613
622
|
|
|
@@ -960,6 +969,20 @@ class WebGLBackend extends Backend {
|
|
|
960
969
|
|
|
961
970
|
}
|
|
962
971
|
|
|
972
|
+
/**
|
|
973
|
+
* Internal to determine if the current render target is a render target array with depth 2D array texture.
|
|
974
|
+
*
|
|
975
|
+
* @param {RenderContext} renderContext - The render context.
|
|
976
|
+
* @return {boolean} Whether the render target is a render target array with depth 2D array texture.
|
|
977
|
+
*
|
|
978
|
+
* @private
|
|
979
|
+
*/
|
|
980
|
+
_isRenderCameraDepthArray( renderContext ) {
|
|
981
|
+
|
|
982
|
+
return renderContext.depthTexture && renderContext.depthTexture.isArrayTexture && renderContext.camera.isArrayCamera;
|
|
983
|
+
|
|
984
|
+
}
|
|
985
|
+
|
|
963
986
|
/**
|
|
964
987
|
* Executes a draw command for the given render object.
|
|
965
988
|
*
|
|
@@ -1128,7 +1151,7 @@ class WebGLBackend extends Backend {
|
|
|
1128
1151
|
|
|
1129
1152
|
};
|
|
1130
1153
|
|
|
1131
|
-
if ( renderObject.camera.isArrayCamera && renderObject.camera.cameras.length > 0 ) {
|
|
1154
|
+
if ( renderObject.camera.isArrayCamera === true && renderObject.camera.cameras.length > 0 && renderObject.camera.isMultiViewCamera === false ) {
|
|
1132
1155
|
|
|
1133
1156
|
const cameraData = this.get( renderObject.camera );
|
|
1134
1157
|
const cameras = renderObject.camera.cameras;
|
|
@@ -1159,25 +1182,71 @@ class WebGLBackend extends Backend {
|
|
|
1159
1182
|
const cameraIndexData = this.get( cameraIndex );
|
|
1160
1183
|
const pixelRatio = this.renderer.getPixelRatio();
|
|
1161
1184
|
|
|
1185
|
+
const renderTarget = this._currentContext.renderTarget;
|
|
1186
|
+
const isRenderCameraDepthArray = this._isRenderCameraDepthArray( this._currentContext );
|
|
1187
|
+
const prevActiveCubeFace = this._currentContext.activeCubeFace;
|
|
1188
|
+
|
|
1189
|
+
if ( isRenderCameraDepthArray ) {
|
|
1190
|
+
|
|
1191
|
+
// Clear the depth texture
|
|
1192
|
+
const textureData = this.get( renderTarget.depthTexture );
|
|
1193
|
+
|
|
1194
|
+
if ( textureData.clearedRenderId !== this.renderer._nodes.nodeFrame.renderId ) {
|
|
1195
|
+
|
|
1196
|
+
textureData.clearedRenderId = this.renderer._nodes.nodeFrame.renderId;
|
|
1197
|
+
|
|
1198
|
+
const { stencilBuffer } = renderTarget;
|
|
1199
|
+
|
|
1200
|
+
for ( let i = 0, len = cameras.length; i < len; i ++ ) {
|
|
1201
|
+
|
|
1202
|
+
this.renderer._activeCubeFace = i;
|
|
1203
|
+
this._currentContext.activeCubeFace = i;
|
|
1204
|
+
|
|
1205
|
+
this._setFramebuffer( this._currentContext );
|
|
1206
|
+
this.clear( false, true, stencilBuffer, this._currentContext, false );
|
|
1207
|
+
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
this.renderer._activeCubeFace = prevActiveCubeFace;
|
|
1211
|
+
this._currentContext.activeCubeFace = prevActiveCubeFace;
|
|
1212
|
+
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1162
1217
|
for ( let i = 0, len = cameras.length; i < len; i ++ ) {
|
|
1163
1218
|
|
|
1164
1219
|
const subCamera = cameras[ i ];
|
|
1165
1220
|
|
|
1166
1221
|
if ( object.layers.test( subCamera.layers ) ) {
|
|
1167
1222
|
|
|
1223
|
+
if ( isRenderCameraDepthArray ) {
|
|
1224
|
+
|
|
1225
|
+
// Update the active layer
|
|
1226
|
+
this.renderer._activeCubeFace = i;
|
|
1227
|
+
this._currentContext.activeCubeFace = i;
|
|
1228
|
+
|
|
1229
|
+
this._setFramebuffer( this._currentContext );
|
|
1230
|
+
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1168
1233
|
const vp = subCamera.viewport;
|
|
1169
1234
|
|
|
1170
|
-
|
|
1171
|
-
const y = vp.y * pixelRatio;
|
|
1172
|
-
const width = vp.width * pixelRatio;
|
|
1173
|
-
const height = vp.height * pixelRatio;
|
|
1235
|
+
if ( vp !== undefined ) {
|
|
1174
1236
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1237
|
+
const x = vp.x * pixelRatio;
|
|
1238
|
+
const y = vp.y * pixelRatio;
|
|
1239
|
+
const width = vp.width * pixelRatio;
|
|
1240
|
+
const height = vp.height * pixelRatio;
|
|
1241
|
+
|
|
1242
|
+
state.viewport(
|
|
1243
|
+
Math.floor( x ),
|
|
1244
|
+
Math.floor( renderObject.context.height - height - y ),
|
|
1245
|
+
Math.floor( width ),
|
|
1246
|
+
Math.floor( height )
|
|
1247
|
+
);
|
|
1248
|
+
|
|
1249
|
+
}
|
|
1181
1250
|
|
|
1182
1251
|
state.bindBufferBase( gl.UNIFORM_BUFFER, cameraIndexData.index, cameraData.indexesGPU[ i ] );
|
|
1183
1252
|
|
|
@@ -1185,6 +1254,9 @@ class WebGLBackend extends Backend {
|
|
|
1185
1254
|
|
|
1186
1255
|
}
|
|
1187
1256
|
|
|
1257
|
+
this._currentContext.activeCubeFace = prevActiveCubeFace;
|
|
1258
|
+
this.renderer._activeCubeFace = prevActiveCubeFace;
|
|
1259
|
+
|
|
1188
1260
|
}
|
|
1189
1261
|
|
|
1190
1262
|
} else {
|
|
@@ -1928,15 +2000,15 @@ class WebGLBackend extends Backend {
|
|
|
1928
2000
|
|
|
1929
2001
|
const isCube = renderTarget.isWebGLCubeRenderTarget === true;
|
|
1930
2002
|
const isRenderTarget3D = renderTarget.isRenderTarget3D === true;
|
|
1931
|
-
const isRenderTargetArray = renderTarget.
|
|
2003
|
+
const isRenderTargetArray = renderTarget.depth > 1;
|
|
1932
2004
|
const isXRRenderTarget = renderTarget.isXRRenderTarget === true;
|
|
1933
2005
|
const hasExternalTextures = ( isXRRenderTarget === true && renderTarget.hasExternalTextures === true );
|
|
1934
2006
|
|
|
1935
2007
|
let msaaFb = renderTargetContextData.msaaFrameBuffer;
|
|
1936
2008
|
let depthRenderbuffer = renderTargetContextData.depthRenderbuffer;
|
|
1937
2009
|
const multisampledRTTExt = this.extensions.get( 'WEBGL_multisampled_render_to_texture' );
|
|
1938
|
-
const
|
|
1939
|
-
|
|
2010
|
+
const multiviewExt = this.extensions.get( 'OVR_multiview2' );
|
|
2011
|
+
const useMultisampledRTT = this._useMultisampledExtension( renderTarget );
|
|
1940
2012
|
const cacheKey = getCacheKey( descriptor );
|
|
1941
2013
|
|
|
1942
2014
|
let fb;
|
|
@@ -1966,6 +2038,7 @@ class WebGLBackend extends Backend {
|
|
|
1966
2038
|
state.bindFramebuffer( gl.FRAMEBUFFER, fb );
|
|
1967
2039
|
|
|
1968
2040
|
const textures = descriptor.textures;
|
|
2041
|
+
const depthInvalidationArray = [];
|
|
1969
2042
|
|
|
1970
2043
|
if ( isCube ) {
|
|
1971
2044
|
|
|
@@ -1990,7 +2063,11 @@ class WebGLBackend extends Backend {
|
|
|
1990
2063
|
|
|
1991
2064
|
const attachment = gl.COLOR_ATTACHMENT0 + i;
|
|
1992
2065
|
|
|
1993
|
-
if (
|
|
2066
|
+
if ( renderTarget.multiview ) {
|
|
2067
|
+
|
|
2068
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, attachment, textureData.textureGPU, 0, samples, 0, 2 );
|
|
2069
|
+
|
|
2070
|
+
} else if ( isRenderTarget3D || isRenderTargetArray ) {
|
|
1994
2071
|
|
|
1995
2072
|
const layer = this.renderer._activeCubeFace;
|
|
1996
2073
|
|
|
@@ -1998,7 +2075,7 @@ class WebGLBackend extends Backend {
|
|
|
1998
2075
|
|
|
1999
2076
|
} else {
|
|
2000
2077
|
|
|
2001
|
-
if (
|
|
2078
|
+
if ( useMultisampledRTT ) {
|
|
2002
2079
|
|
|
2003
2080
|
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, textureData.textureGPU, 0, samples );
|
|
2004
2081
|
|
|
@@ -2016,28 +2093,50 @@ class WebGLBackend extends Backend {
|
|
|
2016
2093
|
|
|
2017
2094
|
}
|
|
2018
2095
|
|
|
2019
|
-
|
|
2096
|
+
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
2097
|
+
|
|
2098
|
+
if ( renderTarget.autoAllocateDepthBuffer === true ) {
|
|
2020
2099
|
|
|
2021
2100
|
const renderbuffer = gl.createRenderbuffer();
|
|
2022
2101
|
this.textureUtils.setupRenderBufferStorage( renderbuffer, descriptor, 0, useMultisampledRTT );
|
|
2023
2102
|
renderTargetContextData.xrDepthRenderbuffer = renderbuffer;
|
|
2103
|
+
depthInvalidationArray.push( stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT );
|
|
2104
|
+
|
|
2105
|
+
gl.bindRenderbuffer( gl.RENDERBUFFER, renderbuffer );
|
|
2106
|
+
gl.framebufferRenderbuffer( gl.FRAMEBUFFER, depthStyle, gl.RENDERBUFFER, renderbuffer );
|
|
2107
|
+
|
|
2024
2108
|
|
|
2025
2109
|
} else {
|
|
2026
2110
|
|
|
2027
2111
|
if ( descriptor.depthTexture !== null ) {
|
|
2028
2112
|
|
|
2113
|
+
depthInvalidationArray.push( stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT );
|
|
2114
|
+
|
|
2029
2115
|
const textureData = this.get( descriptor.depthTexture );
|
|
2030
|
-
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
2031
2116
|
textureData.renderTarget = descriptor.renderTarget;
|
|
2032
2117
|
textureData.cacheKey = cacheKey; // required for copyTextureToTexture()
|
|
2033
2118
|
|
|
2034
|
-
if (
|
|
2119
|
+
if ( renderTarget.multiview ) {
|
|
2120
|
+
|
|
2121
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, samples, 0, 2 );
|
|
2122
|
+
|
|
2123
|
+
} else if ( hasExternalTextures && useMultisampledRTT ) {
|
|
2035
2124
|
|
|
2036
2125
|
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0, samples );
|
|
2037
2126
|
|
|
2038
2127
|
} else {
|
|
2039
2128
|
|
|
2040
|
-
|
|
2129
|
+
if ( descriptor.depthTexture.isArrayTexture ) {
|
|
2130
|
+
|
|
2131
|
+
const layer = this.renderer._activeCubeFace;
|
|
2132
|
+
|
|
2133
|
+
gl.framebufferTextureLayer( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, layer );
|
|
2134
|
+
|
|
2135
|
+
} else {
|
|
2136
|
+
|
|
2137
|
+
gl.framebufferTexture2D( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0 );
|
|
2138
|
+
|
|
2139
|
+
}
|
|
2041
2140
|
|
|
2042
2141
|
}
|
|
2043
2142
|
|
|
@@ -2045,11 +2144,34 @@ class WebGLBackend extends Backend {
|
|
|
2045
2144
|
|
|
2046
2145
|
}
|
|
2047
2146
|
|
|
2147
|
+
renderTargetContextData.depthInvalidationArray = depthInvalidationArray;
|
|
2148
|
+
|
|
2149
|
+
|
|
2048
2150
|
} else {
|
|
2049
2151
|
|
|
2152
|
+
const isRenderCameraDepthArray = this._isRenderCameraDepthArray( descriptor );
|
|
2153
|
+
|
|
2154
|
+
if ( isRenderCameraDepthArray ) {
|
|
2155
|
+
|
|
2156
|
+
state.bindFramebuffer( gl.FRAMEBUFFER, fb );
|
|
2157
|
+
|
|
2158
|
+
const layer = this.renderer._activeCubeFace;
|
|
2159
|
+
|
|
2160
|
+
const depthData = this.get( descriptor.depthTexture );
|
|
2161
|
+
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
2162
|
+
gl.framebufferTextureLayer(
|
|
2163
|
+
gl.FRAMEBUFFER,
|
|
2164
|
+
depthStyle,
|
|
2165
|
+
depthData.textureGPU,
|
|
2166
|
+
0,
|
|
2167
|
+
layer
|
|
2168
|
+
);
|
|
2169
|
+
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2050
2172
|
// rebind external XR textures
|
|
2051
2173
|
|
|
2052
|
-
if ( isXRRenderTarget
|
|
2174
|
+
if ( isXRRenderTarget || useMultisampledRTT || renderTarget.multiview ) {
|
|
2053
2175
|
|
|
2054
2176
|
state.bindFramebuffer( gl.FRAMEBUFFER, fb );
|
|
2055
2177
|
|
|
@@ -2057,7 +2179,11 @@ class WebGLBackend extends Backend {
|
|
|
2057
2179
|
|
|
2058
2180
|
const textureData = this.get( descriptor.textures[ 0 ] );
|
|
2059
2181
|
|
|
2060
|
-
if (
|
|
2182
|
+
if ( renderTarget.multiview ) {
|
|
2183
|
+
|
|
2184
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, textureData.textureGPU, 0, samples, 0, 2 );
|
|
2185
|
+
|
|
2186
|
+
} else if ( useMultisampledRTT ) {
|
|
2061
2187
|
|
|
2062
2188
|
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, textureData.textureGPU, 0, samples );
|
|
2063
2189
|
|
|
@@ -2081,7 +2207,11 @@ class WebGLBackend extends Backend {
|
|
|
2081
2207
|
|
|
2082
2208
|
const textureData = this.get( descriptor.depthTexture );
|
|
2083
2209
|
|
|
2084
|
-
if (
|
|
2210
|
+
if ( renderTarget.multiview ) {
|
|
2211
|
+
|
|
2212
|
+
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, samples, 0, 2 );
|
|
2213
|
+
|
|
2214
|
+
} else if ( useMultisampledRTT ) {
|
|
2085
2215
|
|
|
2086
2216
|
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0, samples );
|
|
2087
2217
|
|
|
@@ -2097,7 +2227,7 @@ class WebGLBackend extends Backend {
|
|
|
2097
2227
|
|
|
2098
2228
|
}
|
|
2099
2229
|
|
|
2100
|
-
if ( samples > 0 && useMultisampledRTT === false ) {
|
|
2230
|
+
if ( samples > 0 && useMultisampledRTT === false && ! renderTarget.multiview ) {
|
|
2101
2231
|
|
|
2102
2232
|
if ( msaaFb === undefined ) {
|
|
2103
2233
|
|
|
@@ -2390,7 +2520,13 @@ class WebGLBackend extends Backend {
|
|
|
2390
2520
|
* @param {RenderTarget} renderTarget - The render target that should be multisampled.
|
|
2391
2521
|
* @return {boolean} Whether to use the `WEBGL_multisampled_render_to_texture` extension for MSAA or not.
|
|
2392
2522
|
*/
|
|
2393
|
-
|
|
2523
|
+
_useMultisampledExtension( renderTarget ) {
|
|
2524
|
+
|
|
2525
|
+
if ( renderTarget.multiview === true ) {
|
|
2526
|
+
|
|
2527
|
+
return true;
|
|
2528
|
+
|
|
2529
|
+
}
|
|
2394
2530
|
|
|
2395
2531
|
return renderTarget.samples > 0 && this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTarget.autoAllocateDepthBuffer !== false;
|
|
2396
2532
|
|