summaryrefslogtreecommitdiffstats
path: root/fiz/naloga/gl/fragment.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'fiz/naloga/gl/fragment.glsl')
-rw-r--r--fiz/naloga/gl/fragment.glsl41
1 files changed, 32 insertions, 9 deletions
diff --git a/fiz/naloga/gl/fragment.glsl b/fiz/naloga/gl/fragment.glsl
index c4952c4..095cb78 100644
--- a/fiz/naloga/gl/fragment.glsl
+++ b/fiz/naloga/gl/fragment.glsl
@@ -1,11 +1,10 @@
#version 330
-#pragma optionNV (unroll 1)
+// #pragma optionNV (unroll 1)
#define show_vec
#define SEG 32
-#define R .8
#define I .5
#define n 100.
@@ -18,12 +17,11 @@ uniform int OPTIONS;
out vec4 fragColor;
-vec3 tuljava (vec3 pz) {
+vec3 tuljava (vec3 pz, float R) {
float dr = 2. * PI / float(SEG);
vec3 sum = vec3(0);
for (int i = 0; i < SEG; i++){
float theta = dr * float(i);
- // jebi se, zakaj neza? pisat ?ita linearno >:(
vec3 dl = vec3(0,cos(theta),-sin(theta))*dr*R;
vec3 r = vec3(0,sin(theta),cos(theta))*R;
r+=pz;
@@ -33,13 +31,38 @@ vec3 tuljava (vec3 pz) {
return sum;
}
+
void main () {
+ float R = 0.8;
+ float R2 = abs(sin((time+8.2)/.6))+0.5;
vec2 uv = UVo;
- vec3 poz = vec3(uv*2.,sin(time/10.)*R);
- vec3 offset = vec3(R/2.,0,0);
-
- vec3 rez = tuljava(poz+offset)*n*I +
- tuljava(poz-offset)*n*I;
+ vec2 poz = vec2(uv*2.); // zavrteti moramo tako točke same, kot tudi
+ vec2 offset = vec2(R/2.,0); // njihove komponente
+ float kot = time/.4;
+ float multi = n*I/**abs(sin(time/.2)+0.2)*/;
+ vec2 dodatek = vec2(sin(time/.6)*.5, cos(time/.4)*.6);
+ vec3 rez = tuljava(
+ vec3(poz+offset, 1/2*R), R
+ )*n*I +
+ tuljava(
+ vec3(
+ vec2(poz-offset+dodatek)*
+ mat2( cos(kot),
+ sin(kot), -sin(kot),
+ cos(kot)
+ ),
+ 1/2*R
+ ),
+ R2
+ )*multi*mat3( cos(kot),
+ sin(kot),
+ 0,
+ -sin(kot),
+ cos(kot),
+ 0,
+ 0,
+ 0,
+ 1);
rez *= 1000.;
#ifdef show_vec
fragColor = vec4(rez, 1);