From: Mark Slee Date: Fri, 8 Nov 2013 20:01:06 +0000 (-0800) Subject: Performance improvements to SineSpheres and 's' to toggle simulation X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=commitdiff_plain;h=f82959711a831753a6c42137de4e71fc5d4af5fb Performance improvements to SineSpheres and 's' to toggle simulation Conflicts: AlexGreen.pde --- diff --git a/AlexGreen.pde b/AlexGreen.pde index 23c4263..91677db 100644 --- a/AlexGreen.pde +++ b/AlexGreen.pde @@ -3,6 +3,7 @@ class SineSphere extends SCPattern { public final Projection sinespin; float modelrad = sqrt((model.xMax)*(model.xMax) + (model.yMax)*(model.yMax) + (model.zMax)*(model.zMax)); Pick Sshape; + public final PVector P = new PVector(); class Sphery { float f1xcenter, f1ycenter, f1zcenter, f2xcenter , f2ycenter, f2zcenter; //second three are for an ellipse with two foci @@ -17,8 +18,6 @@ class SineSphere extends SCPattern { public BasicParameter huespread; public BasicParameter bouncerate; public BasicParameter bounceamp; - - public Sphery(float f1xcenter, float f1ycenter, float f1zcenter, float vibration_min, float vibration_max, float vperiod) { @@ -39,7 +38,7 @@ class SineSphere extends SCPattern { //addModulator(bounceamp); //ybounce.setMagnitude(bouncerate); addModulator( vibration = new SinLFO(vibration_min , vibration_max, 240000./lx.tempo.bpm())).trigger(); //vibration.modulateDurationBy(vx); - + } public Sphery(float f1xcenter, float f1ycenter, float f1zcenter, float f2xcenter, float f2ycenter, float f2zcenter, float vibration_min, float vibration_max, float vperiod) diff --git a/_Internals.pde b/_Internals.pde index 58187f1..da9a7c5 100644 --- a/_Internals.pde +++ b/_Internals.pde @@ -61,6 +61,7 @@ boolean mappingMode = false; boolean debugMode = false; DebugUI debugUI; boolean uiOn = true; +boolean simulationOn = true; LXPattern restoreToPattern = null; PImage logo; float[] hsb = new float[3]; @@ -232,7 +233,29 @@ void draw() { debugUI.maskColors(sendColors); } - camera( + if (simulationOn) { + drawSimulation(simulationColors); + } + + // 2D Overlay UI + drawUI(); + + // Gamma correction here. Apply a cubic to the brightness + // for better representation of dynamic range + for (int i = 0; i < sendColors.length; ++i) { + lx.RGBtoHSB(sendColors[i], hsb); + float b = hsb[2]; + sendColors[i] = lx.hsb(360.*hsb[0], 100.*hsb[1], 100.*(b*b*b)); + } + + // TODO(mcslee): move into GLucose engine + for (PandaDriver p : pandaBoards) { + p.send(sendColors); + } +} + +void drawSimulation(color[] simulationColors) { + camera( eyeX, eyeY, eyeZ, midX, midY, midZ, 0, -1, 0 @@ -279,22 +302,6 @@ void draw() { vertex(p.x, p.y, p.z); } endShape(); - - // 2D Overlay UI - drawUI(); - - // Gamma correction here. Apply a cubic to the brightness - // for better representation of dynamic range - for (int i = 0; i < sendColors.length; ++i) { - lx.RGBtoHSB(sendColors[i], hsb); - float b = hsb[2]; - sendColors[i] = lx.hsb(360.*hsb[0], 100.*hsb[1], 100.*(b*b*b)); - } - - // TODO(mcslee): move into GLucose engine - for (PandaDriver p : pandaBoards) { - p.send(sendColors); - } } void drawBassBox(BassBox b, boolean hasSub) { @@ -521,6 +528,11 @@ void keyPressed() { p.toggle(); } break; + case 's': + if (!midiEngine.isQwertyEnabled()) { + simulationOn = !simulationOn; + } + break; case 'u': if (!midiEngine.isQwertyEnabled()) { uiOn = !uiOn;