1
0
Fork 0

add processing files and upgrade notes

main
Luka Prinčič 2023-05-02 19:27:54 +02:00
parent 8aca939bb9
commit dae4eef298
16 changed files with 1563 additions and 2 deletions

View File

@ -2,7 +2,7 @@
`(maj 2023)` `(maj 2023)`
## general ## general/jitakami
- jitakami/processing midi(values 0-127)->osc values (0-1000?) (one day) - jitakami/processing midi(values 0-127)->osc values (0-1000?) (one day)
- jitakami/p5: titles in source instead of images? - jitakami/p5: titles in source instead of images?
@ -14,7 +14,7 @@
add: add:
- bass/kick - bass/kick
- percusion? - percusion?
- pads? - pads
## INTERRUPT ## INTERRUPT

26
pde/jitakami/autoSnap.pde Normal file
View File

@ -0,0 +1,26 @@
/*
This file is part of "Interface Fractures IV - Q".
Copyright (c) 2016 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
autoSnap.pde
*/
void autoSnap(boolean render) { // -------------------------------------
if (render) {
// auto-save snapshots
if (frameCount == 1000) {
saveFrame("../../dev/snapshots/"
+ year() + nf(month(),2)
+ nf(day(),2)
+ nf(hour(),2)
+ nf(minute(),2)
+ nf(second(),2)
+ "_.png");
}
}
}

View File

@ -0,0 +1,27 @@
/*
This file is part of "Interface Fractures IV - Q".
Copyright (c) 2016 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
displayFps.pde
*/
void displayFps(boolean render) { // -----------------------------------
if (render){
// Display Fps
rectMode(CORNER);
colorMode(RGB, 100, 100, 100, 100);
noStroke();
fill(0,0,0,100);
rect(2, 2, 40, 18);
fill(100, 100, 100, 100);
textFont(fpsFont);
textSize(12);
textAlign(LEFT);
text(round(frameRate) + "fps", 10, 16, 5);}
}

View File

@ -0,0 +1,119 @@
/*
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
drawCurvesfly.pde
*/
void drawFlylines( boolean render, // should we render or not?
int curvesNum,
int pixBank, int pixId,
float speed, float direction, float sensitivity,
float brightDirection,
float rotation, float brightRotation,
int curveHue, int curveSatur, int curveBright,
int curveAlpha, float curveBrightAlpha,
int lineLength, float brightLength, int strokeWeight,
int pixHue, int pixSatur, int pixBright, int pixAlpha
)
{
if (render) {
colorMode(HSB, 127, 127, 127, 127);
blendMode(BLEND); // reset blend mode just in case
textureMode(IMAGE);
// curvesNum = int(map(float(curvesNum), 0, 127, 0, 7000));
speed = speed * 0.002;
brightDirection = map(brightDirection, 0, 127, -5, 5);
brightRotation = map(brightRotation, 0, 127, 0, 7);
curveBrightAlpha = map(curveBrightAlpha, 0, 127, 0, 1);
pixBank = min(pixBank, imgPool.length - 1);
pixId = min(pixId, imgPool[pixBank].length - 1);
// main loop!
for (int i = 0; i < curvesNum; i++) { // for each curve
// is this the time of creation?
if (curveX[i] == 0.0) {
if (curveY[i] == 0.0) {
curveX[i] = random(width);
curveY[i] = random(height);
}
}
color curveC = imgPool[pixBank][pixId] // load only full-size HD images!
.get(int(curveX[i]), int(curveY[i])); // get color of the pixel
float curvePixBrightness = pow(brightness(curveC), 1.8) / 127.0;
// maximum: pow(127, 1.8) / 127 = 48.19954
// if sensitivity is 0 then speedPixBrightness is a constant 48.2 / 2
// speed * (curvePixBrightness * sensitivity) + ((1-sensitivity) * 25))
float curvDirection = radians(map(direction, 0, 127, 0, 360) + (curvePixBrightness * brightDirection));
float cosdir = cos(curvDirection);
float sindir = sin(curvDirection);
float speedPixBrightness = speed * ((curvePixBrightness * sensitivity) + ((1-sensitivity) * 25));
float lineLengthBri = pow(lineLength * 0.1, 2) * ( (curvePixBrightness * brightLength ) + ((1 - brightLength)*1 ) );
//println(curvePixBrightness);
curveX[i] = curveX[i] + speedPixBrightness * cosdir;
curveY[i] = curveY[i] + speedPixBrightness * sindir;
if (curveX[i] > width-1) { // if off-sceen on X-axis
curveX[i] = 1; // wrap back
curveY[i] = random(height-1); } // randomize Y-axis position
else if (curveX[i] < 1) {
curveX[i] = width-1;
curveY[i] = random(height-1); // randomize Y-axis position
}
if (curveY[i] > height-1) { // if off-sceen on X-axis
curveY[i] = 1; // wrap back
curveX[i] = random(width-1); } // randomize Y-axis position
else if (curveY[i] < 0-1) {
curveY[i] = height-1;
curveX[i] = random(width-1); // randomize Y-axis position
}
float curveRotation = radians(map(rotation, 0, 127, 0, 180) + (brightRotation * curvePixBrightness) );
// float curveBrightAlphaFact = (brightness(curveC) / 127.0) * curveBrightAlpha;
float curveAlphaDest = curveAlpha * (((brightness(curveC) / 127.0)
* curveBrightAlpha)
+ (1 - curveBrightAlpha));
pushMatrix();
stroke(color(curveHue, curveSatur, curveBright, curveAlphaDest));
strokeWeight(strokeWeight);
translate(curveX[i], curveY[i]);
rotate(curveRotation);
line (0, lineLengthBri, 0, -lineLengthBri);
popMatrix();
}
noStroke();
beginShape();
texture(imgPool[pixBank][pixId]);
tint(pixHue, pixSatur, pixBright, pixAlpha);
vertex(0, 0, 0, 0);
vertex(width, 0, width, 0);
vertex(width, height, width, height);
vertex(0, height, 0, height);
endShape();
}
}

View File

