瀏覽代碼

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 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
 
 varying vec3 wNormal;
 varying vec3 wPosition;
-#if defined(NORMALMAP) || defined(PARALLAXMAP)
-    attribute vec4 inTangent;
-    varying vec4 wTangent;
-#endif
+
+attribute vec4 inTangent;
+varying vec4 wTangent;
 
 void main(){
     vec4 modelSpacePos = vec4(inPosition, 1.0);
     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
 
     #ifdef NUM_MORPH_TARGETS
@@ -61,10 +65,7 @@ void main(){
 
     wPosition = TransformWorld(modelSpacePos).xyz;
     wNormal  = TransformWorldNormal(modelSpaceNorm);
-
-    #if defined(NORMALMAP) || defined(PARALLAXMAP)
-      wTangent = vec4(TransformWorldNormal(modelSpaceTan),inTangent.w);
-    #endif
+    wTangent = vec4(TransformWorldNormal(modelSpaceTan),inTangent.w);
 
     Color = m_BaseColor;