Revision 2813,
1.3 KB
checked in by mattausch, 16 years ago
(diff) |
ssao working ok
|
Rev | Line | |
---|
[2810] | 1 | // input |
---|
| 2 | struct vtxin |
---|
| 3 | { |
---|
| 4 | float4 position: POSITION; |
---|
| 5 | float3 normal: NORMAL; |
---|
| 6 | float4 color: COLOR0; |
---|
| 7 | float4 texCoord: TEXCOORD0; |
---|
| 8 | }; |
---|
| 9 | |
---|
| 10 | // vtx output |
---|
| 11 | struct vtxout |
---|
| 12 | { |
---|
| 13 | float4 position: POSITION; // eye space |
---|
| 14 | float4 texCoord: TEXCOORD0; |
---|
| 15 | |
---|
| 16 | float4 color: COLOR0; |
---|
| 17 | float4 worldPos: TEXCOORD1; // world position |
---|
[2811] | 18 | float3 normal: TEXCOORD2; |
---|
[2810] | 19 | }; |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | // fragment input |
---|
| 23 | struct fragin |
---|
| 24 | { |
---|
| 25 | float4 position: POSITION; // eye space |
---|
| 26 | float4 texCoord: TEXCOORD0; |
---|
| 27 | |
---|
[2813] | 28 | float4 projPos: WPOS; |
---|
[2810] | 29 | float4 color: COLOR0; |
---|
| 30 | float4 worldPos: TEXCOORD1; // world position |
---|
[2811] | 31 | float3 normal: TEXCOORD2; |
---|
[2810] | 32 | }; |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | struct pixel |
---|
| 36 | { |
---|
| 37 | float4 col: COLOR0; |
---|
| 38 | float4 pos: COLOR1; |
---|
| 39 | float3 norm: COLOR2; |
---|
| 40 | }; |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | vtxout vtx(vtxin IN, uniform float4x4 ModelViewProj) |
---|
| 44 | { |
---|
| 45 | vtxout OUT; |
---|
| 46 | |
---|
| 47 | // transform the vertex position into eye space |
---|
| 48 | OUT.position = mul(ModelViewProj, IN.position); |
---|
| 49 | |
---|
| 50 | OUT.color = IN.color; |
---|
| 51 | |
---|
| 52 | OUT.texCoord = IN.texCoord; |
---|
| 53 | OUT.worldPos = IN.position; |
---|
| 54 | // eye pos with linear depth |
---|
| 55 | //OUT.worldPos = OUT.position; |
---|
[2811] | 56 | OUT.normal = IN.normal; |
---|
[2810] | 57 | |
---|
| 58 | return OUT; |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | pixel frag(fragin IN, uniform sampler2D tex, uniform float maxDepth) |
---|
| 63 | { |
---|
| 64 | pixel pix; |
---|
| 65 | |
---|
| 66 | pix.col = tex2D(tex, IN.texCoord.xy); |
---|
| 67 | pix.pos = IN.worldPos * maxDepth; |
---|
[2813] | 68 | pix.pos.w = IN.projPos.w; |
---|
[2811] | 69 | pix.norm = IN.normal; |
---|
[2810] | 70 | |
---|
| 71 | return pix; |
---|
| 72 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.