@ -0,0 +1,118 @@
/*
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
drawImageBlender.pde
*/
void drawImageBlender(boolean render, // on off
int pixBank, int pixId,
// PImage iblImg1,
int iblNum,
float iblX, float iblY, float iblWidth, float iblHeight,
float iblRot,
float iblSpeedX, float iblSpeedY,
float iblSpeedXfactor, float iblSpeedYfactor,
//float iblTexX, float iblTexY, // using global array
float iblTexWidth, float iblTexHeight,
float iblTexSpeedX, float iblTexSpeedY,
float iblTexSpeedXfactor, float iblTexSpeedYfactor,
int iblH, int iblS, int iblB, int iblA,
int iblBflicker,
float iblItX, float iblItY,
float iblItTexX, float iblItTexY, float iblItRot
)
{
if (render) {
pixBank = min(pixBank, imgPool.length - 1);
pixId = min(pixId, imgPool[pixBank].length - 1);
//iblRot = iblRot * 0.1;
pushMatrix();
translate(width/2, height/2); // center coordinate system
// autonomous movement
iblSpeedX = 0.1;
iblSpeedY = 0.1;
iblSpeedX *= iblSpeedXfactor;
iblSpeedY *= iblSpeedYfactor;
iblX += iblSpeedX;
iblY += iblSpeedY;
if (iblX > width) { iblX = -width; }
if (iblX < -width) { iblX = width; }
if (iblY > height) { iblY = -height; }
if (iblY < -height) { iblY = height; }
iblTexSpeedX = 0.1;
iblTexSpeedY = 0.1;
iblTexSpeedX *= iblTexSpeedXfactor;
iblTexSpeedY *= iblTexSpeedYfactor;
iblTexXY[0] += iblTexSpeedX;
iblTexXY[1] += iblTexSpeedY;
int iblBflicked;
if (frameCount % flickCount == 1) { iblBflicked = iblB - iblBflicker; }
else { iblBflicked = iblB; }
colorMode(HSB, 127);
for (int i=0; i < iblNum; i++) {
// draw in an independent coordinate system
pushMatrix();
// XY = translate
translate(iblX + i*iblItX, iblY + i*iblItY);
rotate(iblRot + (i*iblItRot));
textureWrap(REPEAT);
// draw the quad
beginShape();
tint(iblH, iblS, iblBflicked, iblA);
//tint(200,255,255);
// texture(iblImg1);
textureMode(IMAGE);
texture(imgPool[pixBank][pixId]);
vertex(-iblWidth, -iblHeight, // X & Y of the vertex
width/2 - iblWidth + iblX + iblTexXY[0] + (i*iblItTexX) - iblTexWidth, // X of the texture
height/2 - iblHeight + iblY + iblTexXY[1] + (i*iblItTexY) - iblTexHeight); // Y of the texture
vertex(iblWidth, -iblHeight,
width/2 + iblWidth + iblX + iblTexXY[0] + (i*iblItTexX) + iblTexWidth,
height/2 - iblHeight + iblY + iblTexXY[1] + (i*iblItTexY) - iblTexHeight);
vertex(iblWidth, iblHeight,
width/2 + iblWidth + iblX + iblTexXY[0] + (i*iblItTexX) + iblTexWidth,
height/2 + iblHeight + iblY + iblTexXY[1] + (i*iblItTexY) + iblTexHeight);
vertex(-iblWidth, iblHeight,
width/2 - iblWidth + iblX + iblTexXY[0] + (i*iblItTexX) - iblTexWidth,
height/2 + iblHeight + iblY + iblTexXY[1] + (i*iblItTexY) + iblTexHeight);
endShape();
popMatrix(); // end independent coordinate system
}
popMatrix();
/* //** debug ****************************
fill(0,125);
rect(0, 0, 200, 30);
fill(255);
text(iblTexSpeedXfactor, 5, 30);
//text(iblSpeedXfactor, 20, 60);
*/
}
}

255
pde/jitakami/drawPlates.pde Normal file
View File

