Make yMin correct with unlit bassBox on model
[SugarCubes.git] / _Internals.pde
index 60a5f3296e11abc121aec4607abd44edb95832a8..c86ff963f2bb1cabb94810a89ab19e9ec49a504e 100644 (file)
@@ -102,6 +102,10 @@ void setup() {
   lx.enableKeyboardTempo();
   logTime("Built GLucose engine");
   
+  // MIDI devices
+  midiEngine = new MidiEngine();
+  logTime("Setup MIDI devices");
+
   // Set the patterns
   Engine engine = lx.engine;
   engine.setPatterns(patterns = _patterns(glucose));
@@ -122,10 +126,6 @@ void setup() {
   mappingTool = new MappingTool(glucose, pandaMappings);
   logTime("Built PandaDriver");
 
-  // MIDI devices
-  midiEngine = new MidiEngine();
-  logTime("Setup MIDI devices");
-
   // Build overlay UI
   debugUI = new DebugUI(pandaMappings);
   overlays = new UIContext[] {
@@ -217,10 +217,12 @@ void draw() {
   popMatrix();
   
   noStroke();
-//  drawBassBox(glucose.model.bassBox);
-//  for (Speaker s : glucose.model.speakers) {
-//    drawSpeaker(s);
-//  }
+  if (glucose.model.bassBox.exists) {
+    drawBassBox(glucose.model.bassBox, false);
+  }
+  for (Speaker speaker : glucose.model.speakers) {
+    drawSpeaker(speaker);
+  }
   for (Cube c : glucose.model.cubes) {
     drawCube(c);
   }
@@ -228,13 +230,9 @@ void draw() {
   noFill();
   strokeWeight(2);
   beginShape(POINTS);
-  // TODO(mcslee): restore when bassBox/speakers are right again
-  // for (Point p : glucose.model.points) {
-  for (Cube cube : glucose.model.cubes) {
-    for (Point p : cube.points) {
-      stroke(colors[p.index]);
-      vertex(p.fx, p.fy, p.fz);
-    }
+  for (Point p : glucose.model.points) {
+    stroke(colors[p.index]);
+    vertex(p.fx, p.fy, p.fz);
   }
   endShape();
   
@@ -264,15 +262,18 @@ void draw() {
   }
 }
 
-void drawBassBox(BassBox b) {
+void drawBassBox(BassBox b, boolean hasSub) {
+  
   float in = .15;
-
-  noStroke();
-  fill(#191919);
-  pushMatrix();
-  translate(b.x + BassBox.EDGE_WIDTH/2., b.y + BassBox.EDGE_HEIGHT/2, b.z + BassBox.EDGE_DEPTH/2.);
-  box(BassBox.EDGE_WIDTH-20*in, BassBox.EDGE_HEIGHT-20*in, BassBox.EDGE_DEPTH-20*in);
-  popMatrix();
+  
+  if (hasSub) {
+    noStroke();
+    fill(#191919);
+    pushMatrix();
+    translate(b.x + BassBox.EDGE_WIDTH/2., b.y + BassBox.EDGE_HEIGHT/2, b.z + BassBox.EDGE_DEPTH/2.);
+    box(BassBox.EDGE_WIDTH-20*in, BassBox.EDGE_HEIGHT-20*in, BassBox.EDGE_DEPTH-20*in);
+    popMatrix();
+  }
 
   noStroke();
   fill(#393939);
@@ -410,7 +411,10 @@ void keyPressed() {
     case '=':
     case '+':
       frameRate(++targetFramerate);
-      break;      
+      break; 
+    case 'b':
+      EFF_boom.trigger();
+      break;    
     case 'd':
       if (!midiEngine.isQwertyEnabled()) {
         debugMode = !debugMode;