-
Notifications
You must be signed in to change notification settings - Fork 0
/
sbstest.pde
109 lines (97 loc) · 2.48 KB
/
sbstest.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
PGraphics left, right;
int eyeDistance = 50;
int w = 1920;
int h = 1080;
float aspectRatio = float(w)/h;
float fovy = 2*atan(tan(radians(46)/2)/aspectRatio);
void setup() {
fullScreen(P2D);
left = createGraphics(1920, 1080, P3D);
right = createGraphics(1920, 1080, P3D);
background(0);
}
void draw() {
left.beginDraw();
left.camera(
- eyeDistance, 0, 1000,
0, 0, 0,
0, 1, 0);
drawScene(left);
left.endDraw();
right.beginDraw();
right.camera(
eyeDistance, 0, 1000,
0, 0, 0,
0, 1, 0);
drawScene(right);
right.endDraw();
image(left, 0, 0);
image(right, w, 0);
}
void drawScene(PGraphics pg) {
pg.background(0);
pg.strokeWeight(8);
pg.perspective(fovy, aspectRatio, 400, 1600);
//Central Emerald
pg.stroke(63, 255, 127);
pg.fill(63, 255, 127, 32);
pg.pushMatrix();
pg.rotateY(radians(frameCount));
pg.rotateZ(radians(frameCount));
pg.box(100);
pg.popMatrix();
//Central Orange
pg.stroke(255, 127, 63);
pg.fill(255, 127, 63, 32);
pg.pushMatrix();
pg.rotateX(radians(45));
pg.rotateY(radians(45));
pg.rotateY( -radians(frameCount));
pg.box(120);
pg.popMatrix();
//Satelite Violet
pg.stroke(127, 63, 255);
pg.fill(127, 63, 255, 32);
pg.pushMatrix();
pg.rotateY(radians(frameCount / 2.0));
pg.translate(200, 0, 0);
pg.rotateX(radians(frameCount / 2.0));
pg.rotateZ(radians(45));
pg.box(45);
pg.popMatrix();
//Satelite Azure
pg.stroke(63, 127, 255);
pg.fill(63, 127, 255, 32);
pg.pushMatrix();
pg.rotateY(radians(180));
pg.rotateY(radians(frameCount / 3.0));
pg.translate(320, 0, 0);
pg.rotateX(radians(45));
pg.rotateZ(radians(45));
pg.box(80);
pg.popMatrix();
//Satelite Pink
pg.stroke(255, 63, 127);
pg.fill(255, 63, 127, 32);
pg.pushMatrix();
pg.rotateY(radians(90));
pg.rotateX(radians( -12.5));
pg.rotateY(radians(frameCount * 1.5));
pg.translate(120, 0, 0);
pg.rotateZ(radians(45));
pg.rotateY(radians(frameCount * 2));
pg.box(30);
pg.popMatrix();
//Satelite Lime
pg.stroke(127, 255, 63);
pg.fill(127, 255, 63, 32);
pg.pushMatrix();
pg.rotateY(radians(45));
pg.rotateX(radians(28));
pg.rotateY(radians(frameCount * 1.8));
pg.translate(110, 0, 0);
pg.rotateZ(radians(45));
pg.rotateY(radians(frameCount * 2));
pg.box(25);
pg.popMatrix();
}