@ -0,0 +1,255 @@
/*
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
drawPlates.pde
*/
void drawPlates( boolean render, // should we render or not?
int imgAbank, int imgAid,
int texAspeed, int texAdirection,
int imgATopLeft, int imgATopRight,
int imgABotRight, int imgABotLeft,
int imgAalpha,
int imgAhue, int imgAbright,
int imgBbank, int imgBid,
int texBspeed, int texBdirection,
int imgBTopLeft, int imgBTopRight,
int imgBBotRight, int imgBBotLeft,
int imgBalpha,
int imgBhue, int imgBbright,
int imgCbank, int imgCid,
int texCspeed, int texCdirection,
int imgCTopLeft, int imgCTopRight,
int imgCBotRight, int imgCBotLeft,
int imgCalpha,
int imgChue, int imgCbright,
int imgBblendMode, int imgCblendMode,
int saturation, // common saturation for all
int coordError // glitch texture coordinates - amount of error 0-127 - add random
)
{
if (render) {
blendMode(BLEND); // reset blend mode just in case
colorMode(HSB, 127, 127, 127, 127);
textureWrap(REPEAT);
textureMode(NORMAL);
imgAbank = min(imgAbank, imgPool.length - 1);
imgBbank = min(imgBbank, imgPool.length - 1);
imgCbank = min(imgCbank, imgPool.length - 1);
imgAid = min(imgAid, imgPool[imgAbank].length - 1);
imgBid = min(imgBid, imgPool[imgBbank].length - 1);
imgCid = min(imgCid, imgPool[imgCbank].length - 1);
float textureError = float(coordError) * (1.0/127.0);
// float textureError = 1.0/127.0;
textureError = textureError * rands[coordError]; //* (5.0/250.0);
//println(textureError);
// imgA ----------------------------------------------
// prepare coordinates of all 4 corners for midi input
int imgATopLeftX, imgATopLeftY;
if (imgATopLeft < 64) {
imgATopLeftX = 0;
imgATopLeftY = height - int( (float(imgATopLeft) * 0.015625) * height ); }
else {
imgATopLeftX = int( ((float(imgATopLeft) - 64) * 0.015625) * width );
imgATopLeftY = 0; }
int imgATopRightX, imgATopRightY;
if (imgATopRight < 64) {
imgATopRightX = width;
imgATopRightY = height - int( (float(imgATopRight) / 64) * height ); }
else {
imgATopRightX = int( width - (((float(imgATopRight) - 64) / 64) * width) );
imgATopRightY = 0; }
int imgABotRightX, imgABotRightY;
if (imgABotRight < 64) {
imgABotRightX = width;
imgABotRightY = int( ((float(imgABotRight) / 64) * height) ); }
else {
imgABotRightX = int( width - (((float(imgABotRight) - 64) / 64) * width) );
imgABotRightY = height; }
int imgABotLeftX, imgABotLeftY;
if (imgABotLeft < 64) {
imgABotLeftX = 0;
imgABotLeftY = int( (float(imgABotLeft) / 64) * height ); }
else {
imgABotLeftX = int( ((float(imgABotLeft) - 64) / 64) * width );
imgABotLeftY = height; }
// prepare coordinates of texture using speed and direction
float imgATopLeftTexX, imgATopLeftTexY;
float imgATopRightTexX, imgATopRightTexY;
float imgABotLeftTexX, imgABotLeftTexY;
float imgABotRightTexX, imgABotRightTexY;
float imgATexSpeed = frameCount * 0.0001 * pow(texAspeed,1.5); // temp
float imgATexDirectionRad = radians(float(texAdirection) * 2.83464566929);
imgATopLeftTexX = 0 + imgATexSpeed * cos(imgATexDirectionRad + textureError); // needs to be tested!!
imgATopLeftTexY = 0 + imgATexSpeed * sin(imgATexDirectionRad + textureError);
imgATopRightTexX = 1 + imgATexSpeed * cos(imgATexDirectionRad);
imgATopRightTexY = 0 + imgATexSpeed * sin(imgATexDirectionRad);
imgABotRightTexX = 1 + imgATexSpeed * cos(imgATexDirectionRad);
imgABotRightTexY = 1 + imgATexSpeed * sin(imgATexDirectionRad);
imgABotLeftTexX = 0 + imgATexSpeed * cos(imgATexDirectionRad);
imgABotLeftTexY = 1 + imgATexSpeed * sin(imgATexDirectionRad);
// color
tint(imgAhue, saturation, imgAbright, imgAalpha);
beginShape();
texture(imgPool[imgAbank][imgAid]);
vertex(imgATopLeftX, imgATopLeftY, imgATopLeftTexX, imgATopLeftTexY);
vertex(imgATopRightX, imgATopRightY, imgATopRightTexX, imgATopRightTexY);
vertex(imgABotRightX, imgABotRightY, imgABotRightTexX, imgABotRightTexY);
vertex(imgABotLeftX, imgABotLeftY, imgABotLeftTexX, imgABotLeftTexY);
endShape();
// imgB ----------------------------------------------
// prepare coordinates of all 4 corners for midi input
int imgBTopLeftX, imgBTopLeftY;
if (imgBTopLeft < 64) {
imgBTopLeftX = 0;
imgBTopLeftY = height - int( (float(imgBTopLeft) * 0.015625) * height );
}
else {
imgBTopLeftX = int( ((float(imgBTopLeft) - 64) * 0.015625) * width );
imgBTopLeftY = 0; }
int imgBTopRightX, imgBTopRightY;
if (imgBTopRight < 64) {
imgBTopRightX = width;
imgBTopRightY = height - int( (float(imgBTopRight) / 64) * height ); }
else {
imgBTopRightX = int( width - (((float(imgBTopRight) - 64) / 64) * width) );
imgBTopRightY = 0; }
int imgBBotRightX, imgBBotRightY;
if (imgBBotRight < 64) {
imgBBotRightX = width;
imgBBotRightY = int( ((float(imgBBotRight) / 64) * height) ); }
else {
imgBBotRightX = int( width - (((float(imgBBotRight) - 64) / 64) * width) );
imgBBotRightY = height; }
int imgBBotLeftX, imgBBotLeftY;
if (imgBBotLeft < 64) {
imgBBotLeftX = 0;
imgBBotLeftY = int( (float(imgBBotLeft) / 64) * height ); }
else {
imgBBotLeftX = int( ((float(imgBBotLeft) - 64) / 64) * width );
imgBBotLeftY = height; }
// prepare coordinates of texture using speed and direction
float imgBTopLeftTexX, imgBTopLeftTexY;
float imgBTopRightTexX, imgBTopRightTexY;
float imgBBotLeftTexX, imgBBotLeftTexY;
float imgBBotRightTexX, imgBBotRightTexY;
float imgBTexSpeed = frameCount * 0.0001 * pow(texBspeed,1.5); // temp
float imgBTexDirectionRad = radians(float(texBdirection) * 2.83464566929);
imgBTopLeftTexX = 0 + imgBTexSpeed * cos(imgBTexDirectionRad);
imgBTopLeftTexY = 0 + imgBTexSpeed * sin(imgBTexDirectionRad);
imgBTopRightTexX = 1 + imgBTexSpeed * cos(imgBTexDirectionRad);
imgBTopRightTexY = 0 + imgBTexSpeed * sin(imgBTexDirectionRad);
imgBBotRightTexX = 1 + imgBTexSpeed * cos(imgBTexDirectionRad);
imgBBotRightTexY = 1 + imgBTexSpeed * sin(imgBTexDirectionRad);
imgBBotLeftTexX = 0 + imgBTexSpeed * cos(imgBTexDirectionRad);
imgBBotLeftTexY = 1 + imgBTexSpeed * sin(imgBTexDirectionRad);
// color
tint(imgBhue, saturation, imgBbright, imgBalpha);
switchBlendMode(imgBblendMode);
beginShape();
texture(imgPool[imgBbank][imgBid]);
vertex(imgBTopLeftX, imgBTopLeftY, imgBTopLeftTexX, imgBTopLeftTexY);
vertex(imgBTopRightX, imgBTopRightY, imgBTopRightTexX, imgBTopRightTexY);
vertex(imgBBotRightX, imgBBotRightY, imgBBotRightTexX, imgBBotRightTexY);
vertex(imgBBotLeftX, imgBBotLeftY, imgBBotLeftTexX, imgBBotLeftTexY);
endShape();
// imgC ----------------------------------------------
// prepare coordinates of all 4 corners for midi input
int imgCTopLeftX, imgCTopLeftY;
if (imgCTopLeft < 64) {
imgCTopLeftX = 0;
imgCTopLeftY = height - int( (float(imgCTopLeft) * 0.015625) * height );
}
else {
imgCTopLeftX = int( ((float(imgCTopLeft) - 64) * 0.015625) * width );
imgCTopLeftY = 0; }
int imgCTopRightX, imgCTopRightY;
if (imgCTopRight < 64) {
imgCTopRightX = width;
imgCTopRightY = height - int( (float(imgCTopRight) / 64) * height ); }
else {
imgCTopRightX = int( width - (((float(imgCTopRight) - 64) / 64) * width) );
imgCTopRightY = 0; }
int imgCBotRightX, imgCBotRightY;
if (imgCBotRight < 64) {
imgCBotRightX = width;
imgCBotRightY = int( ((float(imgCBotRight) / 64) * height) ); }
else {
imgCBotRightX = int( width - (((float(imgCBotRight) - 64) / 64) * width) );
imgCBotRightY = height; }
int imgCBotLeftX, imgCBotLeftY;
if (imgCBotLeft < 64) {
imgCBotLeftX = 0;
imgCBotLeftY = int( (float(imgCBotLeft) / 64) * height ); }
else {
imgCBotLeftX = int( ((float(imgCBotLeft) - 64) / 64) * width );
imgCBotLeftY = height; }
// prepare coordinates of texture using speed and direction
float imgCTopLeftTexX, imgCTopLeftTexY;
float imgCTopRightTexX, imgCTopRightTexY;
float imgCBotLeftTexX, imgCBotLeftTexY;
float imgCBotRightTexX, imgCBotRightTexY;
float imgCTexSpeed = frameCount * 0.0001 * pow(texCspeed,1.5); // temp
float imgCTexDirectionRad = radians(float(texCdirection) * 2.83464566929);
imgCTopLeftTexX = 0 + imgCTexSpeed * cos(imgCTexDirectionRad);
imgCTopLeftTexY = 0 + imgCTexSpeed * sin(imgCTexDirectionRad);
imgCTopRightTexX = 1 + imgCTexSpeed * cos(imgCTexDirectionRad);
imgCTopRightTexY = 0 + imgCTexSpeed * sin(imgCTexDirectionRad);
imgCBotRightTexX = 1 + imgCTexSpeed * cos(imgCTexDirectionRad);
imgCBotRightTexY = 1 + imgCTexSpeed * sin(imgCTexDirectionRad);
imgCBotLeftTexX = 0 + imgCTexSpeed * cos(imgCTexDirectionRad);
imgCBotLeftTexY = 1 + imgCTexSpeed * sin(imgCTexDirectionRad);
// color
tint(imgChue, saturation, imgCbright, imgCalpha);
switchBlendMode(imgCblendMode);
beginShape();
texture(imgPool[imgCbank][imgCid]);
vertex(imgCTopLeftX, imgCTopLeftY, imgCTopLeftTexX, imgCTopLeftTexY);
vertex(imgCTopRightX, imgCTopRightY, imgCTopRightTexX, imgCTopRightTexY);
vertex(imgCBotRightX, imgCBotRightY, imgCBotRightTexX, imgCBotRightTexY);
vertex(imgCBotLeftX, imgCBotLeftY, imgCBotLeftTexX, imgCBotLeftTexY);
endShape();
blendMode(BLEND);
}
}

105
pde/jitakami/drawTiles.pde Normal file
View File

