From: Mark Slee Date: Wed, 13 Nov 2013 10:26:31 +0000 (-0800) Subject: New GLucose/HeronLX, LXPoint and LXModel now core classes X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=2bb5682284f70c5788cbfcb9cba3c7bf66a104b6;p=SugarCubes.git New GLucose/HeronLX, LXPoint and LXModel now core classes --- diff --git a/AlexGreen.pde b/AlexGreen.pde index 91677db..b89aaa2 100644 --- a/AlexGreen.pde +++ b/AlexGreen.pde @@ -136,17 +136,17 @@ final Sphery[] spherys; //spherys[1].run(deltaMs); //spherys[2].run(deltaMs); //spherys[3].run(deltaMs);] - sinespin.reset(model) + sinespin.reset() // Translate so the center of the car is the origin, offset by yPos - .translateCenter(model, 0, 0, 0) + .center() // Rotate around the origin (now the center of the car) about an X-vector .rotate(yrot.getValuef(), 0, 1, 0); - for (Point p: model.points){ + for (LXPoint p : model.points){ color c = 0; c = blendColor(c, spherys[1].spheryvalue(p.x, p.y, p.z, .75*model.xMax, model.yMax/2, model.zMax/2), ADD); c = blendColor(c, spherys[0].spheryvalue(p.x, p.y, p.z, model.xMax/4, model.yMax/4, model.zMax/2), ADD); @@ -242,7 +242,7 @@ float cfloor = c.y; // if (i%3 == 0){ -// for (Point p : c.points ){ +// for (LXPoint p : c.points ){ // // colors[p.index]=color(0,0,0); // //float dif = (p.y - c.y); // //colors[p.index] = color( bg.getValuef() , 80 , dif < curl.getValuef() ? 80 : 0, ADD); @@ -251,7 +251,7 @@ float cfloor = c.y; // else if (i%3 == 1) { -// for (Point p: c.points){ +// for (LXPoint p: c.points){ // colors[p.index]=color(0,0,0); // float dif = (p.y - c.y); // // colors[p.index] = @@ -262,7 +262,7 @@ float cfloor = c.y; // } // else if (i%3 == 2){ // centerlist[i].sub(cubeorigin(i); - for (Point p: c.points) { + for (LXPoint p: c.points) { PVector pv = new PVector(p.x, p.y, p.z); colors[p.index] =color( constrain(4* pv.dist(centerlist.get(i)), 0, 360) , 50, 100 ); // colors[p.index] =color(constrain(centerlist[i].x, 0, 360), constrain(centerlist[i].y, 0, 100), ); @@ -290,7 +290,7 @@ HueTestHSB(GLucose glucose) { } void run(double deltaMs){ - for (Point p : model.points) { + for (LXPoint p : model.points) { color c = 0; c = blendColor(c, lx.hsb(360*HueT.getValuef(), 100*SatT.getValuef(), 100*BriT.getValuef()), ADD); colors[p.index]= c; diff --git a/ArjunBanker.pde b/ArjunBanker.pde index c8fe1a6..4709bdc 100644 --- a/ArjunBanker.pde +++ b/ArjunBanker.pde @@ -15,7 +15,7 @@ class TelevisionStatic extends SCPattern { void run(double deltaMs) { boolean d = direction.getValuef() > 5.0; - for (Point p : model.points) { + for (LXPoint p : model.points) { colors[p.index] = lx.hsb((lx.getBaseHuef() + random(hueParameter.getValuef() * 360))%360, random(saturationParameter.getValuef() * 100), random(brightParameter.getValuef() * 100)); } } @@ -38,7 +38,7 @@ class AbstractPainting extends SCPattern { } void run(double deltaMs) { - for (Point p : model.points) { + for (LXPoint p : model.points) { color c = img.get((int)((p.x / model.xMax) * img.width), img.height - (int)((p.y / model.yMax) * img.height)); colors[p.index] = lx.hsb(hue(c) + colorMod.getValuef()%360, saturation(c), brightness(c) - ((p.z - brightMod.getValuef())/p.z)); } @@ -55,7 +55,7 @@ class Spirality extends SCPattern { Spirality(GLucose glucose) { super(glucose); addParameter(r); - for (Point p : model.points) { + for (LXPoint p : model.points) { colors[p.index] = lx.hsb(0, 0, 0); } } @@ -65,7 +65,7 @@ class Spirality extends SCPattern { rad += deltaMs * .025 * direction; float x = model.xMax / 2 + cos(angle) * rad; float y = model.yMax / 2 + sin(angle) * rad; - for (Point p : model.points) { + for (LXPoint p : model.points) { float b = dist(x,y,p.x,p.y); if (b < 90) { colors[p.index] = blendColor( diff --git a/BenMorrow.pde b/BenMorrow.pde index 7024148..51945a8 100644 --- a/BenMorrow.pde +++ b/BenMorrow.pde @@ -59,7 +59,7 @@ class TowerParams extends SCPattern for(int i=0; i> 12; diff --git a/DanKaminsky.pde b/DanKaminsky.pde index 4021d07..f16c0bd 100644 --- a/DanKaminsky.pde +++ b/DanKaminsky.pde @@ -174,10 +174,10 @@ class OSC_Balls extends OSCPattern { } void run(double deltaMs){ - for(Point p: model.points){ colors[p.index]=0; } + for(LXPoint p: model.points){ colors[p.index]=0; } for(int i=1; i x-4 && p.y < y+4 && p.y > y-4) { colors[p.index] = #FF0000; } @@ -207,7 +207,7 @@ import processing.serial.*; pret.pixels = ss.getScreenShotJNI2(x, y, w, h); //for(int i=0; i= b && a <= c; } float interp (float a, float b, float c) { return (1-a)*b + a*c; } float randctr (float a) { return random(a) - a*.5; } float min (float a, float b, float c, float d) { return min(min(a,b),min(c,d)); } -float pointDist(Point p1, Point p2) { return dist(p1.x,p1.y,p1.z,p2.x,p2.y,p2.z); } -float xyDist (Point p1, Point p2) { return dist(p1.x,p1.y,p2.x,p2.y); } +float pointDist(LXPoint p1, LXPoint p2) { return dist(p1.x,p1.y,p1.z,p2.x,p2.y,p2.z); } +float xyDist (LXPoint p1, LXPoint p2) { return dist(p1.x,p1.y,p2.x,p2.y); } float distToSeg(float x, float y, float x1, float y1, float x2, float y2) { float A = x - x1, B = y - y1, C = x2 - x1, D = y2 - y1; float dot = A * C + B * D, len_sq = C * C + D * D; @@ -79,7 +79,7 @@ public class DPat extends SCPattern float interpWv(float i, float[] vals) { return interp(i-floor(i), vals[floor(i)], vals[ceil(i)]); } void setNorm (PVector vec) { vec.set(vec.x/mMax.x, vec.y/mMax.y, vec.z/mMax.z); } void setRand (PVector vec) { vec.set(random(mMax.x), random(mMax.y), random(mMax.z)); } - void setVec (PVector vec, Point p) { vec.set(p.x, p.y, p.z); } + void setVec (PVector vec, LXPoint p) { vec.set(p.x, p.y, p.z); } void interpolate(float i, PVector a, PVector b) { a.set(interp(i,a.x,b.x), interp(i,a.y,b.y), interp(i,a.z,b.z)); } void StartRun(double deltaMs) { } float val (BasicParameter p) { return p.getValuef(); } @@ -211,7 +211,7 @@ public class DPat extends SCPattern xWaveNz[i] = wvAmp * (noise(i/(mMax.y*.3)-(1e3+NoiseMove)/1500.) - .5) * (mMax.x/2.); } - for (Point p : model.points) { nPoint++; + for (LXPoint p : model.points) { nPoint++; setVec(P,p); P.sub(modmin); P.sub(pTrans); @@ -248,8 +248,8 @@ class dVertex { int dir, ci; // dir -- 1 or -1. // ci -- color index - dVertex(Strip _s, Point _p) { s = _s; ci = _p.index; } - Point getPoint(int i) { return s.points.get(dir>0 ? i : 15-i); } + dVertex(Strip _s, LXPoint _p) { s = _s; ci = _p.index; } + LXPoint getPoint(int i) { return s.points.get(dir>0 ? i : 15-i); } void setOpp(dVertex _opp) { opp = _opp; dir = (ci < opp.ci ? 1 : -1); } } //---------------------------------------------------------------------------------------------------------------------------------- @@ -262,7 +262,7 @@ class dLattice { if (v0.t3 == null) { v0.t3=t; return; } } float dist2 (Strip s1, int pos1, Strip s2, int pos2) { return pointDist(s1.points.get(pos1), s2.points.get(pos2)); } - float pd2 (Point p1, float x, float y, float z) { return dist(p1.x,p1.y,p1.z,x,y,z); } + float pd2 (LXPoint p1, float x, float y, float z) { return dist(p1.x,p1.y,p1.z,x,y,z); } boolean sameSame (Strip s1, Strip s2) { return max(dist2(s1, 0, s2, 0), dist2(s1,15, s2,15)) < 5 ; } // same strut, same direction boolean sameOpp (Strip s1, Strip s2) { return max(dist2(s1, 0, s2,15), dist2(s1,15, s2,0 )) < 5 ; } // same strut, opp direction boolean sameBar (Strip s1, Strip s2) { return sameSame(s1,s2) || sameOpp(s1,s2); } // 2 strips on same strut diff --git a/GranimPattern.pde b/GranimPattern.pde index 450c17e..da4c78f 100644 --- a/GranimPattern.pde +++ b/GranimPattern.pde @@ -109,7 +109,7 @@ class GranimPattern extends SCPattern { ((Granim) g).update(); } - List drawList = model.points.subList(Math.min(g.position,colors.length-1), Math.min(g.position + g.width(),colors.length-1)); + List drawList = model.points.subList(Math.min(g.position,colors.length-1), Math.min(g.position + g.width(),colors.length-1)); //println("drawlistsize "+drawList.size()); gbuffer = g.graphicBuffer.toArray(new Integer[0]); diff --git a/JR.pde b/JR.pde index 6692baa..cb8ba63 100644 --- a/JR.pde +++ b/JR.pde @@ -75,9 +75,9 @@ class Gimbal extends SCPattern { Ring ring2 = new Ring((hue + hue_delta * 1) % 360, radius2, girth); Ring ring3 = new Ring((hue + hue_delta * 2) % 360, radius3, girth); - projection.reset(model) + projection.reset() // Translate so the center of the car is the origin - .translateCenter(model, 0, 0, 0); + .center(); for (Coord c : projection) { //if (first_run) println(c.x + "," + c.y + "," + c.z); @@ -191,9 +191,9 @@ class Zebra extends SCPattern { float b = (millis() / 1200.f) % (2 * PI); float g = (millis() / 1600.f) % (2 * PI); - projection.reset(model) + projection.reset() // Translate so the center of the car is the origin - .translateCenter(model, 0, 0, 0); + .center(); for (Coord c : projection) { // rotate3d(c, a, b, g); diff --git a/JackStahl.pde b/JackStahl.pde index 081ea40..dd60db7 100644 --- a/JackStahl.pde +++ b/JackStahl.pde @@ -46,10 +46,10 @@ class Swim extends SCPattern { float denominator = max(xAngle.getValuef() + yAngle.getValuef() + zAngle.getValuef(), 1); - projection.reset(model) + projection.reset() // Swim around the world .rotate(rotation.getValuef(), xAngle.getValuef() / denominator, yAngle.getValuef() / denominator, zAngle.getValuef() / denominator) - .translateCenter(model, 0, 50 + yPos.getValuef(), 0); + .translateCenter(0, 50 + yPos.getValuef(), 0); float model_height = model.yMax - model.yMin; float model_width = model.xMax - model.xMin; @@ -157,7 +157,7 @@ class Balance extends SCPattern { float phase = phaseLFO.getValuef(); float crazy_factor = crazyParam.getValuef() / 0.2; - projection.reset(model) + projection.reset() .rotate(rotationZ.getValuef() * crazy_factor, 0, 1, 0) .rotate(rotationX.getValuef() * crazy_factor, 0, 0, 1) .rotate(rotationY.getValuef() * crazy_factor, 0, 1, 0); diff --git a/MarkSlee.pde b/MarkSlee.pde index 4a37206..dcf35a5 100644 --- a/MarkSlee.pde +++ b/MarkSlee.pde @@ -45,7 +45,7 @@ class Cathedrals extends SCPattern { float sf = 100. / (70 - 69.9*sat.getValuef()); - for (Point p : model.points) { + for (LXPoint p : model.points) { float d = MAX_FLOAT; if (p.y > model.cy) { arm = tarm; @@ -109,7 +109,7 @@ class MidiMusic extends SCPattern { return; } float posf = position.getValuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { colors[p.index] = blendColor(colors[p.index], lx.hsb( (lx.getBaseHuef() + .2*abs(p.x - model.cx) + .2*abs(p.y - model.cy)) % 360, 100, @@ -151,7 +151,7 @@ class MidiMusic extends SCPattern { return; } float yVal = yPos.getValuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { float falloff = 6 - 5*lightSize.getValuef(); float b = max(0, bVal - falloff*dist(p.x, p.y, xPos, yVal)); if (b > 0) { @@ -252,7 +252,7 @@ class MidiMusic extends SCPattern { float maxBright = sparkleBright * (1 - sparkle.getValuef()); for (Strip s : model.strips) { int i = 0; - for (Point p : s.points) { + for (LXPoint p : s.points) { int wavi = (int) constrain(p.x / model.xMax * wval.length, 0, wval.length-1); float wavb = max(0, wave.getValuef()*100. - 8.*abs(p.y - wval[wavi])); colors[p.index] = lx.hsb( @@ -366,7 +366,7 @@ class Pulley extends SCPattern { fPos = .2 + 4 * (.2 - fPos); } float falloff = 100. / (3 + sz.getValuef() * 36 + fPos * beatAmount.getValuef()*48); - for (Point p : model.points) { + for (LXPoint p : model.points) { int gi = (int) constrain((p.x - model.xMin) * NUM_DIVISIONS / (model.xMax - model.xMin), 0, NUM_DIVISIONS-1); colors[p.index] = lx.hsb( (lx.getBaseHuef() + abs(p.x - model.cx)*.8 + p.y*.4) % 360, @@ -438,7 +438,7 @@ class ViolinWave extends SCPattern { } float pFalloff = (30 - 27*pSize.getValuef()); - for (Point p : model.points) { + for (LXPoint p : model.points) { float b = 100 - pFalloff * (abs(p.x - x.getValuef()) + abs(p.y - y.getValuef())); if (b > 0) { colors[p.index] = blendColor(colors[p.index], lx.hsb( @@ -489,7 +489,7 @@ class ViolinWave extends SCPattern { float rng = (78 - 64 * range.getValuef()) / (model.yMax - model.cy); float val = max(2, dbValue.getValuef()); - for (Point p : model.points) { + for (LXPoint p : model.points) { int ci = (int) lerp(0, centers.length-1, (p.x - model.xMin) / (model.xMax - model.xMin)); float rFactor = 1.0 - 0.9 * abs(p.x - model.cx) / (model.xMax - model.cx); colors[p.index] = lx.hsb( @@ -545,7 +545,7 @@ class BouncyBalls extends SCPattern { float xv = xPos.getValuef(); float yv = yPos.getValuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { float d = sqrt((p.x-xv)*(p.x-xv) + (p.y-yv)*(p.y-yv) + .1*(p.z-zPos)*(p.z-zPos)); float b = constrain(130 - falloff*d, 0, 100); if (b > 0) { @@ -630,7 +630,7 @@ class SpaceTime extends SCPattern { int s = 0; for (Strip strip : model.strips) { int i = 0; - for (Point p : strip.points) { + for (LXPoint p : strip.points) { colors[p.index] = lx.hsb( (lx.getBaseHuef() + 360 - p.x*.2 + p.y * .3) % 360, constrain(.4 * min(abs(s - sVal1), abs(s - sVal2)), 20, 100), @@ -648,9 +648,9 @@ class Swarm extends SCPattern { SawLFO offset = new SawLFO(0, 1, 1000); SinLFO rate = new SinLFO(350, 1200, 63000); SinLFO falloff = new SinLFO(15, 50, 17000); - SinLFO fX = new SinLFO(0, model.xMax, 19000); - SinLFO fY = new SinLFO(0, model.yMax, 11000); - SinLFO hOffX = new SinLFO(0, model.xMax, 13000); + SinLFO fX = new SinLFO(model.xMin, model.xMax, 19000); + SinLFO fY = new SinLFO(model.yMin, model.yMax, 11000); + SinLFO hOffX = new SinLFO(model.xMin, model.xMax, 13000); public Swarm(GLucose glucose) { super(glucose); @@ -677,9 +677,9 @@ class Swarm extends SCPattern { void run(double deltaMs) { float s = 0; - for (Strip strip : model.strips ) { + for (Strip strip : model.strips) { int i = 0; - for (Point p : strip.points) { + for (LXPoint p : strip.points) { float fV = max(-1, 1 - dist(p.x/2., p.y, fX.getValuef()/2., fY.getValuef()) / 64.); colors[p.index] = lx.hsb( (lx.getBaseHuef() + 0.3 * abs(p.x - hOffX.getValuef())) % 360, @@ -706,7 +706,7 @@ class SwipeTransition extends SCTransition { void computeBlend(int[] c1, int[] c2, double progress) { float bleedf = 10 + bleed.getValuef() * 200.; float xPos = (float) (-bleedf + progress * (model.xMax + bleedf)); - for (Point p : model.points) { + for (LXPoint p : model.points) { float d = (p.x - xPos) / bleedf; if (d < 0) { colors[p.index] = c2[p.index]; @@ -829,7 +829,7 @@ class BassPod extends SCPattern { float satBase = bassLevel*480*clr.getValuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { int avgIndex = (int) constrain(1 + abs(p.x-model.cx)/(model.cx)*(eq.numBands-5), 0, eq.numBands-5); float value = 0; for (int i = avgIndex; i < avgIndex + 5; ++i) { @@ -880,7 +880,7 @@ class CubeEQ extends SCPattern { float edgeConst = 2 + 30*edge.getValuef(); float clrConst = 1.1 + clr.getValuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { float avgIndex = constrain(2 + p.x / model.xMax * (eq.numBands-4), 0, eq.numBands-4); int avgFloor = (int) avgIndex; @@ -935,7 +935,7 @@ class BoomEffect extends SCEffect { float falloffv = falloffv(); float satv = sat.getValuef() * 100; float huev = lx.getBaseHuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { colors[p.index] = blendColor( colors[p.index], lx.hsb(huev, satv, constrain(brightv - falloffv*abs(boom.getValuef() - dist(p.x, 2*p.y, 3*p.z, model.xMax/2, model.yMax, model.zMax*1.5)), 0, 100)), @@ -1111,7 +1111,7 @@ class CrossSections extends SCPattern { float ywv = 100. / (10 + 40*yw.getValuef()); float zwv = 100. / (10 + 40*zw.getValuef()); - for (Point p : model.points) { + for (LXPoint p : model.points) { color c = 0; c = blendColor(c, lx.hsb( (lx.getBaseHuef() + p.x/10 + p.y/3) % 360, @@ -1158,7 +1158,7 @@ class Blinders extends SCPattern { for (Strip strip : model.strips) { int i = 0; float mv = m[si % m.length].getValuef(); - for (Point p : strip.points) { + for (LXPoint p : strip.points) { colors[p.index] = lx.hsb( (hv + p.z + p.y*hs.getValuef()) % 360, min(100, abs(p.x - s.getValuef())/2.), @@ -1194,7 +1194,7 @@ class Psychedelia extends SCPattern { float mv = m.getValuef(); int i = 0; for (Strip strip : model.strips) { - for (Point p : strip.points) { + for (LXPoint p : strip.points) { colors[p.index] = lx.hsb( (huev + i*constrain(cv, 0, 2) + p.z/2. + p.x/4.) % 360, min(100, abs(p.y-sv)), @@ -1256,7 +1256,7 @@ class AskewPlanes extends SCPattern { planes[1].run(deltaMs); planes[2].run(deltaMs); - for (Point p : model.points) { + for (LXPoint p : model.points) { float d = MAX_FLOAT; for (Plane plane : planes) { if (plane.denom != 0) { @@ -1294,7 +1294,7 @@ class ShiftingPlane extends SCPattern { float cv = c.getValuef(); float dv = d.getValuef(); float denom = sqrt(av*av + bv*bv + cv*cv); - for (Point p : model.points) { + for (LXPoint p : model.points) { float d = abs(av*(p.x-model.cx) + bv*(p.y-model.cy) + cv*(p.z-model.cz) + dv) / denom; colors[p.index] = lx.hsb( (hv + abs(p.x-model.cx)*.6 + abs(p.y-model.cy)*.9 + abs(p.z - model.cz)) % 360, @@ -1361,7 +1361,7 @@ class Traktor extends SCPattern { bass[index] = rawBass * rawBass * rawBass * rawBass; treble[index] = rawTreble * rawTreble; - for (Point p : model.points) { + for (LXPoint p : model.points) { int i = (int) constrain((model.xMax - p.x) / model.xMax * FRAME_WIDTH, 0, FRAME_WIDTH-1); int pos = (index + FRAME_WIDTH - i) % FRAME_WIDTH; @@ -1520,3 +1520,4 @@ class BlurEffect extends SCEffect { } } + diff --git a/ShaheenGandhi.pde b/ShaheenGandhi.pde index d718e36..83b97cf 100644 --- a/ShaheenGandhi.pde +++ b/ShaheenGandhi.pde @@ -252,7 +252,7 @@ class HelixPattern extends SCPattern { h2.step(deltaMs); calculateSpokes(); - for (Point p : model.points) { + for (LXPoint p : model.points) { PVector pt = new PVector(p.x,p.y,p.z); color h1c = h1.colorOfPoint(pt); color h2c = h2.colorOfPoint(pt); diff --git a/SugarCubes.pde b/SugarCubes.pde index c89a72e..a599b43 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -26,7 +26,6 @@ LXPattern[] patterns(GLucose glucose) { return new LXPattern[] { - // Slee new Cathedrals(glucose), new MidiMusic(glucose), @@ -104,7 +103,6 @@ LXPattern[] patterns(GLucose glucose) { new TestBassMapping(glucose), new TestFloorMapping(glucose), new TestSpeakerMapping(glucose), - new TestPerformancePattern(glucose), // new TestHuePattern(glucose), // new TestXPattern(glucose), // new TestYPattern(glucose), diff --git a/TestPatterns.pde b/TestPatterns.pde index 1c2ea70..62a1956 100644 --- a/TestPatterns.pde +++ b/TestPatterns.pde @@ -25,7 +25,7 @@ class TestSpeakerMapping extends TestPattern { for (Speaker speaker : model.speakers) { for (Strip strip : speaker.strips) { float b = 100; - for (Point p : strip.points) { + for (LXPoint p : strip.points) { colors[p.index] = lx.hsb(h % 360, 100, b); b = max(0, b - 10); } @@ -46,7 +46,7 @@ class TestBassMapping extends TestPattern { int h = 0; for (int si : strips) { float b = 100; - for (Point p : model.bassBox.strips.get(si).points) { + for (LXPoint p : model.bassBox.strips.get(si).points) { colors[p.index] = lx.hsb(h % 360, 100, b); b = max(0, b - 10); } @@ -65,7 +65,7 @@ class TestFloorMapping extends TestPattern { int h = 0; for (int si : strutIndices) { float b = 100; - for (Point p : model.bassBox.struts.get(si).points) { + for (LXPoint p : model.bassBox.struts.get(si).points) { colors[p.index] = lx.hsb(h % 360, 100, b); b = max(0, b - 10); } @@ -75,7 +75,7 @@ class TestFloorMapping extends TestPattern { h = 0; for (int fi : floorIndices) { float b = 100; - for (Point p : model.boothFloor.strips.get(fi).points) { + for (LXPoint p : model.boothFloor.strips.get(fi).points) { colors[p.index] = lx.hsb(h, 100, b); b = max(0, b - 3); } @@ -84,59 +84,6 @@ class TestFloorMapping extends TestPattern { } } -class TestPerformancePattern extends TestPattern { - - final BasicParameter ops = new BasicParameter("OPS", 0); - final BasicParameter iter = new BasicParameter("ITER", 0); - - TestPerformancePattern(GLucose glucose) { - super(glucose); - addParameter(ops); - addParameter(iter); - } - - public void run(double deltaMs) { - float x = 1; - for (int j = 0; j < ops.getValuef() * 400000; ++j) { - x *= random(0, 1); - } - - if (iter.getValuef() < 0.25) { - for (Point p : model.points) { - colors[p.index] = lx.hsb( - (p.x*.1 + p.y*.1) % 360, - 100, - 100 - ); - } - } else if (iter.getValuef() < 0.5) { - for (int i = 0; i < colors.length; ++i) { - colors[i] = lx.hsb( - (90 + model.px[i]*.1 + model.py[i]*.1) % 360, - 100, - 100 - ); - } - } else if (iter.getValuef() < 0.75) { - for (int i = 0; i < colors.length; ++i) { - colors[i] = lx.hsb( - (180 + model.p[3*i]*.1 + model.p[3*i+1]*.1) % 360, - 100, - 100 - ); - } - } else { - for (int i = 0; i < colors.length; ++i) { - colors[i] = lx.hsb( - (270 + model.x(i)*.1 + model.y(i)*.1) % 360, - 100, - 100 - ); - } - } - } -} - class TestStripPattern extends TestPattern { SinLFO d = new SinLFO(4, 40, 4000); @@ -148,7 +95,7 @@ class TestStripPattern extends TestPattern { public void run(double deltaMs) { for (Strip s : model.strips) { - for (Point p : s.points) { + for (LXPoint p : s.points) { colors[p.index] = lx.hsb( lx.getBaseHuef(), 100, @@ -188,7 +135,7 @@ class TestXPattern extends TestPattern { } public void run(double deltaMs) { float hv = lx.getBaseHuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { // This is a common technique for modulating brightness. // You can use abs() to determine the distance between two // values. The further away this point is from an exact @@ -210,7 +157,7 @@ class TestYPattern extends TestPattern { } public void run(double deltaMs) { float hv = lx.getBaseHuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { float bv = max(0, 100 - abs(p.y - yPos.getValuef())); colors[p.index] = lx.hsb(hv, 100, bv); } @@ -228,7 +175,7 @@ class TestZPattern extends TestPattern { } public void run(double deltaMs) { float hv = lx.getBaseHuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { float bv = max(0, 100 - abs(p.z - zPos.getValuef())); colors[p.index] = lx.hsb(hv, 100, bv); } @@ -249,7 +196,7 @@ class TestTowerPattern extends TestPattern { public void run(double deltaMs) { int ti = 0; for (Tower t : model.towers) { - for (Point p : t.points) { + for (LXPoint p : t.points) { colors[p.index] = lx.hsb( lx.getBaseHuef(), 100, @@ -297,10 +244,10 @@ class TestProjectionPattern extends TestPattern { // For the same reasons described above, it may logically feel to you that // some of these operations are in reverse order. Again, just keep in mind that // the car itself is what's moving, not the object - projection.reset(model) + projection.reset() // Translate so the center of the car is the origin, offset by yPos - .translateCenter(model, 0, yPos.getValuef(), 0) + .translateCenter(0, yPos.getValuef(), 0) // Rotate around the origin (now the center of the car) about an X-vector .rotate(angle.getValuef(), 1, 0, 0) @@ -334,7 +281,7 @@ class TestCubePattern extends TestPattern { public void run(double deltaMs) { for (Cube c : model.cubes) { int i = 0; - for (Point p : c.points) { + for (LXPoint p : c.points) { colors[p.index] = lx.hsb( lx.getBaseHuef(), 100, diff --git a/TimBavaro.pde b/TimBavaro.pde index a10e89e..5ed805b 100644 --- a/TimBavaro.pde +++ b/TimBavaro.pde @@ -53,7 +53,7 @@ class TimSpheres extends SCPattern { spheres[0].radius = 100 * hueParameter.getValuef(); spheres[1].radius = 100 * hueParameter.getValuef(); - for (Point p : model.points) { + for (LXPoint p : model.points) { float value = 0; color c = lx.hsb(0, 0, 0); @@ -124,7 +124,7 @@ class Vector3 { return distanceTo(v.x, v.y, v.z); } - float distanceTo(Point p) { + float distanceTo(LXPoint p) { return distanceTo(p.x, p.y, p.z); } @@ -246,7 +246,7 @@ class TimRaindrops extends SCPattern { raindrops.add(new Raindrop()); } - for (Point p : model.points) { + for (LXPoint p : model.points) { color c = blendColor( lx.hsb(210, 20, (float)Math.max(0, 1 - Math.pow((model.yMax - p.y) / 10, 2)) * 50), @@ -337,14 +337,14 @@ class TimCubes extends SCPattern { flashes.add(new CubeFlash()); } - for (Point p : model.points) { + for (LXPoint p : model.points) { colors[p.index] = 0; } for (CubeFlash flash : flashes) { float hue = (hueParameter.getValuef() + (hueVarianceParameter.getValuef() * flash.hue)) % 1.0; color c = lx.hsb(hue * 360, saturationParameter.getValuef() * 100, (flash.value) * 100); - for (Point p : flash.c.points) { + for (LXPoint p : flash.c.points) { colors[p.index] = c; } } @@ -456,7 +456,7 @@ class TimPlanes extends SCPattern { Vector3 normalizedPoint = new Vector3(); - for (Point p : model.points) { + for (LXPoint p : model.points) { if (random(1.0) < derez) { continue; } @@ -631,7 +631,7 @@ class TimPinwheels extends SCPattern { float zSlope = (zSlopeParameter.getValuef() - 0.5) * 2; int i = -1; - for (Point p : model.points) { + for (LXPoint p : model.points) { ++i; int value = 0; @@ -663,25 +663,25 @@ class TimPinwheels extends SCPattern { * it but there may be useful code here. */ class TimTrace extends SCPattern { - private Map> pointToNeighbors; - private Map pointToStrip; + private Map> pointToNeighbors; + private Map pointToStrip; // private final Map> stripToNearbyStrips; int extraMs; class MovingPoint { - Point currentPoint; + LXPoint currentPoint; float hue; private Strip currentStrip; private int currentStripIndex; private int direction; // +1 or -1 - MovingPoint(Point p) { + MovingPoint(LXPoint p) { this.setPointOnNewStrip(p); hue = random(360); } - private void setPointOnNewStrip(Point p) { + private void setPointOnNewStrip(LXPoint p) { this.currentPoint = p; this.currentStrip = pointToStrip.get(p); for (int i = 0; i < this.currentStrip.points.size(); ++i) { @@ -703,9 +703,9 @@ class TimTrace extends SCPattern { } void step() { - List neighborsOnOtherStrips = pointToNeighbors.get(this.currentPoint); + List neighborsOnOtherStrips = pointToNeighbors.get(this.currentPoint); - Point nextPointOnCurrentStrip = null; + LXPoint nextPointOnCurrentStrip = null; this.currentStripIndex += this.direction; if (this.currentStripIndex >= 0 && this.currentStripIndex < this.currentStrip.points.size()) { nextPointOnCurrentStrip = this.currentStrip.points.get(this.currentStripIndex); @@ -745,7 +745,7 @@ class TimTrace extends SCPattern { Map stripToCenter = new HashMap(); for (Strip s : model.strips) { Vector3 v = new Vector3(); - for (Point p : s.points) { + for (LXPoint p : s.points) { v.add(p.x, p.y, p.z); } v.divide(s.points.size()); @@ -770,23 +770,23 @@ class TimTrace extends SCPattern { return stripToNeighbors; } - private Map> buildPointToNeighborsMap() { - Map> m = new HashMap(); + private Map> buildPointToNeighborsMap() { + Map> m = new HashMap(); Map> stripToNearbyStrips = this.buildStripToNearbyStripsMap(); for (Strip s : model.strips) { List nearbyStrips = stripToNearbyStrips.get(s); - for (Point p : s.points) { + for (LXPoint p : s.points) { Vector3 v = new Vector3(p.x, p.y, p.z); - List neighbors = new ArrayList(); + List neighbors = new ArrayList(); for (Strip nearbyStrip : nearbyStrips) { - Point closestPoint = null; + LXPoint closestPoint = null; float closestPointDistance = 100000; - for (Point nsp : nearbyStrip.points) { + for (LXPoint nsp : nearbyStrip.points) { float distance = v.distanceTo(nsp.x, nsp.y, nsp.z); if (closestPoint == null || distance < closestPointDistance) { closestPoint = nsp; @@ -806,10 +806,10 @@ class TimTrace extends SCPattern { return m; } - private Map buildPointToStripMap() { - Map m = new HashMap(); + private Map buildPointToStripMap() { + Map m = new HashMap(); for (Strip s : model.strips) { - for (Point p : s.points) { + for (LXPoint p : s.points) { m.put(p, s); } } @@ -817,7 +817,7 @@ class TimTrace extends SCPattern { } public void run(double deltaMs) { - for (Point p : model.points) { + for (LXPoint p : model.points) { color c = colors[p.index]; colors[p.index] = lx.hsb(lx.h(c), lx.s(c), lx.b(c) - 3); } diff --git a/TobySegaran.pde b/TobySegaran.pde index 82ad4d2..8aaacb1 100644 --- a/TobySegaran.pde +++ b/TobySegaran.pde @@ -24,7 +24,7 @@ class GlitchPlasma extends SCPattern { } public void run(double deltaMs) { - for (Point p : model.points) { + for (LXPoint p : model.points) { float hv = sin(dist(p.x + pos, p.y, 128.0, 128.0) / 8.0) + sin(dist(p.x, p.y, 64.0, 64.0) / 8.0) + sin(dist(p.x, p.y + pos / 7, 192.0, 64.0) / 7.0) @@ -81,7 +81,7 @@ class FireEffect extends SCPattern { } } - for (Point p : model.points) { + for (LXPoint p : model.points) { int x = max(0,(int(p.x)+int(p.z))%xm); int y = constrain(ym-int(p.y),0,ym-1); colors[p.index] = flameColor(intensity[x][y]); @@ -120,7 +120,7 @@ class StripBounce extends SCPattern { boolean on = avgdist<30; float hv = (lx.getBaseHuef()+colorOffset[i])%360; float br = max(0,100-avgdist*4); - for (Point p : strip.points) { + for (LXPoint p : strip.points) { if (on && br>bright[p.index]) { colors[p.index] = lx.hsb(hv,sat[i].getValuef(),br); bright[p.index] = br; @@ -184,7 +184,7 @@ class SoundRain extends SCPattern { for (int j=0; javgSize) seq=avgSize-seq; diff --git a/_DebugUI.pde b/_DebugUI.pde index 5b99d43..a36f688 100644 --- a/_DebugUI.pde +++ b/_DebugUI.pde @@ -200,7 +200,7 @@ class DebugUI { if (state != DEBUG_STATE_ANIM) { color debugColor = (state == DEBUG_STATE_WHITE) ? white : off; Cube cube = glucose.model.getCubeByRawIndex(rawCubeIndex); - for (Point p : cube.points) { + for (LXPoint p : cube.points) { colors[p.index] = debugColor; } } @@ -214,7 +214,7 @@ class DebugUI { if (state != DEBUG_STATE_ANIM) { color debugColor = (state == DEBUG_STATE_WHITE) ? white : off; for (Strip s : glucose.model.bassBox.boxStrips) { - for (Point p : s.points) { + for (LXPoint p : s.points) { colors[p.index] = debugColor; } } @@ -225,11 +225,11 @@ class DebugUI { state = debugState[channelIndex][1]; if (state != DEBUG_STATE_ANIM) { color debugColor = (state == DEBUG_STATE_WHITE) ? white : off; - for (Point p : glucose.model.boothFloor.points) { + for (LXPoint p : glucose.model.boothFloor.points) { colors[p.index] = debugColor; } for (Strip s : glucose.model.bassBox.struts) { - for (Point p : s.points) { + for (LXPoint p : s.points) { colors[p.index] = debugColor; } } @@ -240,7 +240,7 @@ class DebugUI { state = debugState[channelIndex][1]; if (state != DEBUG_STATE_ANIM) { color debugColor = (state == DEBUG_STATE_WHITE) ? white : off; - for (Point p : glucose.model.speakers.get(channel.objectIndices[0]).points) { + for (LXPoint p : glucose.model.speakers.get(channel.objectIndices[0]).points) { colors[p.index] = debugColor; } } diff --git a/_Internals.pde b/_Internals.pde index 728e343..8c50a76 100644 --- a/_Internals.pde +++ b/_Internals.pde @@ -140,7 +140,7 @@ void setup() { lx = glucose.lx; lx.enableKeyboardTempo(); logTime("Built GLucose engine"); - + // Set the patterns LXEngine engine = lx.engine; engine.setPatterns(patterns = _leftPatterns(glucose)); @@ -328,7 +328,7 @@ void drawDiagnostics(long drawNanos, long simulationNanos, long uiNanos, long ga } void drawSimulation(color[] simulationColors) { - camera( + camera( eyeX, eyeY, eyeZ, midX, midY, midZ, 0, -1, 0 @@ -370,7 +370,7 @@ void drawSimulation(color[] simulationColors) { noFill(); strokeWeight(2); beginShape(POINTS); - for (Point p : glucose.model.points) { + for (LXPoint p : glucose.model.points) { stroke(simulationColors[p.index]); vertex(p.x, p.y, p.z); } diff --git a/_Mappings.pde b/_Mappings.pde index feca86e..314a88d 100644 --- a/_Mappings.pde +++ b/_Mappings.pde @@ -210,7 +210,7 @@ for (StaggeredTower st : scubes) { tower.add(cubes[cubeIndex++] = new Cube(st.x, st.y + CH* 4/3.*i, st.z, 0, st.r, 0, w)); } towerList.add(new Tower(tower)); - } + } return new Model(towerList, cubes, bassBox, speakers); } @@ -422,4 +422,4 @@ class ChannelMapping { objectIndices[i] = (i < rawObjectIndices.length) ? rawObjectIndices[i] : NO_OBJECT; } } -} \ No newline at end of file +} diff --git a/_PandaDriver.pde b/_PandaDriver.pde index 0aca6af..24afa20 100644 --- a/_PandaDriver.pde +++ b/_PandaDriver.pde @@ -264,7 +264,7 @@ public static class PandaDriver { private int mapStrip(Strip s, int direction, int[] points, int pi) { if (direction == FORWARD) { - for (Point p : s.points) { + for (LXPoint p : s.points) { points[pi++] = p.index; } } else if (direction == BACKWARD) { diff --git a/code/GLucose.jar b/code/GLucose.jar index 92f9ff9..9440558 100755 Binary files a/code/GLucose.jar and b/code/GLucose.jar differ diff --git a/code/HeronLX.jar b/code/HeronLX.jar index 396a41e..86cb0a1 100755 Binary files a/code/HeronLX.jar and b/code/HeronLX.jar differ