annotate Data/Shaders/Bot.fx @ 75:57c0ce406a68 tip

Add main menu
author koryspansel <koryspansel@bendbroadband.com>
date Tue, 18 Oct 2011 17:08:17 -0700
parents 41980ff0607d
children
rev   line source
65
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
1 extern uniform float4x4 kWorld;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
2 extern uniform float4x4 kView;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
3 extern uniform float4x4 kProjection;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
4 extern uniform float4 kColor;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
5 extern uniform texture kTexture;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
6 extern uniform texture kTextureMask;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
7
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
8 sampler TextureSampler = sampler_state
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
9 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
10 Texture = <kTexture>;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
11 MinFilter = LINEAR;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
12 MagFilter = LINEAR;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
13 AddressU = CLAMP;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
14 AddressV = CLAMP;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
15 };
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
16
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
17 sampler MaskSampler = sampler_state
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
18 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
19 Texture = <kTextureMask>;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
20 MinFilter = LINEAR;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
21 MagFilter = LINEAR;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
22 AddressU = CLAMP;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
23 AddressV = CLAMP;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
24 };
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
25
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
26 struct VertexOutput
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
27 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
28 /*
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
29 * kPosition
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
30 */
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
31 float4 kPosition : POSITION0;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
32
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
33 /*
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
34 * kTextureCoords
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
35 */
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
36 float2 kTextureCoords : TEXCOORD0;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
37
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
38 /*
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
39 * kNormal
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
40 */
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
41 float3 kColor : COLOR0;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
42 };
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
43
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
44 VertexOutput BotVS(float3 kVertexPosition : POSITION0, float3 kVertexNormal : NORMAL, float2 kTextureCoords : TEXCOORD0)
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
45 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
46 float4x4 kWorldViewProjection = mul(mul(kWorld, kView), kProjection);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
47
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
48 float4 kDiffuse = float4(0.8f, 0.8f, 0.8f, 1.0f);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
49 float4 kAmbient = float4(0.4f, 0.4f, 0.4f, 1.0f);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
50 float3 kDirection = normalize(float3(-1.0f, -0.60f, -0.3f));
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
51
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
52 float3 kNormal = normalize(mul(kVertexNormal, (float3x3)kWorld));
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
53
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
54 VertexOutput kOutput;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
55 kOutput.kPosition = mul(float4(kVertexPosition, 1.0f), kWorldViewProjection);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
56 kOutput.kTextureCoords = kTextureCoords;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
57 kOutput.kColor = kAmbient + kDiffuse * saturate(dot(-kDirection, kNormal));
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
58
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
59 return kOutput;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
60 }
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
61
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
62 float4 BotPS(float4 kDiffuseColor : COLOR0, float2 kTextureCoords : TEXCOORD0) : COLOR0
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
63 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
64 float4 kTexture = tex2D(TextureSampler, kTextureCoords);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
65 float4 kMask = tex2D(MaskSampler, kTextureCoords);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
66
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
67 float fMaskScale = kMask.r;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
68 float fTextureScale = 1.0f - fMaskScale;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
69
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
70 float4 kBaseColor = kTexture;// * fTextureScale;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
71 float4 kMaskColor = kColor;// * fMaskScale;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
72
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
73 /*
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
74 if(mask == 0)
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
75 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
76 (1 - mask) * kBaseColor.rgb * kDiffuseColor.rgb + mask * kMaskColor.rgb
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
77 }
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
78 else
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
79 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
80 0 * kBaseColor.rgb * kDiffuseColor.rgb + 1 * kMaskColor.rgb
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
81 }
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
82 */
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
83
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
84 return float4(kDiffuseColor.rgb * (fTextureScale * kBaseColor.rgb + fMaskScale * kMaskColor.rgb), kTexture.a);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
85
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
86 //return float4(kBaseColor.rgb * kDiffuseColor.rgb + kMaskColor, kTexture.a);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
87 //return float4(kTexture.rgb * kDiffuseColor.rgb + kMask.r * kColor.rgb, kTexture.a);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
88 //return float4(kTexture.rgb * kDiffuseColor.rgb * kColor.rgb, kTexture.a);
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
89 }
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
90
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
91 technique Default
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
92 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
93 pass Pass0
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
94 {
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
95 vertexShader = compile vs_2_0 BotVS();
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
96 pixelShader = compile ps_2_0 BotPS();
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
97
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
98 ZEnable = true;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
99 ZWriteEnable = true;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
100 ZFunc = LessEqual;
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
101 }
41980ff0607d Added shader and textures for bot
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
102 }