2023-06-08 09:00:18 +00:00
|
|
|
#version 450
|
2016-12-26 16:11:13 +00:00
|
|
|
|
2023-06-08 10:03:48 +00:00
|
|
|
#include "common.vert.glsl"
|
|
|
|
#include "rect.vert.glsl"
|
2017-01-17 01:20:08 +00:00
|
|
|
|
2016-12-26 16:11:13 +00:00
|
|
|
layout(location = 0) in vec4 inRect;
|
|
|
|
layout(location = 1) in vec2 inStart;
|
|
|
|
layout(location = 2) in vec2 inEnd;
|
|
|
|
layout(location = 3) in int inRepeating;
|
2023-06-08 10:03:48 +00:00
|
|
|
layout(location = 4) in int inStopOffset;
|
|
|
|
layout(location = 5) in int inStopCount;
|
2016-12-26 16:11:13 +00:00
|
|
|
|
|
|
|
layout(location = 0) out vec2 outPos;
|
2023-06-08 10:03:48 +00:00
|
|
|
layout(location = 1) out flat Rect outRect;
|
|
|
|
layout(location = 2) out float outGradientPos;
|
|
|
|
layout(location = 3) out flat int outRepeating;
|
|
|
|
layout(location = 4) out flat int outStopOffset;
|
|
|
|
layout(location = 5) out flat int outStopCount;
|
2016-12-26 16:11:13 +00:00
|
|
|
|
|
|
|
float
|
|
|
|
get_gradient_pos (vec2 pos)
|
|
|
|
{
|
2023-06-08 10:03:48 +00:00
|
|
|
pos = pos - inStart * push.scale;
|
|
|
|
vec2 grad = (inEnd - inStart) * push.scale;
|
2016-12-26 16:11:13 +00:00
|
|
|
|
|
|
|
return dot (pos, grad) / dot (grad, grad);
|
|
|
|
}
|
|
|
|
|
|
|
|
void main() {
|
2023-06-08 10:03:48 +00:00
|
|
|
Rect r = rect_from_gsk (inRect);
|
|
|
|
vec2 pos = set_position_from_rect (r);
|
2016-12-26 16:11:13 +00:00
|
|
|
outPos = pos;
|
2023-06-08 10:03:48 +00:00
|
|
|
outRect = r;
|
2016-12-26 16:11:13 +00:00
|
|
|
outGradientPos = get_gradient_pos (pos);
|
|
|
|
outRepeating = inRepeating;
|
2023-06-08 10:03:48 +00:00
|
|
|
outStopOffset = inStopOffset;
|
2016-12-26 16:11:13 +00:00
|
|
|
outStopCount = inStopCount;
|
|
|
|
}
|