blob: a44ea7081bae357c7c6635f68c3a3f081abf11ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
uniform bool depthSet;
uniform bool isCameraBackground;
in vec3 pos;
out vec2 uvs;
void main()
{
if (isCameraBackground) {
vec3 vP = (ModelMatrix * vec4(pos, 1.0)).xyz;
gl_Position = point_view_to_ndc(vP);
}
else {
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
}
if (depthSet) {
/* Result in a position at 1.0 (far plane). Small epsilon to avoid precision issue.
* This mimics the effect of infinite projection matrix
* (see http://www.terathon.com/gdc07_lengyel.pdf). */
gl_Position.z = gl_Position.w - 2.4e-7;
}
uvs = pos.xy * 0.5 + 0.5;
}
|