From 2d17cef64677a5c4baaa288eb404eb9b73a9fe0b Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Mon, 4 Nov 2024 11:34:05 +0100 Subject: [PATCH] NodeMaterial: Use early out in `setupDepth()`. --- src/materials/nodes/NodeMaterial.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/materials/nodes/NodeMaterial.js b/src/materials/nodes/NodeMaterial.js index 96efbf7345896d..da6f3665807a1a 100644 --- a/src/materials/nodes/NodeMaterial.js +++ b/src/materials/nodes/NodeMaterial.js @@ -229,6 +229,19 @@ class NodeMaterial extends Material { setupDepth( builder ) { const { renderer, camera } = builder; + const renderTarget = renderer.getRenderTarget(); + + // early out if not depth buffer is configured + + if ( renderTarget !== null ) { + + if ( renderTarget.depthBuffer === false ) return; + + } else { + + if ( renderer.depth === false ) return; + + } // Depth