}
}
}
+
+class ColorFuckerEffect extends SCEffect {
+
+ BasicParameter hueShift = new BasicParameter("HSHFT", 0);
+ BasicParameter sat = new BasicParameter("SAT", 1);
+ BasicParameter bright = new BasicParameter("BRT", 1);
+
+ ColorFuckerEffect(GLucose glucose) {
+ super(glucose);
+ addParameter(hueShift);
+ addParameter(bright);
+ addParameter(sat);
+ }
+
+ public void doApply(int[] colors) {
+ float bMod = bright.getValuef();
+ float sMod = sat.getValuef();
+ float hMod = hueShift.getValuef();
+ if (bMod < 1 || sMod < 1 || hMod > 0) {
+ for (int i = 0; i < colors.length; ++i) {
+ colors[i] = color(
+ (hue(colors[i]) + hueShift.getValuef()*360.) % 360,
+ saturation(colors[i]) * sat.getValuef(),
+ brightness(colors[i]) * bright.getValuef()
+ );
+ }
+ }
+ }
+}
}
}
-class ColorFuckerEffect extends SCEffect {
-
- BasicParameter hueShift = new BasicParameter("HSHFT", 0);
- BasicParameter sat = new BasicParameter("SAT", 1);
- BasicParameter bright = new BasicParameter("BRT", 1);
-
- ColorFuckerEffect(GLucose glucose) {
- super(glucose);
- addParameter(hueShift);
- addParameter(bright);
- addParameter(sat);
- }
-
- public void doApply(int[] colors) {
- for (int i = 0; i < colors.length; ++i) {
- colors[i] = color(
- (hue(colors[i]) + hueShift.getValuef()*360.) % 360,
- saturation(colors[i]) * sat.getValuef(),
- brightness(colors[i]) * bright.getValuef()
- );
- }
- }
-}
-
class TestCubePattern extends TestPattern {
private SawLFO index = new SawLFO(0, Cube.POINTS_PER_CUBE, Cube.POINTS_PER_CUBE*60);
debugUI.draw();
}
- // TODO(dan): if you want to, here would be a good place to
- // put in gamma correction, modifying the colors that get
- // sent to the pandaboards, without mucking up the UI here
+ // Gamma correction here. Apply a cubic to the brightness
+ // for better representation of dynamic range
+ for (int i = 0; i < colors.length; ++i) {
+ float b = brightness(colors[i]) / 100.f;
+ colors[i] = color(
+ hue(colors[i]),
+ saturation(colors[i]),
+ (b*b*b) * 100.
+ );
+ }
// TODO(mcslee): move into GLucose engine
for (PandaDriver p : pandaBoards) {
return new PandaMapping[] {
new PandaMapping(
"10.200.1.29", new ChannelMapping[] {
- new ChannelMapping(),
- new ChannelMapping(),
- new ChannelMapping(),
- new ChannelMapping(),
- new ChannelMapping(),
- new ChannelMapping(),
- new ChannelMapping(),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
new ChannelMapping(ChannelMapping.MODE_BASS),
new ChannelMapping(ChannelMapping.MODE_STRUTS_AND_FLOOR),
new ChannelMapping(ChannelMapping.MODE_SPEAKER, LEFT_SPEAKER),
new ChannelMapping(ChannelMapping.MODE_SPEAKER, RIGHT_SPEAKER),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
+ new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 1, 2, 3, 4 }),
}),
new PandaMapping(