armory/Shaders/compositor_pass/compositor_pass.vert.glsl

34 lines
518 B
Plaintext
Raw Normal View History

2016-03-23 23:35:44 +01:00
#version 450
#ifdef GL_ES
precision highp float;
#endif
2016-08-15 23:45:03 +02:00
#ifdef _CompoPos
uniform mat4 invVP;
uniform vec3 eye;
#endif
2016-03-23 23:35:44 +01:00
in vec2 pos;
out vec2 texCoord;
2016-08-15 23:45:03 +02:00
#ifdef _CompoPos
out vec3 viewRay;
#endif
2016-03-23 23:35:44 +01:00
void main() {
2016-08-15 23:45:03 +02:00
// Scale vertex attribute to [0-1] range
2016-10-17 17:39:40 +02:00
const vec2 madd = vec2(0.5, 0.5);
2016-08-15 23:45:03 +02:00
texCoord = pos.xy * madd + madd;
2016-03-23 23:35:44 +01:00
2016-08-15 23:45:03 +02:00
gl_Position = vec4(pos.xy, 0.0, 1.0);
#ifdef _CompoPos
// NDC (at the back of cube)
vec4 v = vec4(pos.xy, 1.0, 1.0);
v = vec4(invVP * v);
v.xyz /= v.w;
viewRay = v.xyz - eye;
#endif
2016-03-23 23:35:44 +01:00
}