@ -0,0 +1,105 @@
/*
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
tiles.pde
*/
// TILES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/* TODO:
- different zooms (random?)
- better rotation
- multiple instances of the same thing - with
different texture & some parameters + parameterize
- zoom variations
- ?amount of speed variations accross tiles
*/
void drawTiles( boolean render, // should we render or not?
int tilesBgHue, int tilesBgSat, int tilesBgBri,
int tilesHue, int tilesSat, int tilesBri,
//color bgfill, // backgorund color
//!!color tilecolor, // tile color
int huedist, // tile color distance for interpolation
int blendMode, // blending mode of tiles
int numx, // number of tiles on X
int numy, // number of tiles on Y
int texBank,
int texNum,
float texSpeedX,
float texSpeedY,
float overlap )
{
if (render) {
colorMode(HSB, 127, 127, 127, 127);
blendMode(BLEND);
color bgfill = color(tilesBgHue, tilesBgSat, tilesBgBri);
color tilecolor = color(tilesHue, tilesSat, tilesBri);
fill(bgfill);
noStroke();
rectMode(CORNER);
rect(0, 0, width, height);
switchBlendMode(blendMode); // blendMode function using integers
texBank = min(texBank, imgPool.length - 1);
texNum = min(texNum, imgPool[texBank].length - 1);
texSpeedX *= 0.01;
texSpeedY *= 0.01;
texX += sq(sq(texSpeedX));
texY += sq(sq(texSpeedY));
numx = max(1, numx);
numy = max(1, numy);
float numxfact = 1 / float(numx);
float numyfact = 1 / float(numy);
float aspectRatio = (height / float(numy)) / (width / float(numx));
float offsetPerc = overlap * (300/127);
float uniZoom = numxfact * (float(width)/1024);
float offsetX = width * numxfact * offsetPerc * 0.01;
float offsetY = height * numyfact * offsetPerc * 0.01;
float texoffsetX = 1 + 0.01 * offsetPerc ;
float texoffsetY = texoffsetX;
float huefactor = float(huedist) / (numx * numy);
for (int nx=0; nx < numx; nx++) {
for (int ny=0; ny < numy; ny++) {
int tileID = nx * numy + ny;
float randX = rands[ (tileID % rands.length) ] * 0.01;
float randY = rands[ ((tileID + 50) % rands.length) ] * 0.01;
float newhue = hue(tilecolor) + huefactor * tileID;
tint(newhue, saturation(tilecolor), brightness(tilecolor), alpha(tilecolor));
textureWrap(REPEAT);
textureMode(NORMAL);
beginShape();
texture(imgPool[texBank][texNum]);
vertex(width * numxfact * nx - offsetX, height * numyfact * ny - offsetY, 0 + texX * randX, 0 + texY * randY);
vertex(width * numxfact * (nx + 1) + offsetX, height * numyfact * ny - offsetY, 1 * uniZoom * texoffsetX + texX * randX, 0 + texY * randY);
vertex(width * numxfact * (nx + 1) + offsetX, height * numyfact * (ny + 1) + offsetY, 1 * uniZoom * texoffsetX + texX * randX, aspectRatio * uniZoom * texoffsetY + texY * randY);
vertex(width * numxfact * nx - offsetX, height * numyfact * (ny + 1) + offsetY, 0 + texX * randX, aspectRatio * uniZoom * texoffsetY + texY * randY);
endShape();
}
}
}
}

View File

@ -0,0 +1,51 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
getImages.pde
*/
// loads all images into an array - - - - - - - - - - - - - - - - - - - - - - - - -
PImage[][] getImages(String folder) {
//ArrayList<ArrayList> getImages(String folder) {
PImage[][] imgPool; // declare 2D array imgPool
//ArrayList<ArrayList> imgPool;
File dir = new File(dataPath(sketchPath() + folder)); // first folder
String[] dirlist = dir.list(); // an array of folders (strings)
dirlist = sort(dirlist); //
//imgPool = new ArrayList<ArrayList>();
imgPool = new PImage[dirlist.length][100]; // create 2d array imgPool
for (int i = 0; i < dirlist.length; i++) {
String fulldir = dataPath(sketchPath() + folder + dirlist[i]) + "/";
File dir2 = new File(fulldir);
String[] filelist = dir2.list(); // an array of image names
filelist = sort(filelist);
println("\n~~~ IMAGE BANK no." + i + ": " + dirlist[i]);
if (filelist.length != 0) {
imgPool[i] = (PImage[]) expand(imgPool[i], filelist.length);
// geez: ^^^^^^^^^^ !!!!!
for (int j = 0; j < filelist.length; j++) {
println(" imgPool[" + i + "][" + j + "]: " + dirlist[i] + " " + filelist[j]);
imgPool[i][j] = loadImage(fulldir + filelist[j]);
}
} else {
println("No files in this folder: " + fulldir);
}
}
println("\n~~~ Done loading images.\n");
return imgPool;
}

View File

@ -0,0 +1,68 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
getVideos.pde
*/
Movie[][] getVideos(String folder) {
Movie[][] vidPool;
File dir = new File(dataPath(sketchPath() + folder)); // first folder
String[] dirlist = dir.list(); // an array of folders (strings)
dirlist = sort(dirlist); //
//println("... dirlist array:");
// printArray(dirlist);
//println(" from: " + dir);
//vidPool = new ArrayList<ArrayList>();
vidPool = new Movie[dirlist.length][100]; // create 2d array imgPool
for (int i = 0; i < dirlist.length; i++) {
//println("here" + dirlist);
String fulldir = dataPath(sketchPath() + folder + dirlist[i]) + "/";
File dir2 = new File(fulldir);
String[] filelist = dir2.list(); // an array of image names
filelist = sort(filelist);
println("\n~~~ VIDEO BANK no." + i + ": " + dirlist[i]);
if (filelist.length != 0) {
vidPool[i] = (Movie[]) expand(vidPool[i], filelist.length);
// geez: ^^^^^^^^^^ !!!!!
for (int j = 0; j < filelist.length; j++) {
println("___ vidPool[" + i + "][" + j + "]: " + dirlist[i] + " " + filelist[j]);
vidPool[i][j] = new Movie(this, fulldir + filelist[j]);
delay(40);
}
println("");
delay(400);
} else {
println("No files in this folder: " + fulldir);
}
}
println("\n~~~ Done loading videos.\n");
return vidPool;
/* // in setup:
video = new GLMovie(this, "stuffloor2.mov");
video.loop();
*/
}

318
pde/jitakami/jitakami.pde Normal file
View File

