From 2ccf2f316206716bae2adab0f6bc3670f1921a13 Mon Sep 17 00:00:00 2001 From: sunag Date: Sat, 13 Jul 2024 13:56:33 -0300 Subject: [PATCH] Introduce `renderer.transparent` and `renderer.opaque` --- src/renderers/common/Renderer.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/renderers/common/Renderer.js b/src/renderers/common/Renderer.js index 35965fc7e174ac..9809c93d311732 100644 --- a/src/renderers/common/Renderer.js +++ b/src/renderers/common/Renderer.js @@ -133,7 +133,8 @@ class Renderer { this._compilationPromises = null; - // backwards compatibility + this.transparent = true; + this.opaque = true; this.shadowMap = { enabled: false, @@ -317,8 +318,8 @@ class Renderer { const transparentObjects = renderList.transparent; const lightsNode = renderList.lightsNode; - if ( opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera, sceneRef, lightsNode ); - if ( transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera, sceneRef, lightsNode ); + if ( this.opaque === true && opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera, sceneRef, lightsNode ); + if ( this.transparent === true && transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera, sceneRef, lightsNode ); // restore render tree @@ -679,8 +680,8 @@ class Renderer { const lightsNode = renderList.lightsNode; if ( bundles.length > 0 ) this._renderBundles( bundles, sceneRef, lightsNode ); - if ( opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera, sceneRef, lightsNode ); - if ( transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera, sceneRef, lightsNode ); + if ( this.opaque === true && opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera, sceneRef, lightsNode ); + if ( this.transparent === true && transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera, sceneRef, lightsNode ); // finish render pass