0
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
1 extern uniform float4x4 kWorld;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
2 extern uniform float4x4 kView;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
3 extern uniform float4x4 kProjection;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
4 extern uniform float4 kColor;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
5 extern uniform texture kTexture;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
6
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
7 sampler TextureSampler = sampler_state
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
8 {
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
9 Texture = <kTexture>;
|
60
|
10 MinFilter = LINEAR;
|
|
11 MagFilter = LINEAR;
|
2
|
12 AddressU = CLAMP;
|
|
13 AddressV = CLAMP;
|
0
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
14 };
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
15
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
16 struct VertexOutput
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
17 {
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
18 /*
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
19 * kPosition
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
20 */
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
21 float4 kPosition : POSITION0;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
22
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
23 /*
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
24 * kTextureCoords
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
25 */
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
26 float2 kTextureCoords : TEXCOORD0;
|
60
|
27
|
|
28 /*
|
|
29 * kNormal
|
|
30 */
|
|
31 float3 kColor : COLOR0;
|
0
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
32 };
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
33
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
34 VertexOutput EnvironmentVS(float3 kVertexPosition : POSITION0, float3 kVertexNormal : NORMAL, float2 kTextureCoords : TEXCOORD0)
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
35 {
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
36 float4x4 kWorldViewProjection = mul(mul(kWorld, kView), kProjection);
|
60
|
37
|
|
38 float4 kDiffuse = float4(0.8f, 0.8f, 0.8f, 1.0f);
|
|
39 float4 kAmbient = float4(0.4f, 0.4f, 0.4f, 1.0f);
|
|
40 float3 kDirection = normalize(float3(-1.0f, -0.60f, -0.3f));
|
|
41
|
|
42 float3 kNormal = normalize(mul(kVertexNormal, (float3x3)kWorld));
|
0
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
43
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
44 VertexOutput kOutput;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
45 kOutput.kPosition = mul(float4(kVertexPosition, 1.0f), kWorldViewProjection);
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
46 kOutput.kTextureCoords = kTextureCoords;
|
60
|
47 kOutput.kColor = kAmbient + kDiffuse * saturate(dot(-kDirection, kNormal));
|
0
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
48
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
49 return kOutput;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
50 }
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
51
|
60
|
52 float4 EnvironmentPS(float4 kDiffuseColor : COLOR0, float2 kTextureCoords : TEXCOORD0) : COLOR0
|
0
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
53 {
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
54 float4 kTexture = tex2D(TextureSampler, kTextureCoords);
|
60
|
55
|
|
56 return float4(kTexture.rgb * kDiffuseColor.rgb * kColor.rgb, kTexture.a);
|
0
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
57 }
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
58
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
59 technique Default
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
60 {
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
61 pass Pass0
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
62 {
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
63 vertexShader = compile vs_2_0 EnvironmentVS();
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
64 pixelShader = compile ps_2_0 EnvironmentPS();
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
65
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
66 ZEnable = true;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
67 ZWriteEnable = true;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
68 ZFunc = LessEqual;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
69 }
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
70 }
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
71
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
72 technique Wire
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
73 {
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
74 pass Pass0
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
75 {
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
76 vertexShader = compile vs_2_0 EnvironmentVS();
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
77 pixelShader = compile ps_2_0 EnvironmentPS();
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
78
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
79 ZEnable = true;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
80 ZWriteEnable = false;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
81 ZFunc = LessEqual;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
82 FillMode = Wireframe;
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
83 }
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
84 }
|