@ -0,0 +1,318 @@
/*
Copyright (c) 2016 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
jitakami.pde
*/
// basic screen settings
void settings() {
fullScreen(P3D, 2);
//size(1280, 720, P3D);
}
// load libs
import oscP5.*; // Open Sound Control
import netP5.*;
import processing.video.*;
//import gohai.glvideo.*;
// DECLARATIONS --------------- //
// OSC object
OscP5 oscP5;
String oscVal1;
float oscVal2;
// temporary
float ampColor;
// image pool, a 2D array
PImage[][] imgPool;
// video pool, a 2D array
Movie[][] vidPool;
// screenClean
float screenCleanHue, screenCleanSaturation, screenCleanBrightness,
screenCleanAlpha, screenCleanFlickrAmount, screenCleanFlickrSpeed;
// drawFlylinesfly
boolean drawFlylinesflyToggle = false;
int drawFlylinesflyCurvesNumInit = 7000, // init
drawFlylinesflyCurvesNum = 127, // dynamic
drawFlylinesflyPixBank = 0, drawFlylinesflyPixId = 1;
float drawFlylinesflySpeed = 20, drawFlylinesflyDirection = 0, drawFlylinesSensitivity = 1,
drawFlylinesflyBrightDirection = 64, // 0-64-127
drawFlylinesflyRotation = 0, drawFlylinesflyBrightRotation = 0;
int drawFlylinesHue = 0, drawFlylinesSatur = 0, drawFlylinesBright = 127, drawFlylinesAlpha = 27;
float drawFlylinesBrightAlpha = 127;
int drawFlylinesLineLength = 20;
float drawFlylinesBrightLength = 0;
int drawFlylinesStrokeWeight = 2;
int drawFlylinesPixHue = 127, drawFlylinesPixSatur = 127,
drawFlylinesPixBright = 127, drawFlylinesPixAlpha = 10;
float[] curveX = new float[drawFlylinesflyCurvesNumInit];
float[] curveY = new float[drawFlylinesflyCurvesNumInit];
// drawPlates
boolean drawPlatesToggle = false;
int drawPlatesimgAbank = 0, drawPlatesimgAid = 9;
int drawPlatesTexAspeed = 1, drawPlatesTexAdirection = 16;
int drawPlatesimgATopLeft = 64, drawPlatesimgATopRight = 64,
drawPlatesimgABotRight = 64, drawPlatesimgABotleft = 64;
int drawPlatesimgAalpha = 127, drawPlatesimgAhue = 0, drawPlatesimgAbright = 127;
int drawPlatesimgBbank = 0, drawPlatesimgBid = 1;
int drawPlatesTexBspeed = 1, drawPlatesTexBdirection = 0;
int drawPlatesimgBTopLeft = 64, drawPlatesimgBTopRight = 64,
drawPlatesimgBBotRight = 64, drawPlatesimgBBotleft = 64;
int drawPlatesimgBalpha = 64, drawPlatesimgBhue = 64, drawPlatesimgBbright = 127;
int drawPlatesimgCbank = 0, drawPlatesimgCid = 2;
int drawPlatesTexCspeed = 1, drawPlatesTexCdirection = 96;
int drawPlatesimgCTopLeft = 64, drawPlatesimgCTopRight = 64,
drawPlatesimgCBotRight = 64, drawPlatesimgCBotleft = 64;
int drawPlatesimgCalpha = 64, drawPlatesimgChue = 0, drawPlatesimgCbright = 127;
int drawPlatesimgBblendMode = 8, drawPlatesimgCblendMode = 8;
int drawPlatesSaturation = 0;
int drawPlatesCoordError = 0;
// tiles
boolean drawTilesToggle = false;
int drawTilesBgHue, drawTilesBgSat, drawTilesBgBri = 64, drawTilesHue, drawTilesSat, drawTilesBri = 64;
int drawTilesHueDistance = 20, drawTilesBlendMode = 0;
int drawTilesNumX = 3, drawTilesNumY = 3, drawTilesTexBank = 0, drawTilesTexId = 1;
float drawTilesTexSpeedX = 10, drawTilesTexSpeedY = 10, drawTilesOverlap = 10;
float texX = 0; // globals?
float texY = 0;
// image blender
boolean drawImageBlenderToggle = false;
int drawImageBlenderBank = 0, drawImageBlenderID = 2, iblNum = 1;
float iblX = 0, iblY = 0, iblWidth = 600, iblHeight = 100;
float iblRot; // radians need a float
float iblSpeedX, iblSpeedY;
float iblSpeedXfactor = 0, iblSpeedYfactor = 0;
float[] iblTexXY = new float[2]; // global object for texture coordinates
float iblTexWidth, iblTexHeight;
float iblTexSpeedX, iblTexSpeedY;
float iblTexSpeedXfactor, iblTexSpeedYfactor;
int iblH, iblS = 0, iblB = 100, iblA = 255; // stroke color / tint
int iblBflicker = 0; // flicker (Brightness)
float iblItX = 0, iblItY = 0, iblItTexX = 0, iblItTexY = 0, iblItRot;
// video player
boolean playVideoToggle = false;
boolean playVideoPausePlay = true;
boolean playVideoLoop = false;
int playVideoBank = 0, playVideoID = 0;
int playVideoHue, playVideoSaturation, playVideoBrightness,
playVideoAlpha, playVideoJump;
int playVideoSpeed;
//float playVideoPosition = 0;
// ?
int flickCount = 2; // 2,3,4 or 5
// generate an array of random numbers
int[] rands = new int[500];
// testPicture
boolean testPictureToggle = false;
PFont testFont;
// fps
boolean displayFpsToggle = false;
PFont fpsFont;
// regular snapshots / improve: snap when buttonPress(SC-GUI)
boolean autoSnapToggle = false;
///////////////////////////////////////////////////////////////////////////////
void setup() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// framerate
//frameRate(60); // looks like 60fps by default, see displayFps function
//smooth(32);
noCursor();
background(0);
// setup open sound control
println("~~~ starting oscP5 ...");
oscP5 = new OscP5(this,12000); // listening at port 12000
//oscP5.plug(this,"hhosc","/highhat"); // osc from SuperCollider -> function 'scosc'
// get all textures into an image pool
println("\n\n~~~ loading textures into image pool ...\n");
imgPool = getImages("/images/");
// get all videos into an video pool
println("\n\n~~~ loading videos into videos pool ...\n");
vidPool = getVideos("/videos/");
// create an array of random value between -250 and 250
for (int i=0; i < 500; i++) { rands[i] = i-250; }
shuffle(rands);
// testPicture font
testFont = createFont("Oliver's Barney", 50);
// fps
fpsFont = createFont("Ubuntu Mono", 12);
println("~~~ setup() finished. now to the draw() ...");
}
//////////////////////////////////////////////////////////////////////////////
void draw() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// clean screen
blendMode(BLEND);
screenClean
( screenCleanHue,
screenCleanSaturation,
screenCleanBrightness,
screenCleanAlpha,
screenCleanFlickrAmount,
screenCleanFlickrSpeed );
drawFlylines
( drawFlylinesflyToggle,
drawFlylinesflyCurvesNum,
drawFlylinesflyPixBank, drawFlylinesflyPixId,
drawFlylinesflySpeed, drawFlylinesflyDirection, drawFlylinesSensitivity,
drawFlylinesflyBrightDirection,
drawFlylinesflyRotation, drawFlylinesflyBrightRotation,
drawFlylinesHue, drawFlylinesSatur, drawFlylinesBright,
drawFlylinesAlpha, drawFlylinesBrightAlpha,
drawFlylinesLineLength, drawFlylinesBrightLength, drawFlylinesStrokeWeight,
drawFlylinesPixHue, drawFlylinesPixSatur, drawFlylinesPixBright, drawFlylinesPixAlpha );
drawPlates
( drawPlatesToggle,
drawPlatesimgAbank, drawPlatesimgAid,
drawPlatesTexAspeed, drawPlatesTexAdirection,
drawPlatesimgATopLeft, drawPlatesimgATopRight,
drawPlatesimgABotRight, drawPlatesimgABotleft,
drawPlatesimgAalpha, drawPlatesimgAhue, drawPlatesimgAbright,
drawPlatesimgBbank, drawPlatesimgBid,
drawPlatesTexBspeed, drawPlatesTexBdirection,
drawPlatesimgBTopLeft, drawPlatesimgBTopRight,
drawPlatesimgBBotRight, drawPlatesimgBBotleft,
drawPlatesimgBalpha, drawPlatesimgBhue, drawPlatesimgBbright,
drawPlatesimgCbank, drawPlatesimgCid,
drawPlatesTexCspeed, drawPlatesTexCdirection,
drawPlatesimgCTopLeft, drawPlatesimgCTopRight,
drawPlatesimgCBotRight, drawPlatesimgCBotleft,
drawPlatesimgCalpha, drawPlatesimgChue, drawPlatesimgCbright,
drawPlatesimgBblendMode, drawPlatesimgCblendMode,
drawPlatesSaturation,
drawPlatesCoordError // 0-127
);
drawTiles
( drawTilesToggle,
drawTilesBgHue, drawTilesBgSat, drawTilesBgBri, drawTilesHue, drawTilesSat, drawTilesBri,
drawTilesHueDistance, // tile hue distance
drawTilesBlendMode, // blendMode
drawTilesNumX, // number of drawTiles on X axis
drawTilesNumY, // number of drawTiles on Y axis
drawTilesTexBank, // texture bank number
drawTilesTexId, // texture number/id
drawTilesTexSpeedX, // texture speed X
drawTilesTexSpeedY, // texture speed Y
drawTilesOverlap // overlap. 127 = 300%
);
drawImageBlender
( drawImageBlenderToggle,
drawImageBlenderBank, drawImageBlenderID,
// iblImg1,
iblNum,
iblX, iblY, iblWidth, iblHeight,
iblRot,
iblSpeedX, iblSpeedY,
iblSpeedXfactor, iblSpeedYfactor,
iblTexWidth, iblTexHeight,
iblTexSpeedX, iblTexSpeedY,
iblTexSpeedXfactor, iblTexSpeedYfactor,
iblH, iblS, iblB, iblA,
iblBflicker,
iblItX, iblItY,
iblItTexX, iblItTexY, iblItRot
);
playVideo
( playVideoToggle,
playVideoPausePlay,
playVideoLoop,
playVideoBank, playVideoID,
playVideoHue, playVideoSaturation,
playVideoBrightness, playVideoAlpha, playVideoJump, playVideoSpeed
//playVideoPosition
);
if(playVideoJump != 1000) {
playVideoJump = 1000;
};
// draw test picture
testPicture(testPictureToggle);
// frames per second
displayFps(displayFpsToggle);
// document
autoSnap(autoSnapToggle);
} ///////////////////////////////////////////////////////////////////////////
//void mousePressed() {
// vidPool[0][0].jump(map(mouseX, 0, width, 0, vidPool[0][0].duration()));
//}

