From 02b11c090854334f66501b3d21caf9d5e4cd2e0b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 27 May 2015 01:07:03 +0100 Subject: [PATCH] Add new shaders --- .../resources/ball.frag.glsl | 36 +++++ .../resources/bleepyblocks.frag.glsl | 21 +++ .../resources/fastclouds.frag.glsl | 146 ++++++++++++++++++ .../resources/flaring.frag.glsl | 146 ++++++++++++++++++ .../resources/juliasm.frag.glsl | 35 +++++ .../resources/juliatrap.frag.glsl | 27 ++++ .../resources/language/English/strings.po | 74 ++++++++- .../resources/noise.frag.glsl | 14 ++ .../resources/noiseanimelectric.frag.glsl | 66 ++++++++ .../resources/noiseanimlava.frag.glsl | 79 ++++++++++ .../resources/noiseanimwatery.frag.glsl | 55 +++++++ .../resources/plasma.frag.glsl | 19 +++ .../resources/plasma2.frag.glsl | 17 ++ .../resources/plasmatriangle.frag.glsl | 95 ++++++++++++ screensaver.shadertoy/resources/settings.xml | 2 +- .../resources/silexarst.frag.glsl | 22 +++ .../resources/simplefire.frag.glsl | 29 ++++ .../resources/sinebands.frag.glsl | 22 +++ .../resources/skyatnight.frag.glsl | 57 +++++++ .../resources/spiral.frag.glsl | 49 ++++++ .../resources/stellar.frag.glsl | 40 +++++ .../resources/test.frag.glsl | 5 + .../resources/warp.frag.glsl | 30 ++++ .../resources/watercaustic.frag.glsl | 57 +++++++ .../resources/worleynoisewaters.frag.glsl | 48 ++++++ src/main.cpp | 30 +++- 26 files changed, 1213 insertions(+), 8 deletions(-) create mode 100644 screensaver.shadertoy/resources/ball.frag.glsl create mode 100644 screensaver.shadertoy/resources/bleepyblocks.frag.glsl create mode 100644 screensaver.shadertoy/resources/fastclouds.frag.glsl create mode 100644 screensaver.shadertoy/resources/flaring.frag.glsl create mode 100644 screensaver.shadertoy/resources/juliasm.frag.glsl create mode 100644 screensaver.shadertoy/resources/juliatrap.frag.glsl create mode 100644 screensaver.shadertoy/resources/noise.frag.glsl create mode 100644 screensaver.shadertoy/resources/noiseanimelectric.frag.glsl create mode 100644 screensaver.shadertoy/resources/noiseanimlava.frag.glsl create mode 100644 screensaver.shadertoy/resources/noiseanimwatery.frag.glsl create mode 100644 screensaver.shadertoy/resources/plasma.frag.glsl create mode 100644 screensaver.shadertoy/resources/plasma2.frag.glsl create mode 100644 screensaver.shadertoy/resources/plasmatriangle.frag.glsl create mode 100644 screensaver.shadertoy/resources/silexarst.frag.glsl create mode 100644 screensaver.shadertoy/resources/simplefire.frag.glsl create mode 100644 screensaver.shadertoy/resources/sinebands.frag.glsl create mode 100644 screensaver.shadertoy/resources/skyatnight.frag.glsl create mode 100644 screensaver.shadertoy/resources/spiral.frag.glsl create mode 100644 screensaver.shadertoy/resources/stellar.frag.glsl create mode 100644 screensaver.shadertoy/resources/test.frag.glsl create mode 100644 screensaver.shadertoy/resources/warp.frag.glsl create mode 100644 screensaver.shadertoy/resources/watercaustic.frag.glsl create mode 100644 screensaver.shadertoy/resources/worleynoisewaters.frag.glsl diff --git a/screensaver.shadertoy/resources/ball.frag.glsl b/screensaver.shadertoy/resources/ball.frag.glsl new file mode 100644 index 0000000..9ee2f92 --- /dev/null +++ b/screensaver.shadertoy/resources/ball.frag.glsl @@ -0,0 +1,36 @@ +const float PI=3.1415926535897932384626433832795; + +// by maq/floppy +const float R=0.2; // to play +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec3 col; + vec2 uv = -0.5+fragCoord.xy / iResolution.xy; + uv.y*=0.66; // hack to get ar nice on 16:10 + vec2 p = uv; + float d=sqrt(dot(p,p)); + float fac,fac2; + if(d ridged, 2 -> sinfbm, 3 -> pure fbm + #define noisetype 2 + #define sin_freq 50. //for type 2 +#elif TYPE == 2 + #define brightness 1.5 + #define ray_brightness 10. + #define gamma 8. + #define spot_brightness 15. + #define ray_density 3.5 + #define curvature 15. + #define red 4. + #define green 1. + #define blue .1 + #define noisetype 1 + #define sin_freq 13. +#elif TYPE == 3 + #define brightness 1.5 + #define ray_brightness 20. + #define gamma 4. + #define spot_brightness .95 + #define ray_density 3.14 + #define curvature 17. + #define red 2.9 + #define green .7 + #define blue 3.5 + #define noisetype 2 + #define sin_freq 15. +#elif TYPE == 4 + #define brightness 3. + #define ray_brightness 5. + #define gamma 6. + #define spot_brightness 1.5 + #define ray_density 6. + #define curvature 90. + #define red 1.8 + #define green 3. + #define blue .5 + #define noisetype 1 + #define sin_freq 6. + #define YO_DAWG +#elif TYPE == 5 + #define brightness 2. + #define ray_brightness 5. + #define gamma 5. + #define spot_brightness 1.7 + #define ray_density 30. + #define curvature 1. + #define red 1. + #define green 4.0 + #define blue 4.9 + #define noisetype 2 + #define sin_freq 5. //for type 2 +#endif + + +//#define PROCEDURAL_NOISE +//#define YO_DAWG + + +float hash( float n ){return fract(sin(n)*43758.5453);} + +float noise( in vec2 x ) +{ + #ifdef PROCEDURAL_NOISE + x *= 1.75; + vec2 p = floor(x); + vec2 f = fract(x); + + f = f*f*(3.0-2.0*f); + + float n = p.x + p.y*57.0; + + float res = mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), + mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y); + return res; + #else + return texture2D(iChannel0, x*.01).x; + #endif +} + +mat2 m2 = mat2( 0.80, 0.60, -0.60, 0.80 ); +float fbm( in vec2 p ) +{ + float z=2.; + float rz = 0.; + p *= 0.25; + for (float i= 1.;i < 6.;i++ ) + { + #if noisetype == 1 + rz+= abs((noise(p)-0.5)*2.)/z; + #elif noisetype == 2 + rz+= (sin(noise(p)*sin_freq)*0.5+0.5) /z; + #else + rz+= noise(p)/z; + #endif + z = z*2.; + p = p*2.*m2; + } + return rz; +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + float t = -iGlobalTime*0.03; + vec2 uv = fragCoord.xy / iResolution.xy-0.5; + uv.x *= iResolution.x/iResolution.y; + uv*= curvature*.05+0.0001; + + float r = sqrt(dot(uv,uv)); + float x = dot(normalize(uv), vec2(.5,0.))+t; + float y = dot(normalize(uv), vec2(.0,.5))+t; + + #ifdef YO_DAWG + x = fbm(vec2(y*ray_density*0.5,r+x*ray_density*.2)); + y = fbm(vec2(r+y*ray_density*0.1,x*ray_density*.5)); + #endif + + float val; + val = fbm(vec2(r+y*ray_density,r+x*ray_density-y)); + val = smoothstep(gamma*.02-.1,ray_brightness+(gamma*0.02-.1)+.001,val); + val = sqrt(val); + + vec3 col = val/vec3(red,green,blue); + col = clamp(1.-col,0.,1.); + col = mix(col,vec3(1.),spot_brightness-r/0.1/curvature*200./brightness); + + fragColor = vec4(col,1.0); +} diff --git a/screensaver.shadertoy/resources/flaring.frag.glsl b/screensaver.shadertoy/resources/flaring.frag.glsl new file mode 100644 index 0000000..2f0e4ff --- /dev/null +++ b/screensaver.shadertoy/resources/flaring.frag.glsl @@ -0,0 +1,146 @@ +// https://www.shadertoy.com/view/XsjSRt + +//Flaring by nimitz (twitter: @stormoid) + +//change this value (1 to 5) or tweak the settings yourself. +//the gamma and spot brightness parameters can use negative values +#define TYPE 4 + +#if TYPE == 1 + #define brightness 1. + #define ray_brightness 11. + #define gamma 5. + #define spot_brightness 4. + #define ray_density 1.5 + #define curvature .1 + #define red 7. + #define green 1.3 + #define blue 1. + //1 -> ridged, 2 -> sinfbm, 3 -> pure fbm + #define noisetype 2 + #define sin_freq 50. //for type 2 +#elif TYPE == 2 + #define brightness 1.5 + #define ray_brightness 10. + #define gamma 8. + #define spot_brightness 15. + #define ray_density 3.5 + #define curvature 15. + #define red 4. + #define green 1. + #define blue .1 + #define noisetype 1 + #define sin_freq 13. +#elif TYPE == 3 + #define brightness 1.5 + #define ray_brightness 20. + #define gamma 4. + #define spot_brightness .95 + #define ray_density 3.14 + #define curvature 17. + #define red 2.9 + #define green .7 + #define blue 3.5 + #define noisetype 2 + #define sin_freq 15. +#elif TYPE == 4 + #define brightness 3. + #define ray_brightness 5. + #define gamma 6. + #define spot_brightness 1.5 + #define ray_density 6. + #define curvature 90. + #define red 1.8 + #define green 3. + #define blue .5 + #define noisetype 1 + #define sin_freq 6. + #define YO_DAWG +#elif TYPE == 5 + #define brightness 2. + #define ray_brightness 5. + #define gamma 5. + #define spot_brightness 1.7 + #define ray_density 30. + #define curvature 1. + #define red 1. + #define green 4.0 + #define blue 4.9 + #define noisetype 2 + #define sin_freq 5. //for type 2 +#endif + + +//#define PROCEDURAL_NOISE +//#define YO_DAWG + + +float hash( float n ){return fract(sin(n)*43758.5453);} + +float noise( in vec2 x ) +{ + #ifdef PROCEDURAL_NOISE + x *= 1.75; + vec2 p = floor(x); + vec2 f = fract(x); + + f = f*f*(3.0-2.0*f); + + float n = p.x + p.y*57.0; + + float res = mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x), + mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y); + return res; + #else + return texture2D(iChannel0, x*.01).x; + #endif +} + +mat2 m2 = mat2( 0.80, 0.60, -0.60, 0.80 ); +float fbm( in vec2 p ) +{ + float z=2.; + float rz = 0.; + p *= 0.25; + for (float i= 1.;i < 6.;i++ ) + { + #if noisetype == 1 + rz+= abs((noise(p)-0.5)*2.)/z; + #elif noisetype == 2 + rz+= (sin(noise(p)*sin_freq)*0.5+0.5) /z; + #else + rz+= noise(p)/z; + #endif + z = z*2.; + p = p*2.*m2; + } + return rz; +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + float t = -iGlobalTime*0.03; + vec2 uv = fragCoord.xy / iResolution.xy-0.5; + uv.x *= iResolution.x/iResolution.y; + uv*= curvature*.05+0.0001; + + float r = sqrt(dot(uv,uv)); + float x = dot(normalize(uv), vec2(.5,0.))+t; + float y = dot(normalize(uv), vec2(.0,.5))+t; + + #ifdef YO_DAWG + x = fbm(vec2(y*ray_density*0.5,r+x*ray_density*.2)); + y = fbm(vec2(r+y*ray_density*0.1,x*ray_density*.5)); + #endif + + float val; + val = fbm(vec2(r+y*ray_density,r+x*ray_density-y)); + val = smoothstep(gamma*.02-.1,ray_brightness+(gamma*0.02-.1)+.001,val); + val = sqrt(val); + + vec3 col = val/vec3(red,green,blue); + col = clamp(1.-col,0.,1.); + col = mix(col,vec3(1.),spot_brightness-r/0.1/curvature*200./brightness); + + fragColor = vec4(col,1.0); +} diff --git a/screensaver.shadertoy/resources/juliasm.frag.glsl b/screensaver.shadertoy/resources/juliasm.frag.glsl new file mode 100644 index 0000000..08496a2 --- /dev/null +++ b/screensaver.shadertoy/resources/juliasm.frag.glsl @@ -0,0 +1,35 @@ +// See: https://www.shadertoy.com/view/XssXDr + +const int max_iterations = 14; + +vec2 complex_square( vec2 v ) { + return vec2( + v.x * v.x - v.y * v.y, + v.x * v.y * 2.0 + ); +} + + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 uv = fragCoord.yx - iResolution.yx * 0.5; + uv *= 2.5 / min( iResolution.x, iResolution.y ); + + vec2 c = vec2( 0.37+cos(iGlobalTime*1.23462673423)*0.04, sin(iGlobalTime*1.43472384234)*0.10+0.50); + vec2 v = uv; + float scale = 0.01; + + float smoothcolor = exp(-length(v)); + + for ( int i = 0 ; i < max_iterations; i++ ) { + v = c + complex_square( v ); + smoothcolor += exp(-length(v)); + if ( dot( v, v ) > 4.0 ) { + break; + } + } + float r = 0.6+0.4*(sin(smoothcolor*0.1+iGlobalTime*0.63)); + float g = r * r; + float b = r * g; + fragColor = vec4(r,g,b,0); +} diff --git a/screensaver.shadertoy/resources/juliatrap.frag.glsl b/screensaver.shadertoy/resources/juliatrap.frag.glsl new file mode 100644 index 0000000..509c9e8 --- /dev/null +++ b/screensaver.shadertoy/resources/juliatrap.frag.glsl @@ -0,0 +1,27 @@ +// Created by inigo quilez - iq/2014 +// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. + +// line 13: pixel coordinates +// line 15: c travels around the main cardiod c(t) = ½e^it - ¼e^i2t +// line 20: z = z² + c +// line 21: trap orbit +// line 24: remap +// line 26: color + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 z = 1.15*(-iResolution.yx+2.0*fragCoord.yx)/iResolution.y; + + vec2 an = 0.51*cos( vec2(0.0,1.5708) + 0.1*iGlobalTime ) - 0.25*cos( vec2(0.0,1.5708) + 0.2*iGlobalTime ); + + float f = 1e20; + for( int i=0; i<17; i++ ) + { + z = vec2( z.x*z.x-z.y*z.y, 2.0*z.x*z.y ) + an; + f = min( f, dot(z,z) ); + } + + f = 1.0+log(f)/16.0; + + fragColor = vec4(f,f*f,f*f*f,1.0); +} diff --git a/screensaver.shadertoy/resources/language/English/strings.po b/screensaver.shadertoy/resources/language/English/strings.po index 08ca451..fd0cb58 100644 --- a/screensaver.shadertoy/resources/language/English/strings.po +++ b/screensaver.shadertoy/resources/language/English/strings.po @@ -16,31 +16,95 @@ msgctxt "#30000" msgid "ShaderToy" msgstr "" +msgctxt "#30100" +msgid "Random" +msgstr "" + msgctxt "#30001" msgid "Ball" msgstr "" msgctxt "#30002" -msgid "Plasma" +msgid "Bleepy Blocks" msgstr "" msgctxt "#30003" -msgid "Plasma2" +msgid "Clouds" msgstr "" msgctxt "#30004" -msgid "Stellar" +msgid "Interstellar" msgstr "" msgctxt "#30005" -msgid "Noise" +msgid "Interweaving Sine Bands" msgstr "" msgctxt "#30006" -msgid "Spiral" +msgid "Juliasm" msgstr "" msgctxt "#30007" +msgid "Julia Trap" +msgstr "" + +msgctxt "#30008" +msgid "Noise" +msgstr "" + +msgctxt "#30009" +msgid "Noise Animation Electric" +msgstr "" + +msgctxt "#30010" +msgid "Noise Animation Lava" +msgstr "" + +msgctxt "#30011" +msgid "Noise Animation Watery" +msgstr "" + +msgctxt "#30012" +msgid "Plasma Triangle" +msgstr "" + +msgctxt "#30013" +msgid "Plasma" +msgstr "" + +msgctxt "#30014" +msgid "Plasma2" +msgstr "" + +msgctxt "#30015" +msgid "Silexars Creation" +msgstr "" + +msgctxt "#30016" +msgid "Simple Fire" +msgstr "" + +msgctxt "#30017" +msgid "Sky at Night" +msgstr "" + +msgctxt "#30018" +msgid "Spiral" +msgstr "" + +msgctxt "#30019" msgid "Warp" msgstr "" +msgctxt "#30020" +msgid "Water Caustic" +msgstr "" + +msgctxt "#30021" +msgid "Worley Noise Waters" +msgstr "" + +msgctxt "#30022" +msgid "Flaring" +msgstr "" + diff --git a/screensaver.shadertoy/resources/noise.frag.glsl b/screensaver.shadertoy/resources/noise.frag.glsl new file mode 100644 index 0000000..94976f0 --- /dev/null +++ b/screensaver.shadertoy/resources/noise.frag.glsl @@ -0,0 +1,14 @@ +float rand(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898,78.233))) * 43758.5453); +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 uv = fract(iGlobalTime) + fragCoord.xy * 1e-1; + float r = rand(vec2(1.0*uv.x, 0.8*uv.y)); + float g = rand(vec2(1.1*uv.x, 0.9*uv.y)); + float b = rand(vec2(1.2*uv.x, 1.0*uv.y)); + fragColor = vec4(r, g, b, 1.0); +} + diff --git a/screensaver.shadertoy/resources/noiseanimelectric.frag.glsl b/screensaver.shadertoy/resources/noiseanimelectric.frag.glsl new file mode 100644 index 0000000..796f1d7 --- /dev/null +++ b/screensaver.shadertoy/resources/noiseanimelectric.frag.glsl @@ -0,0 +1,66 @@ +// Based on https://www.shadertoy.com/view/ldlXRS + +//Noise animation - Electric +//by nimitz (stormoid.com) (twitter: @stormoid) + +//The domain is displaced by two fbm calls one for each axis. +//Turbulent fbm (aka ridged) is used for better effect. + +#define time iGlobalTime*0.15 +#define tau 6.2831853 + +mat2 makem2(in float theta){float c = cos(theta);float s = sin(theta);return mat2(c,-s,s,c);} +float noise( in vec2 x ){return texture2D(iChannel0, x*.01).x;} + +float fbm(in vec2 p) +{ + float z=2.; + float rz = 0.; + vec2 bp = p; + for (float i= 1.;i < 6.;i++) + { + rz+= abs((noise(p)-0.5)*2.)/z; + z = z*2.; + p = p*2.; + } + return rz; +} + +float dualfbm(in vec2 p) +{ + //get two rotated fbm calls and displace the domain + vec2 p2 = p*.7; + vec2 basis = vec2(fbm(p2-time*1.6),fbm(p2+time*1.7)); + basis = (basis-.5)*.2; + p += basis; + + //coloring + return fbm(p*makem2(time*0.2)); +} + +float circ(vec2 p) +{ + float r = length(p); + r = log(sqrt(r)); + return abs(mod(r*4.,tau)-3.14)*3.+.2; + +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + //setup system + vec2 p = fragCoord.xy / iResolution.xy-0.5; + p.x *= iResolution.x/iResolution.y; + p*=4.; + + float rz = dualfbm(p); + + //rings + p /= exp(mod(time*10.,3.14159)); + rz *= pow(abs((0.1-circ(p))),.9); + + //final color + vec3 col = vec3(.2,0.1,0.4)/rz; + col=pow(abs(col),vec3(.99)); + fragColor = vec4(col,1.); +} diff --git a/screensaver.shadertoy/resources/noiseanimlava.frag.glsl b/screensaver.shadertoy/resources/noiseanimlava.frag.glsl new file mode 100644 index 0000000..1cd8304 --- /dev/null +++ b/screensaver.shadertoy/resources/noiseanimlava.frag.glsl @@ -0,0 +1,79 @@ +// Taken from https://www.shadertoy.com/view/lslXRS + +//Noise animation - Lava +//by nimitz (stormoid.com) (twitter: @stormoid) + + +//Somewhat inspired by the concepts behind "flow noise" +//every octave of noise is modulated separately +//with displacement using a rotated vector field + +//This is a more standard use of the flow noise +//unlike my normalized vector field version (https://www.shadertoy.com/view/MdlXRS) +//the noise octaves are actually displaced to create a directional flow + +//Sinus ridged fbm is used for better effect. + +#define time iGlobalTime*0.1 + +float hash21(in vec2 n){ return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); } +mat2 makem2(in float theta){float c = cos(theta);float s = sin(theta);return mat2(c,-s,s,c);} +float noise( in vec2 x ){return texture2D(iChannel0, x*.01).x;} + +vec2 gradn(vec2 p) +{ + float ep = .09; + float gradx = noise(vec2(p.x+ep,p.y))-noise(vec2(p.x-ep,p.y)); + float grady = noise(vec2(p.x,p.y+ep))-noise(vec2(p.x,p.y-ep)); + return vec2(gradx,grady); +} + +float flow(in vec2 p) +{ + float z=2.; + float rz = 0.; + vec2 bp = p; + for (float i= 1.;i < 7.;i++ ) + { + //primary flow speed + p += time*.6; + + //secondary flow speed (speed of the perceived flow) + bp += time*1.9; + + //displacement field (try changing time multiplier) + vec2 gr = gradn(i*p*.34+time*1.); + + //rotation of the displacement field + gr*=makem2(time*6.-(0.05*p.x+0.03*p.y)*40.); + + //displace the system + p += gr*.5; + + //add noise octave + rz+= (sin(noise(p)*7.)*0.5+0.5)/z; + + //blend factor (blending displaced system with base system) + //you could call this advection factor (.5 being low, .95 being high) + p = mix(bp,p,.77); + + //intensity scaling + z *= 1.4; + //octave scaling + p *= 2.; + bp *= 1.9; + } + return rz; +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 p = fragCoord.xy / iResolution.xy-0.5; + p.x *= iResolution.x/iResolution.y; + p*= 3.; + float rz = flow(p); + + vec3 col = vec3(.2,0.07,0.01)/rz; + col=pow(col,vec3(1.4)); + fragColor = vec4(col,1.0); +} diff --git a/screensaver.shadertoy/resources/noiseanimwatery.frag.glsl b/screensaver.shadertoy/resources/noiseanimwatery.frag.glsl new file mode 100644 index 0000000..235ec22 --- /dev/null +++ b/screensaver.shadertoy/resources/noiseanimwatery.frag.glsl @@ -0,0 +1,55 @@ +// Taken from https://www.shadertoy.com/view/MssSRS + +//Noise animation - Watery by nimitz (twitter: @stormoid) + +//The domain is rotated by the values of a preliminary fbm call +//then the fbm function is called again to color the screen. +//Turbulent fbm (aka ridged) is used for better effect. +//define centered to see the rotation better. + +//#define CENTERED + +#define time iGlobalTime*0.2 + +mat2 makem2(in float theta){float c = cos(theta);float s = sin(theta);return mat2(c,-s,s,c);} +float noise( in vec2 x ){return texture2D(iChannel0, x*.01).x;} + +mat2 m2 = mat2( 0.80, 0.60, -0.60, 0.80 ); +float fbm( in vec2 p ) +{ + float z=2.; + float rz = 0.; + for (float i= 1.;i < 7.;i++ ) + { + rz+= abs((noise(p)-0.5)*2.)/z; + z = z*2.; + p = p*2.; + p*= m2; + } + return rz; +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 p = fragCoord.xy / iResolution.xy*2.-1.; + p.x *= iResolution.x/iResolution.y; + vec2 bp = p; + #ifndef CENTERED + p += 5.; + p *= 0.6; + #endif + float rb = fbm(p*.5+time*.17)*.1; + rb = sqrt(rb); + #ifndef CENTERED + p *= makem2(rb*.2+atan(p.y,p.x)*1.); + #else + p *= makem2(rb*.2+atan(p.y,p.x)*2.); + #endif + + //coloring + float rz = fbm(p*.9-time*.7); + rz *= dot(bp*5.,bp)+.5; + rz *= sin(p.x*.5+time*4.)*1.5; + vec3 col = vec3(.04,0.07,0.45)/(.1-rz); + fragColor = vec4(sqrt(abs(col)),1.0); +} diff --git a/screensaver.shadertoy/resources/plasma.frag.glsl b/screensaver.shadertoy/resources/plasma.frag.glsl new file mode 100644 index 0000000..8692f12 --- /dev/null +++ b/screensaver.shadertoy/resources/plasma.frag.glsl @@ -0,0 +1,19 @@ +float u_time=iGlobalTime*0.2; +vec2 u_k = vec2(32.0, 32.0); +precision mediump float; +const float PI=3.1415926535897932384626433832795; +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 p = fragCoord.xy / iResolution.xy; + float v = 0.0; + vec2 c = p * u_k - u_k/2.0; + v += sin((c.x+u_time)); + v += sin((c.y+u_time)/2.0); + v += sin((c.x+c.y+u_time)/2.0); + c += u_k/2.0 * vec2(sin(u_time/3.0), cos(u_time/2.0)); + v += sin(sqrt(c.x*c.x+c.y*c.y+1.0)+u_time); + v = v/2.0; + vec3 col = vec3(1.0, sin(PI*v), cos(PI*v)); + fragColor = vec4(col*0.5 + 0.5, 1.0); +} + diff --git a/screensaver.shadertoy/resources/plasma2.frag.glsl b/screensaver.shadertoy/resources/plasma2.frag.glsl new file mode 100644 index 0000000..59a5834 --- /dev/null +++ b/screensaver.shadertoy/resources/plasma2.frag.glsl @@ -0,0 +1,17 @@ +// from: https://www.shadertoy.com/view/ldBGRR + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 p = -1.0 + 2.0 * fragCoord.xy / iResolution.xy; + + // main code, *original shader by: 'Plasma' by Viktor Korsun (2011) + float x = p.x; + float y = p.y; + float mov0 = x+y+cos(sin(iGlobalTime)*2.0)*100.+sin(x/100.)*1000.; + float mov1 = y / 0.9 + iGlobalTime; + float mov2 = x / 0.2; + float c1 = abs(sin(mov1+iGlobalTime)/2.+mov2/2.-mov1-mov2+iGlobalTime); + float c2 = abs(sin(c1+sin(mov0/1000.+iGlobalTime)+sin(y/40.+iGlobalTime)+sin((x+y)/100.)*3.)); + float c3 = abs(sin(c2+cos(mov1+mov2+c2)+cos(mov2)+sin(x/1000.))); + fragColor = vec4(c1,c2,c3,1.0); +} diff --git a/screensaver.shadertoy/resources/plasmatriangle.frag.glsl b/screensaver.shadertoy/resources/plasmatriangle.frag.glsl new file mode 100644 index 0000000..57766f2 --- /dev/null +++ b/screensaver.shadertoy/resources/plasmatriangle.frag.glsl @@ -0,0 +1,95 @@ +// Taken from https://www.shadertoy.com/view/XdX3WN + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + float pointRadius = 0.06; + float linkSize = 0.04; + float noiseStrength = 0.08; // range: 0-1 + + float minDimension = min(iResolution.x, iResolution.y); + vec2 bounds = vec2(iResolution.x / minDimension, iResolution.y / minDimension); + vec2 uv = fragCoord.xy / minDimension; + + vec3 pointR = vec3(0.0, 0.0, 1.0); + vec3 pointG = vec3(0.0, 0.0, 1.0); + vec3 pointB = vec3(0.0, 0.0, 1.0); + + // Make the points orbit round the origin in 3 dimensions. + // Coefficients are arbitrary to give different behaviours. + // The Z coordinate should always be >0.0, as it's used directly to + // multiply the radius to give the impression of depth. + pointR.x += 0.32 * sin(1.32 * iGlobalTime); + pointR.y += 0.3 * sin(1.03 * iGlobalTime); + pointR.z += 0.4 * sin(1.32 * iGlobalTime); + + pointG.x += 0.31 * sin(0.92 * iGlobalTime); + pointG.y += 0.29 * sin(0.99 * iGlobalTime); + pointG.z += 0.38 * sin(1.24 * iGlobalTime); + + pointB.x += 0.33 * sin(1.245 * iGlobalTime); + pointB.y += 0.3 * sin(1.41 * iGlobalTime); + pointB.z += 0.41 * sin(1.11 * iGlobalTime); + + // Centre the points in the display + vec2 midUV = vec2(bounds.x * 0.5, bounds.y * 0.5); + pointR.xy += midUV; + pointG.xy += midUV; + pointB.xy += midUV; + + // Calculate the vectors from the current fragment to the coloured points + vec2 vecToR = pointR.xy - uv; + vec2 vecToG = pointG.xy - uv; + vec2 vecToB = pointB.xy - uv; + + vec2 dirToR = normalize(vecToR.xy); + vec2 dirToG = normalize(vecToG.xy); + vec2 dirToB = normalize(vecToB.xy); + + float distToR = length(vecToR); + float distToG = length(vecToG); + float distToB = length(vecToB); + + // Calculate the dot product between vectors from the current fragment to each pair + // of adjacent coloured points. This helps us determine how close the current fragment + // is to a link between points. + float dotRG = dot(dirToR, dirToG); + float dotGB = dot(dirToG, dirToB); + float dotBR = dot(dirToB, dirToR); + + // Start with a bright coloured dot around each point + fragColor.x = 1.0 - smoothstep(distToR, 0.0, pointRadius * pointR.z); + fragColor.y = 1.0 - smoothstep(distToG, 0.0, pointRadius * pointG.z); + fragColor.z = 1.0 - smoothstep(distToB, 0.0, pointRadius * pointB.z); + fragColor.w = 1.0; + + // We want to show a coloured link between adjacent points. + // Determine the strength of each link at the current fragment. + // This tends towards 1.0 as the vectors to each point tend towards opposite directions. + float linkStrengthRG = 1.0 - smoothstep(dotRG, -1.01, -1.0 + (linkSize * pointR.z * pointG.z)); + float linkStrengthGB = 1.0 - smoothstep(dotGB, -1.01, -1.0 + (linkSize * pointG.z * pointB.z)); + float linkStrengthBR = 1.0 - smoothstep(dotBR, -1.01, -1.0 + (linkSize * pointB.z * pointR.z)); + + // If the current fragment is in a link, we need to know how much the + // linked points contribute of their colour. + float sumDistRG = distToR + distToG; + float sumDistGB = distToG + distToB; + float sumDistBR = distToB + distToR; + + float contribRonRG = 1.0 - (distToR / sumDistRG); + float contribRonBR = 1.0 - (distToR / sumDistBR); + + float contribGonRG = 1.0 - (distToG / sumDistRG); + float contribGonGB = 1.0 - (distToG / sumDistGB); + + float contribBonGB = 1.0 - (distToB / sumDistGB); + float contribBonBR = 1.0 - (distToB / sumDistBR); + + // Additively blend the link colours into the fragment. + fragColor.x += (linkStrengthRG * contribRonRG) + (linkStrengthBR * contribRonBR); + fragColor.y += (linkStrengthGB * contribGonGB) + (linkStrengthRG * contribGonRG); + fragColor.z += (linkStrengthBR * contribBonBR) + (linkStrengthGB * contribBonGB); + + // Use an underlying texture to provide some noise + float noiseMin = 1.0 - noiseStrength; + fragColor.xyz *= (1.0 - noiseStrength) + (noiseStrength * texture2D(iChannel0, uv * 2.0).xyz); +} diff --git a/screensaver.shadertoy/resources/settings.xml b/screensaver.shadertoy/resources/settings.xml index 200ce6f..d55ca2c 100644 --- a/screensaver.shadertoy/resources/settings.xml +++ b/screensaver.shadertoy/resources/settings.xml @@ -1,3 +1,3 @@ - + diff --git a/screensaver.shadertoy/resources/silexarst.frag.glsl b/screensaver.shadertoy/resources/silexarst.frag.glsl new file mode 100644 index 0000000..46aef7a --- /dev/null +++ b/screensaver.shadertoy/resources/silexarst.frag.glsl @@ -0,0 +1,22 @@ +// Taken from https://www.shadertoy.com/view/XsXXDn + +// http://www.pouet.net/prod.php?which=57245 + +#define t iGlobalTime +#define r iResolution.xy + +void mainImage( out vec4 fragColor, in vec2 fragCoord ){ + vec3 c; + float l,z=t; + for(int i=0;i<3;i++) { + vec2 uv,p=fragCoord.xy/r; + uv=p; + p-=.5; + p.x*=r.x/r.y; + z+=.07; + l=length(p); + uv+=p/l*(sin(z)+1.)*abs(sin(l*9.-z*2.)); + c[i]=.01/length(abs(mod(uv,1.)-.5)); + } + fragColor=vec4(c/l,t); +} diff --git a/screensaver.shadertoy/resources/simplefire.frag.glsl b/screensaver.shadertoy/resources/simplefire.frag.glsl new file mode 100644 index 0000000..eaf2f21 --- /dev/null +++ b/screensaver.shadertoy/resources/simplefire.frag.glsl @@ -0,0 +1,29 @@ +// much simplified version of the fire shader by @301z + +const float SCALE = 16.0; +// speed of perturbations +const float PSPEED1 = 1.5; +const float PSPEED2 = 1.0; +// speed of flame cores +const vec2 CORESPEED = vec2(0.2,0.4); +const vec3 color1 = vec3(0.5, 0.0, 0.0); +const vec3 color2 = vec3(1.0, 0.5, 0.0); + +float rand(vec2 n) { + return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453); +} + +float noise(vec2 n) { + const vec2 d = vec2(0.0, 1.0); + vec2 b = floor(n); + vec2 f = smoothstep(vec2(0.0), vec2(1.0), fract(n)); + return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y); +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) { + vec2 p = fragCoord.xy * SCALE / iResolution.xx; + vec2 r = vec2(noise(p + iGlobalTime*PSPEED1 - p.x - p.y), noise(p - iGlobalTime*PSPEED2)); + vec3 c = mix(color1, color2, noise(p + r - CORESPEED*iGlobalTime)); + fragColor = vec4(c, 1.0); +} + diff --git a/screensaver.shadertoy/resources/sinebands.frag.glsl b/screensaver.shadertoy/resources/sinebands.frag.glsl new file mode 100644 index 0000000..38d77cf --- /dev/null +++ b/screensaver.shadertoy/resources/sinebands.frag.glsl @@ -0,0 +1,22 @@ +// from: https://www.shadertoy.com/view/ltB3zw + +vec3 calcSine(vec2 uv, + float frequency, float amplitude, float shift, float offset, + vec3 color, float width, float exponent) +{ + float y = sin(iGlobalTime * frequency + shift + uv.x) * amplitude + offset; + float scale = pow(smoothstep(width, 0.0, distance(y, uv.y)), exponent); + return color * scale; +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 uv = fragCoord.xy / iResolution.xy; + vec3 color = vec3(0.0); + + color += calcSine(uv, 2.0, 0.25, 0.0, 0.5, vec3(0.0, 0.0, 1.0), 0.3, 1.0); + color += calcSine(uv, 2.6, 0.25, 0.2, 0.5, vec3(0.0, 1.0, 0.0), 0.3, 1.0); + color += calcSine(uv, 2.9, 0.25, 0.4, 0.5, vec3(1.0, 0.0, 0.0), 0.3, 1.0); + + fragColor = vec4(color,1.0); +} diff --git a/screensaver.shadertoy/resources/skyatnight.frag.glsl b/screensaver.shadertoy/resources/skyatnight.frag.glsl new file mode 100644 index 0000000..e532ecc --- /dev/null +++ b/screensaver.shadertoy/resources/skyatnight.frag.glsl @@ -0,0 +1,57 @@ +// Taken from https://www.shadertoy.com/view/Mlf3WX + +// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. +// Created by S.Guillitte + +const mat2 m2 = mat2(.8,.6,-.6,.8); + +float stars(in vec2 p){ + vec2 z = p; + p=floor(p*5.)/5.+0.1; + float r = 80.*dot(z-p,z-p); + z=p; + for( int i=0; i< 3; i++ ) + { + z=m2*z*1.1+1.3; + z+=15.*sin(z+3.*sin(p.yx)); + } + return clamp(2.5-length(z),0.,1.)*exp(-r); +} + +float noise(in vec2 p){ + + float res=0.; + float f=1.; + for( int i=0; i< 2; i++ ) + { + p=m2*p*f+4.3; + f*=1.1; + res+=(sin(p+sin(p.yx))).x; + } + return (res/3.); +} + +float fbm(in vec2 p){ + + float res=0.; + float f=1.; + for( int i=0; i< 5; i++ ) + { + f*=2.; + res+=noise(f*p)/f; + } + return res; +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 p = 15.*(-iResolution.xy+2.0*fragCoord.xy)/iResolution.y; + float f = stars(p); + p+=.8*iGlobalTime; + vec3 col = vec3(f*f*f,f*f*.8,f*.8); + f= clamp(fbm(p*.1),0.,1.); + if(f>.1)col =vec3(f*f*f,f*f,f); + else col = mix(col,vec3(f*f*f,f*f,f),10.*f); + + fragColor = vec4(col,1.0); +} diff --git a/screensaver.shadertoy/resources/spiral.frag.glsl b/screensaver.shadertoy/resources/spiral.frag.glsl new file mode 100644 index 0000000..e2d8044 --- /dev/null +++ b/screensaver.shadertoy/resources/spiral.frag.glsl @@ -0,0 +1,49 @@ + float u_time=iGlobalTime*0.2; + vec2 u_k = vec2(32.0, 32.0); + precision mediump float; + const float PI=3.1415926535897932384626433832795; + const float TAU=6.283185307179586; + + void mainImage( out vec4 fragColor, in vec2 fragCoord ) + { + vec2 p = 2.0*(0.5 * iResolution.xy - fragCoord.xy) / iResolution.xx; + float angle = atan(p.y, p.x); + float turn = (angle + PI) / TAU; + float radius = sqrt(p.x*p.x + p.y*p.y); + + float rotation = 0.04 * TAU * iGlobalTime; + float turn_1 = turn + rotation; + + float n_sub = 2.0; + + float turn_sub = mod(float(n_sub) * turn_1, float(n_sub)); + + float k_sine = 0.1 * sin(3.0 * iGlobalTime); + float sine = k_sine * sin(50.0 * (pow(radius, 0.1) - 0.4 * iGlobalTime)); + float turn_sine = turn_sub + sine; + + int n_colors = 5; + int i_turn = int(mod(float(n_colors) * turn_sine, float(n_colors))); + + int i_radius = int(1.5/pow(radius*0.5, 0.6) + 5.0 * iGlobalTime); + + int i_color = int(mod(float(i_turn + i_radius), float(n_colors))); + + vec3 color; + if(i_color == 0) { + color = vec3(1.0, 1.0, 1.0); + } else if(i_color == 1) { + color = vec3(0.0, 0.0, 0.0); + } else if(i_color == 2) { + color = vec3(1.0, 0.0, 0.0); + } else if(i_color == 3) { + color = vec3(1.0, 0.5, 0.0); + } else if(i_color == 4) { + color = vec3(1.0, 1.0, 0.0); + } + + color *= pow(radius, 0.5)*1.0; + + fragColor = vec4(color, 1.0); + } + diff --git a/screensaver.shadertoy/resources/stellar.frag.glsl b/screensaver.shadertoy/resources/stellar.frag.glsl new file mode 100644 index 0000000..7b14512 --- /dev/null +++ b/screensaver.shadertoy/resources/stellar.frag.glsl @@ -0,0 +1,40 @@ +// from https://www.shadertoy.com/view/Xdl3D2 + +precision lowp float; + +vec4 Noise( in ivec2 x ) +{ + return texture2D( iChannel0, (vec2(x)+0.5)/256.0, -100.0 ); +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec3 ray; + ray.xy = 2.0*(fragCoord.xy-iResolution.xy*.5)/iResolution.x; + ray.z = 1.0; + + float offset = iGlobalTime*.5; + float speed2 = (cos(offset)+1.0)*2.0; + float ispeed = 1.0/(speed2+.1); + offset += sin(offset)*.96; + offset *= 2.0; + + vec3 col = vec3(0); + + vec3 stp = ray/max(abs(ray.x),abs(ray.y)); + + vec3 pos = 2.0*stp+.5; + for ( int i=0; i < 14; i++ ) + { + float z = Noise(ivec2(pos.xy)).x; + z = fract(z-offset); + float d = 50.0*z-pos.z; + float w = max(0.0,1.0-8.0*length(fract(pos.xy)-.5)); + w *= w; + vec3 c = max(vec3(0),vec3(1.0-abs(d+speed2*.5)*ispeed,1.0-abs(d)*ispeed,1.0-abs(d-speed2*.5)*ispeed)); + col += 1.5*(1.0-z)*c*w; + pos += stp; + } + + fragColor = vec4(col,1.0); +} diff --git a/screensaver.shadertoy/resources/test.frag.glsl b/screensaver.shadertoy/resources/test.frag.glsl new file mode 100644 index 0000000..95f8397 --- /dev/null +++ b/screensaver.shadertoy/resources/test.frag.glsl @@ -0,0 +1,5 @@ +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 p = vec2(fragCoord.x/iResolution.x, fragCoord.y/iResolution.y); + fragColor = texture2D( iChannel0, p ); +} diff --git a/screensaver.shadertoy/resources/warp.frag.glsl b/screensaver.shadertoy/resources/warp.frag.glsl new file mode 100644 index 0000000..7299357 --- /dev/null +++ b/screensaver.shadertoy/resources/warp.frag.glsl @@ -0,0 +1,30 @@ +float time=iGlobalTime*0.1; +const float pi = 3.14159265; +const float sin_4000 = 0.6427876097; +const float cos_4000 = 0.7660444431; +const float sin_6000 = -0.8660254038; +const float cos_6000 = -0.5; + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 vTextureCoord = fragCoord.xy / iResolution.xy; + float s = sin(time); + float c = cos(time); + float s2 = 2.0*s*c; + float c2 = 1.0-2.0*s*s; + float s3 = s2*c + c2*s; + float c3 = c2*c - s2*s; + float ss = s2*cos_4000 + c2*sin_4000; + float cc = c3*cos_6000 - s3*sin_6000; + vec2 offset2 = vec2(6.0*sin(time*1.1), 3.0*cos(time*1.1)); + vec2 oldPos = vTextureCoord.xy - vec2(0.5, 0.5); + vec2 newPos = vec2(oldPos.x * c2 - oldPos.y * s2, + oldPos.y * c2 + oldPos.x * s2); + newPos = newPos*(1.0+0.2*s3) - offset2; + vec2 temp = newPos; + float beta = sin(temp.y*2.0 + time*8.0); + newPos.x = temp.x + 0.4*beta; + newPos.y = temp.y - 0.4*beta; + fragColor = texture2D(iChannel0, newPos); +} + diff --git a/screensaver.shadertoy/resources/watercaustic.frag.glsl b/screensaver.shadertoy/resources/watercaustic.frag.glsl new file mode 100644 index 0000000..d42b624 --- /dev/null +++ b/screensaver.shadertoy/resources/watercaustic.frag.glsl @@ -0,0 +1,57 @@ +// Taken from https://www.shadertoy.com/view/MdlXz8 + +// Found this on GLSL sandbox. I really liked it, changed a few things and made it tileable. +// :) +// by David Hoskins. + + +// Water turbulence effect by joltz0r 2013-07-04, improved 2013-07-07 + + +// Redefine below to see the tiling... +//#define SHOW_TILING + +#define TAU 6.28318530718 +#define MAX_ITER 5 + +void mainImage(out vec4 fragColor, in vec2 fragCoord) +{ + float time = iGlobalTime * .5 + 23.0; + // uv should be the 0-1 uv of texture... + vec2 uv = fragCoord.xy / iResolution.xy; + +#ifdef SHOW_TILING + vec2 p = mod(uv*TAU*2.0, TAU) - 250.0; +#else + vec2 p = mod(uv*TAU, TAU) - 250.0; +#endif + vec2 i = vec2(p); + float c = 1.0; + float inten = .005; + + for (int n = 0; n < MAX_ITER; n++) + { + float t = time * (1.0 - (3.5 / float(n + 1))); + i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(t + i.x)); + c += 1.0 / length(vec2(p.x / (sin(i.x + t) / inten), p.y / (cos(i.y + t) / inten))); + } + c /= float(MAX_ITER); + c = 1.17 - pow(c, 1.4); + float tmp = pow(abs(c), 8.0); + vec3 colour = vec3(tmp, tmp, tmp); + colour = clamp(colour + vec3(0.0, 0.35, 0.5), 0.0, 1.0); + + +#ifdef SHOW_TILING + // Flash tile borders... + vec2 pixel = 2.0 / iResolution.xy; + uv *= 2.0; + + float f = floor(mod(iGlobalTime*.5, 2.0)); // Flash value. + vec2 first = step(pixel, uv) * f; // Rule out first screen pixels and flash. + uv = step(fract(uv), pixel); // Add one line of pixels per tile. + colour = mix(colour, vec3(1.0, 1.0, 0.0), (uv.x + uv.y) * first.x * first.y); // Yellow line + +#endif + fragColor = vec4(colour, 1.0); +} \ No newline at end of file diff --git a/screensaver.shadertoy/resources/worleynoisewaters.frag.glsl b/screensaver.shadertoy/resources/worleynoisewaters.frag.glsl new file mode 100644 index 0000000..088135a --- /dev/null +++ b/screensaver.shadertoy/resources/worleynoisewaters.frag.glsl @@ -0,0 +1,48 @@ +// Taken from https://www.shadertoy.com/view/llS3RK + +//Calculate the squared length of a vector +float length2(vec2 p){ + return dot(p,p); +} + +//Generate some noise to scatter points. +float noise(vec2 p){ + return fract(sin(fract(sin(p.x) * (43.13311)) + p.y) * 31.0011); +} + +float worley(vec2 p) { + //Set our distance to infinity + float d = 1e30; + //For the 9 surrounding grid points + for (int xo = -1; xo <= 1; ++xo) { + for (int yo = -1; yo <= 1; ++yo) { + //Floor our vec2 and add an offset to create our point + vec2 tp = floor(p) + vec2(xo, yo); + //Calculate the minimum distance for this grid point + //Mix in the noise value too! + d = min(d, length2(p - tp - noise(tp))); + } + } + return 3.0*exp(-4.0*abs(2.5*d - 1.0)); +} + +float fworley(vec2 p) { + //Stack noise layers + return sqrt(sqrt(sqrt( + worley(p*5.0 + 0.05*iGlobalTime) * + sqrt(worley(p * 50.0 + 0.12 + -0.1*iGlobalTime)) * + sqrt(sqrt(worley(p * -10.0 + 0.03*iGlobalTime)))))); +} + +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + vec2 uv = fragCoord.xy / iResolution.xy; + //Calculate an intensity + float t = fworley(uv * iResolution.xy / 1500.0); + //Add some gradient + t*=exp(-length2(abs(0.7*uv - 1.0))); + //Make it blue! + fragColor = vec4(t * vec3(0.1, 1.1*t, pow(t, 0.5-t)), 1.0); +} + + diff --git a/src/main.cpp b/src/main.cpp index dca98be..1d41b68 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -55,6 +55,28 @@ struct Preset { const std::vector g_presets = { + {"Ball", "ball.frag.glsl", 99,-1,-1,-1}, + {"Bleepy Blocks", "bleepyblocks.frag.glsl", 99,-1,-1,-1}, + {"Fast Clouds", "fastclouds.frag.glsl", 12,-1,-1,-1}, + {"Flaring", "flaring.frag.glsl", 12,-1,-1,-1}, + {"Interstellar", "stellar.frag.glsl", 14,-1,-1,-1}, + {"Interweaving Sine bands", "sinebands.frag.glsl", -1,-1,-1,-1}, + {"Juliasm", "juliasm.frag.glsl", -1,-1,-1,-1}, + {"Julia Trap", "juliatrap.frag.glsl", -1,-1,-1,-1}, + {"Noise", "noise.frag.glsl", -1,-1,-1,-1}, + {"Noise Animation Electric", "noiseanimelectric.frag.glsl", 12,-1,-1,-1}, + {"Noise Animation Lava", "noiseanimlava.frag.glsl", 12,-1,-1,-1}, + {"Noise Animation Watery", "noiseanimwatery.frag.glsl", 12,-1,-1,-1}, + {"Plasma Triangle", "plasmatriangle.frag.glsl", 11,-1,-1,-1}, + {"Plasma", "plasma.frag.glsl", -1,-1,-1,-1}, + {"Plasma2", "plasma2.frag.glsl", -1,-1,-1,-1}, + {"Silexars Creation", "silexarst.frag.glsl", -1,-1,-1,-1}, + {"Simple Fire", "simplefire.frag.glsl", -1,-1,-1,-1}, + {"Sky at Night", "skyatnight.frag.glsl", -1,-1,-1,-1}, + {"Spiral", "spiral.frag.glsl", -1,-1,-1,-1}, + {"Warp", "warp.frag.glsl", 99,-1,-1,-1}, + {"Water Caustic", "watercaustic.frag.glsl", -1,-1,-1,-1}, + {"Worley Noise Waters", "worleynoisewaters.frag.glsl", -1,-1,-1,-1}, }; int g_currentPreset = 0; char** lpresets = nullptr; @@ -129,7 +151,7 @@ GLuint createTexture(const GLvoid *data, GLint format, unsigned int w, unsigned glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat); #if defined(HAS_GLES) - glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, internalFormat, GL_UNSIGNED_BYTE, data); + glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, format, GL_UNSIGNED_BYTE, data); #else glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, w, h, 0, format, GL_UNSIGNED_BYTE, data); #endif @@ -800,9 +822,13 @@ extern "C" ADDON_STATUS ADDON_SetSetting(const char *strSetting, const void* val } int c = *(int*)value; - if (strcmp(strSetting,"preset") == 0 && c >= 0 && c < g_presets.size()) + if (strcmp(strSetting,"preset") == 0 && c >= 0 && c < g_presets.size()+1) { cout << "Setting preset from " << g_currentPreset << " to " << c << endl; + if (c == 0) + c = (rand() >> 12) % g_presets.size(); + else + c--; g_currentPreset = c; } return ADDON_STATUS_OK;