Skip to content

Commit

Permalink
Nodes: Ensure getBackgroundNode() and getEnvironmentNode() only r…
Browse files Browse the repository at this point in the history
…eturns nodes. (mrdoob#30169)
  • Loading branch information
Mugen87 authored Dec 19, 2024
1 parent f28ec3c commit b1567a0
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions src/renderers/common/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,49 @@ class Nodes extends DataMap {

getEnvironmentNode( scene ) {

return scene.environmentNode || this.get( scene ).environmentNode || null;
let environmentNode = null;

if ( scene.environmentNode && scene.environmentNode.isNode ) {

environmentNode = scene.environmentNode;

} else {

const sceneData = this.get( scene );

if ( sceneData.environmentNode ) {

environmentNode = sceneData.environmentNode;

}

}

return environmentNode;

}

getBackgroundNode( scene ) {

return scene.backgroundNode || this.get( scene ).backgroundNode || null;
let backgroundNode = null;

if ( scene.backgroundNode && scene.backgroundNode.isNode ) {

backgroundNode = scene.backgroundNode;

} else {

const sceneData = this.get( scene );

if ( sceneData.backgroundNode ) {

backgroundNode = sceneData.backgroundNode;

}

}

return backgroundNode;

}

Expand Down

0 comments on commit b1567a0

Please sign in to comment.