ソースを参照

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 年 前
コミット
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 ) {