From 254d34c098c28b006e88a830cc0d00c60b37f3f7 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Tue, 6 Aug 2013 23:57:43 -0700 Subject: [PATCH] New test pattern and make cubes block out back lights that aren't actually visible in reality --- SugarCubes.pde | 3 ++- TestPatterns.pde | 25 +++++++++++++++++++++++++ _Internals.pde | 3 ++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/SugarCubes.pde b/SugarCubes.pde index 5504001..801e293 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -35,7 +35,8 @@ LXPattern[] patterns(GLucose glucose) { new CubeEQ(glucose), new PianoKeyPattern(glucose), - // Basic test patterns for reference, not art + // Basic test patterns for reference, not art +// new TestCubePattern(glucose), // new TestHuePattern(glucose), // new TestXPattern(glucose), // new TestYPattern(glucose), diff --git a/TestPatterns.pde b/TestPatterns.pde index d7d5625..c4432ab 100644 --- a/TestPatterns.pde +++ b/TestPatterns.pde @@ -134,6 +134,31 @@ class TestProjectionPattern extends SCPattern { } } +class TestCubePattern extends SCPattern { + + private int POINTS_PER_CUBE = Cube.FACES_PER_CUBE * Face.STRIPS_PER_FACE * Strip.POINTS_PER_STRIP; + private SawLFO index = new SawLFO(0, POINTS_PER_CUBE, POINTS_PER_CUBE*60); + + TestCubePattern(GLucose glucose) { + super(glucose); + addModulator(index).start(); + } + + public void run(int deltaMs) { + for (Cube c : model.cubes) { + int i = 0; + for (Point p : c.points) { + colors[p.index] = color( + lx.getBaseHuef(), + 100, + max(0, 100 - 80.*abs(i - index.getValuef())) + ); + ++i; + } + } + } +} + class MappingTool extends SCPattern { private int cubeIndex = 0; diff --git a/_Internals.pde b/_Internals.pde index 7dcf175..8b9163d 100644 --- a/_Internals.pde +++ b/_Internals.pde @@ -220,7 +220,8 @@ void draw() { } void drawCube(Cube c) { - drawBox(c.x, c.y, c.z, c.rx, c.ry, c.rz, Cube.EDGE_WIDTH, Cube.EDGE_HEIGHT, Cube.EDGE_WIDTH, Cube.CHANNEL_WIDTH); + float in = .15; + 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 drawBox(float x, float y, float z, float rx, float ry, float rz, float xd, float yd, float zd, float sw) { -- 2.34.1