Просмотр исходного кода

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 лет назад
Родитель
Сommit
677e44e00c
1 измененных файлов с 2 добавлено и 1 удалено
  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 ) {

粤ICP备19079148号