Final Processing.org code
import com.cycling74.io.*;
import com.cycling74.net.*;
import com.cycling74.util.*;
import maxlink.*;
import com.cycling74.msp.*;
import com.cycling74.max.*;
import com.cycling74.mxjedit.*;
MaxLink link = new MaxLink(this,"maxlink");
public float a0_0, a1_0, a1_5, a2_0, a2_5, camx1, camy1, camx2, camy2;
float box1 = 0.0;
float box2 = 0.0;
float box3 = 0.0;
void setup() {
link.declareInlet("a0_0");
link.declareInlet("a1_0");
link.declareInlet("a1_5");
link.declareInlet("a2_0");
link.declareInlet("a2_5");
link.declareInlet("camx1");
link.declareInlet("camy1");
link.declareInlet("camx2");
link.declareInlet("camy2");
size(1030, 2550, P3D);
noStroke();
}
void draw()
{
//lights();
background(a2_5);//photoresistor from usb#1
if (a2_0 < 50) {
background(232,0,0);
}
float cameraY = height/2.0;
float fov = camy1/float(width) * PI/2; //float fov = camy/float(width) * PI/2
float cameraZ = cameraY / tan(fov / 1.0);
float aspect = float(width)/float(height);
perspective(fov, aspect, cameraZ/5.0, cameraZ*5.0);
//BACK BOX
box1 = 5;
box2 = 50;
box3 = 1000;
translate(width/2, 1400, 0);
rotateX(-camy1/3000);// rotateX(-PI/3 + camx/float(height) * PI);
rotateY(camx1/float(height)+45);//(PI/1 + camy/float(height) * PI/2);
fill(255);
if (a2_0 < 50) {
fill(232,0,0);
}
box(box1,box2,box3);
//TOP BOX
///SIDE BOXES
translate(-box3/2, 0, box3*.5);
fill(255);
if (a2_0 < 50) {
fill(232,0,0);}
box(box3,box2, 5);
translate(0, 0, -box3);
box(box3,box2,5);
}
import com.cycling74.net.*;
import com.cycling74.util.*;
import maxlink.*;
import com.cycling74.msp.*;
import com.cycling74.max.*;
import com.cycling74.mxjedit.*;
MaxLink link = new MaxLink(this,"maxlink");
public float a0_0, a1_0, a1_5, a2_0, a2_5, camx1, camy1, camx2, camy2;
float box1 = 0.0;
float box2 = 0.0;
float box3 = 0.0;
void setup() {
link.declareInlet("a0_0");
link.declareInlet("a1_0");
link.declareInlet("a1_5");
link.declareInlet("a2_0");
link.declareInlet("a2_5");
link.declareInlet("camx1");
link.declareInlet("camy1");
link.declareInlet("camx2");
link.declareInlet("camy2");
size(1030, 2550, P3D);
noStroke();
}
void draw()
{
//lights();
background(a2_5);//photoresistor from usb#1
if (a2_0 < 50) {
background(232,0,0);
}
float cameraY = height/2.0;
float fov = camy1/float(width) * PI/2; //float fov = camy/float(width) * PI/2
float cameraZ = cameraY / tan(fov / 1.0);
float aspect = float(width)/float(height);
perspective(fov, aspect, cameraZ/5.0, cameraZ*5.0);
//BACK BOX
box1 = 5;
box2 = 50;
box3 = 1000;
translate(width/2, 1400, 0);
rotateX(-camy1/3000);// rotateX(-PI/3 + camx/float(height) * PI);
rotateY(camx1/float(height)+45);//(PI/1 + camy/float(height) * PI/2);
fill(255);
if (a2_0 < 50) {
fill(232,0,0);
}
box(box1,box2,box3);
//TOP BOX
///SIDE BOXES
translate(-box3/2, 0, box3*.5);
fill(255);
if (a2_0 < 50) {
fill(232,0,0);}
box(box3,box2, 5);
translate(0, 0, -box3);
box(box3,box2,5);
}
0 Comments:
Post a Comment
<< Home