for (Point p : model.points) {
float b = max(0, bVal - 3*dist(p.x, p.y, xPos, yVal));
if (b > 0) {
- colors[p.index] = blendColor(colors[p.index], color(
+ colors[p.index] = blendColor(colors[p.index], lx.hsb(
(lx.getBaseHuef() + abs(p.x - model.cx) + abs(p.y - model.cy)) % 360,
100,
b
float falloff = 100. / (3 + sz.getValuef() * 36 + fPos * beatAmount.getValuef()*48);
for (Point p : model.points) {
int g = (int) constrain((p.x - model.xMin) * NUM_DIVISIONS / (model.xMax - model.xMin), 0, NUM_DIVISIONS-1);
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
(lx.getBaseHuef() + abs(p.x - model.cx)*.8 + p.y*.4) % 360,
constrain(130 - p.y*.8, 0, 100),
max(0, 100 - abs(p.y - gravity[g].getValuef())*falloff)
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) {
- colors[p.index] = blendColor(colors[p.index], color(
+ colors[p.index] = blendColor(colors[p.index], lx.hsb(
(lx.getBaseHuef() + p.y*.5 + abs(model.cx - p.x) * .5) % 360,
max(0, 100 - .45*(p.y - flrLevel)),
b
for (Strip strip : model.strips) {
int i = 0;
for (Point p : strip.points) {
- colors[p.index] = color(
+ 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),
max(0, 100 - fVal*abs(i - pVal*(strip.metrics.numPoints - 1)))
int i = 0;
for (Point p : strip.points) {
float fV = max(-1, 1 - dist(p.x/2., p.y, fX.getValuef()/2., fY.getValuef()) / 64.);
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
(lx.getBaseHuef() + 0.3 * abs(p.x - hOffX.getValuef())) % 360,
constrain(80 + 40 * fV, 0, 100),
constrain(100 - (30 - fV * falloff.getValuef()) * modDist(i + (s*63)%61, offset.getValuef() * strip.metrics.numPoints, strip.metrics.numPoints), 0, 100)
value /= 5.;
float b = constrain(8 * (value*model.yMax - abs(p.y-model.yMax/2.)), 0, 100);
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
(lx.getBaseHuef() + abs(p.y - model.cy) + abs(p.x - model.cx)) % 360,
constrain(bassLevel*240 - .6*dist(p.x, p.y, model.cx, model.cy), 0, 100),
b
float value = lerp(smoothValue, chunkyValue, blockiness.getValuef());
float b = constrain(edgeConst * (value*model.yMax - p.y), 0, 100);
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
(480 + lx.getBaseHuef() - min(clrConst*p.y, 120)) % 360,
100,
b
for (Point p : model.points) {
colors[p.index] = blendColor(
colors[p.index],
- color(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)),
+ 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)),
ADD);
}
}
float levelf = level.getValuef();
for (Cube c : model.cubes) {
float v = max(getBase(i).getValuef() * levelf/4., getEnvelope(i++).getValuef());
- setColor(c, color(
+ setColor(c, lx.hsb(
(huef + 20*v + abs(c.cx-model.xMax/2.)*.3 + c.cy) % 360,
min(100, 120*v),
100*v
for (Point p : model.points) {
color c = 0;
- c = blendColor(c, color(
+ c = blendColor(c, lx.hsb(
(lx.getBaseHuef() + p.x/10 + p.y/3) % 360,
constrain(140 - 1.1*abs(p.x - model.xMax/2.), 0, 100),
max(0, xlv - xwv*abs(p.x - xv))
), ADD);
- c = blendColor(c, color(
+ c = blendColor(c, lx.hsb(
(lx.getBaseHuef() + 80 + p.y/10) % 360,
constrain(140 - 2.2*abs(p.y - model.yMax/2.), 0, 100),
max(0, ylv - ywv*abs(p.y - yv))
), ADD);
- c = blendColor(c, color(
+ c = blendColor(c, lx.hsb(
(lx.getBaseHuef() + 160 + p.z / 10 + p.y/2) % 360,
constrain(140 - 2.2*abs(p.z - model.zMax/2.), 0, 100),
max(0, zlv - zwv*abs(p.z - zv))
int i = 0;
float mv = m[si % m.length].getValuef();
for (Point p : strip.points) {
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
(hv + p.z + p.y*hs.getValuef()) % 360,
min(100, abs(p.x - s.getValuef())/2.),
max(0, 100 - mv/2. - mv * abs(i - (strip.metrics.length-1)/2.))
int i = 0;
for (Strip strip : model.strips) {
for (Point p : strip.points) {
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
(huev + i*constrain(cv, 0, 2) + p.z/2. + p.x/4.) % 360,
min(100, abs(p.y-sv)),
max(0, 100 - 50*abs((i%NUM) - mv))
d = min(d, abs(plane.av*(p.x-model.cx) + plane.bv*(p.y-model.cy) + plane.cv) / plane.denom);
}
}
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
(huev + abs(p.x-model.cx)*.3 + p.y*.8) % 360,
max(0, 100 - .8*abs(p.x - model.cx)),
constrain(140 - 10.*d, 0, 100)
float denom = sqrt(av*av + bv*bv + cv*cv);
for (Point 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] = color(
+ colors[p.index] = lx.hsb(
(hv + abs(p.x-model.cx)*.6 + abs(p.y-model.cy)*.9 + abs(p.z - model.cz)) % 360,
constrain(110 - d*6, 0, 100),
constrain(130 - 7*d, 0, 100)
int i = (int) constrain((model.xMax - p.x) / model.xMax * FRAME_WIDTH, 0, FRAME_WIDTH-1);
int pos = (index + FRAME_WIDTH - i) % FRAME_WIDTH;
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
(360 + lx.getBaseHuef() + .8*abs(p.x-model.cx)) % 360,
100,
constrain(9 * (bass[pos]*model.cy - abs(p.y - model.cy)), 0, 100)
);
- colors[p.index] = blendColor(colors[p.index], color(
+ colors[p.index] = blendColor(colors[p.index], lx.hsb(
(400 + lx.getBaseHuef() + .5*abs(p.x-model.cx)) % 360,
60,
constrain(5 * (treble[pos]*.6*model.cy - abs(p.y - model.cy)), 0, 100)
for (Strip strip : speaker.strips) {
float b = 100;
for (Point p : strip.points) {
- colors[p.index] = color(h % 360, 100, b);
+ colors[p.index] = lx.hsb(h % 360, 100, b);
b = max(0, b - 10);
}
h += 70;
for (int si : strips) {
float b = 100;
for (Point p : model.bassBox.strips.get(si).points) {
- colors[p.index] = color(h % 360, 100, b);
+ colors[p.index] = lx.hsb(h % 360, 100, b);
b = max(0, b - 10);
}
h += 70;
for (int si : strutIndices) {
float b = 100;
for (Point p : model.bassBox.struts.get(si).points) {
- colors[p.index] = color(h % 360, 100, b);
+ colors[p.index] = lx.hsb(h % 360, 100, b);
b = max(0, b - 10);
}
h += 50;
for (int fi : floorIndices) {
float b = 100;
for (Point p : model.boothFloor.strips.get(fi).points) {
- colors[p.index] = color(h, 100, b);
+ colors[p.index] = lx.hsb(h, 100, b);
b = max(0, b - 3);
}
h += 90;
}
}
+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) {
+ if (iter.getValuef() > 0.5) {
+ for (int i = 0; i < colors.length; ++i) {
+ float x = 1;
+ for (int j = 0; j < ops.getValuef() * 30; ++j) {
+ x *= random(0, 1);
+ }
+ colors[i] = lx.hsb(
+ (lx.getBaseHuef() + model.px[i]*.2 + model.py[i]*.4) % 360,
+ 100,
+ 100
+ );
+ }
+ } else {
+ for (Point p : model.points) {
+ float x = 1;
+ for (int j = 0; j < ops.getValuef() * 30; ++j) {
+ x *= random(0, 1);
+ }
+ colors[p.index] = lx.hsb(
+ (lx.getBaseHuef() + p.x*.2 + p.y*.4) % 360,
+ 100,
+ 100
+ );
+ }
+ }
+ }
+}
+
class TestStripPattern extends TestPattern {
SinLFO d = new SinLFO(4, 40, 4000);
public void run(double deltaMs) {
for (Strip s : model.strips) {
for (Point p : s.points) {
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
lx.getBaseHuef(),
100,
max(0, 100 - d.getValuef()*dist(p.x, p.y, s.cx, s.cy))
// Access the core master hue via this method call
float hv = lx.getBaseHuef();
for (int i = 0; i < colors.length; ++i) {
- colors[i] = color(hv, 100, 100);
+ colors[i] = lx.hsb(hv, 100, 100);
}
}
}
// values. The further away this point is from an exact
// point, the more we decrease its brightness
float bv = max(0, 100 - abs(p.x - xPos.getValuef()));
- colors[p.index] = color(hv, 100, bv);
+ colors[p.index] = lx.hsb(hv, 100, bv);
}
}
}
float hv = lx.getBaseHuef();
for (Point p : model.points) {
float bv = max(0, 100 - abs(p.y - yPos.getValuef()));
- colors[p.index] = color(hv, 100, bv);
+ colors[p.index] = lx.hsb(hv, 100, bv);
}
}
}
float hv = lx.getBaseHuef();
for (Point p : model.points) {
float bv = max(0, 100 - abs(p.z - zPos.getValuef()));
- colors[p.index] = color(hv, 100, bv);
+ colors[p.index] = lx.hsb(hv, 100, bv);
}
}
}
int ti = 0;
for (Tower t : model.towers) {
for (Point p : t.points) {
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
lx.getBaseHuef(),
100,
max(0, 100 - 80*LXUtils.wrapdistf(ti, towerIndex.getValuef(), model.towers.size()))
float d = sqrt(c.x*c.x + c.y*c.y + c.z*c.z); // distance from origin
// d = abs(d-60) + max(0, abs(c.z) - 20); // life saver / ring thing
d = max(0, abs(c.y) - 10 + .1*abs(c.z) + .02*abs(c.x)); // plane / spear thing
- colors[c.index] = color(
+ colors[c.index] = lx.hsb(
(hv + .6*abs(c.x) + abs(c.z)) % 360,
100,
constrain(140 - 40*d, 0, 100)
for (Cube c : model.cubes) {
int i = 0;
for (Point p : c.points) {
- colors[p.index] = color(
+ colors[p.index] = lx.hsb(
lx.getBaseHuef(),
100,
max(0, 100 - 80.*abs(i - index.getValuef()))
}
public void run(double deltaMs) {
- color off = color(0, 0, 0);
+ color off = #000000;
color c = off;
color r = #FF0000;
color g = #00FF00;
MappingTool mappingTool;
PandaDriver[] pandaBoards;
MidiEngine midiEngine;
+color[] threadColors;
// Display configuration mode
boolean mappingMode = false;
glucose = new GLucose(this, buildModel());
lx = glucose.lx;
lx.enableKeyboardTempo();
+ threadColors = new color[lx.total];
logTime("Built GLucose engine");
// Set the patterns
void draw() {
// Draws the simulation and the 2D UI overlay
background(40);
- color[] colors = glucose.getColors();
+ color[] simulationColors;
+ color[] sendColors;
+ simulationColors = sendColors = glucose.getColors();
String displayMode = uiCrossfader.getDisplayMode();
if (displayMode == "A") {
- colors = lx.engine.getDeck(0).getColors();
+ simulationColors = lx.engine.getDeck(0).getColors();
} else if (displayMode == "B") {
- colors = lx.engine.getDeck(1).getColors();
+ simulationColors = lx.engine.getDeck(1).getColors();
}
if (debugMode) {
- debugUI.maskColors(colors);
+ debugUI.maskColors(simulationColors);
+ debugUI.maskColors(sendColors);
}
camera(
strokeWeight(2);
beginShape(POINTS);
for (Point p : glucose.model.points) {
- stroke(colors[p.index]);
+ stroke(simulationColors[p.index]);
vertex(p.x, p.y, p.z);
}
endShape();
// 2D Overlay UI
drawUI();
- // Send output colors
- color[] sendColors = glucose.getColors();
- if (debugMode) {
- debugUI.maskColors(sendColors);
- }
-
// Gamma correction here. Apply a cubic to the brightness
// for better representation of dynamic range
for (int i = 0; i < sendColors.length; ++i) {
}
}
break;
+ case 't':
+ if (!midiEngine.isQwertyEnabled()) {
+ lx.engine.setThreaded(!lx.engine.isThreaded());
+ }
+ break;
case 'p':
for (PandaDriver p : pandaBoards) {
p.toggle();