Hey guys,
I am trying to read a skel file and create a skeleton from it, but I don't understand how to do the joint class. Here is what i have now:
this is the main class.
public static void main(String[] args) {
// Frame frame = new Frame("Simple JOGL Application");
// GLCanvas canvas = new GLCanvas();
/* canvas.addGLEventListener(new SkelProjectJOGL());
frame.add(canvas);
frame.setSize(640, 480);
final Animator animator = new Animator(canvas);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
// Run this on another thread than the AWT event queue to
// make sure the call to Animator.stop() completes before
// exiting
new Thread(new Runnable() {
public void run() {
animator.stop();
System.exit(0);
}
}).start();
}
});
// Center frame
frame.setLocationRelativeTo(null);
frame.setVisible(true);
animator.start();*/
String skel = "";
try {
byte[] buffer = new byte[(int) new File("test.skel").length()];
BufferedInputStream f = new BufferedInputStream(new FileInputStream("test.skel"));
f.read(buffer);
skel = new String(buffer);
//System.out.println("This is the file content:" + skel);
} catch (java.io.IOException e) {
System.out.println("Can't find test.skel");
}
StringTokenizer t = new StringTokenizer(skel);
while (t.hasMoreTokens())
{
//Stack root_stk = new Stack();
//if (t.nextToken().equals("balljoint") )
System.out.println(t.nextToken());
//System.out.println("here");
/*if (t.nextToken().equals("root")) {
if (t.nextToken().equals("{")) {
System.out.println(t.nextToken());
// while (!t.nextToken().equals("}"))
// System.out.println(t.nextToken());
//root_stk.push(t.nextToken());
}
}*/
// System.out.println(root_stk);
//else
// System.out.println("No balljoint found");
}
}
here is the data in the .skel file:
balljoint root {
offset 0 0 0
boxmin -0.2 -0.3 -0.15
boxmax 0.2 0.3 0.15
pose 0 0.1 0
balljoint head {
offset 0 0.3 0
boxmin -0.1 0 -0.1
boxmax 0.1 0.2 0.1
}
balljoint hip_l {
offset -0.1 -0.3 0
boxmin -0.05 -0.3 -0.05
boxmax 0.05 0 0.05
balljoint knee_l {
offset 0 -0.3 0
boxmin -0.05 -0.3 -0.05
boxmax 0.05 0 0.05
}
}
balljoint hip_r {
offset 0.1 -0.3 0
boxmin -0.05 -0.3 -0.05
boxmax 0.05 0 0.05
balljoint knee_r {
offset 0 -0.3 0
boxmin -0.05 -0.3 -0.05
boxmax 0.05 0 0.05
rotxlimit -2 0
rotylimit 0 0
rotzlimit 0 0
pose -3 1 2
}
}
}
Any help please? Thanks a lot.