1+ import processing.cardboard.* ;
2+
3+ PShape grid;
4+ PShape cubes;
5+
6+ void setup () {
7+ fullScreen(PCardboard . STEREO );
8+
9+ grid = createShape();
10+ grid. beginShape(LINES );
11+ grid. stroke(255 );
12+ for (int x = - 10000 ; x < + 10000 ; x += 250 ) {
13+ grid. vertex(x, - 1000 , + 10000 );
14+ grid. vertex(x, - 1000 , - 10000 );
15+ }
16+ for (int z = - 10000 ; z < + 10000 ; z += 250 ) {
17+ grid. vertex(+ 10000 , - 1000 , z);
18+ grid. vertex(- 10000 , - 1000 , z);
19+ }
20+ grid. endShape();
21+
22+ cubes = createShape(GROUP );
23+ for (int i = 0 ; i < 100 ; i++ ) {
24+ float x = random (- 1000 , + 1000 );
25+ float y = random (- 1000 , + 1000 );
26+ float z = random (- 1000 , + 1000 );
27+
28+ float r = random (50 , 150 );
29+ PShape cube = createShape(BOX , r, r, r);
30+ cube. setStroke(false );
31+ cube. setFill(color (180 ));
32+ cube. translate(x, y, z);
33+ cubes. addChild(cube);
34+ }
35+ }
36+
37+ void draw () {
38+ background (0 );
39+ ambientLight (150 , 150 , 150 );
40+ pointLight (255 , 255 , 255 , 0 , 0 , 0 );
41+ translate (width / 2 - 1000 , height / 2 , 500 );
42+ shape (cubes);
43+ shape (grid);
44+ }
0 commit comments