224
pde/jitakami/oscEvent.pde Normal file
View File

@ -0,0 +1,224 @@
/*
This file is part of "Interface Fractures IV - Q".
Copyright (c) 2016 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
oscEvent.pde - processes incoming osc messages
*/
void oscEvent(OscMessage theOscMessage) {
if(theOscMessage.checkTypetag("si")) {
oscVal1 = theOscMessage.get(0).stringValue();
oscVal2 = float(theOscMessage.get(1).intValue());
}
if(theOscMessage.checkTypetag("sf")) {
oscVal1 = theOscMessage.get(0).stringValue();
oscVal2 = theOscMessage.get(1).floatValue();
}
if(theOscMessage.checkTypetag("ii")) {
oscVal1 = str(theOscMessage.get(0).intValue());
oscVal2 = theOscMessage.get(1).intValue();
}
/*
// direct translation?
// SuperCollider direct osc paths
if(theOscMessage.checkAddrPattern("/var")==true) {
//(oscVal1[]) = oscVal2;
}
// SuperCollider direct osc paths
if(theOscMessage.checkAddrPattern("/highhat")==true) {
if(oscVal1.equals( "amp")) { ampColor = oscVal2; println("amp:"+oscVal2); }
}
*/
// OSC patchbay
// /ctlin - Renoise-midi > SuperCollider-OSC
if(theOscMessage.checkAddrPattern("/ctlin")==true) {
// screenClean
if(oscVal1.equals( "/screenCleanHue" )) { screenCleanHue = oscVal2 ; }
if(oscVal1.equals( "/screenCleanSaturation" )) { screenCleanSaturation = oscVal2 ; }
if(oscVal1.equals( "/screenCleanBrightness" )) { screenCleanBrightness = oscVal2 ; }
if(oscVal1.equals( "/screenCleanAlpha" )) { screenCleanAlpha = oscVal2 ; }
if(oscVal1.equals( "/screenCleanFlickrAmount" )) { screenCleanFlickrAmount = oscVal2 ; }
if(oscVal1.equals( "/screenCleanFlickrSpeed" )) { screenCleanFlickrSpeed = oscVal2 ; }
// drawFlylines
if(oscVal1.equals( "/drawFlylinesflyToggle" )) { drawFlylinesflyToggle = boolean(int(oscVal2)) ; }
if(oscVal1.equals( "/drawFlylinesflyCurvesNum" )) { drawFlylinesflyCurvesNum = int(map(oscVal2, 0, 127, 0, 7000)); }
if(oscVal1.equals( "/drawFlylinesflyPixBank" )) { drawFlylinesflyPixBank = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesflyPixId" )) { drawFlylinesflyPixId = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesflySpeed" )) { drawFlylinesflySpeed = oscVal2 ; }
if(oscVal1.equals( "/drawFlylinesflyDirection" )) { drawFlylinesflyDirection = oscVal2 ; }
if(oscVal1.equals( "/drawFlylinesSensitivity" )) { drawFlylinesSensitivity = map(oscVal2, 0, 127, 0, 1) ; }
if(oscVal1.equals( "/drawFlylinesflyBrightDirection" )) { drawFlylinesflyBrightDirection = oscVal2 ; }
if(oscVal1.equals( "/drawFlylinesflyRotation" )) { drawFlylinesflyRotation = oscVal2 ; }
if(oscVal1.equals( "/drawFlylinesflyBrightRotation" )) { drawFlylinesflyBrightRotation = oscVal2 ; }
if(oscVal1.equals( "/drawFlylinesHue" )) { drawFlylinesHue = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesSatur" )) { drawFlylinesSatur = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesBright" )) { drawFlylinesBright = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesAlpha" )) { drawFlylinesAlpha = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesBrightAlpha" )) { drawFlylinesBrightAlpha = oscVal2 ; }
if(oscVal1.equals( "/drawFlylinesLineLength" )) { drawFlylinesLineLength = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesBrightLength" )) { drawFlylinesBrightLength = map(oscVal2, 0, 127, 0, 1) ; }
if(oscVal1.equals( "/drawFlylinesStrokeWeight" )) { drawFlylinesStrokeWeight = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesPixHue" )) { drawFlylinesPixHue = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesPixSatur" )) { drawFlylinesPixSatur = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesPixBright" )) { drawFlylinesPixBright = int(oscVal2) ; }
if(oscVal1.equals( "/drawFlylinesPixAlpha" )) { drawFlylinesPixAlpha = int(oscVal2) ; }
// drawPlates
if(oscVal1.equals( "/drawPlatesToggle" )) { drawPlatesToggle = boolean(int(oscVal2)) ; }
if(oscVal1.equals( "/drawPlatesimgAbank" )) { drawPlatesimgAbank = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgAid" )) { drawPlatesimgAid = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesTexAspeed" )) { drawPlatesTexAspeed = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesTexAdirection" )) { drawPlatesTexAdirection = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgATopLeft" )) { drawPlatesimgATopLeft = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgATopRight" )) { drawPlatesimgATopRight = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgABotRight" )) { drawPlatesimgABotRight = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgABotleft" )) { drawPlatesimgABotleft = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgAalpha" )) { drawPlatesimgAalpha = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgAhue" )) { drawPlatesimgAhue = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgAbright" )) { drawPlatesimgAbright = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBbank" )) { drawPlatesimgBbank = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBid" )) { drawPlatesimgBid = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesTexBspeed" )) { drawPlatesTexBspeed = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesTexBdirection" )) { drawPlatesTexBdirection = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBTopLeft" )) { drawPlatesimgBTopLeft = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBTopRight" )) { drawPlatesimgBTopRight = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBBotRight" )) { drawPlatesimgBBotRight = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBBotleft" )) { drawPlatesimgBBotleft = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBalpha" )) { drawPlatesimgBalpha = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBhue" )) { drawPlatesimgBhue = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBbright" )) { drawPlatesimgBbright = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCbank" )) { drawPlatesimgCbank = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCid" )) { drawPlatesimgCid = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesTexCspeed" )) { drawPlatesTexCspeed = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesTexCdirection" )) { drawPlatesTexCdirection = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCTopLeft" )) { drawPlatesimgCTopLeft = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCTopRight" )) { drawPlatesimgCTopRight = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCBotRight" )) { drawPlatesimgCBotRight = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCBotleft" )) { drawPlatesimgCBotleft = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCalpha" )) { drawPlatesimgCalpha = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgChue" )) { drawPlatesimgChue = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCbright" )) { drawPlatesimgCbright = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgBblendMode" )) { drawPlatesimgBblendMode = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesimgCblendMode" )) { drawPlatesimgCblendMode = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesSaturation" )) { drawPlatesSaturation = int(oscVal2) ; }
if(oscVal1.equals( "/drawPlatesCoordError" )) { drawPlatesCoordError = int(oscVal2) ; } // 0-127
// drawTiles
if(oscVal1.equals( "/drawTilesToggle" )) { drawTilesToggle = boolean(int(oscVal2)) ; }
if(oscVal1.equals( "/drawTilesBgHue" )) { drawTilesBgHue = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesBgSat" )) { drawTilesBgSat = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesBgBri" )) { drawTilesBgBri = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesHue" )) { drawTilesHue = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesSat" )) { drawTilesSat = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesBri" )) { drawTilesBri = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesHueDistance" )) { drawTilesHueDistance = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesBlendMode" )) { drawTilesBlendMode = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesNumX" )) { drawTilesNumX = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesNumY" )) { drawTilesNumY = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesTexBank" )) { drawTilesTexBank = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesTexId" )) { drawTilesTexId = int(oscVal2) ; }
if(oscVal1.equals( "/drawTilesTexSpeedX" )) { drawTilesTexSpeedX = oscVal2 ; }
if(oscVal1.equals( "/drawTilesTexSpeedY" )) { drawTilesTexSpeedY = oscVal2 ; }
if(oscVal1.equals( "/drawTilesOverlap" )) { drawTilesOverlap = oscVal2 ; }
// drawImageBlender
if(oscVal1.equals( "/drawImageBlenderToggle" )) { drawImageBlenderToggle = boolean(int(oscVal2)) ; } // 130-127 = 3 @ chan2
if(oscVal1.equals( "/drawImageBlenderBank" )) { drawImageBlenderBank = int(oscVal2) ; } // 131-127 = 4
if(oscVal1.equals( "/drawImageBlenderID" )) { drawImageBlenderID = int(oscVal2) ; } //5
if(oscVal1.equals( "/iblNum" )) { iblNum = int(oscVal2) ; } // 6
if(oscVal1.equals( "/iblX" )) { iblX = ((oscVal2-64) / 64.0) * width/2 ; } // 7 int( ((oscVal2-64) / 64.0) * width/2 ); }
if(oscVal1.equals( "/iblY" )) { iblY = ((oscVal2-64) / 64.0) * width/2 ; } // 8
if(oscVal1.equals( "/iblWidth" )) { iblWidth = oscVal2 * oscVal2 * 0.2 * norm(width, 0, width) ; } // 9 int(oscVal2 * oscVal2 * 0.05 * norm(width, 0, width));
if(oscVal1.equals( "/iblHeight" )) { iblHeight = oscVal2 * oscVal2 * 0.1 * norm(height, 0, height) ; } // 10
if(oscVal1.equals( "/iblRot" )) { iblRot = radians(oscVal2 * 360 / 120) ; } // 11
//if(oscVal1.equals( "139" )) { iblSpeedX = oscVal2 ; } // 12
//if(oscVal1.equals( "140" )) { iblSpeedY = oscVal2 ; } // 13
//if(oscVal1.equals( "141" )) { iblSpeedXfactor = ((oscVal2-64) * abs(oscVal2-64) * 0.6) ; } // 14
//if(oscVal1.equals( "142" )) { iblSpeedYfactor = ((oscVal2-64) * abs(oscVal2-64) * 0.6) ; } // 15
//if(oscVal1.equals( "143" )) { iblTexX = ((oscVal2 - 64) / 64.0) * width / 2 ; } // 16
//if(oscVal1.equals( "144" )) { iblTexY = ((oscVal2 - 64) / 64.0) * height / 2 ; } // 17
if(oscVal1.equals( "/iblTexWidth" )) { iblTexWidth = (oscVal2 - 64) * oscVal2 ; } // 18
if(oscVal1.equals( "/iblTexHeight" )) { iblTexHeight = (oscVal2 - 64) * oscVal2 ; } // 19
//if(oscVal1.equals( "147" )) { iblTexSpeedX = oscVal2 ; } // 20
//if(oscVal1.equals( "148" )) { iblTexSpeedY = oscVal2 ; } // 21
if(oscVal1.equals( "/iblTexSpeedXfactor" )) { iblTexSpeedXfactor = ((oscVal2-64) * abs(oscVal2-64) * 0.6) ; } // 22
if(oscVal1.equals( "/iblTexSpeedYfactor" )) { iblTexSpeedYfactor = ((oscVal2-64) * abs(oscVal2-64) * 0.6) ; } // 23
if(oscVal1.equals( "/iblH" )) { iblH = int(oscVal2) ; } // 24
if(oscVal1.equals( "/iblS" )) { iblS = int(oscVal2) ; } // 25
if(oscVal1.equals( "/iblB" )) { iblB = int(oscVal2) ; } // 26
if(oscVal1.equals( "/iblA" )) { iblA = int(oscVal2) ; } // 27
if(oscVal1.equals( "/iblBflicker" )) { iblBflicker = int(oscVal2) ; } // 28
if(oscVal1.equals( "/iblItX" )) { iblItX = ((oscVal2-64) * abs(oscVal2-64) * 0.1) ; } // 29
if(oscVal1.equals( "/iblItY" )) { iblItY = ((oscVal2-64) * abs(oscVal2-64) * 0.1) ; } // 30
if(oscVal1.equals( "/iblItTexX" )) { iblItTexX = oscVal2 * 4 ; } // 31
if(oscVal1.equals( "/iblItTexY" )) { iblItTexY = oscVal2 * 4; } // 32
if(oscVal1.equals( "/iblItRot" )) { iblItRot = radians(oscVal2) ; } // 33
// playVideo
if(oscVal1.equals( "/playVideoToggle" )) { playVideoToggle = boolean(int(oscVal2)); }
if(oscVal1.equals( "/playVideoBank" )) { playVideoBank = int(oscVal2); }
if(oscVal1.equals( "/playVideoID" )) { playVideoID = int(oscVal2); }
if(oscVal1.equals( "/playVideoJump" )) { playVideoJump = int(oscVal2); }
if(oscVal1.equals( "/playVideoPausePlay" )) { playVideoPausePlay = boolean(int(oscVal2)); }
if(oscVal1.equals( "/playVideoLoop" )) { playVideoPausePlay = boolean(int(oscVal2)); }
if(oscVal1.equals( "/playVideoHue" )) { playVideoHue = int(oscVal2); }
if(oscVal1.equals( "/playVideoSaturation" )) { playVideoSaturation = int(oscVal2); }
if(oscVal1.equals( "/playVideoBrightness" )) { playVideoBrightness = int(oscVal2); }
if(oscVal1.equals( "/playVideoAlpha" )) { playVideoAlpha = int(oscVal2); } //
if(oscVal1.equals( "/playVideoSpeed" )) { playVideoSpeed = int(oscVal2); } //
// test picture
if(oscVal1.equals( "/testPictureToggle" )) { testPictureToggle = boolean(int(oscVal2)); }
}
// debug:
print("### OSC | typetag: " + theOscMessage.typetag() + " " + theOscMessage.addrPattern());
println(" " + oscVal1 + " " + oscVal2);
return;
}

