Ver código fonte

Update materialProperties.environment even if program doesn't change

The environment map can be switched to a different image while still using the exact same shader. It's important to update materialProperties.environment in this case so that unnecessary calls to initMaterial can be avoided. Prior to this fix FPS could be halved after changing scene.environment.
Olli Etuaho 5 anos atrás
pai
commit
677e44e00c
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      src/renderers/WebGLRenderer.js

+ 2 - 1
src/renderers/WebGLRenderer.js

@@ -1519,12 +1519,13 @@ function WebGLRenderer( parameters ) {
 
 			materialProperties.program = program;
 			materialProperties.uniforms = parameters.uniforms;
-			materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
 			materialProperties.outputEncoding = _this.outputEncoding;
 			material.program = program;
 
 		}
 
+		materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
+
 		var programAttributes = program.getAttributes();
 
 		if ( material.morphTargets ) {