+ // Draws the simulation and the 2D UI overlay
+ background(40);
+ color[] colors = glucose.getColors();
+ if (debugMode) {
+ debugUI.maskColors(colors);
+ }
+
+ camera(
+ eyeX, eyeY, eyeZ,
+ midX, midY, midZ,
+ 0, -1, 0
+ );
+
+ noStroke();
+ fill(#141414);
+ drawBox(0, -TRAILER_HEIGHT, 0, 0, 0, 0, TRAILER_WIDTH, TRAILER_HEIGHT, TRAILER_DEPTH, TRAILER_HEIGHT/2.);
+ fill(#070707);
+ stroke(#222222);
+ beginShape();
+ vertex(0, 0, 0);
+ vertex(TRAILER_WIDTH, 0, 0);
+ vertex(TRAILER_WIDTH, 0, TRAILER_DEPTH);
+ vertex(0, 0, TRAILER_DEPTH);
+ endShape();
+
+ noStroke();
+ fill(#292929);
+ drawBox(BASS_X, 0, BASS_Z, 0, 0, 0, BASS_WIDTH, BASS_HEIGHT, BASS_DEPTH, Cube.CHANNEL_WIDTH);
+ for (Cube c : glucose.model.cubes) {
+ drawCube(c);
+ }
+
+ noFill();
+ strokeWeight(2);
+ beginShape(POINTS);
+ for (Point p : glucose.model.points) {
+ stroke(colors[p.index]);
+ vertex(p.fx, p.fy, p.fz);
+ // println(p.fx + ":" + p.fy + ":" + p.fz);
+ }
+ endShape();
+
+ // 2D Overlay
+ camera();
+ javax.media.opengl.GL gl = ((PGraphicsOpenGL)g).beginGL();
+ gl.glClear(javax.media.opengl.GL.GL_DEPTH_BUFFER_BIT);
+ ((PGraphicsOpenGL)g).endGL();
+ strokeWeight(1);
+ drawUI();
+
+ if (debugMode) {
+ debugUI.draw();
+ }