Browse Source

SPLighting.frag: fix syntax error with vertex lighting enabled

Kirill Vainer 10 years ago
parent
commit
1fec72605f
1 changed files with 11 additions and 9 deletions
  1. 11 9
      jme3-core/src/main/resources/Common/MatDefs/Light/SPLighting.frag

+ 11 - 9
jme3-core/src/main/resources/Common/MatDefs/Light/SPLighting.frag

@@ -72,17 +72,19 @@ uniform float m_Shininess;
 #endif
 
 void main(){
-    #ifdef NORMALMAP   
-        mat3 tbnMat = mat3(normalize(vTangent.xyz) , normalize(vBinormal.xyz) , normalize(vNormal.xyz));
+    #if !defined(VERTEX_LIGHTING)
+        #if defined(NORMALMAP)
+            mat3 tbnMat = mat3(normalize(vTangent.xyz) , normalize(vBinormal.xyz) , normalize(vNormal.xyz));
 
-        if (!gl_FrontFacing)
-        {
-            tbnMat[2] = -tbnMat[2];
-        }
+            if (!gl_FrontFacing)
+            {
+                tbnMat[2] = -tbnMat[2];
+            }
 
-        vec3 viewDir = normalize(-vPos.xyz * tbnMat);
-    #else
-        vec3 viewDir = normalize(-vPos.xyz);
+            vec3 viewDir = normalize(-vPos.xyz * tbnMat);
+        #else
+            vec3 viewDir = normalize(-vPos.xyz);
+        #endif
     #endif
 
     vec2 newTexCoord;