Skip to content

Commit

Permalink
Release v1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
diwi committed Oct 15, 2017
1 parent 514b701 commit 75c4ecf
Show file tree
Hide file tree
Showing 8 changed files with 832 additions and 129 deletions.
Expand Up @@ -62,8 +62,9 @@ public class FlowField_LIC_Image extends PApplet {
PGraphics2D pg_source;
PGraphics2D pg_impulse;
PGraphics2D pg_noise;
PGraphics2D pg_tmp;

DwPixelFlow context;

DwFlowField ff_impulse;

PImage img;
Expand Down Expand Up @@ -194,9 +195,9 @@ public void resetScene(){
float impulse_mul = 10;
float impulse_tsmooth = 1f;
int impulse_radius = 200;

public void addImpulse(){



APPLY_IMPULSE = mousePressed && !cp5.isMouseOver();

final int MID = 127;
Expand Down
Expand Up @@ -31,7 +31,6 @@
import controlP5.Toggle;
import processing.core.*;
import processing.opengl.PGraphics2D;
import processing.opengl.PJOGL;
import processing.video.Capture;


Expand Down Expand Up @@ -120,8 +119,8 @@ public void setup(){

ff_impulse.param_lic.iterations = 2;
ff_impulse.param_lic.num_samples = 30;
ff_impulse.param_lic.acc_mult = 1.9999f;
ff_impulse.param_lic.vel_mult = 0.8999f;
ff_impulse.param_lic.acc_mult = 1.50f;
ff_impulse.param_lic.vel_mult = 1.0f;
ff_impulse.param_lic.TRACE_BACKWARD = true;
ff_impulse.param_lic.TRACE_FORWARD = !true;

Expand Down Expand Up @@ -149,17 +148,15 @@ public void resizeScene(){
pg_impulse = (PGraphics2D) createGraphics(width, height, P2D);
pg_impulse.smooth(0);



DwUtils.COL_TL = new float[]{ 64,255, 0, 255};
DwUtils.COL_TR = new float[]{255, 0, 0, 255};
DwUtils.COL_BL = new float[]{ 0, 64,255, 255};
DwUtils.COL_BR = new float[]{255,196, 0, 255};

// DwUtils.COL_TL = new float[]{ 255,255,255, 255};
// DwUtils.COL_TR = new float[]{ 0,64,255, 255};
// DwUtils.COL_BL = new float[]{ 0, 0,0, 255};
// DwUtils.COL_BR = new float[]{ 255,224,64, 255};
// DwUtils.COL_TR = new float[]{ 0 ,64,255, 255};
// DwUtils.COL_BL = new float[]{ 0, 0, 0, 255};
// DwUtils.COL_BR = new float[]{ 255,224, 64, 255};

// DwUtils.COL_TL = new float[]{255,192, 0, 255};
// DwUtils.COL_TR = new float[]{ 0, 64,255, 255};
Expand All @@ -175,17 +172,12 @@ public void resizeScene(){
// DwUtils.COL_TR = new float[]{255,255,255, 255};
// DwUtils.COL_BL = new float[]{255,255,255, 255};
// DwUtils.COL_BR = new float[]{255,128, 0, 255};



pg_noise = DwUtils.createBackgroundNoiseTexture(this, width/2, height/2);


resetScene();
}




public void resetScene(){
pg_canvas.beginDraw();
Expand All @@ -195,7 +187,6 @@ public void resetScene(){
}




//////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -205,11 +196,11 @@ public void resetScene(){
boolean APPLY_IMPULSE = false;
float impulse_max = 256;
float impulse_mul = 10;
float impulse_tsmooth = 0.99f;
float impulse_tsmooth = 0.997f;
int impulse_radius = 130;
public void addImpulse(){


APPLY_IMPULSE = mousePressed && !cp5.isMouseOver();

final int MID = 127;
Expand Down Expand Up @@ -278,7 +269,6 @@ public void draw(){

DwFilter.get(context).luminance.apply(pg_cam, pg_cam);


// update Optical Flow
opticalflow.update(pg_cam);
}
Expand Down
Expand Up @@ -97,10 +97,10 @@ public class FlowField_LIC_StreamLines extends PApplet {
int STREAMLINE_RES = 10;
int DISPLAY_MODE = 1;

boolean APPLY_IMPULSE = false;
boolean APPLY_IMPULSE = false;
boolean DISPLAY_STREAMLINES = true;
boolean DISPLAY_PARTICLES = !true;
boolean BLUR_ITERATIONS = true;
boolean BLUR_ITERATIONS = true;


float impulse_max = 256;
Expand Down Expand Up @@ -157,7 +157,7 @@ public void setup(){
particles_stream.param.mul_obs = 0.0f;
particles_stream.param.mul_col = 0.0f;
particles_stream.param.mul_coh = 0.0f;
particles_stream.param.mul_acc = -5.0f;
particles_stream.param.mul_acc = +5.0f;
particles_stream.param.velocity_damping = 0.30f;

particles_stream.param.acc_minmax[1] = 120;
Expand Down Expand Up @@ -205,56 +205,23 @@ public void resizeScene(){
pg_impulse = (PGraphics2D) createGraphics(width, height, P2D);
pg_impulse.smooth(0);

// DwUtils.COL_TL = new float[]{ 0, 0, 0, 255};
// DwUtils.COL_TR = new float[]{255, 32, 0, 255};
// DwUtils.COL_BL = new float[]{ 0, 32,255, 255};
// DwUtils.COL_BR = new float[]{32, 255, 32, 255};
//
// DwUtils.COL_TL = new float[]{ 0, 0, 0, 255};
// DwUtils.COL_TR = new float[]{255, 96, 0, 255};
// DwUtils.COL_BL = new float[]{ 0, 96,255, 255};
// DwUtils.COL_BR = new float[]{ 32, 32, 32, 255};
//
//
DwUtils.COL_TL = new float[]{ 0, 0, 0, 255};
DwUtils.COL_TR = new float[]{ 32, 64, 128, 255};
DwUtils.COL_BL = new float[]{ 128, 64, 32, 255};
DwUtils.COL_BR = new float[]{ 0, 0, 0, 255};

pg_noise = DwUtils.createBackgroundNoiseTexture(this, width/2, height/2);

// pg_noise = (PGraphics2D) createGraphics(width, height, P2D);
// int dimx = pg_noise.width;
// int dimy = pg_noise.height;
// pg_noise.beginDraw();
// pg_noise.clear();
// pg_noise.blendMode(BLEND);
//
// int num_points = dimx * dimy / (3*3);
// for(int i = 0; i < num_points; i++){
// float x = random(0, dimx-1);
// float y = random(0, dimy-1);
//
// pg_noise.noStroke();
// pg_noise.fill(255);
// pg_noise.rect(x, y, 2, 2);
//
// }
// pg_noise.endDraw();

resetScene();
}

public void resetScene(){
pg_canvas.beginDraw();
pg_canvas.clear();
pg_canvas.blendMode(REPLACE);
// pg_canvas.image(pg_noise, 0, 0, pg_canvas.width, pg_canvas.height);
pg_canvas.endDraw();
}




//////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -335,7 +302,6 @@ public void draw(){
ff_impulse.displayLineIntegralConvolution(pg_canvas, pg_noise);
}



if(DISPLAY_STREAMLINES || DISPLAY_PARTICLES){

Expand All @@ -361,32 +327,30 @@ public void draw(){
particles_stream.param.shader_type = 0;
particles_stream.param.size_display = (int) max(2, (0.55f * min(dim_x/(float)num_x, dim_y/(float)num_y)));

particles_stream.param.display_line_width = 1;



float mul_vec = particles_stream.param.velocity_damping;
float mul_acc = particles_stream.param.mul_acc;
float mul_coh = particles_stream.param.mul_coh;
float mul_col = particles_stream.param.mul_col;
float mul_obs = particles_stream.param.mul_obs;

particles_stream.param.mul_coh = 0;
particles_stream.param.mul_col = 0;
particles_stream.param.mul_obs = 0;


// int warmup = min(5, iterations / 5);
// for(int i = 0; i < warmup; i++){
// particles_stream.param.velocity_damping = 1.0f - i / (float)(warmup);
// particles_stream.update(ff_impulse);
// float mul_vec = particles_stream.param.velocity_damping;
// float mul_acc = particles_stream.param.mul_acc;
// float mul_coh = particles_stream.param.mul_coh;
// float mul_col = particles_stream.param.mul_col;
// float mul_obs = particles_stream.param.mul_obs;
//
// particles_stream.param.mul_coh = 0;
// particles_stream.param.mul_col = 0;
// particles_stream.param.mul_obs = 0;
//
// if(keyPressed && key =='w')
// {
// int warmup = min(5, iterations / 5);
// for(int i = 0; i < warmup; i++){
// particles_stream.param.velocity_damping = (1.0f - i / (float)(warmup-1)) * 2.0f;
// particles_stream.update(ff_impulse);
// }
// }

particles_stream.param.velocity_damping = mul_vec;
particles_stream.param.mul_acc = -mul_acc;
particles_stream.param.mul_coh = mul_coh;
particles_stream.param.mul_col = mul_col;
particles_stream.param.mul_obs = mul_obs;
//
// particles_stream.param.velocity_damping = mul_vec;
// particles_stream.param.mul_acc = -mul_acc;
// particles_stream.param.mul_coh = mul_coh;
// particles_stream.param.mul_col = mul_col;
// particles_stream.param.mul_obs = mul_obs;


float s1 = 0.40f;
Expand Down Expand Up @@ -429,8 +393,8 @@ public void draw(){



particles_stream.param.mul_acc = mul_acc;
particles_stream.param.velocity_damping = mul_vec;
// particles_stream.param.mul_acc = mul_acc;
// particles_stream.param.velocity_damping = mul_vec;
}


Expand Down

0 comments on commit 75c4ecf

Please sign in to comment.