annotate Data/Shaders/TexturedQuad.fx @ 17:4951acfe92fc

Reworking GUI system
author koryspansel <koryspansel@bendbroadband.com>
date Wed, 14 Sep 2011 13:33:22 -0700
parents 7e3a0ae9c016
children efd2b1ca5b77
rev   line source
0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
1 extern uniform float4x4 kProjection;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
2 extern uniform float4x4 kWorld;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
3 extern uniform texture kTexture;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
4 extern uniform float4 kColor;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
5
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
6 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
7 * TextureSampler
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
8 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
9 sampler TextureSampler = sampler_state
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
10 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
11 Texture = <kTexture>;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
12 MinFilter = POINT;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
13 MagFilter = POINT;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
14 AddressU = CLAMP;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
15 AddressV = CLAMP;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
16 };
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
17
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
18 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
19 * VertexInput
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
20 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
21 struct VertexInput
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
22 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
23 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
24 * Position
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
25 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
26 float3 Position : POSITION0;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
27
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
28 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
29 * TextureCoordinate
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
30 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
31 float2 TextureCoordinate : TEXCOORD0;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
32 };
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
33
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
34 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
35 * VertexOutput
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
36 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
37 struct VertexOutput
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
38 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
39 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
40 * Position
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
41 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
42 float4 Position : POSITION0;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
43
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
44 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
45 * TextureCoordinate
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
46 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
47 float2 TextureCoordinate : TEXCOORD0;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
48 };
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
49
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
50 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
51 * PixelInput
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
52 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
53 struct PixelInput
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
54 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
55 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
56 * TextureCoordinate
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
57 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
58 float2 TextureCoordinate : TEXCOORD0;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
59
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
60 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
61 * Color
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
62 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
63 float4 Color : COLOR0;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
64 };
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
65
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
66 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
67 * PixelOutput
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
68 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
69 struct PixelOutput
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
70 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
71 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
72 * Color
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
73 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
74 float4 Color : COLOR0;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
75 };
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
76
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
77 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
78 * TexturedQuadVS
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
79 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
80 VertexOutput TexturedQuadVS(VertexInput kInput)
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
81 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
82 VertexOutput kOutput;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
83
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
84 kOutput.Position = mul(float4(kInput.Position, 1.0f), mul(kWorld, kProjection));
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
85 kOutput.TextureCoordinate = kInput.TextureCoordinate;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
86
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
87 return kOutput;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
88 }
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
89
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
90 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
91 * TexturedQuadPS
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
92 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
93 PixelOutput TexturedQuadPS(PixelInput kInput)
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
94 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
95 PixelOutput kOutput;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
96
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
97 float4 kTexture = tex2D(TextureSampler, kInput.TextureCoordinate);
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
98
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
99 kOutput.Color = float4(kTexture.rgb * kColor.rgb, kTexture.a);
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
100 //kOutput.Color = kColor;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
101
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
102 return kOutput;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
103 }
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
104
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
105 technique Default
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
106 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
107 pass Opaque
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
108 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
109 vertexShader = compile vs_2_0 TexturedQuadVS();
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
110 pixelShader = compile ps_2_0 TexturedQuadPS();
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
111
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
112 /*
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
113 ZEnable = true;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
114 ZWriteEnable = true;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
115 ZFunc = LessEqual;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
116 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
117
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
118 AlphaBlendEnable = true;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
119 AlphaFunc = LessEqual;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
120 SrcBlend = SrcAlpha;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
121 DestBlend = InvSrcAlpha;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
122 }
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
123 }