added fxAuEcho
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
//globals
|
||||
uptime = 116636389
|
||||
uptime = 116639275
|
||||
|
||||
86
effects.pde
86
effects.pde
@@ -301,15 +301,20 @@ class DISTORTER extends Shader {
|
||||
|
||||
PImage buffer;
|
||||
|
||||
|
||||
int[][] distort = new int[2][512];
|
||||
final static float tick = 1.0/512.0;
|
||||
final static int distortionMatrixSize = 512; //doesnt really make a difference, it's more or less "noise variety".. only kinda different if real low, like 2 or so
|
||||
|
||||
int[][] distort = new int[2][distortionMatrixSize];
|
||||
final static float tick = 1.0/distortionMatrixSize;
|
||||
|
||||
int mode = 0;
|
||||
int initBufferW, initBufferH;
|
||||
|
||||
DISTORTER() {
|
||||
|
||||
buffer = createImage(renderer.width, renderer.height, ARGB);
|
||||
initBufferW = buffer.width;
|
||||
initBufferH = buffer.height;
|
||||
|
||||
name = "fxDistorter";
|
||||
params.add(new Param("width", FLOATVAL, 2, buffer.width/4-1, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
|
||||
params.add(new Param("height", FLOATVAL, 2, buffer.height/4-1, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
|
||||
@@ -326,10 +331,12 @@ class DISTORTER extends Shader {
|
||||
|
||||
|
||||
// prepare distortion pattern
|
||||
for (int i=0; i<512; i++) {
|
||||
|
||||
for (int i=0; i<distortionMatrixSize; i++) {
|
||||
distort[0][i] = (int)random(-128, 128);
|
||||
distort[1][i] = (int)random(-128, 128);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -350,13 +357,16 @@ class DISTORTER extends Shader {
|
||||
final static int NBRIGHTNESS = 11;
|
||||
|
||||
void apply() {
|
||||
println(buffer.height);
|
||||
//println(buffer.height);
|
||||
|
||||
buffer = renderer.get();
|
||||
buffer.resize(renderer.width, renderer.height);
|
||||
|
||||
float neww = params.get(0).value;
|
||||
float newh = params.get(1).value;
|
||||
float neww = map(params.get(0).value, 2,initBufferW-2, 2, buffer.width/4-2);
|
||||
float newh = map(params.get(1).value, 2,initBufferH-2, 2, buffer.height/4-2);
|
||||
|
||||
|
||||
|
||||
do_blend = boolean(int(params.get(2).value));
|
||||
shift_amt = params.get(3).value;
|
||||
scalex = params.get(4).value;
|
||||
@@ -384,8 +394,8 @@ class DISTORTER extends Shader {
|
||||
|
||||
float shift = fx%1.0;
|
||||
float st = shift/tick;
|
||||
int no1 = floor(st)%512;
|
||||
int no2 = ceil(st)%512;
|
||||
int no1 = floor(st)%distortionMatrixSize;
|
||||
int no2 = ceil(st)%distortionMatrixSize ;
|
||||
float l = st-(float)no1;
|
||||
|
||||
float cx = lerp(distort[0][no1], distort[0][no2], l);
|
||||
@@ -926,10 +936,66 @@ class WZIP extends Shader {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
AUECHO
|
||||
|
||||
*/
|
||||
|
||||
|
||||
class AUECHO extends Shader {
|
||||
final int[] blends = {BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN};
|
||||
AUECHO() {
|
||||
name = "fxAUecho";
|
||||
params.add(new Param("mode", INTVAL, 0, 1, new int[]{RANDOM, SQUAR}));
|
||||
params.add(new Param ("echo", FLOATVAL, 0.001, 1, new int[]{TRIANG, SINE, RAMPUPDOWN, }));
|
||||
params.add(new Param ("decay", FLOATVAL, 0.001, 1, new int[]{TRIANG, SINE, RAMPUPDOWN }));
|
||||
params.add(new Param ("blend mode", INTVAL, 0, this.blends.length-1, new int[]{RANDOM }));
|
||||
}
|
||||
void apply() {
|
||||
renderer.beginDraw();
|
||||
if (boolean((int)params.get(0).value)) {
|
||||
renderer.colorMode(HSB);
|
||||
colorMode(HSB);
|
||||
} else {
|
||||
renderer.colorMode(RGB);
|
||||
colorMode(RGB);
|
||||
}
|
||||
renderer.loadPixels();
|
||||
|
||||
float _delay = params.get(1).value;
|
||||
float decay = params.get(2).value;
|
||||
|
||||
int delay = (int)(renderer.pixels.length * _delay);
|
||||
color[] history = new color[renderer.pixels.length];
|
||||
int blendMode =this.blends[(int)params.get(3).value];
|
||||
for ( int i = 0, l = renderer.pixels.length; i<l; i++) {
|
||||
history[i] = renderer.pixels[i];
|
||||
}
|
||||
for ( int i = 0, l = renderer.pixels.length; i<l; i++) {
|
||||
int fromPos = i-delay < 0 ? l-abs(i-delay) : i-delay;
|
||||
color fromColor = history[fromPos];
|
||||
float r = red(fromColor) * decay;
|
||||
float g = green(fromColor) * decay;
|
||||
float b = blue(fromColor) * decay;
|
||||
color origColor = history[i];
|
||||
color toColor = color(
|
||||
r = r + red(origColor) > 255 ? r + red(origColor) - 255 : r + red(origColor), // simulate overflow ;)
|
||||
g = g + green(origColor) > 255 ? g + green(origColor) - 255 : g + green(origColor),
|
||||
b = b + blue(origColor) > 255 ? b + blue(origColor) - 255 : b + blue(origColor) );
|
||||
|
||||
|
||||
//renderer.pixels[i] = history[i] = toColor;
|
||||
renderer.pixels[i] = history[i] = blendColor(origColor, toColor, blendMode);
|
||||
|
||||
}
|
||||
renderer.updatePixels();
|
||||
if (boolean((int)params.get(0).value)) {
|
||||
renderer.colorMode(RGB);
|
||||
colorMode(RGB);
|
||||
}
|
||||
renderer.endDraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -469,6 +469,9 @@ public class SecondApplet extends PApplet {
|
||||
case(3):
|
||||
shaderManager.addShader(new WZIP());
|
||||
break;
|
||||
case(4):
|
||||
shaderManager.addShader(new AUECHO());
|
||||
break;
|
||||
/*
|
||||
case(4):
|
||||
shaderManager.addShader(new AUECHO());
|
||||
|
||||
Reference in New Issue
Block a user