New Heron and GLucose jars, bring bass box back
[SugarCubes.git] / _Internals.pde
index fc06832ba72a9692447bc3111d4ad272419dde8f..5035ed59b6f8aeef7f4c7f232466929222924211 100644 (file)
@@ -122,10 +122,9 @@ void setup() {
   
   println("Total setup: " + (millis() - startMillis) + "ms");
   println("Hit the 'p' key to toggle Panda Board output");
-  
-  println(glucose.model.bassBox.points.size());
 }
 
+
 void controllerChangeReceived(rwmidi.Controller cc) {
   if (debugMode) {
     println("CC: " + cc.toString());
@@ -177,10 +176,10 @@ void draw() {
   endShape();
   
   noStroke();
-  drawBassBox(glucose.model.bassBox);
-  for (Speaker s : glucose.model.speakers) {
-    drawSpeaker(s);
-  }
+//  drawBassBox(glucose.model.bassBox);
+//  for (Speaker s : glucose.model.speakers) {
+//    drawSpeaker(s);
+//  }
   for (Cube c : glucose.model.cubes) {
     drawCube(c);
   }
@@ -188,9 +187,13 @@ void draw() {
   noFill();
   strokeWeight(2);
   beginShape(POINTS);
-  for (Point p : glucose.model.points) {
-    stroke(colors[p.index]);
-    vertex(p.fx, p.fy, p.fz);
+  // 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);
+    }
   }
   endShape();
   
@@ -206,6 +209,17 @@ void draw() {
     debugUI.draw();
   }
   
+  // Gamma correction here. Apply a cubic to the brightness
+  // for better representation of dynamic range
+  for (int i = 0; i < colors.length; ++i) {
+    float b = brightness(colors[i]) / 100.f;
+    colors[i] = color(
+      hue(colors[i]),
+      saturation(colors[i]),
+      (b*b*b) * 100.
+    );
+  }
+  
   // TODO(mcslee): move into GLucose engine
   for (PandaDriver p : pandaBoards) {
     p.send(colors);
@@ -284,8 +298,7 @@ void drawSpeaker(Speaker s) {
   noStroke();
   fill(#393939);  
   drawBox(s.x+in, s.y+in, s.z+in, 0, s.ry, 0, Speaker.EDGE_WIDTH-in*2, Speaker.EDGE_HEIGHT-in*2, Speaker.EDGE_DEPTH-in*2, Cube.CHANNEL_WIDTH-in);
-}  
-
+}
 
 void drawBox(float x, float y, float z, float rx, float ry, float rz, float xd, float yd, float zd, float sw) {
   pushMatrix();
@@ -326,16 +339,22 @@ void drawUI() {
     ui.drawHelpTip();
   }
   ui.drawFPS();
+  ui.drawDanText();
 }
 
 boolean uiOn = true;
 int restoreToIndex = -1;
 
+boolean doDual = false;
+
 void keyPressed() {
   if (mappingMode) {
     mappingTool.keyPressed();
   }
   switch (key) {
+    case 'w':
+       doDual = !doDual;
+       break;
     case '-':
     case '_':
       frameRate(--targetFramerate);
@@ -417,4 +436,3 @@ void mouseWheel(int delta) {
     eyeZ = midZ + eyeR*cos(eyeA);
   }
 }
-