Line | |
---|
1 | struct fragment
|
---|
2 | {
|
---|
3 | float4 position : POSITION; //screen position
|
---|
4 | float4 color0 : COLOR0;
|
---|
5 | float4 depthTexCoord: TEXCOORD0;
|
---|
6 | };
|
---|
7 |
|
---|
8 |
|
---|
9 | struct pixel
|
---|
10 | {
|
---|
11 | float4 color : COLOR;
|
---|
12 | };
|
---|
13 |
|
---|
14 | pixel main(fragment IN, const uniform sampler2D depthMap)
|
---|
15 | {
|
---|
16 | pixel OUT;
|
---|
17 | OUT.color = IN.color0;
|
---|
18 |
|
---|
19 | // the depth buffer has to be compared to the current depth
|
---|
20 | float4 depth = tex2D(depthMap, IN.depthTexCoord.xy);
|
---|
21 | float test = IN.depthTexCoord.z / IN.depthTexCoord.w;
|
---|
22 |
|
---|
23 | // reject by alpha test
|
---|
24 | if (test < depth.x)
|
---|
25 | {
|
---|
26 | OUT.color.w = 0;
|
---|
27 | // OUT.color.y += 0.5;
|
---|
28 | }
|
---|
29 |
|
---|
30 | return OUT;
|
---|
31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.