Pārlūkot izejas kodu

fix dispose crash

Nicolas Maréchal 5 gadi atpakaļ
vecāks
revīzija
fa9d7186a6
1 mainītis faili ar 7 papildinājumiem un 3 dzēšanām
  1. 7 3
      examples/jsm/csm/CSM.js

+ 7 - 3
examples/jsm/csm/CSM.js

@@ -361,9 +361,13 @@ export class CSM {
 			delete material.defines.CSM_CASCADES;
 			delete material.defines.CSM_FADE;
 
-			delete shader.uniforms.CSM_cascades;
-			delete shader.uniforms.cameraNear;
-			delete shader.uniforms.shadowFar;
+			if ( shader !== null ) {
+
+				delete shader.uniforms.CSM_cascades;
+				delete shader.uniforms.cameraNear;
+				delete shader.uniforms.shadowFar;
+
+			}
 
 			material.needsUpdate = true;