class SpaceTime extends SCPattern {
- SinLFO pos = new SinLFO(0, 15, 3000);
+ SinLFO pos = new SinLFO(0, 1, 3000);
SinLFO rate = new SinLFO(1000, 9000, 13000);
SinLFO falloff = new SinLFO(10, 70, 5000);
float angle = 0;
BasicParameter rateParameter = new BasicParameter("RATE", 0.5);
BasicParameter sizeParameter = new BasicParameter("SIZE", 0.5);
+
public SpaceTime(GLucose glucose) {
super(glucose);
+
addModulator(pos).trigger();
addModulator(rate).trigger();
addModulator(falloff).trigger();
int i = 0;
for (Point p : strip.points) {
colors[p.index] = color(
- (lx.getBaseHuef() + 360 - p.fx*.2 + p.fy * .3) % 360,
- constrain(.4 * min(abs(s - sVal1), abs(s - sVal2)), 20, 100),
- max(0, 100 - fVal*abs(i - pVal))
- );
+ (lx.getBaseHuef() + 360 - p.fx*.2 + p.fy * .3) % 360,
+ constrain(.4 * min(abs(s - sVal1), abs(s - sVal2)), 20, 100),
+ max(0, 100 - fVal*abs(i - pVal*(strip.metrics.numPoints - 1)))
+ );
++i;
}
++s;
class Swarm extends SCPattern {
- SawLFO offset = new SawLFO(0, 16, 1000);
+ 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);
public Swarm(GLucose glucose) {
super(glucose);
+
addModulator(offset).trigger();
addModulator(rate).trigger();
addModulator(falloff).trigger();
void run(int deltaMs) {
float s = 0;
- for (Strip strip : model.strips) {
+ 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.);
colors[p.index] = color(
(lx.getBaseHuef() + 0.3 * abs(p.fx - hOffX.getValuef())) % 360,
constrain(80 + 40 * fV, 0, 100),
- constrain(100 - (30 - fV * falloff.getValuef()) * modDist(i + (s*63)%61, offset.getValuef(), 16), 0, 100)
+ constrain(100 - (30 - fV * falloff.getValuef()) * modDist(i + (s*63)%61, (int) (offset.getValuef() * strip.metrics.numPoints), strip.metrics.numPoints), 0, 100)
);
++i;
}
addParams();
}
- public void addParams()
- {
+ protected void addParams() {
addParameter(xr);
addParameter(yr);
addParameter(zr);
addParameter(yw);
addParameter(zw);
}
-
- public void onParameterChanged(LXParameter p) {
+
+ void onParameterChanged(LXParameter p) {
if (p == xr) {
x.setDuration(10000 - 8800*p.getValuef());
} else if (p == yr) {
z.setDuration(10000 - 9000*p.getValuef());
}
}
-
- float xv;
- float yv;
- float zv;
-
- public void updateXYZVals()
- {
+
+ float xv, yv, zv;
+
+ protected void updateXYZVals() {
xv = x.getValuef();
yv = y.getValuef();
- zv = z.getValuef();
+ zv = z.getValuef();
}
public void run(int deltaMs) {
- updateXYZVals();
+ updateXYZVals();
+
float xlv = 100*xl.getValuef();
float ylv = 100*yl.getValuef();
float zlv = 100*zl.getValuef();
colors[p.index] = color(
(hv + p.fz + p.fy*hs.getValuef()) % 360,
min(100, abs(p.fx - s.getValuef())/2.),
- max(0, 100 - mv/2. - mv * abs(i - 7.5))
+ max(0, 100 - mv/2. - mv * abs(i - (strip.metrics.length-1)/2.))
);
++i;
}
final int VIEWPORT_WIDTH = 900;
final int VIEWPORT_HEIGHT = 700;
+// The trailer is measured from the outside of the black metal (but not including the higher welded part on the front)
final float TRAILER_WIDTH = 240;
final float TRAILER_DEPTH = 97;
final float TRAILER_HEIGHT = 33;
-final float BASS_WIDTH = 124;
-final float BASS_HEIGHT = 31.5;
-final float BASS_DEPTH = 66;
-final float BASS_X = (TRAILER_WIDTH - BASS_WIDTH) / 2.;
-final float BASS_Z = (TRAILER_DEPTH - BASS_DEPTH) / 2.;
-
int targetFramerate = 60;
int startMillis, lastMillis;
endShape();
noStroke();
- fill(#393939);
- drawBox(BASS_X, 0, BASS_Z, 0, 0, 0, BASS_WIDTH, BASS_HEIGHT, BASS_DEPTH, Cube.CHANNEL_WIDTH);
+ drawBassBox(glucose.model.bassBox);
+ for (Speaker s : glucose.model.speakers) {
+ drawSpeaker(s);
+ }
for (Cube c : glucose.model.cubes) {
drawCube(c);
}
for (Point p : glucose.model.points) {
stroke(colors[p.index]);
vertex(p.fx, p.fy, p.fz);
- // println(p.fx + ":" + p.fy + ":" + p.fz);
}
endShape();
}
}
+void drawBassBox(BassBox b) {
+ float in = .15;
+
+ noStroke();
+ fill(#191919);
+ pushMatrix();
+ translate(b.x + BassBox.EDGE_WIDTH/2., b.y + BassBox.EDGE_HEIGHT/2, b.z + BassBox.EDGE_DEPTH/2.);
+ box(BassBox.EDGE_WIDTH-20*in, BassBox.EDGE_HEIGHT-20*in, BassBox.EDGE_DEPTH-20*in);
+ popMatrix();
+
+ noStroke();
+ fill(#393939);
+ drawBox(b.x+in, b.y+in, b.z+in, 0, 0, 0, BassBox.EDGE_WIDTH-in*2, BassBox.EDGE_HEIGHT-in*2, BassBox.EDGE_DEPTH-in*2, Cube.CHANNEL_WIDTH-in);
+
+ pushMatrix();
+ translate(b.x + (Cube.CHANNEL_WIDTH-in)/2., b.y + BassBox.EDGE_HEIGHT/2., b.z + in);
+ for (int j = 0; j < 2; ++j) {
+ pushMatrix();
+ for (int i = 0; i < BassBox.NUM_FRONT_STRUTS; ++i) {
+ translate(BassBox.FRONT_STRUT_SPACING, 0, 0);
+ box(Cube.CHANNEL_WIDTH-in, BassBox.EDGE_HEIGHT - in*2, 0);
+ }
+ popMatrix();
+ translate(0, 0, BassBox.EDGE_DEPTH - 2*in);
+ }
+ popMatrix();
+
+ pushMatrix();
+ translate(b.x + in, b.y + BassBox.EDGE_HEIGHT/2., b.z + BassBox.SIDE_STRUT_SPACING + (Cube.CHANNEL_WIDTH-in)/2.);
+ box(0, BassBox.EDGE_HEIGHT - in*2, Cube.CHANNEL_WIDTH-in);
+ translate(BassBox.EDGE_WIDTH-2*in, 0, 0);
+ box(0, BassBox.EDGE_HEIGHT - in*2, Cube.CHANNEL_WIDTH-in);
+ popMatrix();
+
+}
+
void drawCube(Cube c) {
float in = .15;
+ noStroke();
+ fill(#393939);
drawBox(c.x+in, c.y+in, c.z+in, c.rx, c.ry, c.rz, Cube.EDGE_WIDTH-in*2, Cube.EDGE_HEIGHT-in*2, Cube.EDGE_WIDTH-in*2, Cube.CHANNEL_WIDTH-in);
}
+void drawSpeaker(Speaker s) {
+ float in = .15;
+
+ noStroke();
+ fill(#191919);
+ pushMatrix();
+ translate(s.x, s.y, s.z);
+ rotate(s.ry / 180. * PI, 0, -1, 0);
+ translate(Speaker.EDGE_WIDTH/2., Speaker.EDGE_HEIGHT/2., Speaker.EDGE_DEPTH/2.);
+ box(Speaker.EDGE_WIDTH-20*in, Speaker.EDGE_HEIGHT-20*in, Speaker.EDGE_DEPTH-20*in);
+ translate(0, Speaker.EDGE_HEIGHT/2. + Speaker.EDGE_HEIGHT*.8/2, 0);
+
+ fill(#222222);
+ box(Speaker.EDGE_WIDTH*.6, Speaker.EDGE_HEIGHT*.8, Speaker.EDGE_DEPTH*.75);
+ popMatrix();
+
+ noStroke();
+ fill(#393939);
+ drawBox(s.x+in, s.y+in, s.z+in, 0, s.ry, 0, Speaker.EDGE_WIDTH-in*2, Speaker.EDGE_HEIGHT-in*2, Speaker.EDGE_DEPTH-in*2, Cube.CHANNEL_WIDTH-in);
+}
+
+
void drawBox(float x, float y, float z, float rx, float ry, float rz, float xd, float yd, float zd, float sw) {
pushMatrix();
translate(x, y, z);
final float STACKED_RELATIVE = 1;
final float STACKED_REL_SPIN = 2;
+ final float BASS_DEPTH = BassBox.EDGE_DEPTH + 4;
TowerMapping[] mapping = new TowerMapping[] {
-
- new TowerMapping(0, 0, 0, new float[][] {
- {STACKED_RELATIVE, 0, 0},
- {STACKED_RELATIVE, 5, -10, 20},
- {STACKED_RELATIVE, 0, -6},
- {STACKED_RELATIVE, -5, -2, -20},
- }),
- new TowerMapping(Cube.EDGE_WIDTH + 2, 0, 0, new float[][] {
- {STACKED_RELATIVE, 0, 0},
- {STACKED_RELATIVE, 0, 5, 10},
- {STACKED_RELATIVE, 0, 2, 20},
- {STACKED_RELATIVE, 0, 0, 30},
- }),
+ // Front left cubes
+// new TowerMapping(0, 0, 0, new float[][] {
+// {STACKED_RELATIVE, 0, 0},
+// {STACKED_RELATIVE, 5, -10, 20},
+// {STACKED_RELATIVE, 0, -6},
+// {STACKED_RELATIVE, -5, -2, -20},
+// }),
+//
+// new TowerMapping(Cube.EDGE_WIDTH + 2, 0, 0, new float[][] {
+// {STACKED_RELATIVE, 0, 0},
+// {STACKED_RELATIVE, 0, 5, 10},
+// {STACKED_RELATIVE, 0, 2, 20},
+// {STACKED_RELATIVE, 0, 0, 30},
+// }),
// Back Cubes behind DJ platform (in order of increasing x)
new TowerMapping(50, 5, BASS_DEPTH, new float[][] {
}),
// front DJ cubes
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2, BASS_HEIGHT, 10, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2, BassBox.EDGE_HEIGHT, 10, new float[][] {
{STACKED_RELATIVE, 0, 0},
{STACKED_RELATIVE, 0, -10, 20},
}),
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + Cube.EDGE_HEIGHT, BASS_HEIGHT, 10, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2 + Cube.EDGE_HEIGHT, BassBox.EDGE_HEIGHT, 10, new float[][] {
{STACKED_RELATIVE, 3, 0},
{STACKED_RELATIVE, 2, -10, 20},
}),
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 2*Cube.EDGE_HEIGHT + 5, BASS_HEIGHT, 10, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2 + 2*Cube.EDGE_HEIGHT + 5, BassBox.EDGE_HEIGHT, 10, new float[][] {
{STACKED_RELATIVE, 0, 0},
{STACKED_RELATIVE, 1, 0, 10},
}),
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 3*Cube.EDGE_HEIGHT + 9, BASS_HEIGHT, 10, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2 + 3*Cube.EDGE_HEIGHT + 9, BassBox.EDGE_HEIGHT, 10, new float[][] {
{STACKED_RELATIVE, 0, 0},
{STACKED_RELATIVE, -1, 0},
}),
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BASS_HEIGHT, 10, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BassBox.EDGE_HEIGHT, 10, new float[][] {
{STACKED_RELATIVE, 0, 0},
{STACKED_RELATIVE, -1, 0},
}),
// left dj cubes
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2, BASS_HEIGHT, Cube.EDGE_HEIGHT + 2, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2, BassBox.EDGE_HEIGHT, Cube.EDGE_HEIGHT + 2, new float[][] {
{STACKED_RELATIVE, 0, 0},
{STACKED_RELATIVE, 0, 2, 20},
}),
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2, BASS_HEIGHT, 2*Cube.EDGE_HEIGHT + 4, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2, BassBox.EDGE_HEIGHT, 2*Cube.EDGE_HEIGHT + 4, new float[][] {
{STACKED_RELATIVE, 0, 0},
{STACKED_RELATIVE, 0, 2, 20},
}),
// right dj cubes
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BASS_HEIGHT, Cube.EDGE_HEIGHT + 2, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BassBox.EDGE_HEIGHT, Cube.EDGE_HEIGHT + 2, new float[][] {
{STACKED_RELATIVE, 0, 0},
{STACKED_RELATIVE, 0, 2, 20},
}),
- new TowerMapping((TRAILER_WIDTH - BASS_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BASS_HEIGHT, 2*Cube.EDGE_HEIGHT + 4, new float[][] {
+ new TowerMapping((TRAILER_WIDTH - BassBox.EDGE_WIDTH)/2 + 4*Cube.EDGE_HEIGHT + 15, BassBox.EDGE_HEIGHT, 2*Cube.EDGE_HEIGHT + 4, new float[][] {
{STACKED_RELATIVE, 0, 0},
{STACKED_RELATIVE, 0, 2, 20},
}),
- new TowerMapping(200, 0, 0, new float[][] {
- {STACKED_RELATIVE, 0, 10},
- {STACKED_RELATIVE, 5, 0, 20},
- {STACKED_RELATIVE, 0, 4},
- {STACKED_RELATIVE, -5, 8, -20},
- {STACKED_RELATIVE, 0, 3},
- }),
+// new TowerMapping(200, 0, 0, new float[][] {
+// {STACKED_RELATIVE, 0, 10},
+// {STACKED_RELATIVE, 5, 0, 20},
+// {STACKED_RELATIVE, 0, 4},
+// {STACKED_RELATIVE, -5, 8, -20},
+// {STACKED_RELATIVE, 0, 3},
+// }),
- new TowerMapping(0, 0, Cube.EDGE_HEIGHT + 10, new float[][] {
- {STACKED_RELATIVE, 10, 0, 40},
- {STACKED_RELATIVE, 3, -2, 20},
- {STACKED_RELATIVE, 0, 0, 40},
- {STACKED_RELATIVE, 0, 0, 60},
- {STACKED_RELATIVE, 0, 0, 40},
- }),
+// new TowerMapping(0, 0, Cube.EDGE_HEIGHT + 10, new float[][] {
+// {STACKED_RELATIVE, 10, 0, 40},
+// {STACKED_RELATIVE, 3, -2, 20},
+// {STACKED_RELATIVE, 0, 0, 40},
+// {STACKED_RELATIVE, 0, 0, 60},
+// {STACKED_RELATIVE, 0, 0, 40},
+// }),
new TowerMapping(20, 0, 2*Cube.EDGE_HEIGHT + 18, new float[][] {
{STACKED_RELATIVE, 0, 0, 40},
{STACKED_RELATIVE, 12, 0, 40},
}),
- new TowerMapping(210, 0, Cube.EDGE_HEIGHT + 15, new float[][] {
- {STACKED_RELATIVE, 0, 0, 40},
- {STACKED_RELATIVE, 5, 0, 20},
- {STACKED_RELATIVE, 8, 0, 40},
- {STACKED_RELATIVE, 3, 0, 60},
- {STACKED_RELATIVE, 0, 0, 40},
- }),
+// new TowerMapping(210, 0, Cube.EDGE_HEIGHT + 15, new float[][] {
+// {STACKED_RELATIVE, 0, 0, 40},
+// {STACKED_RELATIVE, 5, 0, 20},
+// {STACKED_RELATIVE, 8, 0, 40},
+// {STACKED_RELATIVE, 3, 0, 60},
+// {STACKED_RELATIVE, 0, 0, 40},
+// }),
new TowerMapping(210, 0, 2*Cube.EDGE_HEIGHT + 25, new float[][] {
{STACKED_RELATIVE, 0, 0, 40},
}
towerList.add(new Tower(tower));
}
-
- return new Model(towerList, cubes);
+
+ BassBox bassBox = new BassBox(56, 0, 2);
+
+ List<Speaker> speakers = new ArrayList<Speaker>();
+ speakers.add(new Speaker(-12, 6, 0, 15));
+ speakers.add(new Speaker(TRAILER_WIDTH - Speaker.EDGE_WIDTH, 6, 6, -15));
+
+ return new Model(towerList, cubes, bassBox, speakers);
}
public PandaMapping[] buildPandaList() {
{ 37, 38, 39, 40 }, // ch10
{ 41, 42, 43, 44 }, // ch11
{ 45, 46, 47, 48 }, // ch12
- { 49, 50, 51, 52 }, // ch13
- { 53, 54, 55, 56 }, // ch14
- { 57, 58, 59, 60 }, // ch15
- { 61, 62, 63, 64 }, // ch16
+ { 33, 34, 35, 36 }, // ch13
+ { 37, 38, 39, 40 }, // ch14
+ { 41, 42, 43, 44 }, // ch15
+ { 45, 46, 47, 48 }, // ch16
}),
};