Browse Source

WebGLRenderer: Removed material.envMap condition from setProgram().

Mr.doob 5 years ago
parent
commit
b1d1f26b19
2 changed files with 5 additions and 7 deletions
  1. 0 4
      src/renderers/WebGLRenderer.js
  2. 5 3
      src/renderers/webgl/WebGLBackground.js

+ 0 - 4
src/renderers/WebGLRenderer.js

@@ -1965,10 +1965,6 @@ function WebGLRenderer( parameters ) {
 				m_uniforms.color.value.copy( material.color );
 				m_uniforms.opacity.value = material.opacity;
 
-			} else if ( material.envMap ) {
-
-				refreshUniformsCommon( m_uniforms, material );
-
 			}
 
 			// RectAreaLight Texture

+ 5 - 3
src/renderers/webgl/WebGLBackground.js

@@ -88,11 +88,11 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
 				};
 
 				// enable code injection for non-built-in material
-				Object.defineProperty( boxMesh.material, 'map', {
+				Object.defineProperty( boxMesh.material, 'envMap', {
 
 					get: function () {
 
-						return this.envMap.value;
+						return this.uniforms.envMap.value;
 
 					}
 
@@ -103,7 +103,9 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
 			}
 
 			var texture = background.isWebGLRenderTargetCube ? background.texture : background;
-			boxMesh.material.envMap = texture;
+
+			boxMesh.material.uniforms.envMap.value = texture;
+			boxMesh.material.uniforms.flipEnvMap.value = texture.isCubeTexture ? - 1 : 1;
 
 			if ( currentBackground !== background ||
 			     currentBackgroundVersion !== texture.version ) {