View warped_dirs.frag
/**
* Written by Gerard Geer.
* License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
*
* Version 1.0
* Version 1.1 Optomized/cleaned up a bit, and did some more documentin'.
* Version 1.2 Gave pipes a clear protective coating. (I made them shiny.)
* I also changed some colors.
* Version 1.3 Functioned out determining reflectivity and deflection. This allowed me
* to add some variation in the reflections in the form of puddles
View random-dots.glsl
/*
The same old random function with a different signature.
*/
vec2 rand(vec2 co){
return vec2(
fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453),
fract(cos(dot(co.yx ,vec2(8.64947,45.097))) * 43758.5453)
)*2.0-1.0;
}
View type-agnostic-glsl-array.glsl
// By Gerard Geer, under MIT license
// A 2,4,8 or 16 element array implemented as a binary tree, #defined for type agnosticity.
#define ARR2(x, a,b) (x<1) ? a : b
#define ARR4(x, a,b,c,d) (x<2) ? ARR2(x,a,b) : ARR2(x-2,c,d)
#define ARR8(x, a,b,c,d, e,f,g,h) (x<4) ? ARR4(x, a,b,c,d) : ARR4(x-4, e,f,g,h)
#define ARR16(x, a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p) (x<8) ? ARR8(x, a,b,c,d, e,f,g,h) : ARR8(x-8, i,j,k,l, m,n,o,p)
// Shadertoy entry point.
void mainImage( out vec4 fragColor, in vec2 fragCoord )