From 775d3394a0627c94af6ac5fa190b2294f6034c78 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Sat, 17 Aug 2013 15:12:07 -0700 Subject: [PATCH] Fix super bizarro bug with framerate on askew planes pattern --- MarkSlee.pde | 50 +++++++++++++++++++++++++++-------------------- _Overlay.pde | 2 +- code/GLucose.jar | Bin 18758 -> 18817 bytes 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/MarkSlee.pde b/MarkSlee.pde index 1ecb640..7b1b86b 100644 --- a/MarkSlee.pde +++ b/MarkSlee.pde @@ -499,10 +499,10 @@ class AskewPlanes extends SCPattern { private final SinLFO a; private final SinLFO b; private final SinLFO c; - float av; - float bv; - float cv; - float denom; + float av = 1; + float bv = 1; + float cv = 1; + float denom = 0.1; Plane(int i) { addModulator(a = new SinLFO(-1, 1, 4000 + 1029*i)).trigger(); @@ -528,25 +528,33 @@ class AskewPlanes extends SCPattern { planes[i] = new Plane(i); } } - - private final float denoms[] = new float[NUM_PLANES]; public void run(int deltaMs) { float huev = lx.getBaseHuef(); - int i = 0; - for (Plane p : planes) { - p.run(deltaMs); - } + + // This is super fucking bizarre. But if this is a for loop, the framerate + // tanks to like 30FPS, instead of 60. Call them manually and it works fine. + // Doesn't make ANY sense... there must be some weird side effect going on + // with the Processing internals perhaps? +// for (Plane plane : planes) { +// plane.run(deltaMs); +// } + planes[0].run(deltaMs); + planes[1].run(deltaMs); + planes[2].run(deltaMs); + for (Point p : model.points) { - float d = MAX_FLOAT; - for (Plane plane : planes) { - d = min(d, abs(plane.av*(p.fx-model.xMax/2.) + plane.bv*(p.fy-model.yMax/2.) + plane.cv) / plane.denom); - } - colors[p.index] = color( - (lx.getBaseHuef() + abs(p.fx-model.xMax/2.)*.3 + p.fy*.8) % 360, - max(0, 100 - .8*abs(p.fx - model.xMax/2.)), - constrain(140 - 10.*d, 0, 100) - ); + float d = MAX_FLOAT; + for (Plane plane : planes) { + if (plane.denom != 0) { + d = min(d, abs(plane.av*(p.fx-model.cx) + plane.bv*(p.fy-model.cy) + plane.cv) / plane.denom); + } + } + colors[p.index] = color( + (huev + abs(p.fx-model.cx)*.3 + p.fy*.8) % 360, + max(0, 100 - .8*abs(p.fx - model.cx)), + constrain(140 - 10.*d, 0, 100) + ); } } } @@ -574,9 +582,9 @@ class ShiftingPlane extends SCPattern { float dv = d.getValuef(); float denom = sqrt(av*av + bv*bv + cv*cv); for (Point p : model.points) { - float d = abs(av*(p.fx-model.xMax/2.) + bv*(p.fy-model.yMax/2.) + cv*(p.fz-model.zMax/2.) + dv) / denom; + float d = abs(av*(p.fx-model.cx) + bv*(p.fy-model.cy) + cv*(p.fz-model.cz) + dv) / denom; colors[p.index] = color( - (hv + abs(p.fx-model.xMax/2.)*.6 + abs(p.fy-model.yMax/2)*.9 + abs(p.fz - model.zMax/2.)) % 360, + (hv + abs(p.fx-model.cx)*.6 + abs(p.fy-model.cy)*.9 + abs(p.fz - model.cz)) % 360, constrain(110 - d*6, 0, 100), constrain(130 - 7*d, 0, 100) ); diff --git a/_Overlay.pde b/_Overlay.pde index 3b01715..a02aa12 100644 --- a/_Overlay.pde +++ b/_Overlay.pde @@ -473,7 +473,7 @@ class ControlUI extends OverlayUI { } else { int patternIndex = objectClickIndex(firstPatternY); if (patternIndex < patterns.length) { - if (mouseX > eligibleLeft) { + if (lx.isAutoTransitionEnabled() && (mouseX > eligibleLeft)) { patterns[patternIndex + patternScrollPos].toggleEligible(); } else { lx.goIndex(patternIndex + patternScrollPos); diff --git a/code/GLucose.jar b/code/GLucose.jar index 3525e185d14bb71910f52411c518c4ef2917e3a9..04bf1fafee00298f26817c0de7878434523e6d14 100644 GIT binary patch delta 2012 zcmZ9NdpMMN8^`CFgV4xe$Qa{L%wTfJSPjT z%dAtwYjR9lVlK5CwP7tqOEIrQ2g=4fp4s=h+I{}`eeU1yzQ6bHxt`~`zIX3MAO`|e z0(?+tWduSIfk3j=id0NcfDCjVjD7=@Wx86?{7y9)K*VPc4qC!#e5RGh@ym$)a=+BvrnD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