diff options
Diffstat (limited to '')
| -rw-r--r-- | src/main/resources/shaders/modules/utils.glsl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/resources/shaders/modules/utils.glsl b/src/main/resources/shaders/modules/utils.glsl index 961480f..090e017 100644 --- a/src/main/resources/shaders/modules/utils.glsl +++ b/src/main/resources/shaders/modules/utils.glsl @@ -9,6 +9,16 @@ float ssubtract(float a, float b, float k) { return -smin(-a, b, k); } +float rotational_repetition(vec2 p, int n, inout vec2 p1, inout vec2 p2) { + float del = 2. * PI / float(n); + float theta = atan(p.y, p.x); + float id = floor(theta / del); + float id2 = id + 1.; + p1 = mat2(cos(del * id), -sin(del * id), sin(del * id), cos(del * id)) * p; + p2 = mat2(cos(del * id2), -sin(del * id2), sin(del * id2), cos(del * id2)) * p; + return id; +} + // Easing float ease_in_out_quart(in float x) { return x < 0.5 ? 8 * x * x * x * x : 1 - pow(-2 * x + 2, 4) / 2; |
