فهرست منبع

ShaderLib: Moved phong composite code to main file.

Mr.doob 9 سال پیش
والد
کامیت
7696fbcbc0
2فایلهای تغییر یافته به همراه10 افزوده شده و 10 حذف شده
  1. 0 10
      src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl
  2. 10 0
      src/renderers/shaders/ShaderLib.js

+ 0 - 10
src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl

@@ -97,13 +97,3 @@ vec3 totalSpecularLight = vec3( 0.0 );
 	}
 
 #endif
-
-#ifdef METAL
-
-	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;
-
-#else
-
-	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) + totalSpecularLight + totalEmissiveLight;
-
-#endif

+ 10 - 0
src/renderers/shaders/ShaderLib.js

@@ -377,6 +377,16 @@ THREE.ShaderLib = {
 
 				THREE.ShaderChunk[ "lights_phong_fragment" ],
 
+				"#ifdef METAL",
+
+				"	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) * specular + totalSpecularLight + totalEmissiveLight;",
+
+				"#else",
+
+				"	outgoingLight += diffuseColor.rgb * ( totalDiffuseLight + totalAmbientLight ) + totalSpecularLight + totalEmissiveLight;",
+
+				"#endif",
+
 				THREE.ShaderChunk[ "envmap_fragment" ],
 				THREE.ShaderChunk[ "shadowmap_fragment" ],