View File

@ -0,0 +1,85 @@
/*
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
playVideo.pde
*/
void playVideo( boolean render, // should we render or not?
boolean pausePlay, boolean loop,
int bank, int id,
int hue, int saturation, int brightness, int alpha, int jump, int speed
)
{
if (render) {
// protect boundaries of vidPool array
bank = min(bank, vidPool.length - 1);
id = min(id, vidPool[bank].length - 1);
// play/pause/loop
if(pausePlay == true) {
vidPool[bank][id].speed(float(speed) / 100);
//println("speed: " + speed + " " + (float(speed) / 100));
if (loop == true) {
vidPool[bank][id].loop();
} else {
vidPool[bank][id].play();
}
}
if(pausePlay == false) {
vidPool[bank][id].pause();
}
if (jump != 1000) {
println("jump: " + jump);
vidPool[bank][id].jump(vidPool[bank][id].duration() * (float(jump) / 100));
//vidPool[bank][id].read();
}
if (vidPool[bank][id].available()) {
vidPool[bank][id].read();
}
// use/display/texture
textureMode(NORMAL);
colorMode(HSB, 127);
beginShape();
tint(hue, saturation, brightness, alpha);
texture(vidPool[bank][id]);
vertex(-3, -3, 1, 1);
vertex(width+3, -3, 0, 1);
vertex(width+3, height+3, 0, 0);
vertex(-3, height+3, 1, 0);
endShape();
}
}
void jumpVideo(float position, int bank, int id) {
// protect boundaries of vidPool array
bank = min(bank, vidPool.length - 1);
id = min(id, vidPool[bank].length - 1);
// jump to position in the video maped from 0-127
vidPool[bank][id].jump(map(position, 0, 127, 0, vidPool[bank][id].duration()));
//vidPool[bank][id].read();
}

