浏览代码

cleanup requires.rradiance

sunag 6 年之前
父节点
当前提交
90a531624d
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      examples/jsm/nodes/materials/nodes/StandardNode.js

+ 7 - 1
examples/jsm/nodes/materials/nodes/StandardNode.js

@@ -156,9 +156,15 @@ StandardNode.prototype.build = function ( builder ) {
 		if ( this.environment ) {
 
 			// isolate environment from others inputs ( see TextureNode, CubeTextureNode )
+			// environment.analyze will detect if there is a need of calculate irradiance
 
 			this.environment.analyze( builder, { cache: 'radiance', context: contextEnvironment, slot: 'radiance' } ); 
-			this.environment.analyze( builder, { cache: 'irradiance', context: contextEnvironment, slot: 'irradiance' } ); 
+
+			if ( builder.requires.irradiance ) {
+
+				this.environment.analyze( builder, { cache: 'irradiance', context: contextEnvironment, slot: 'irradiance' } ); 
+
+			}
 
 		}