| Line | |
|---|
| 1 | uniform mat4 worldViewProj; |
|---|
| 2 | uniform vec4 texelOffsets; |
|---|
| 3 | uniform vec4 depthRange; |
|---|
| 4 | |
|---|
| 5 | varying vec2 depth; |
|---|
| 6 | |
|---|
| 7 | void main() |
|---|
| 8 | { |
|---|
| 9 | gl_Position = ftransform(); |
|---|
| 10 | |
|---|
| 11 | // fix pixel / texel alignment |
|---|
| 12 | gl_Position.xy += texelOffsets.zw * gl_Position.w; |
|---|
| 13 | // linear depth storage |
|---|
| 14 | // offset / scale range output |
|---|
| 15 | #if LINEAR_RANGE |
|---|
| 16 | depth.x = (gl_Position.z - depthRange.x) * depthRange.w; |
|---|
| 17 | #else |
|---|
| 18 | depth.x = gl_Position.z; |
|---|
| 19 | #endif |
|---|
| 20 | depth.y = gl_Position.w; |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | } |
|---|
| 24 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.