From: Mark Slee Date: Wed, 29 May 2013 04:55:59 +0000 (-0500) Subject: Update to use new form of referencing immutable model object lists X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=commitdiff_plain;h=87f6fa397be5aa98d1331b34f9819b997953536d Update to use new form of referencing immutable model object lists --- diff --git a/MarkSlee.pde b/MarkSlee.pde index 76d2aef..ef65b3f 100644 --- a/MarkSlee.pde +++ b/MarkSlee.pde @@ -28,14 +28,14 @@ class SpaceTime extends SCPattern { void run(int deltaMs) { angle += deltaMs * 0.0007; - float sVal1 = Strip.list.size() * (0.5 + 0.5*sin(angle)); - float sVal2 = Strip.list.size() * (0.5 + 0.5*cos(angle)); + float sVal1 = model.strips.size() * (0.5 + 0.5*sin(angle)); + float sVal2 = model.strips.size() * (0.5 + 0.5*cos(angle)); float pVal = pos.getValuef(); float fVal = falloff.getValuef(); int s = 0; - for (Strip strip : Strip.list) { + for (Strip strip : model.strips) { int i = 0; for (Point p : strip.points) { colors[p.index] = color( @@ -83,7 +83,7 @@ class Swarm extends SCPattern { void run(int deltaMs) { float s = 0; - for (Strip strip : Strip.list) { + for (Strip strip : model.strips) { int i = 0; for (Point p : strip.points) { float fV = max(-1, 1 - dist(p.fx/2., p.fy, fX.getValuef()/2., fY.getValuef()) / 64.); @@ -112,7 +112,7 @@ class SwipeTransition extends SCTransition { void computeBlend(int[] c1, int[] c2, double progress) { float bleedf = 10 + bleed.getValuef() * 200.; float xPos = (float) (-bleedf + progress * (255. + bleedf)); - for (Point p : Point.list) { + for (Point p : model.points) { float d = (p.fx - xPos) / bleedf; if (d < 0) { colors[p.index] = c2[p.index]; @@ -184,7 +184,7 @@ class CubeEQ extends SCPattern { float jConst = 300.*(1-range.getValuef()); float clrConst = 1.1 + clr.getValuef(); - for (Point p : Point.list) { + for (Point p : model.points) { float avgIndex = constrain((p.fx / 256. * avgSize), 0, avgSize-2); int avgFloor = (int) avgIndex; float j = jBase + jConst * (p.fy / 128.); @@ -231,7 +231,7 @@ class BoomEffect extends SCEffect { float falloffv = falloffv(); float satv = sat.getValuef() * 100; float huev = lx.getBaseHuef(); - for (Point p : Point.list) { + for (Point p : model.points) { colors[p.index] = blendColor( colors[p.index], color(huev, satv, constrain(brightv - falloffv*abs(boom.getValuef() - dist(p.fx, 2*p.fy, 2*p.fz, 128, 128, 128)), 0, 100)), @@ -293,11 +293,11 @@ public class PianoKeyPattern extends SCPattern { addParameter(attack); addParameter(release); addParameter(level); - cubeBrt = new LinearEnvelope[Cube.list.size() / 4]; + cubeBrt = new LinearEnvelope[model.cubes.size() / 4]; for (int i = 0; i < cubeBrt.length; ++i) { addModulator(cubeBrt[i] = new LinearEnvelope(0, 0, 100)); } - base = new SinLFO[Cube.list.size() / 12]; + base = new SinLFO[model.cubes.size() / 12]; for (int i = 0; i < base.length; ++i) { addModulator(base[i] = new SinLFO(0, 1, 7000 + 1000*i)).trigger(); } @@ -332,7 +332,7 @@ public class PianoKeyPattern extends SCPattern { int i = 0; float huef = lx.getBaseHuef(); float levelf = level.getValuef(); - for (Cube c : Cube.list) { + for (Cube c : model.cubes) { float v = max(getBase(i).getValuef() * levelf/4., getEnvelope(i++).getValuef()); setColor(c, color( (huef + 20*v + abs(c.fx-128.)*.3 + c.fy) % 360, @@ -398,7 +398,7 @@ class CrossSections extends SCPattern { float ywv = 100. / (10 + 40*yw.getValuef()); float zwv = 100. / (10 + 40*zw.getValuef()); - for (Point p : Point.list) { + for (Point p : model.points) { color c = 0; c = blendColor(c, color( (lx.getBaseHuef() + p.fx/10 + p.fy/3) % 360, @@ -442,7 +442,7 @@ class Blinders extends SCPattern { public void run(int deltaMs) { float hv = lx.getBaseHuef(); int si = 0; - for (Strip strip : Strip.list) { + for (Strip strip : model.strips) { int i = 0; float mv = m[si % m.length].getValuef(); for (Point p : strip.points) { @@ -458,4 +458,37 @@ class Blinders extends SCPattern { } } +class Psychedelia extends SCPattern { + + final int NUM = 3; + SinLFO m = new SinLFO(-0.5, NUM-0.5, 9000); + SinLFO s = new SinLFO(-20, 147, 11000); + TriangleLFO h = new TriangleLFO(0, 240, 19000); + SinLFO c = new SinLFO(-.2, .8, 31000); + + Psychedelia(GLucose glucose) { + super(glucose); + addModulator(m).trigger(); + addModulator(s).trigger(); + addModulator(h).trigger(); + addModulator(c).trigger(); + } + void run(int deltaMs) { + float huev = h.getValuef(); + float cv = c.getValuef(); + float sv = s.getValuef(); + float mv = m.getValuef(); + int i = 0; + for (Strip strip : model.strips) { + for (Point p : strip.points) { + colors[p.index] = color( + (huev + i*constrain(cv, 0, 2) + p.fz/2. + p.fx/4.) % 360, + min(100, abs(p.fy-sv)), + max(0, 100 - 50*abs((i%NUM) - mv)) + ); + } + ++i; + } + } +} diff --git a/SugarCubes.pde b/SugarCubes.pde index ed2cf6d..67b1538 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -25,18 +25,19 @@ LXPattern[] patterns(GLucose glucose) { return new LXPattern[] { -// new Swarm(glucose), -// new SpaceTime(glucose), -// new Blinders(glucose), -// new CrossSections(glucose), -// new CubeEQ(glucose), -// new PianoKeyPattern(glucose), + new Swarm(glucose), + new SpaceTime(glucose), + new Blinders(glucose), + new CrossSections(glucose), + new Psychedelia(glucose), + new CubeEQ(glucose), + new PianoKeyPattern(glucose), // Basic test patterns for reference, not art // new TestHuePattern(glucose), // new TestXPattern(glucose), // new TestYPattern(glucose), - new TestZPattern(glucose), +// new TestZPattern(glucose), }; } diff --git a/TestPatterns.pde b/TestPatterns.pde index 04c2c73..e7b30f9 100644 --- a/TestPatterns.pde +++ b/TestPatterns.pde @@ -16,7 +16,7 @@ class TestXPattern extends SCPattern { addModulator(xPos).trigger(); } public void run(int deltaMs) { - for (Point p : Point.list) { + for (Point p : model.points) { colors[p.index] = color( lx.getBaseHuef(), 100, @@ -33,7 +33,7 @@ class TestYPattern extends SCPattern { addModulator(yPos).trigger(); } public void run(int deltaMs) { - for (Point p : Point.list) { + for (Point p : model.points) { colors[p.index] = color( lx.getBaseHuef(), 100, @@ -50,7 +50,7 @@ class TestZPattern extends SCPattern { addModulator(zPos).trigger(); } public void run(int deltaMs) { - for (Point p : Point.list) { + for (Point p : model.points) { colors[p.index] = color( lx.getBaseHuef(), 100, diff --git a/_Overlay.pde b/_Overlay.pde index 6d3266a..5bd90d3 100644 --- a/_Overlay.pde +++ b/_Overlay.pde @@ -257,6 +257,7 @@ class OverlayUI { } ellipseMode(CENTER); + noStroke(); fill(#222222); // For some reason this arc call really crushes drawing performance. Presumably // because openGL is drawing it and when we overlap the second set of arcs it diff --git a/code/GLucose.jar b/code/GLucose.jar index 13bc6cf..9f90cbd 100644 Binary files a/code/GLucose.jar and b/code/GLucose.jar differ