Merge branch 'master' of https://github.com/sugarcubes/SugarCubes
[SugarCubes.git] / _PandaDriver.pde
index 7fd45c0acc8134d699e25a7293963c47e5129f4b..ad870aaa9d59aacc6a1d1630b0720114a864752b 100644 (file)
@@ -23,7 +23,7 @@ public class PandaDriver {
   private final OscMessage message;
 
   // List of point indices on the board
-  private final List<Integer> points;
+  private final int[] points;
 
   // Bit for flipped status of each point index
   private final boolean[] flipped;
@@ -34,7 +34,12 @@ public class PandaDriver {
   public PandaDriver(NetAddress address, Model model, int[][] channelList, int[][] flippedList) {
     this.address = address;
     message = new OscMessage("/shady/pointbuffer");
-    points = buildMappedList(model, channelList);
+    List<Integer> pointList = buildMappedList(model, channelList);
+    points = new int[pointList.size()];
+    int i = 0;
+    for (int value : pointList) {
+      points[i++] = value;
+    }
     flipped = buildFlippedList(model, flippedList);
   }
 
@@ -43,7 +48,7 @@ public class PandaDriver {
     for (int[] channel : channelList) {
       for (int cubeNumber : channel) {
         if (cubeNumber == 0) {
-          for (int i = 0; i < (Cube.CLIPS_PER_CUBE*Clip.STRIPS_PER_CLIP*Strip.POINTS_PER_STRIP); ++i) {
+          for (int i = 0; i < (Cube.FACES_PER_CUBE*Face.STRIPS_PER_FACE*Strip.POINTS_PER_STRIP); ++i) {
             points.add(0);
           }
         } else {
@@ -70,12 +75,11 @@ public class PandaDriver {
       Cube cube = model.getCubeByRawIndex(cubeNumber);
       if (cube == null) {
         throw new RuntimeException("Non-existing cube specified in flipped RGB mapping (" + cubeNumber + ")");
-      } else {
-        for (int i = 1; i < cubeInfo.length; ++i) {
-          int stripIndex = cubeInfo[i];
-          for (Point p : cube.strips.get(stripIndex-1).points) {
-            flipped[p.index] = true;
-          }
+      }
+      for (int i = 1; i < cubeInfo.length; ++i) {
+        int stripIndex = cubeInfo[i];
+        for (Point p : cube.strips.get(stripIndex-1).points) {
+          flipped[p.index] = true;
         }
       }
     }