aboutsummaryrefslogtreecommitdiff
path: root/samples/AnselSDKIntegration/Shaders.fx
diff options
context:
space:
mode:
authorDmitry Duka <[email protected]>2017-03-09 18:45:50 +0300
committerDmitry Duka <[email protected]>2017-03-09 18:45:50 +0300
commita7ea1b2f43a648470818937b871b244b67246953 (patch)
tree0de34a81e91a5910a21669646c53fade61394fc0 /samples/AnselSDKIntegration/Shaders.fx
parentUpdating Ansel SDK to version 1.2. Introducing game-driven UI controls (slide... (diff)
downloadanselsdk-a7ea1b2f43a648470818937b871b244b67246953.tar.xz
anselsdk-a7ea1b2f43a648470818937b871b244b67246953.zip
Adding AnselSDKIntegration project demonstrating simplistic Ansel integration
Diffstat (limited to 'samples/AnselSDKIntegration/Shaders.fx')
-rw-r--r--samples/AnselSDKIntegration/Shaders.fx59
1 files changed, 59 insertions, 0 deletions
diff --git a/samples/AnselSDKIntegration/Shaders.fx b/samples/AnselSDKIntegration/Shaders.fx
new file mode 100644
index 0000000..abac43c
--- /dev/null
+++ b/samples/AnselSDKIntegration/Shaders.fx
@@ -0,0 +1,59 @@
+cbuffer ConstantBuffer : register( b0 )
+{
+ matrix World;
+ matrix View;
+ matrix Projection;
+ float4 vLightDir;
+ float4 vLightColor;
+ float4 vOutputColor;
+ float vTime;
+}
+
+struct VS_INPUT
+{
+ float4 Pos : POSITION;
+ float3 Norm : NORMAL;
+};
+
+struct PS_INPUT
+{
+ float4 Pos : SV_POSITION;
+ float3 Norm : TEXCOORD0;
+};
+
+PS_INPUT VS( VS_INPUT input )
+{
+ PS_INPUT output = (PS_INPUT)0;
+ output.Pos = mul( input.Pos, World );
+ output.Pos = mul( output.Pos, View );
+ output.Pos = mul( output.Pos, Projection );
+ output.Norm = mul( float4( input.Norm, 1 ), World ).xyz;
+
+ return output;
+}
+
+float4 PS(PS_INPUT input) : SV_Target
+{
+ float4 finalColor = saturate(dot((float3)vLightDir, input.Norm) * vLightColor);
+ finalColor.a = 1.0f;
+ return finalColor;
+}
+
+PS_INPUT VS_Hud(VS_INPUT input)
+{
+ PS_INPUT output = (PS_INPUT)0;
+ output.Pos = input.Pos;
+ output.Pos.w = 1.0f;
+
+ if (input.Norm.x > 1.0f)
+ {
+ output.Pos.x *= 0.8f * abs(sin(vTime * 0.25f)) + 0.15f;
+ }
+
+ return output;
+}
+
+float4 PS_Hud(PS_INPUT input) : SV_Target
+{
+ return float4(0.33f, 0.5f, 0.906f, 1.0f);
+}