From: Mark Slee Date: Thu, 22 Aug 2013 05:19:21 +0000 (-0700) Subject: Merge branch 'master' of https://github.com/sugarcubes/SugarCubes into realmapping X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=456312c336859c793938dff95bfa3798341d1dfa;hp=1627a617de5297dac990987a70d7e7c5fc29caca;p=SugarCubes.git Merge branch 'master' of https://github.com/sugarcubes/SugarCubes into realmapping --- diff --git a/AlexGreen.pde b/AlexGreen.pde new file mode 100644 index 0000000..9e53975 --- /dev/null +++ b/AlexGreen.pde @@ -0,0 +1,85 @@ +class SineSphere extends SCPattern { + float modelrad = sqrt((model.xMax)*(model.xMax) + (model.yMax)*(model.yMax) + (model.zMax)*(model.zMax)); + private final SinLFO rs = new SinLFO(0, 180, 5000); + private final SinLFO noisey = new SinLFO(modelrad/8.0, modelrad/4.0, 2300); + private final SinLFO band = new SinLFO (0, 10, 2000); + PVector modelcenter = new PVector(model.xMax, model.yMax, model.zMax); + BasicParameter widthparameter = new BasicParameter("Width", 10); + + + class Sphery { + float f1xcenter, f1ycenter, f1zcenter, f2xcenter, f2ycenter, f2zcenter; + private SinLFO vibration; + private SinLFO surface; + private SinLFO vx; + float vibration_min, vibration_max, vperiod; + + Sphery(float f1xcenter, float f1ycenter, float f1zcenter, float vibration_min, float vibration_max, float vperiod) { + this.f1xcenter = f1xcenter; + this.f1ycenter = f1ycenter; + this.f1zcenter = f1zcenter; + this.vibration_min = vibration_min; + this.vibration_max = vibration_max; + this.vperiod = vperiod; + addModulator( vibration = new SinLFO(vibration_min , vibration_max, vperiod)).trigger(); vibration.modulateDurationBy(vx); + addModulator( vx = new SinLFO(-1000, 1000, 10000)).trigger(); + } + float distfromcirclecenter(float px, float py, float pz, float f1x, float f1y, float f1z) { + return dist(px, py, pz, f1x, f1y, f1z); + } + + color spheryvalue (float px, float py, float pz , float f1xcenter, float f1ycenter, float f1zcenter) { + + return color(px, dist(px, py, pz, f1xcenter, f1ycenter, f1zcenter) , max(0, 100 - 10*abs(dist(px, py, pz, f1xcenter, f1ycenter, f1zcenter)- vibration.getValuef() ) ) ); + + } + + void run(int deltaMS) { + final float vv = vibration.getValuef(); + final float vvx = vx.getValuef(); + } + + } +final int NUM_SPHERES = 5; +final Sphery[] spherys; + SineSphere(GLucose glucose) { + super(glucose); + addModulator(rs).trigger(); + //addModulator(band).trigger(); + addModulator(noisey).trigger(); + spherys = new Sphery[NUM_SPHERES]; + spherys[1] = new Sphery(model.xMax/4, model.yMax/2, model.zMax/2, modelrad/16, modelrad/8, 2500) ; + spherys[2] = new Sphery(.75*model.xMax, model.yMax/2, model.zMax/2, modelrad/20, modelrad/10, 2000); + } + + public void run(int deltaMs) { + float rsv = rs.getValuef(); + float noiseyv = noisey.getValuef(); + float bandv = band.getValuef(); + + spherys[1].run(deltaMs); + spherys[2].run(deltaMs); + + for (Point p: model.points) { + + color c = 0; + + c = blendColor(c, spherys[2].spheryvalue(p.fx, p.fy, p.fz, .75*model.xMax, model.yMax/2, model.zMax/2), ADD); + c = blendColor(c, spherys[1].spheryvalue(p.fx, p.fy, p.fz, model.xMax/4, model.yMax/4, model.zMax/2), ADD); + float distfromcenter = dist(p.fx, p.fy, p.fz, model.xMax/2, model.yMax/2, model.zMax/2); + int distint = floor(distfromcenter); + + c = blendColor(c, color( + + constrain( p.fx , 0, 360), + constrain( distfromcenter, 20, 80), + max(0, 100 - 10*abs(distfromcenter - noiseyv ) ) + ), + ADD); + + + colors[p.index]=c; + } + } +} + diff --git a/SugarCubes.pde b/SugarCubes.pde index 2586b1a..ab81e30 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -44,6 +44,9 @@ LXPattern[] patterns(GLucose glucose) { new Pong(glucose), new Noise(glucose), + // Alex G + new SineSphere(glucose), + // Shaheen new HelixPattern(glucose).setEligible(false), diff --git a/_Overlay.pde b/_Overlay.pde index e21be8e..50c037c 100644 --- a/_Overlay.pde +++ b/_Overlay.pde @@ -42,7 +42,7 @@ abstract class OverlayUI { protected final int STATE_PENDING = 2; protected int[] pandaLeft = new int[pandaBoards.length]; - protected final int pandaWidth = 56; + protected final int pandaWidth = 64; protected final int pandaHeight = 13; protected final int pandaTop = height-16; @@ -79,22 +79,30 @@ abstract class OverlayUI { textFont(titleFont); textAlign(LEFT); fill(#666666); - text("FPS: " + (((int)(frameRate * 10)) / 10.), 4, height-6); - text("Target (-/+):", 50, height-6); + int lPos = 4; + String fps = "FPS: " + (((int)(frameRate * 10)) / 10.); + text(fps, lPos, height-6); + lPos += 48; + + String target = "Target (-/+):"; + text(target, lPos, height-6); fill(#000000); - rect(104, height-16, 20, 13); + lPos += textWidth(target) + 4; + rect(lPos, height-16, 24, 13); fill(#666666); - text("" + targetFramerate, 108, height-6); - text("PandaOutput (p):", 134, height-6); - int lPos = 214; + text("" + targetFramerate, lPos + (24 - textWidth("" + targetFramerate))/2, height-6); + lPos += 32; + String pandaOutput = "PandaOutput (p):"; + text(pandaOutput, lPos, height-6); + lPos += textWidth(pandaOutput)+4; int pi = 0; for (PandaDriver p : pandaBoards) { pandaLeft[pi++] = lPos; fill(p.enabled ? #666666 : #000000); rect(lPos, pandaTop, pandaWidth, pandaHeight); fill(p.enabled ? #000000 : #666666); - text(p.ip, lPos + 4, height-6); - lPos += 60; + text(p.ip, lPos + (pandaWidth - textWidth(p.ip)) / 2, height-6); + lPos += pandaWidth + 8; } }