Revision 2fa9c672 examples/bunny/processing/cuberotate/cuberotate.pde

View differences:

examples/bunny/processing/cuberotate/cuberotate.pde
15 15

  
16 16
// Serial port state.
17 17
Serial       port;
18
String       buffer = "";
19 18
final String serialConfigFile = "serialconfig.txt";
20 19
boolean      printSerial = false;
21 20

  
......
23 22
GPanel    configPanel;
24 23
GDropList serialList;
25 24
GLabel    serialLabel;
25
GLabel    calLabel;
26 26
GCheckbox printSerialCheckbox;
27 27

  
28 28
void setup()
29 29
{
30
  size(400, 550, OPENGL);
30
  size(640, 480, OPENGL);
31 31
  frameRate(30);
32 32
  model = new OBJModel(this);
33 33
  model.load("bunny.obj");
......
58 58
  serialList = new GDropList(this, 90, 20, 200, 200, 6);
59 59
  serialList.setItems(availablePorts, selectedPort);
60 60
  configPanel.addControl(serialList);
61
  calLabel = new GLabel(this, 300, 20, 350, 25, "Calibration: Sys=? Gyro=? Accel=? Mag=?");
62
  configPanel.addControl(calLabel); 
61 63
  printSerialCheckbox = new GCheckbox(this, 5, 50, 200, 20, "Print serial data");
62 64
  printSerialCheckbox.setSelected(printSerial);
63 65
  configPanel.addControl(printSerialCheckbox);
......
78 80
  pointLight(200, 200, 255, -400, 400,  500);
79 81
  pointLight(255, 255, 255,    0,   0, -500);
80 82
  
81
  // Displace objects from 0,0
82
  translate(200, 300, 0);
83
  // Move bunny from 0,0 in upper left corner to roughly center of screen.
84
  translate(300, 380, 0);
83 85
  
84 86
  // Rotate shapes around the X/Y/Z axis (values in radians, 0..Pi*2)
85 87
  rotateZ(radians(roll));
......
109 111
      roll  = float(list[3]); // Roll = Z
110 112
      pitch = float(list[2]); // Pitch = Y 
111 113
      yaw   = float(list[1]); // Yaw/Heading = X
112
      buffer = incoming;
113 114
    }
114 115
    if ( (list.length > 0) && (list[0].equals("Alt:")) ) 
115 116
    {
116 117
      alt  = float(list[1]);
117
      buffer = incoming;
118 118
    }
119 119
    if ( (list.length > 0) && (list[0].equals("Temp:")) ) 
120 120
    {
121 121
      temp  = float(list[1]);
122
      buffer = incoming;
122
    }
123
    if ( (list.length > 0) && (list[0].equals("Calibration:")) )
124
    {
125
      int sysCal   = int(list[1]);
126
      int gyroCal  = int(list[2]);
127
      int accelCal = int(list[3]);
128
      int magCal   = int(list[4]);
129
      calLabel.setText("Calibration: Sys=" + sysCal + " Gyro=" + gyroCal + " Accel=" + accelCal + " Mag=" + magCal);
123 130
    }
124 131
  }
125 132
}
......
161 168
  if (checkbox == printSerialCheckbox) {
162 169
    printSerial = printSerialCheckbox.isSelected(); 
163 170
  }
164
}
171
}

Also available in: Unified diff