Browse Source

WebGLRenderer: Recompile program when fog changes. Fixes #9384.

Mr.doob 9 years ago
parent
commit
ff4eb5bc10
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/renderers/WebGLRenderer.js

+ 13 - 0
src/renderers/WebGLRenderer.js

@@ -1631,6 +1631,12 @@ function WebGLRenderer( parameters ) {
 
 
 		}
 		}
 
 
+		if ( material.fog ) {
+
+			materialProperties.fog = fog;
+
+		}
+
 		if ( material.lights ) {
 		if ( material.lights ) {
 
 
 			// store the light setup it was created for
 			// store the light setup it was created for
@@ -1729,6 +1735,13 @@ function WebGLRenderer( parameters ) {
 
 
 		}
 		}
 
 
+		if ( materialProperties.fog !== undefined &&
+			materialProperties.fog !== fog ) {
+
+				material.needsUpdate = true;
+
+		}
+
 		if ( materialProperties.lightsHash !== undefined &&
 		if ( materialProperties.lightsHash !== undefined &&
 			materialProperties.lightsHash !== _lights.hash ) {
 			materialProperties.lightsHash !== _lights.hash ) {