Line | |
---|
1 | struct fragment
|
---|
2 | {
|
---|
3 | float4 position : POSITION; //screen position
|
---|
4 | float4 color0 : COLOR0;
|
---|
5 | float4 color1 : COLOR1; //lighting
|
---|
6 | float2 texcoord0 : TEXCOORD0;
|
---|
7 | float4 depthTexCoord: TEXCOORD1;
|
---|
8 | float3 normal : TEXCOORD2;
|
---|
9 | };
|
---|
10 |
|
---|
11 |
|
---|
12 | struct pixel
|
---|
13 | {
|
---|
14 | float4 color : COLOR;
|
---|
15 | };
|
---|
16 |
|
---|
17 |
|
---|
18 | pixel main(fragment IN,
|
---|
19 | uniform sampler2D shadowMap: TEXUNIT1,
|
---|
20 | uniform float doTexturing)
|
---|
21 | {
|
---|
22 | pixel OUT;
|
---|
23 |
|
---|
24 | float4 col = IN.color0;
|
---|
25 |
|
---|
26 | // the depth buffer
|
---|
27 | float4 depth = tex2Dproj(shadowMap, IN.SMTexCoord);
|
---|
28 | float test = IN.depthTexCoord.z / IN.depthTexCoord.w;
|
---|
29 |
|
---|
30 | float shadow;
|
---|
31 | shadow = (test < depth.x) ? 1.0 : 0.0;
|
---|
32 | OUT.color = localcolor * shadow * IN.color1;
|
---|
33 |
|
---|
34 | return OUT;
|
---|
35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.