View File

@ -0,0 +1,48 @@
/*
This file is part of "Interface Fractures IV - Q".
Copyright (c) 2016 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
screenClean.pde
*/
// if screenClean is supposed to "clean" the screen
// alpha should always be to the max
void screenClean( float hue,
float saturation,
float brightness,
float alpha,
float flickrAmount,
float flickrSpeed )
{
/*
hue = map(hue, 0, 127, 0, 255);
saturation = map(saturation, 0, 127, 0, 255);
brightness = map(brightness, 0, 127, 0, 255);
alpha = map(alpha, 0, 127, 0, 255);
*/
flickrAmount = map(flickrAmount, 0, 127, 0, 1);
flickrSpeed = map(flickrSpeed, 0, 127, 1, 120);
if ((frameCount % int(flickrSpeed)) == 0) {
brightness = brightness * flickrAmount;
}
//println(frameCount + " " + flickrSpeed + " " + (frameCount % flickrSpeed));
colorMode(HSB, 127);
color c = color(hue, saturation, brightness, alpha);
fill(c);
noStroke();
rectMode(CORNER);
// rect(0, 0, width * 2, height);
rect(0, 0, width, height);
}

13
pde/jitakami/shuffle.pde Normal file
View File

@ -0,0 +1,13 @@
// function to shuffle an array of integers
void shuffle(int[] a)
{
int temp, pick;
for(int i=0; i<a.length; i++)
{
temp = a[i];
pick = (int)random(a.length);
a[i] = a[pick];
a[pick] = temp;
}
}

View File

@ -0,0 +1,47 @@
/*
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
switchBlendMode.pde
*/
void switchBlendMode(int blendMode)
{
switch(blendMode) {
case 0:
blendMode(ADD); // additive blending with white clip: C = min(A*factor + B, 255)
break;
case 1:
blendMode(SUBTRACT); // subtractive blend w/ black clip: C = max(B - A*factor, 0)
break;
case 2:
blendMode(LIGHTEST); // only the lightest colour succeeds: C = max(A*factor, B)
break;
case 3:
blendMode(DARKEST); // only the darkest colour succeeds: C = min(A*factor, B)
break;
case 4:
blendMode(SCREEN); // opposite multiply, uses inverse values of the colors.
break;
case 5:
blendMode(MULTIPLY); // multiply the colors, result will always be darker.
break;
case 6:
blendMode(EXCLUSION); // similar to DIFFERENCE, but less extreme.
break;
case 7:
blendMode(REPLACE); // pixels entirely replace others + don't utilize alpha values
break;
case 8:
blendMode(BLEND); // pixels entirely replace others + don't utilize alpha values
break;
default:
blendMode(BLEND); // linear interp. of colours: C = A*factor + B. Default.
break;
} // DIFFERENCE: subtract colors from underlying image. NOT SUPPORTED BY P3D!! */
}

View File

@ -0,0 +1,57 @@
/*
This file is part of "Interface Fractures III - Silicon".
Copyright (c) 2015 Luka Prinčič, All rights reserved.
This program is free software distributed under
GNU General Public Licence. See COPYING for more info.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
testPicture.pde
*/
void testPicture(boolean render) {
if (render) {
blendMode(BLEND);
colorMode(RGB, 255);
fill(127);
stroke(255);
strokeWeight(4);
rectMode(CORNER);
rect(1, 1, width-2, height-2);
ellipse(width/2, height/2, height-4, height-4);
ellipse(height/4, height/4, height/2-4, height/2-4);
ellipse(height/4, 3*height/4, height/2-4, height/2-4);
ellipse(width-height/4, height/4, height/2-4, height/2-4);
ellipse(width-height/4, 3*height/4, height/2-4, height/2-4);
line(width/2, 0, width/2, height);
line(0, height/2, width, height/2);
fill(255);
rectMode(CENTER);
rect(width/2, height/2, width/2, height/6);
fill(0);
textFont(testFont);
textSize(50);
textAlign(CENTER,CENTER);
text("trans.fail/jitakami", width/2, height/2,4);
/* more tests:
- horizontal and vertical block, moving fast!
- flicker test, black&white, 60Hz
- color and gray stripes of interpolation
*/
}
}