2017-12-25 01:00:10 -05:00
|
|
|
vec4 getPosFromUVDepth(vec3 uvDepth, mat4 u_inverse_projection_matrix)
|
2014-05-02 12:11:34 -04:00
|
|
|
{
|
2016-06-27 07:39:20 -04:00
|
|
|
vec4 pos = 2.0 * vec4(uvDepth, 1.0) - 1.0;
|
2017-12-25 01:00:10 -05:00
|
|
|
pos.xy *= vec2(u_inverse_projection_matrix[0][0], u_inverse_projection_matrix[1][1]);
|
|
|
|
pos.zw = vec2(pos.z * u_inverse_projection_matrix[2][2] + pos.w, pos.z * u_inverse_projection_matrix[2][3] + pos.w);
|
2014-05-02 12:11:34 -04:00
|
|
|
pos /= pos.w;
|
|
|
|
return pos;
|
|
|
|
}
|