Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/extras/PMREMGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ const ENCODINGS = {
[ GammaEncoding ]: 6
};

const backgroundMaterial = new MeshBasicMaterial( {
side: BackSide,
depthWrite: false,
depthTest: false,
} );
const backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );

const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
const { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/ _createPlanes();
const _clearColor = /*@__PURE__*/ new Color();
Expand Down Expand Up @@ -279,8 +272,18 @@ class PMREMGenerator {
renderer.outputEncoding = LinearEncoding;
renderer.autoClear = false;

const backgroundMaterial = new MeshBasicMaterial( {
name: 'PMREM.Background',
side: BackSide,
depthWrite: false,
depthTest: false,
} );

const backgroundBox = new Mesh( new BoxGeometry(), backgroundMaterial );

let useSolidColor = false;
const background = scene.background;

if ( background ) {

if ( background.isColor ) {
Expand All @@ -298,7 +301,6 @@ class PMREMGenerator {

}


for ( let i = 0; i < 6; i ++ ) {

const col = i % 3;
Expand Down Expand Up @@ -333,6 +335,9 @@ class PMREMGenerator {

}

backgroundBox.geometry.dispose();
backgroundBox.material.dispose();

renderer.toneMapping = toneMapping;
renderer.outputEncoding = outputEncoding;
renderer.autoClear = originalAutoClear;
Expand Down