added fxSubtleSort
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
//globals
|
||||
uptime = 116669596
|
||||
uptime = 116688775
|
||||
|
||||
127
effects.pde
127
effects.pde
@@ -1809,11 +1809,6 @@ class COPYZOOM extends Shader {
|
||||
params.add(new Param("x", FLOATVAL, 0, 1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
|
||||
params.add(new Param("y", FLOATVAL, 0, 1, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
|
||||
buffer = createImage(renderer.width, renderer.height, ARGB);
|
||||
|
||||
coprw = int(random(0, renderer.width));
|
||||
coprh = int(random(0, renderer.height));
|
||||
coprx = int(random(0, renderer.width-coprw));
|
||||
copry = int(random(0, renderer.height-coprh));
|
||||
}
|
||||
void apply() {
|
||||
if (buffer.width != renderer.width || buffer.height != renderer.height) buffer.resize(renderer.width, renderer.height);
|
||||
@@ -1829,6 +1824,128 @@ class COPYZOOM extends Shader {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
SUBTLESORT
|
||||
|
||||
*/
|
||||
|
||||
class SUBTLESORT extends Shader {
|
||||
int direction = 0;
|
||||
int mode = 0;
|
||||
int c;
|
||||
//int count = int(random(777));
|
||||
color col;
|
||||
final static int RED = 0;
|
||||
final static int GREEN = 1;
|
||||
final static int BLUE = 2;
|
||||
final static int HUE = 3;
|
||||
final static int SATURATION = 4;
|
||||
final static int BRIGHTNESS = 5;
|
||||
final static int NRED = 6;
|
||||
final static int NGREEN = 7;
|
||||
final static int NBLUE = 8;
|
||||
final static int NHUE = 9;
|
||||
final static int NSATURATION = 10;
|
||||
final static int NBRIGHTNESS = 11;
|
||||
|
||||
// channels for depth: RED, GREEN, BLUE, HUE, SATURATION, BRIGHTNESS, NRED, NGREEN, NBLUE, NHUE, NSATURATION, NBRIGHTNESS.
|
||||
int channel = BRIGHTNESS;
|
||||
// channel weight.
|
||||
float channel_weight = .2;
|
||||
//
|
||||
SUBTLESORT() {
|
||||
name ="fxSubtleSort";
|
||||
params.add(new Param ("channel weight", FLOATVAL, 0.001, 20, new int[]{SAWTOOTH, TRIANG, SINE, TAN, TANINVERSE, RAMPUPDOWN, RAMP, RAMPINVERSE}));
|
||||
params.add(new Param ("channel", INTVAL, 0, 6, new int[]{RANDOM}));
|
||||
params.add(new Param("direction", INTVAL, 0,3, new int[]{RANDOM}));
|
||||
params.add(new Param("mode", INTVAL, 0,1, new int[]{SQUARE, RANDOM}));
|
||||
}
|
||||
|
||||
void apply() {
|
||||
channel_weight = map(renderSize, 4, 15000, 0, 1.5)*params.get(0).value;
|
||||
channel = (int)params.get(1).value;
|
||||
direction = (int)params.get(2).value;
|
||||
mode = (int)params.get(3).value;
|
||||
renderer.beginDraw();
|
||||
renderer.noStroke();
|
||||
|
||||
if (direction == 0) {
|
||||
for (int i = 0; i < renderer.width; i++) {
|
||||
for (int j = 0; j < renderer.height; j++) {
|
||||
c = i+(j*renderer.width);
|
||||
col = renderer.pixels[c];
|
||||
renderer.fill(col);
|
||||
renderer.rect(i, j+(getChannel(col)), 1, getChannel(col));
|
||||
}
|
||||
}
|
||||
} else if (direction == 1) {
|
||||
for (int i = 0; i < renderer.width; i++) {
|
||||
for (int j = 0; j < renderer.height; j++) {
|
||||
c = i+(j*renderer.width);
|
||||
col = renderer.pixels[c];
|
||||
renderer.fill(col);
|
||||
renderer.rect(i, j-(getChannel(col)*mode), 1, -getChannel(col));
|
||||
}
|
||||
}
|
||||
} else if (direction == 2) {
|
||||
for (int i = 0; i < renderer.width; i++) {
|
||||
for (int j = 0; j < renderer.height; j++) {
|
||||
c = i+(j*renderer.width);
|
||||
col = renderer.pixels[c];
|
||||
renderer.fill(col);
|
||||
renderer.rect(i-(getChannel(col)*mode), j, -getChannel(col), 1);
|
||||
}
|
||||
}
|
||||
} else if (direction == 3) {
|
||||
for (int i = 0; i < renderer.width; i++) {
|
||||
for (int j = 0; j < renderer.height; j++) {
|
||||
c = i+(j*renderer.width);
|
||||
col = renderer.pixels[c];
|
||||
renderer.fill(col);
|
||||
renderer.rect(i+(getChannel(col)), j, getChannel(col), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderer.endDraw();
|
||||
}
|
||||
|
||||
|
||||
float getChannel(color c) {
|
||||
int ch = channel;
|
||||
float cc;
|
||||
|
||||
switch(ch) {
|
||||
case RED:
|
||||
cc = red(c);
|
||||
break;
|
||||
case GREEN:
|
||||
cc = green(c);
|
||||
break;
|
||||
case BLUE:
|
||||
cc = blue(c);
|
||||
break;
|
||||
case HUE:
|
||||
cc = hue(c);
|
||||
break;
|
||||
case SATURATION:
|
||||
cc = saturation(c);
|
||||
break;
|
||||
default:
|
||||
cc= brightness(c);
|
||||
break;
|
||||
}
|
||||
|
||||
return channel_weight * (channel>5?255-cc:cc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
BUFFER
|
||||
|
||||
@@ -554,6 +554,9 @@ public class SecondApplet extends PApplet {
|
||||
case(16):
|
||||
shaderManager.addShader(new COPYZOOM());
|
||||
break;
|
||||
case(17):
|
||||
shaderManager.addShader(new SUBTLESORT());
|
||||
break;
|
||||
/*
|
||||
case(4):
|
||||
shaderManager.addShader(new AUECHO());
|
||||
|
||||
@@ -58,12 +58,10 @@ String availableFx[] = {
|
||||
"fxDual",
|
||||
"fxGrauzone",
|
||||
"fxCopyZoom",
|
||||
|
||||
"fxMove",
|
||||
"fxSubtleSort",
|
||||
|
||||
"fxScanker",
|
||||
"fxPixelSort",
|
||||
"fxSubtleSort",
|
||||
|
||||
"fxMosh",
|
||||
"fxPixelDrifter",
|
||||
|
||||
Reference in New Issue
Block a user