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