浏览代码

WebGLRenderer: Fixed MeshPhongMaterial+FlatShaded+Flip/DoubleSide. See #6117.

Mr.doob 10 年之前
父节点
当前提交
1b0ac10c96
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl

+ 6 - 6
src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl

@@ -2,6 +2,12 @@
 
 	vec3 normal = normalize( vNormal );
 
+	#ifdef DOUBLE_SIDED
+
+		normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );
+
+	#endif
+
 #else
 
 	vec3 fdx = dFdx( vViewPosition );
@@ -12,12 +18,6 @@
 
 vec3 viewPosition = normalize( vViewPosition );
 
-#ifdef DOUBLE_SIDED
-
-	normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );
-
-#endif
-
 #ifdef USE_NORMALMAP
 
 	normal = perturbNormal2Arb( -vViewPosition, normal );