-public Model buildModel() {
-
-
- // Shorthand helpers for specifying wiring more quickly
- final Cube.Wiring WFL = Cube.Wiring.FRONT_LEFT;
- final Cube.Wiring WFR = Cube.Wiring.FRONT_RIGHT;
- final Cube.Wiring WRL = Cube.Wiring.REAR_LEFT;
- final Cube.Wiring WRR = Cube.Wiring.REAR_RIGHT;
-
- final float CH = Cube.EDGE_HEIGHT;
-
- final float BBY = BassBox.EDGE_HEIGHT + BoothFloor.PLEXI_WIDTH;
- final float BBX = 56;
- final float BBZ = 2;
-
-
- // The model is represented as an array of towers. The cubes in the tower
- // are represenented relatively. Each tower has an x, y, z reference position,
- // which is typically the base cube's bottom left corner.
- //
- // Following that is an array of floats. A 2-d array contains an x-offset
- // and a z-offset from the previous reference position. Typically the first cube
- // will just be {0, 0}. Each successive cube uses the position of the previous
- // cube as its reference.
- //
- // A 3-d array contains an x-offset, a z-offset, and a rotation about the
- // y-axis.
- //
- // The cubes automatically increment their y-position by Cube.EDGE_HEIGHT.
- TowerMapping[] towerCubes = new TowerMapping[] {
-
- // DJ booth, from left to right
- new TowerMapping(BBX, BBY, BBZ, new CubeMapping[] {
- new CubeMapping(-7.25, 7.5, -25, WFR),
- new CubeMapping(7.5, -15.75, 12, WRL),
- }),
- new TowerMapping(BBX, BBY, BBZ, new CubeMapping[] {
- new CubeMapping(19.625, 5.375, -22, WFR),
- new CubeMapping(8, -14.5, 10, WRR),
- }),
- new TowerMapping(BBX, BBY, BBZ, new CubeMapping[] {
- new CubeMapping(48, 4.75, -35, WRL),
- new CubeMapping(8, -15, 10, WRR),
- }),
- new TowerMapping(BBX, BBY, BBZ, new CubeMapping[] {
- new CubeMapping(78.75, 3.75, -28, WRR),
- new CubeMapping(8, -15, 10, WRR),
- }),
- new TowerMapping(BBX, BBY, BBZ, new CubeMapping[] {
- new CubeMapping(104.75, 0, -27, WRL),
- new CubeMapping(8, -15, 10, WFL),
- }),
-
- };
-
- // Single cubes can be constructed directly here if you need them
- Cube[] singleCubes = new Cube[] {
- // new Cube(x, y, z, rx, ry, rz, wiring),
- };
-
- // The bass box!
- BassBox bassBox = new BassBox(BBX, 0, BBZ);
-
- // The speakers!
- List<Speaker> speakers = Arrays.asList(new Speaker[] {
- new Speaker(-12, 6, 0, 15),
- new Speaker(TRAILER_WIDTH - Speaker.EDGE_WIDTH + 8, 6, 3, -15)
- });
-
- // These guts just convert the shorthand mappings into usable objects
- ArrayList<Tower> towerList = new ArrayList<Tower>();
- ArrayList<Cube> tower;
- Cube[] cubes = new Cube[80];
- int cubeIndex = 1;
- float px, pz, ny;
- for (TowerMapping tm : towerCubes) {
- px = tm.x;
- ny = tm.y;
- pz = tm.z;
- tower = new ArrayList<Cube>();
- for (CubeMapping cm : tm.cubeMappings) {
- tower.add(cubes[cubeIndex++] = new Cube(px = px + cm.dx, ny, pz = pz + cm.dz, 0, cm.ry, 0, cm.wiring));
- ny += Cube.EDGE_HEIGHT;
- }
- towerList.add(new Tower(tower));
- }
- for (Cube cube : singleCubes) {
- cubes[cubeIndex++] = cube;
- }
-
- return new Model(towerList, cubes, bassBox, speakers);
-}
-
-public PandaMapping[] buildPandaList() {
- return new PandaMapping[] {
- new PandaMapping(
- "10.200.1.29", new ChannelMapping[] {
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- new ChannelMapping(ChannelMapping.MODE_CUBES, new int[] { 5, 6, 4, 3 }),
- }),
-
- new PandaMapping(
- "10.200.1.28", new ChannelMapping[] {
- new ChannelMapping(ChannelMapping.MODE_BASS),
- new ChannelMapping(ChannelMapping.MODE_FLOOR),
- new ChannelMapping(ChannelMapping.MODE_SPEAKER, 0),
- new ChannelMapping(ChannelMapping.MODE_SPEAKER, 1),
- }),
- };
-}
-
-class TowerMapping {
- public final float x, y, z;
- public final CubeMapping[] cubeMappings;
-
- TowerMapping(float x, float y, float z, CubeMapping[] cubeMappings) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.cubeMappings = cubeMappings;
- }
-}
-
-class CubeMapping {
- public final float dx, dz, ry;
- public final Cube.Wiring wiring;
-
- CubeMapping(float dx, float dz, Cube.Wiring wiring) {
- this(dx, dz, 0, wiring);
- }
-
- CubeMapping(float dx, float dz, float ry) {
- this(dz, dz, ry, Cube.Wiring.FRONT_LEFT);
- }
-
- CubeMapping(float dx, float dz, float ry, Cube.Wiring wiring) {
- this.dx = dx;
- this.dz = dz;
- this.ry = ry;
- this.wiring = wiring;
- }
-}