comparison Data/Shaders/TexturedQuad.fx @ 0:7e3a0ae9c016

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