Преглед на файлове

Update PBRLighting.vert

removed ifDef checks around some things (like tangents) that could still be used by other glslibs even if the shader doesn't have a normal map.
Ryan McDonough преди 1 година
родител
ревизия
da43265453
променени са 1 файла, в които са добавени 13 реда и са изтрити 12 реда
  1. 13 12
      jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.vert

+ 13 - 12
jme3-core/src/main/resources/Common/MatDefs/Light/PBRLighting.vert

@@ -18,23 +18,27 @@ attribute vec3 inPosition;
 attribute vec2 inTexCoord;
 attribute vec2 inTexCoord;
 attribute vec3 inNormal;
 attribute vec3 inNormal;
 
 
-#ifdef VERTEX_COLOR
-  attribute vec4 inColor;
+#if defined (VERTEX_COLOR) || defined(USE_VERTEX_COLORS_AS_SUN_INTENSITY)
+    attribute vec4 inColor;
+#endif
+
+#if defined(USE_VERTEX_COLORS_AS_SUN_INTENSITY)
+    varying vec4 vertColors;
 #endif
 #endif
 
 
 varying vec3 wNormal;
 varying vec3 wNormal;
 varying vec3 wPosition;
 varying vec3 wPosition;
-#if defined(NORMALMAP) || defined(PARALLAXMAP)
-    attribute vec4 inTangent;
-    varying vec4 wTangent;
-#endif
+
+attribute vec4 inTangent;
+varying vec4 wTangent;
 
 
 void main(){
 void main(){
     vec4 modelSpacePos = vec4(inPosition, 1.0);
     vec4 modelSpacePos = vec4(inPosition, 1.0);
     vec3 modelSpaceNorm = inNormal;
     vec3 modelSpaceNorm = inNormal;
+    vec3 modelSpaceTan  = inTangent.xyz;
 
 
-    #if  ( defined(NORMALMAP) || defined(PARALLAXMAP)) && !defined(VERTEX_LIGHTING)
-         vec3 modelSpaceTan  = inTangent.xyz;
+    #ifdef USE_VERTEX_COLORS_AS_SUN_INTENSITY
+        vertColors = inColor;
     #endif
     #endif
 
 
     #ifdef NUM_MORPH_TARGETS
     #ifdef NUM_MORPH_TARGETS
@@ -61,10 +65,7 @@ void main(){
 
 
     wPosition = TransformWorld(modelSpacePos).xyz;
     wPosition = TransformWorld(modelSpacePos).xyz;
     wNormal  = TransformWorldNormal(modelSpaceNorm);
     wNormal  = TransformWorldNormal(modelSpaceNorm);
-
-    #if defined(NORMALMAP) || defined(PARALLAXMAP)
-      wTangent = vec4(TransformWorldNormal(modelSpaceTan),inTangent.w);
-    #endif
+    wTangent = vec4(TransformWorldNormal(modelSpaceTan),inTangent.w);
 
 
     Color = m_BaseColor;
     Color = m_BaseColor;