X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=blobdiff_plain;f=Mappings.pde;h=30d06898c49a5317462ebf11534eb3d0595f1586;hp=8798fb59fea91797853017ed978d5ad191538e71;hb=bffb6a80f723b2795e47e56a7d8eb3d65e9324a5;hpb=30624e974f88224b0a8719b11bd649578eb97ab6 diff --git a/Mappings.pde b/Mappings.pde index 8798fb5..30d0689 100644 --- a/Mappings.pde +++ b/Mappings.pde @@ -23,19 +23,90 @@ static final float FLOOR = 0; * The first value is the offset moving NE (towards back-right). * The second value is the offset moving NW (negative comes forward-right). */ -static final float[][] TOWER_CONFIG = new float[][] { - new float[] { 0, 0, RISER, 4 }, - new float[] { 25, -10, RISER, 4 }, - new float[] { 50, -22.5, FLOOR, 5 }, - new float[] { 17.25, -35.5, FLOOR, 6 }, - new float[] { 43.25, -51.5, RISER, 6 }, - new float[] { 69.25, -56, FLOOR, 6 }, - new float[] { 12.75, -62.5, RISER, 4 }, - new float[] { 38.75, -78.5, FLOOR, 5 }, - new float[] { 65.75, -83, RISER, 5 }, - +static final TowerConfig[] TOWER_CONFIG = { + new TowerConfig("A", 0, 0, RISER, 4), + new TowerConfig("B", 25, -10, RISER, 4), + new TowerConfig("C", 50, -22.5, FLOOR, 5), + new TowerConfig("D", 17.25, -35.5, FLOOR, 6), + new TowerConfig("E", 43.25, -51.5, RISER, 6), + new TowerConfig("F", 69.25, -56, FLOOR, 6), + new TowerConfig("G", 12.75, -62.5, RISER, 4), + new TowerConfig("H", 38.75, -78.5, FLOOR, 5), + new TowerConfig("I", 65.75, -83, RISER, 5), + new TowerConfig("J", 11.75, -89, RISER, 3), + new TowerConfig("K", -50, -28, FLOOR, 3), + new TowerConfig("L", -14, -28, FLOOR, 4), + new TowerConfig("M", -16, -81, FLOOR, 3), + new TowerConfig("N", -56, 8, FLOOR, 2), + new TowerConfig("O", -9, 27, RISER, 2), + new TowerConfig("P", -28, 0, RISER, 3), + new TowerConfig("Q", -14, 54, FLOOR, 2), + new TowerConfig("R", -30, -54, RISER, 2), }; +/** + * Mappings for the output drivers. Can mix grizzly boards with + * panda boards in here no problem. + */ +IPOutput[] buildOutputs() throws SocketException, UnknownHostException { + return new IPOutput[] { +// new GrizzlyOutput(lx, "192.168.88.100", 0, 0, 0, 39, 38, 40, 0, 37, 35, 0, 21, 20, 22, 0, 33, 32 ), +// new GrizzlyOutput(lx, "192.168.88.104", 0, 13, 12, 0, 1, 2, 6, 5, 7, 0, 0, 4, 3, 9, 10, 11 ), +// new GrizzlyOutput(lx, "192.168.88.105", 42, 41, 0, 43, 45, 44, 0, 0, 0, 0, 0, 0, 0, 24, 23, 25 ), +// new GrizzlyOutput(lx, "192.168.88.107", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), + + new PandaOutput(lx, "10.200.1.29", new String[][] { + new String[] { "00", "00", "00", "00" }, // 1 + new String[] { "00", "00", "00", "00" }, // 2 + new String[] { "E1", "E2", "E3", "E4" }, // 3 + new String[] { "E5", "E6", "D5", "D6" }, // 4 + new String[] { "H2", "H3", "H4", "H5" }, // 5 + new String[] { "G1", "G2", "G3", "G4" }, // 6 + new String[] { "00", "00", "00", "00" }, // 7 + new String[] { "D1", "D2", "D3", "D4" }, // 8 + }), + + new PandaOutput(lx, "10.200.1.30", new String[][] { + new String[] { "00", "00", "00", "00" }, // 1 + new String[] { "J1", "J2", "J3", "00" }, // 2 + new String[] { "B1", "B2", "B3", "B4" }, // 3 + new String[] { "K1", "K2", "K3", "00" }, // 4 + new String[] { "F1", "F2", "F3", "F4" }, // 5 + new String[] { "L1", "L2", "L3", "L4" }, // 6 + new String[] { "C1", "C2", "C3", "C4" }, // 7 + new String[] { "I1", "I2", "I3", "I4" }, // 8 + }), + + new PandaOutput(lx, "10.200.1.31", new String[][] { + new String[] { "00", "00", "00", "00" }, // 1 + new String[] { "00", "00", "00", "00" }, // 2 + new String[] { "A1", "A2", "A3", "A4" }, // 3 + new String[] { "M1", "M2", "M3", "00" }, // 4 + new String[] { "N1", "N2", "O1", "O2" }, // 5 + new String[] { "C5", "F5", "F6", "I5" }, // 6 + new String[] { "P1", "P2", "P3", "00" }, // 7 + new String[] { "Q1", "Q2", "R1", "R2" }, // 8 + }), + + }; +} + +static class TowerConfig { + public final String id; + public final float x; + public final float z; + public final float base; + public final int numCubes; + + public TowerConfig(String id, float z, float x, float base, int numCubes) { + this.id = id; + this.x = x; + this.z = z; + this.base = base; + this.numCubes = numCubes; + } +} + public Model buildModel() { List towers = new ArrayList(); @@ -44,11 +115,11 @@ public Model buildModel() { float rt2 = sqrt(2); float x, y, z, xd, zd, num; - for (float[] tc : TOWER_CONFIG) { - x = -tc[1]; - z = tc[0]; - y = tc[2]; - num = tc[3]; + for (TowerConfig tc : TOWER_CONFIG) { + x = -tc.x; + z = tc.z; + y = tc.base; + num = tc.numCubes; if (z < x) { zd = -(x-z)/rt2; xd = z*rt2 - zd; @@ -58,12 +129,12 @@ public Model buildModel() { } List tower = new ArrayList(); for (int n = 0; n < num; ++n) { - Cube cube = new Cube(xd + 24, y, zd + 84, 0, -45, 0); + Cube cube = new Cube(tc.id + (n+1), xd + 24, y, zd + 84, 0, -45, 0); tower.add(cube); cubes[cubeIndex++] = cube; y += SPACING; } - towers.add(new Tower(tower)); + towers.add(new Tower(tc.id, tower)); } return new Model(towers, cubes);