|
|
@@ -1036,13 +1036,13 @@ class SLITSCAN extends Shader { |
|
|
|
buffer = renderer.get(0, 0, renderer.width, renderer.height); |
|
|
|
|
|
|
|
//int s = buffer.width>buffer.height?buffer.height:buffer.width; |
|
|
|
int s = min(buffer.width,buffer.height); |
|
|
|
|
|
|
|
int s = min(buffer.width, buffer.height); |
|
|
|
|
|
|
|
depth = (int)(log(s)/log(2)); |
|
|
|
|
|
|
|
|
|
|
|
fxnum = (int)random(depth); //// |
|
|
|
fynum = (int)random(depth); //// |
|
|
|
|
|
|
|
|
|
|
|
fx = new int[fxnum+1]; |
|
|
|
fy = new int[fynum+1]; |
|
|
|
sx = new int[fxnum+1]; |
|
|
@@ -1052,25 +1052,23 @@ class SLITSCAN extends Shader { |
|
|
|
skipfx = new boolean[fxnum+1]; |
|
|
|
skipfy = new boolean[fynum+1]; |
|
|
|
for (int i=0; i<fxnum; i++) { |
|
|
|
|
|
|
|
|
|
|
|
fx[i]=(int)random(6); |
|
|
|
phx[i] = random(1); |
|
|
|
skipfx[i] = random(1)<0.2; |
|
|
|
sx[i] = random(1)<0.2?-1:1; |
|
|
|
|
|
|
|
} |
|
|
|
for (int i=0; i<fynum; i++) { |
|
|
|
|
|
|
|
|
|
|
|
fy[i]=(int)random(6); |
|
|
|
phy[i] = random(1); |
|
|
|
skipfy[i] = random(1)<0.2; |
|
|
|
sy[i] = random(1)<0.2?-1:1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dox = random(1)<0.8; |
|
|
|
doy = dox?random(1)<0.8:true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float v=0; |
|
|
@@ -1150,7 +1148,80 @@ class SLITSCAN extends Shader { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
WAHWAH |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
class WAHWAH extends Shader { |
|
|
|
float sequence, lfoskip, xn1, xn2, yn1, yn2, b0, b1, b2, a0, a1, a2, freqofs, freq, freqoff, startsequence, res, depth; |
|
|
|
float mCurRate = 0.4, skipcount = 0; |
|
|
|
int lfoskipsamples = 0; |
|
|
|
float frequency, omega, sn, cs, alpha; |
|
|
|
float in, out; |
|
|
|
float val; |
|
|
|
WAHWAH() { |
|
|
|
name = "fxWahWah"; |
|
|
|
//params.add(new Param("mode", INTVAL, 0, 1, new int[]{RANDOM, SQUAR})); |
|
|
|
params.add(new Param ("resolution", FLOATVAL, 1, 100, new int[]{TRIANG, SINE, RAMPUPDOWN, })); |
|
|
|
params.add(new Param ("depth", FLOATVAL, 0.0001, 1, new int[]{TRIANG, SINE, RAMPUPDOWN })); |
|
|
|
params.add(new Param ("frequency offset", FLOATVAL, 0, 1, new int[]{TRIANG, SINE, RAMPUPDOWN })); |
|
|
|
params.add(new Param ("mCurRate", FLOATVAL, 0, 1, new int[]{TRIANG, SINE, RAMPUPDOWN })); |
|
|
|
// params.add(new Param ("blend mode", INTVAL, 0, this.blends.length-1, new int[]{RANDOM })); |
|
|
|
} |
|
|
|
void apply() { |
|
|
|
res = params.get(0).value; |
|
|
|
depth = params.get(1).value; |
|
|
|
freqofs = params.get(2).value; |
|
|
|
//res = 12.5 |
|
|
|
//depth = 0.8; |
|
|
|
//freqofs = 0.9; |
|
|
|
|
|
|
|
freq = 1.5; |
|
|
|
startsequence = 0.2; |
|
|
|
lfoskip = freq * 2 * PI / mCurRate; |
|
|
|
skipcount = xn1 = xn2 = yn1 = yn2 = b0 = b1 = b2 = a0 = a1 = a2 = 0; |
|
|
|
sequence = startsequence; |
|
|
|
|
|
|
|
renderer.beginDraw(); |
|
|
|
renderer.colorMode(RGB); |
|
|
|
renderer.loadPixels(); |
|
|
|
float[] rgb = new float[3]; |
|
|
|
for ( int i = 0, len = renderer.pixels.length; i < len; i++) { |
|
|
|
rgb[0] = red(renderer.pixels[i]); |
|
|
|
rgb[1] = green(renderer.pixels[i]); |
|
|
|
rgb[2] = blue(renderer.pixels[i]); |
|
|
|
for ( int ri = 0; ri < 3; ri++ ) { |
|
|
|
in = map(rgb[ri], 0, 255, 0, 1); |
|
|
|
frequency = (1+cos(skipcount * lfoskip + sequence ))/2; |
|
|
|
frequency = frequency * depth * (1-freqofs) + freqofs; |
|
|
|
frequency = exp((frequency - 1) * 6 ); |
|
|
|
omega = PI * frequency; |
|
|
|
sn = sin(omega); |
|
|
|
cs = cos(omega); |
|
|
|
alpha = sn/(2*res); |
|
|
|
b0 = (1-cs) /2; |
|
|
|
b1 = 1 - cs; |
|
|
|
b2 = (1-cs)/2; |
|
|
|
a0 = 1 + alpha; |
|
|
|
a1 = -2 * cs; |
|
|
|
a2 = 1 - alpha; |
|
|
|
out = ( b0 * in + b1 * xn1 + b2 * xn2 - a1 * yn1 - a2 * yn2 ) / a0; |
|
|
|
xn2 = xn1; |
|
|
|
xn1 = in; |
|
|
|
yn2 = yn1; |
|
|
|
yn1 = out; |
|
|
|
rgb[ri] = map(out, 0, 1, 0, 255); |
|
|
|
} |
|
|
|
renderer.pixels[i] = color(rgb[0], rgb[1], rgb[2]); |
|
|
|
} |
|
|
|
|
|
|
|
renderer.updatePixels(); |
|
|
|
renderer.endDraw(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|