2017-01-01 22:47:53 +00:00
|
|
|
#version 420 core
|
|
|
|
|
2017-01-17 04:50:52 +00:00
|
|
|
#include "clip.vert.glsl"
|
2017-01-17 01:20:08 +00:00
|
|
|
|
2017-01-01 22:47:53 +00:00
|
|
|
layout(location = 0) in vec4 inRect;
|
|
|
|
layout(location = 1) in vec4 inTexRect;
|
|
|
|
|
|
|
|
layout(location = 0) out vec2 outPos;
|
|
|
|
layout(location = 1) out vec2 outTexCoord;
|
|
|
|
|
|
|
|
out gl_PerVertex {
|
|
|
|
vec4 gl_Position;
|
|
|
|
};
|
|
|
|
|
|
|
|
vec2 offsets[6] = { vec2(0.0, 0.0),
|
|
|
|
vec2(1.0, 0.0),
|
|
|
|
vec2(0.0, 1.0),
|
|
|
|
vec2(0.0, 1.0),
|
|
|
|
vec2(1.0, 0.0),
|
|
|
|
vec2(1.0, 1.0) };
|
|
|
|
|
|
|
|
void main() {
|
2017-01-17 04:50:52 +00:00
|
|
|
vec4 rect = clip (inRect);
|
2017-01-01 22:47:53 +00:00
|
|
|
vec2 pos = rect.xy + rect.zw * offsets[gl_VertexIndex];
|
|
|
|
gl_Position = push.mvp * vec4 (pos, 0.0, 1.0);
|
|
|
|
|
|
|
|
outPos = pos;
|
|
|
|
|
|
|
|
vec4 texrect = vec4((rect.xy - inRect.xy) / inRect.zw,
|
|
|
|
rect.zw / inRect.zw);
|
|
|
|
texrect = vec4(inTexRect.xy + inTexRect.zw * texrect.xy,
|
|
|
|
inTexRect.zw * texrect.zw);
|
|
|
|
outTexCoord = texrect.xy + texrect.zw * offsets[gl_VertexIndex];
|
|
|
|
}
|