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

Cleaned up Unlit shader code.

Lasse Öörni преди 14 години
родител
ревизия
642cde63d5
променени са 3 файла, в които са добавени 8 реда и са изтрити 8 реда
  1. 2 2
      SourceAssets/GLSLShaders/Unlit.frag
  2. 2 2
      SourceAssets/GLSLShaders/Unlit.vert
  3. 4 4
      SourceAssets/HLSLShaders/Unlit.hlsl

+ 2 - 2
SourceAssets/GLSLShaders/Unlit.frag

@@ -6,7 +6,7 @@ varying vec2 vTexCoord;
 #ifdef VERTEXCOLOR
     varying vec4 vColor;
 #endif
-varying vec4 vLightVec;
+varying float vDepth;
 
 void main()
 {
@@ -20,6 +20,6 @@ void main()
         diffColor *= vColor;
     #endif
 
-    gl_FragColor = vec4(GetFog(diffColor.rgb, vLightVec.w), diffColor.a);
+    gl_FragColor = vec4(GetFog(diffColor.rgb, vDepth), diffColor.a);
 }
 

+ 2 - 2
SourceAssets/GLSLShaders/Unlit.vert

@@ -5,7 +5,7 @@ varying vec2 vTexCoord;
 #ifdef VERTEXCOLOR
     varying vec4 vColor;
 #endif
-varying vec4 vLightVec;
+varying float vDepth;
 
 void main()
 {
@@ -13,7 +13,7 @@ void main()
     vec3 worldPos = GetWorldPos(modelMatrix);
     gl_Position = GetClipPos(worldPos);
     vTexCoord = GetTexCoord(iTexCoord);
-    vLightVec = vec4(0.0, 0.0, 0.0, GetDepth(gl_Position));
+    vDepth = GetDepth(gl_Position);
 
     #ifdef VERTEXCOLOR
         vColor = iColor;

+ 4 - 4
SourceAssets/HLSLShaders/Unlit.hlsl

@@ -19,7 +19,7 @@ void VS(float4 iPos : POSITION,
         float2 iSize : TEXCOORD1,
     #endif
     out float2 oTexCoord : TEXCOORD0,
-    out float4 oLightVec : TEXCOORD1,
+    out float oDepth : TEXCOORD1,
     #ifdef VERTEXCOLOR
         out float4 oColor : COLOR0,
     #endif
@@ -29,7 +29,7 @@ void VS(float4 iPos : POSITION,
     float3 worldPos = GetWorldPos(modelMatrix);
     oPos = GetClipPos(worldPos);
     oTexCoord = GetTexCoord(iTexCoord);
-    oLightVec = float4(0.0, 0.0, 0.0, GetDepth(oPos));
+    oDepth = GetDepth(oPos);
 
     #ifdef VERTEXCOLOR
         oColor = iColor;
@@ -37,7 +37,7 @@ void VS(float4 iPos : POSITION,
 }
 
 void PS(float2 iTexCoord : TEXCOORD0,
-    float4 iLightVec : TEXCOORD1,
+    float iDepth : TEXCOORD1,
     #ifdef VERTEXCOLOR
         float4 iColor : COLOR0,
     #endif
@@ -53,5 +53,5 @@ void PS(float2 iTexCoord : TEXCOORD0,
         diffColor *= iColor;
     #endif
 
-    oColor = float4(GetFog(diffColor.rgb, iLightVec.w), diffColor.a);
+    oColor = float4(GetFog(diffColor.rgb, iDepth), diffColor.a);
 }