stk-code_catmod/data/shaders/utils/getPosFromUVDepth.frag
vlj 2a1623d8ca Use a more efficient screen to view conversion
Also use the opportunity to use UBO where possible.
2014-05-02 18:11:34 +02:00

9 lines
348 B
GLSL

vec4 getPosFromUVDepth(vec3 uvDepth, mat4 InverseProjectionMatrix)
{
vec4 pos = 2.0 * vec4(uvDepth, 1.0) - 1.0f;
pos.xy *= vec2(InverseProjectionMatrix[0][0], InverseProjectionMatrix[1][1]);
pos.zw = vec2(pos.z * InverseProjectionMatrix[2][2] + pos.w, pos.z * InverseProjectionMatrix[2][3] + pos.w);
pos /= pos.w;
return pos;
}