- for (int index : points) {
- int c = (index < 0) ? 0 : colors[index];
- byte r = (byte) ((c >> 16) & 0xFF);
- byte g = (byte) ((c >> 8) & 0xFF);
- byte b = (byte) ((c) & 0xFF);
- packet[len++] = 0; // alpha channel, unused but makes for 4-byte alignment
- packet[len++] = r;
- packet[len++] = g;
- packet[len++] = b;
-
- // Flush once packet is full buffer size
- if (len >= packet.length) {
- sendPacket(packetNum++);
- len = 0;
+ for (ChannelMapping channel : pm.channelList) {
+ for (int rawCubeIndex : channel.objectIndices) {
+ if (rawCubeIndex > 0) {
+ Cube cube = _model.getCubeByRawIndex(rawCubeIndex);
+
+ // TODO(mcslee): clean this up, precompute paths
+ for (int stripIndex : GRIZZLY_STRIP_ORDERING) {
+ Strip strip = cube.strips.get(stripIndex);
+ int stripLen = ((stripIndex == 9) || (stripIndex == 16)) ? 15 : 16;
+ for (int i = stripLen-1; i >= 0; --i) {
+ int c = colors[strip.points.get(i).index];
+ byte r = (byte) ((c >> 16) & 0xFF);
+ byte g = (byte) ((c >> 8) & 0xFF);
+ byte b = (byte) ((c) & 0xFF);
+ packet[len++] = (byte) 0; // alpha channel, unused but makes for 4-byte alignment
+ packet[len++] = (byte) r;
+ packet[len++] = (byte) g;
+ packet[len++] = (byte) b;
+ }
+ }
+
+// for (LXPoint p : cube.points) {
+// int c = (p.index < 0) ? 0 : colors[p.index];
+// byte r = (byte) ((c >> 16) & 0xFF);
+// byte g = (byte) ((c >> 8) & 0xFF);
+// byte b = (byte) ((c) & 0xFF);
+// packet[len++] = (byte) 0; // alpha channel, unused but makes for 4-byte alignment
+// packet[len++] = (byte) r;
+// packet[len++] = (byte) g;
+// packet[len++] = (byte) b;
+// }
+ }