Skip to content

Commit be3483d

Browse files
Mugen87RuthySheffi
authored andcommitted
Background: Make sure background nodes can be disposed of. (mrdoob#30938)
1 parent 85376d3 commit be3483d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/renderers/common/Background.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ class Background extends DataMap {
118118

119119
};
120120

121+
function onBackgroundDispose() {
122+
123+
background.removeEventListener( 'dispose', onBackgroundDispose );
124+
125+
backgroundMesh.material.dispose();
126+
backgroundMesh.geometry.dispose();
127+
128+
}
129+
130+
background.addEventListener( 'dispose', onBackgroundDispose );
131+
121132
}
122133

123134
const backgroundCacheKey = backgroundNode.getCacheKey();

0 commit comments

Comments
 (0)