annotate Data/Shaders/Environment.fx @ 61:1fe27776627e

Added asserts
author koryspansel
date Mon, 03 Oct 2011 15:05:09 -0700
parents b0f642ee22d3
children
rev   line source
0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
1 extern uniform float4x4 kWorld;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
2 extern uniform float4x4 kView;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
3 extern uniform float4x4 kProjection;
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 extern uniform texture kTexture;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
6
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
7 sampler TextureSampler = sampler_state
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
8 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
9 Texture = <kTexture>;
60
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
10 MinFilter = LINEAR;
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
11 MagFilter = LINEAR;
2
fd55825393df Update block texture; Change filtering modes
koryspansel <koryspansel@bendbroadband.com>
parents: 0
diff changeset
12 AddressU = CLAMP;
fd55825393df Update block texture; Change filtering modes
koryspansel <koryspansel@bendbroadband.com>
parents: 0
diff changeset
13 AddressV = CLAMP;
0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
14 };
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
15
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
16 struct VertexOutput
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 * kPosition
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
20 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
21 float4 kPosition : POSITION0;
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 * kTextureCoords
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
25 */
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
26 float2 kTextureCoords : TEXCOORD0;
60
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
27
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
28 /*
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
29 * kNormal
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
30 */
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
31 float3 kColor : COLOR0;
0
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 VertexOutput EnvironmentVS(float3 kVertexPosition : POSITION0, float3 kVertexNormal : NORMAL, float2 kTextureCoords : TEXCOORD0)
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
35 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
36 float4x4 kWorldViewProjection = mul(mul(kWorld, kView), kProjection);
60
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
37
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
38 float4 kDiffuse = float4(0.8f, 0.8f, 0.8f, 1.0f);
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
39 float4 kAmbient = float4(0.4f, 0.4f, 0.4f, 1.0f);
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
40 float3 kDirection = normalize(float3(-1.0f, -0.60f, -0.3f));
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
41
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
42 float3 kNormal = normalize(mul(kVertexNormal, (float3x3)kWorld));
0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
43
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
44 VertexOutput kOutput;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
45 kOutput.kPosition = mul(float4(kVertexPosition, 1.0f), kWorldViewProjection);
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
46 kOutput.kTextureCoords = kTextureCoords;
60
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
47 kOutput.kColor = kAmbient + kDiffuse * saturate(dot(-kDirection, kNormal));
0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
48
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
49 return kOutput;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
50 }
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
51
60
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
52 float4 EnvironmentPS(float4 kDiffuseColor : COLOR0, float2 kTextureCoords : TEXCOORD0) : COLOR0
0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
53 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
54 float4 kTexture = tex2D(TextureSampler, kTextureCoords);
60
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
55
b0f642ee22d3 Additional maps
koryspansel <koryspansel@bendbroadband.com>
parents: 2
diff changeset
56 return float4(kTexture.rgb * kDiffuseColor.rgb * kColor.rgb, kTexture.a);
0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
57 }
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
58
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
59 technique Default
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
60 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
61 pass Pass0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
62 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
63 vertexShader = compile vs_2_0 EnvironmentVS();
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
64 pixelShader = compile ps_2_0 EnvironmentPS();
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
65
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
66 ZEnable = true;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
67 ZWriteEnable = true;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
68 ZFunc = LessEqual;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
69 }
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 technique Wire
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
73 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
74 pass Pass0
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
75 {
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
76 vertexShader = compile vs_2_0 EnvironmentVS();
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
77 pixelShader = compile ps_2_0 EnvironmentPS();
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
78
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
79 ZEnable = true;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
80 ZWriteEnable = false;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
81 ZFunc = LessEqual;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
82 FillMode = Wireframe;
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
83 }
7e3a0ae9c016 Initial commit
koryspansel <koryspansel@bendbroadband.com>
parents:
diff changeset
84 }