From: Mark Slee Date: Wed, 7 Aug 2013 06:57:43 +0000 (-0700) Subject: New test pattern and make cubes block out back lights that aren't actually visible... X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=commitdiff_plain;h=254d34c098c28b006e88a830cc0d00c60b37f3f7 New test pattern and make cubes block out back lights that aren't actually visible in reality --- 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) {