From e7f14d4d86fc5f0228895b610971a032fa096394 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Thu, 22 Aug 2013 01:52:37 -0700 Subject: [PATCH] Add a color fucker effect for global modifications --- SugarCubes.pde | 1 + TestPatterns.pde | 24 ++++++++++++++++++++++++ _Internals.pde | 4 ++++ 3 files changed, 29 insertions(+) diff --git a/SugarCubes.pde b/SugarCubes.pde index 637f7c6..dac639a 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -106,6 +106,7 @@ LXEffect[] effects(GLucose glucose) { new FlashEffect(lx), new BoomEffect(glucose), new DesaturationEffect(lx), + new ColorFuckerEffect(glucose), }; } diff --git a/TestPatterns.pde b/TestPatterns.pde index b2e49f1..ab90d21 100644 --- a/TestPatterns.pde +++ b/TestPatterns.pde @@ -259,6 +259,30 @@ class TestProjectionPattern extends TestPattern { } } +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); diff --git a/_Internals.pde b/_Internals.pde index 580e173..8b2e3da 100644 --- a/_Internals.pde +++ b/_Internals.pde @@ -204,6 +204,10 @@ void draw() { 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 + // TODO(mcslee): move into GLucose engine for (PandaDriver p : pandaBoards) { p.send(colors); -- 2.34.1