diff --git a/effects.pde b/effects.pde index db9aa61..8ac5d32 100644 --- a/effects.pde +++ b/effects.pde @@ -302,7 +302,7 @@ class DISTORTER extends Shader { PImage buffer; 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; @@ -314,7 +314,7 @@ class DISTORTER extends Shader { 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})); @@ -331,16 +331,15 @@ class DISTORTER extends Shader { // prepare distortion pattern - + for (int i=0; i 255 ? b + blue(origColor) - 255 : b + blue(origColor) ); //renderer.pixels[i] = history[i] = toColor; - renderer.pixels[i] = history[i] = blendColor(origColor, toColor, blendMode); - + renderer.pixels[i] = history[i] = blendColor(origColor, toColor, blendMode); } renderer.updatePixels(); if (boolean((int)params.get(0).value)) { @@ -1000,9 +998,9 @@ class AUECHO extends Shader { /* -SLITSCAN - -*/ + SLITSCAN + + */ class SLITSCAN extends Shader { @@ -1027,51 +1025,6 @@ class SLITSCAN extends Shader { ft[1][i] = 0.5*1.0/ft[0][i]; } } - - /* - - void animate() { - - buffer.resize(renderer.width, renderer.height); - buffer = renderer.get(0, 0, renderer.width, renderer.height); - int s = buffer.width>buffer.height?buffer.height:buffer.width; - 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]; - sy = new int[fynum+1]; - - phx = new float[fxnum+1]; - phy = new float[fynum+1]; - - skipfx = new boolean[fxnum+1]; - skipfy = new boolean[fynum+1]; - - - for (int i=0; ibuffer.height?buffer.height:buffer.width; + int s = min(buffer.width,buffer.height); - // buffer = createImage(renderW, renderH, ARGB); - buffer.resize(renderer.width, renderer.height); - buffer = renderer.get(0, 0, renderer.width, renderer.height); - // int s = buffer.width>buffer.height?buffer.height:buffer.width; - // depth = (int)(log(s)/log(2)); - // fxnum = (int)map(knobZero, 0, 255, 0, depth); - // fynum = (int)map(knobOne, 0, 255, 0, depth); - // fx = new int[fxnum+1]; - // fy = new int[fynum+1]; - // sx = new int[fxnum+1]; - // sy = new int[fynum+1]; - // - // phx = new float[fxnum+1]; - // phy = new float[fynum+1]; - // - // skipfx = new boolean[fxnum+1]; - // skipfy = new boolean[fynum+1]; - // - // - // for (int i=0; i255) R-=256; - if(B>255) B-=256; - + if (R>255) R-=256; + if (B>255) B-=256; + int G = (int)((Y-0.2126*R-0.0722*B)/0.7152); - + return blendRGB(c, R, G, B); } @@ -1531,8 +1485,8 @@ color toRGGBG(color c) { int G = getG(c); int R = getR(c)-G; int B = getB(c)-G; - if(R<0) R+=256; - if(B<0) B+=256; + if (R<0) R+=256; + if (B<0) B+=256; return blendRGB(c, R, G, B); } @@ -1540,8 +1494,8 @@ color fromRGGBG(color c) { int G = getG(c); int R = getR(c)+G; int B = getB(c)+G; - if(R>255) R-=256; - if(B>255) B-=256; + if (R>255) R-=256; + if (B>255) B-=256; return blendRGB(c, R, G, B); } @@ -1882,9 +1836,9 @@ color toYXY(color c) { float x = xyz.x > 0 ? xyz.x / sum : 0.0; float y = xyz.y > 0 ? xyz.y / sum : 0.0; return blendRGB(c, - (int)map(xyz.y, 0, RANGE_Y, 0, 255), - (int)map(x, 0.0, 1.0, 0, 255), - (int)map(y, 0.0, 1.0, 0, 255)); + (int)map(xyz.y, 0, RANGE_Y, 0, 255), + (int)map(x, 0.0, 1.0, 0, 255), + (int)map(y, 0.0, 1.0, 0, 255)); } color fromYXY(color c) { @@ -1910,16 +1864,16 @@ PVector _toXYZ(float rr, float gg, float bb) { float g = correctionxyz(gg); float b = correctionxyz(bb); return new PVector(r * 0.4124 + g * 0.3576 + b * 0.1805, - r * 0.2126 + g * 0.7152 + b * 0.0722, - r * 0.0193 + g * 0.1192 + b * 0.9505); + r * 0.2126 + g * 0.7152 + b * 0.0722, + r * 0.0193 + g * 0.1192 + b * 0.9505); } color toXYZ(color c) { PVector xyz = _toXYZ(getNR(c), getNG(c), getNB(c)); return blendRGB(c, - (int)map(xyz.x, 0, RANGE_X, 0, 255), - (int)map(xyz.y, 0, RANGE_Y, 0, 255), - (int)map(xyz.z, 0, RANGE_Z, 0, 255)); + (int)map(xyz.x, 0, RANGE_X, 0, 255), + (int)map(xyz.y, 0, RANGE_Y, 0, 255), + (int)map(xyz.z, 0, RANGE_Z, 0, 255)); } float recorrectionxyz(float n) {