Browse Source

fixed text, added resolution info in gui

master
Victor Giers 2 years ago
parent
commit
565c7a3bc9
4 changed files with 52 additions and 44 deletions
  1. 1
    1
      data/saves.sav
  2. 21
    23
      effects.pde
  3. 0
    1
      keys_mouse.pde
  4. 30
    19
      secondapplet.pde

+ 1
- 1
data/saves.sav View File

@@ -1,2 +1,2 @@
//globals
uptime = 116633462
uptime = 116634213

+ 21
- 23
effects.pde View File

@@ -290,7 +290,7 @@ class ASDFPIXELSORT extends Shader {
*/

class DISTORTER extends Shader{
class DISTORTER extends Shader {
boolean do_blend = false; // blend image after process
int blend_mode = OVERLAY; // blend type
int channel = BRIGHTNESS; // channel used in processing (R,G,B) or (H,S,B)
@@ -308,31 +308,31 @@ class DISTORTER extends Shader{
int mode = 0;

DISTORTER() {
buffer = createImage(renderer.width, renderer.height, ARGB);
name = "fxDIstorter";
params.add(new Param("width", FLOATVAL, 1, buffer.width/4-1, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
params.add(new Param("height", FLOATVAL, 1, buffer.height/4-1, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
params.add(new Param("do blend", INTVAL, 0, 1, new int[]{RANDOM,SQUAR}));
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}));
params.add(new Param("do blend", INTVAL, 0, 1, new int[]{RANDOM, SQUAR}));
params.add(new Param("shift hue amount", FLOATVAL, 0, 1, new int[]{SAWTOOTH, SAWTOOTHINVERSE, TAN, TANINVERSE, RAMP, RAMPINVERSE}));
params.add(new Param("scale x", FLOATVAL, 0.01, 1, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
params.add(new Param("scale y", FLOATVAL, 0.01, 1, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
params.add(new Param("blend mode", INTVAL, 0, 11, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
params.add(new Param("channel", INTVAL, 0, 12, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
// channel, blend_mode
// channel, blend_mode
//params.add(new Param("height", FLOATVAL, 1, buffer.height/4-1, new int[]{SINE, SAWTOOTH, RAMPUPDOWN, TAN, TANINVERSE, TRIANG}));
// prepare distortion pattern
for (int i=0; i<512; i++) {
distort[0][i] = (int)random(-128, 128);
distort[1][i] = (int)random(-128, 128);
}
}
final int[] blends = {
ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, BURN
};
@@ -351,9 +351,10 @@ class DISTORTER extends Shader{
final static int NHUE = 9;
final static int NSATURATION = 10;
final static int NBRIGHTNESS = 11;
void apply() {
println(buffer.height);

buffer = renderer.get();
buffer.resize(renderer.width, renderer.height);

@@ -365,16 +366,15 @@ class DISTORTER extends Shader{
scaley = params.get(5).value;
blend_mode = blends[(int)params.get(6).value];
channel = (int)params.get(7).value;
float totalnum = neww+newh;
float times = (totalnum/floor(totalnum/neww));
float offx = (totalnum%neww)/times;
float ratiox = neww/buffer.width;
println(ratiox);

renderer.beginDraw();
renderer.colorMode(RGB);
colorMode(RGB);
renderer.noStroke();

for (int y=0; y<buffer.height; y++) {
@@ -406,8 +406,8 @@ class DISTORTER extends Shader{
colorMode(RGB, 255);
}
// buffer.fill(lerpColor(c,img.get(x,y),0.2));
renderer.fill(c);
renderer.rect(x, y, 1, 1);
renderer.fill(c); //wärs nich effizienter die pixelmatrix zu ändern ?
renderer.rect(x, y, 1, 1);
}
}

@@ -446,6 +446,4 @@ class DISTORTER extends Shader{

return channel>5?255-cc:cc;
}


}

+ 0
- 1
keys_mouse.pde View File

@@ -14,5 +14,4 @@ void mouseWheel(MouseEvent event) {
if (event.getCount() < 0) renderSize += 8;
else renderSize -= 8;
renderSize = constrain(renderSize, 8, 15000);
println("Render size: " + renderSize);
}

+ 30
- 19
secondapplet.pde View File

@@ -69,8 +69,8 @@ public class SecondApplet extends PApplet {


void CP5_pauseAllAction() {
for(int i = 0; i < bricks.size(); i++){
if(!bricks.get(i).paused) bricks.get(i).playPause();
for (int i = 0; i < bricks.size(); i++) {
if (!bricks.get(i).paused) bricks.get(i).playPause();
}
}

@@ -81,6 +81,10 @@ public class SecondApplet extends PApplet {
image(bin, binX, binY, binS, binS);
stroke(255);
strokeWeight(1);
textSize(25);
fill(255);
text(renderer.width + "x" + renderer.height, 100, height-18);
textSize(10);
line(0, height-120, width, height-120);
totalBrickHeight = 0;
for (int i = 0; i < shaderList.size(); i++) {
@@ -106,7 +110,7 @@ public class SecondApplet extends PApplet {
}

cp5.setPosition(0, height-120);
binY = height-85;
binY = height-87;
}

class shaderManager {
@@ -196,10 +200,10 @@ public class SecondApplet extends PApplet {
slider.add(new Slider(10, 20+(20*i)+y, 230, 12, params.get(i).minValue, params.get(i).maxValue, params.get(i).name, params.get(i).type, params.get(i).osciModes)); //add possible waves to slider
}
pauseStates = new boolean[slider.size()];
for(int i = 0; i < pauseStates.length; i++){
for (int i = 0; i < pauseStates.length; i++) {
pauseStates[i] = false;
}
if(!spawnPlaying){
if (!spawnPlaying) {
playPause();
}
}
@@ -224,9 +228,9 @@ public class SecondApplet extends PApplet {
slider.get(sliderNo).setLabel(param.name);
}

void playPause(){
void playPause() {
paused = !paused;
if(paused){
if (paused) {
pauseAllSliders();
} else {
resumeAllSliders();
@@ -239,9 +243,9 @@ public class SecondApplet extends PApplet {
slider.get(i).animated = false;
}
}
void resumeAllSliders(){
for(int i = 0; i < slider.size(); i++){
void resumeAllSliders() {
for (int i = 0; i < slider.size(); i++) {
slider.get(i).animated = pauseStates[i];
}
}
@@ -252,14 +256,14 @@ public class SecondApplet extends PApplet {
if (slider.get(i).hovering || slider.get(i).hovering_anim_btn) sliderHover = true;
if (paused && slider.get(i).animated) paused = false;
}
if(mouseX > 10 && mouseX < 22 && mouseY > 4+totalBrickHeight && mouseY < 4+totalBrickHeight+13){
if (mouseX > 10 && mouseX < 22 && mouseY > 4+totalBrickHeight && mouseY < 4+totalBrickHeight+13) {
hoverActiveButton = true;
} else {
hoverActiveButton = false;
}

if(mouseX > 25 && mouseX < 37 && mouseY > 4+totalBrickHeight && mouseY < 4+totalBrickHeight+13){
if (mouseX > 25 && mouseX < 37 && mouseY > 4+totalBrickHeight && mouseY < 4+totalBrickHeight+13) {
hoverPauseButton = true;
} else {
hoverPauseButton = false;
@@ -307,16 +311,16 @@ public class SecondApplet extends PApplet {
rect(0, totalBrickHeight, width, h);

fill(255);
text(name, 40, 10+totalBrickHeight, 10);
text(name, 40, 13+totalBrickHeight, 10);

stroke(255);
if (active) fill(185);
else noFill();
rect(10, 4+totalBrickHeight, 10, 10);
if (paused) fill(185);
else noFill();
rect(25,4+totalBrickHeight, 10, 10);
rect(25, 4+totalBrickHeight, 10, 10);

for (int i = 0; i < slider.size(); i++) {
slider.get(i).display();
@@ -438,7 +442,7 @@ public class SecondApplet extends PApplet {
fill(185+(40*int(hovering)));
rect(x, y, map(value, minVal, maxVal, 0, w), h);
fill(255);
text(label, x+5, y+7);
text(label, x+5, y+10);

if (animated) {
fill(185+(40*int(hovering_anim_btn)));
@@ -546,8 +550,8 @@ public class SecondApplet extends PApplet {
if (bricks.get(i).hovering) {
bricks.get(i).press();
}
if(bricks.get(i).hoverActiveButton) bricks.get(i).active = !bricks.get(i).active;
if(bricks.get(i).hoverPauseButton) bricks.get(i).playPause();
if (bricks.get(i).hoverActiveButton) bricks.get(i).active = !bricks.get(i).active;
if (bricks.get(i).hoverPauseButton) bricks.get(i).playPause();
}
}
void mouseDragged() {
@@ -597,4 +601,11 @@ public class SecondApplet extends PApplet {
pressedSlider = -1;
pressedBrick = -1;
}

void mouseWheel(MouseEvent event) {

if (event.getCount() < 0) renderSize += 8;
else renderSize -= 8;
renderSize = constrain(renderSize, 8, 15000);
}
}

Loading…
Cancel
Save