-
Notifications
You must be signed in to change notification settings - Fork 0
/
scatteredMemories.pde
71 lines (58 loc) · 1.57 KB
/
scatteredMemories.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import processing.video.*;
import peasy.*;
PeasyCam cam;
Capture video;
PImage maskImage;
int totalMirror = 400;
float[] xs = new float[totalMirror];
float[] ys = new float[totalMirror];
float[] zs = new float[totalMirror];
float[] angleXs = new float[totalMirror];
float[] angleYs = new float[totalMirror];
float[] angleZs = new float[totalMirror];
PVector rotateAngles = new PVector(0, 0, 0);
void setup() {
//size(800, 600, P3D);
fullScreen(P3D);
cam = new PeasyCam(this, 100);
cam.setMinimumDistance(0);
cam.setMaximumDistance(2000);
smooth();
rectMode(CENTER);
hint( ENABLE_DEPTH_TEST);
//println(Capture.list());
video = new Capture(this, 320, 240);
video.start();
maskImage = loadImage("mask.png");
for (int i=0; i<totalMirror; i++) {
xs[i] = random(-width/2, width/2);
ys[i] = random(-height/2, height/2);
zs[i] = random(-300, 300);
angleXs[i] = random(-PI, PI);
angleYs[i] = random(-PI, PI);
angleZs[i] = random(-PI, PI);
}
}
// An event for when a new frame is available
void captureEvent(Capture video) {
// Step 4. Read the image from the camera.
video.read();
}
void draw() {
//blendMode(MULTIPLY);
background(200);
rotateX(rotateAngles.x);
rotateY(rotateAngles.y);
rotateAngles = PVector.add(rotateAngles, new PVector(0.001, 0.001, 0.001));
for (int i=0; i<totalMirror; i++) {
pushMatrix();
translate(xs[i], ys[i], zs[i]);
rotateX(angleXs[i]);
rotateY(angleYs[i]);
rotateZ(angleZs[i]);
//video.mask(maskImage);
tint(50, 153, 204, 150);
image(video, 0, 0);
popMatrix();
}
}