603515dd3e
The tests seem to work: ./test/test_FileIO ./test/test_FileIO ./test/test_FileIO ./test/test_FileIO | \ ./test/test_SafeUDPpacket -f - ./test/test_SafeUDPpacket -f ./test/test_SafeUDPpacket
42 lines
1.1 KiB
GLSL
42 lines
1.1 KiB
GLSL
/* vim: set ft=c: */
|
|
|
|
# define M_PI (3.141592653589793238462643383279502884) /* pi */
|
|
# define M_PI_2 (1.570796326794896619231321691639751442) /* pi/2 */
|
|
# define M_PI_4 (0.785398163397448309615660845819875721) /* pi/4 */
|
|
|
|
/* <https://www.shadertoy.com/new> */
|
|
|
|
void
|
|
mainImage (out vec4 fragColor, in vec2 fragCoord)
|
|
{
|
|
const float t = iTime;
|
|
const int T = int (3 * (0.5 + 0.5 * cos (t)));
|
|
|
|
// Normalized pixel coordinates (from 0 to 1)
|
|
// vec2 uv = fragCoord.xy / iResolution.xy;
|
|
|
|
// Texture coordinates
|
|
vec2 uv = TexCoords;
|
|
|
|
// float du = 1.0 / iResolution.y;
|
|
// vec2 uv = du * (fragCoord.xy - (0.5 * iResolution.xy));
|
|
|
|
// Time varying pixel color
|
|
vec3 z1 = vec3 (
|
|
sin (t) * cos (t)
|
|
, sin (t / M_PI) * cos (t / M_PI)
|
|
, sin (t / M_PI / 2) * cos (t / M_PI_2)
|
|
);
|
|
vec3 z2 = uv.xyx;
|
|
switch (T)
|
|
{
|
|
case 0: z2 = uv.xxx; break;
|
|
case 1: z2 = uv.yyy; break;
|
|
case 2: z2 = uv.xyx; break;
|
|
}
|
|
vec3 col = 0.5 + 0.5 * cos (iTime + z1 + z2);
|
|
|
|
// Output to screen
|
|
fragColor = vec4 (col, 1.0);
|
|
}
|