浏览代码

#ifdef the shadow HLSL/GLSL code to potentially speed up shader compilation.

Lasse Öörni 14 年之前
父节点
当前提交
720a19dea3
共有 2 个文件被更改,包括 14 次插入9 次删除
  1. 7 4
      SourceAssets/GLSLShaders/Lighting.frag
  2. 7 5
      SourceAssets/HLSLShaders/Lighting.hlsl

+ 7 - 4
SourceAssets/GLSLShaders/Lighting.frag

@@ -27,6 +27,12 @@ float GetSpecular(vec3 normal, vec3 eyeVec, vec3 lightDir, float specularPower)
     return pow(max(dot(normal, halfVec), 0.0), specularPower);
 }
 
+float GetIntensity(vec3 color)
+{
+    return dot(color, vec3(0.333, 0.333, 0.333));
+}
+
+#ifdef SHADOW
 float GetShadow(vec4 shadowPos)
 {
     // Note: in case of sampling a point light cube shadow, we optimize out the w divide as it has already been performed
@@ -99,8 +105,5 @@ mat4 GetDirShadowMatrix(float depth, const mat4 matrices[4])
     else
         return matrices[3];
 }
+#endif
 
-float GetIntensity(vec3 color)
-{
-    return dot(color, vec3(0.333, 0.333, 0.333));
-}

+ 7 - 5
SourceAssets/HLSLShaders/Lighting.hlsl

@@ -79,6 +79,12 @@ float3 GetAmbient(float zonePos)
     return cAmbientStartColor + zonePos * cAmbientEndColor;
 }
 
+float GetIntensity(float3 color)
+{
+    return dot(color, float3(0.333, 0.333, 0.333));
+}
+
+#ifdef SHADOW
 float GetShadow(float4 shadowPos)
 {
     // Note: in case of sampling a point light cube shadow, we optimize out the w divide as it has already been performed
@@ -194,8 +200,4 @@ float4x4 GetDirShadowMatrix(float depth, const float4x4 matrices[4])
             return matrices[2];
     #endif
 }
-
-float GetIntensity(float3 color)
-{
-    return dot(color, float3(0.333, 0.333, 0.333));
-}
+#endif