- for (int[] channel : pm.channelList) {
- for (int cubeNumber : channel) {
- if (cubeNumber <= 0) {
- for (int i = 0; i < Cube.POINTS_PER_CUBE; ++i) {
- points[pi++] = 0;
+ for (ChannelMapping channel : pm.channelList) {
+ switch (channel.mode) {
+ case ChannelMapping.MODE_CUBES:
+ for (int rawCubeIndex : channel.objectIndices) {
+ if (rawCubeIndex < 0) {
+ for (int i = 0; i < Cube.POINTS_PER_CUBE; ++i) {
+ points[pi++] = NO_POINT;
+ }
+ } else {
+ Cube cube = model.getCubeByRawIndex(rawCubeIndex);
+ int stripOrderIndex = 0;
+ switch (cube.wiring) {
+ case FRONT_LEFT: stripOrderIndex = 0; break;
+ case FRONT_RIGHT: stripOrderIndex = 1; break;
+ case REAR_LEFT: stripOrderIndex = 2; break;
+ case REAR_RIGHT: stripOrderIndex = 3; break;
+ }
+ for (int stripIndex : stripOrderings[stripOrderIndex]) {
+ Strip s = cube.strips.get(stripIndex);
+ for (int j = s.points.size() - 1; j >= 0; --j) {
+ points[pi++] = s.points.get(j).index;
+ }
+ }
+ }