Browse Source

Merge branch 'master' of https://github.com/AtomicGameEngine/AtomicRuntime

Josh Engebretson 11 years ago
parent
commit
8851e41e33
2 changed files with 50 additions and 0 deletions
  1. 22 0
      Bin/CoreData/Shaders/HLSL/Light2D.hlsl
  2. 28 0
      Bin/CoreData/Shaders/HLSL/Shadow2D.hlsl

+ 22 - 0
Bin/CoreData/Shaders/HLSL/Light2D.hlsl

@@ -0,0 +1,22 @@
+#include "Uniforms.hlsl"
+#include "Samplers.hlsl"
+#include "Transform.hlsl"
+
+void VS(float4 iPos : POSITION,
+		float2 iTexCoord : TEXCOORD0,  
+		float4 iColor : COLOR0, 
+		out float4 oPos : POSITION, 
+		out float4 oColor : COLOR0)
+{
+
+	float4x3 modelMatrix = iModelMatrix;
+    float3 worldPos = GetWorldPos(modelMatrix);
+    oPos = GetClipPos(worldPos);
+    oColor = iColor * iTexCoord.x;
+}
+
+void PS(float4 iColor : COLOR0, out float4 oColor : COLOR0)
+{
+	oColor = iColor;
+}
+

+ 28 - 0
Bin/CoreData/Shaders/HLSL/Shadow2D.hlsl

@@ -0,0 +1,28 @@
+
+#include "Uniforms.hlsl"
+#include "Samplers.hlsl"
+#include "Transform.hlsl"
+#include "ScreenPos.hlsl"
+
+#ifdef COMPILEPS
+uniform float4 cShadowAmbient;
+#endif
+
+void VS(float4 iPos : POSITION, out float4 oPos : POSITION, out float2 oScreenPos : TEXCOORD0)
+{
+    float4x3 modelMatrix = iModelMatrix;
+    float3 worldPos = GetWorldPos(modelMatrix);
+    oPos = GetClipPos(worldPos);
+    oScreenPos = GetScreenPosPreDiv(oPos);
+}
+
+void PS(float2 iScreenPos : TEXCOORD0, out float4 oColor : COLOR0)
+{
+	float4 diffInput = tex2D(sDiffMap, iScreenPos);
+    float4 lightInput = tex2D(sEmissiveMap, iScreenPos);
+	oColor.rgb = (diffInput.rgb * (lightInput.rgb + cShadowAmbient.rgb) * (lightInput.a + cShadowAmbient.a));
+    oColor.a = 1.0;
+}
+
+
+