Needs a lot of cleanup. Data has been de-duplicated, and where identical copies existed, one of them has been replaced with a symlink. Some files have been excluded, such as binaries, installers and debug dumps. Some of that may still be present.
93 lines
2.9 KiB
GLSL
93 lines
2.9 KiB
GLSL
uniform float mode = 0;
|
|
uniform float width = 0.2;
|
|
uniform float speed = 4.0;
|
|
|
|
#define PI 3.1415926535897932384626433832795
|
|
|
|
|
|
float t(float minv, float maxv, float m) {
|
|
float range = (maxv - minv);
|
|
return (minv + range/2) + (range/2) * sin(iGlobalTime * m);
|
|
}
|
|
float pulse(float freq) {
|
|
return 0.5 + 0.25 * sin(iGlobalTime * freq);
|
|
}
|
|
|
|
float getProceduralColors(inout vec3 diffuse, inout vec3 specular, inout float shininess) {
|
|
if (abs(_modelNormal.y) > width) {
|
|
discard;
|
|
}
|
|
if (mode == 0) {
|
|
diffuse = vec3(t(.5, 1, 5), t(.5, 1, 3), t(.5, 1, 2));
|
|
if (abs(_modelNormal.y) > width) {
|
|
discard;
|
|
}
|
|
return 1.0;
|
|
} else if (mode == 1) {
|
|
float count = 2;
|
|
float rad = mod(iGlobalTime * 2.0, 2 * PI);
|
|
rad -= PI;
|
|
rad += _modelNormal.y / 0.25;
|
|
float currad = atan(_modelNormal.z, _modelNormal.x);
|
|
currad = mod((currad + PI) * count, 2 * PI);
|
|
currad -= PI;
|
|
diffuse = vec3(t(.5, 1, 5), t(.5, 1, 3), t(.5, 1, 2));
|
|
float drad = abs(currad - rad);
|
|
if (drad > PI) {
|
|
drad = 2 * PI - drad;
|
|
}
|
|
if (drad > PI/2) {
|
|
discard;
|
|
}
|
|
return 1.0;
|
|
} else if (mode == 2) {
|
|
float color = floor(mod(iGlobalTime * 5, 6.0));
|
|
if (color == 0) {
|
|
diffuse = vec3(1, .3, .7);
|
|
} else if (color == 2) {
|
|
diffuse = vec3(66/255.0, 232/255.0, 244/255.0);
|
|
} else if (color == 4) {
|
|
diffuse = vec3(179/255.0, 66/255.0, 244/255.0);
|
|
} else {
|
|
discard;
|
|
}
|
|
return 1.0;
|
|
} else if (mode == 3) {
|
|
float count = 4 + 50 * sin(iGlobalTime * 1);
|
|
float rad = mod(iGlobalTime * 2.0, 2 * PI);
|
|
rad -= PI;
|
|
rad += _modelNormal.y / 0.25;
|
|
float currad = atan(_modelNormal.z, _modelNormal.x);
|
|
currad = mod((currad + PI) * count, 2 * PI);
|
|
currad -= PI;
|
|
diffuse = vec3(t(.5, 1, 5), t(.5, 1, 3), t(.5, 1, 2));
|
|
float drad = abs(currad - rad);
|
|
if (drad > PI) {
|
|
drad = 2 * PI - drad;
|
|
}
|
|
if (drad > PI/2) {
|
|
discard;
|
|
}
|
|
return 1.0;
|
|
} else if (mode == 4) {
|
|
float count = 20;
|
|
float rad = mod(iGlobalTime * 2.0, 2 * PI);
|
|
rad -= PI;
|
|
rad += _modelNormal.y / 0.5;
|
|
float currad = atan(_modelNormal.z, _modelNormal.x);
|
|
currad = mod((currad + PI) * count, 2 * PI);
|
|
currad -= PI;
|
|
diffuse = vec3(t(.5, 1, 5), t(.5, 1, 3), t(.5, 1, 2));
|
|
float drad = abs(currad - rad);
|
|
if (drad > PI) {
|
|
drad = 2 * PI - drad;
|
|
}
|
|
if (drad > 0.3) {
|
|
discard;
|
|
}
|
|
return 1.0;
|
|
}
|
|
//float size = 0.5 + (1 + sin(iGlobalTime * 2)) * 0.14;
|
|
diffuse = vec3(1.0, 0, 0);
|
|
return 1.0;
|
|
}
|