331
Projects / Re: 3D Sound using lwjgl binding of Open AL
« on: September 04, 2008, 11:14:00 am »
Nice one, demo works all good for me. I will surely be using this for my game when I add sound.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
public final SimpleVector matrixToRad(Matrix m) {
float[] mDump = m.getDump();
float heading,attitude,bank;
if (mDump[4] > 0.998) { // singularity at north pole
heading = (float) Math.atan2(mDump[2],mDump[10]);
attitude = (float) (Math.PI/2);
bank = 0;
}
else if (mDump[4] < -0.998) { // singularity at south pole
heading = (float) Math.atan2(mDump[2],mDump[10]);
attitude = (float) (-Math.PI/2);
bank = 0;
}
else{
heading = (float) Math.atan2(-mDump[8],mDump[0]);
bank = (float) Math.atan2(-mDump[6],mDump[5]);
attitude = (float) Math.asin(mDump[4]);
}
return new SimpleVector(bank,heading,attitude);
}
private void setupGui(){
SimpleStream ss = new SimpleStream("Models/chatgui.png");
Texture backDrop = new Texture(ss.getStream());
try {
ss.close();
} catch (IOException e) {}
TextField field = new TextField(1, 100, 100, 10);
field.setVisible(true);
Label chatlabel = new Label(1,1);
try {
window = new Window(backDrop, 50, 50);
window.add(field);
window.add(chatlabel);
window.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
field.setText("Chat");
chatlabel.setText("Welcome to Casters of Fate");
}