Impressive!
Simple and fast
Simple and fast
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.
Show posts Menupublic FloatBuffer getInvertedBuffer() {
Matrix temp = new Matrix(this); // Creates a temporary matrix with this matrix' values.
temp.invertTranslation(); // This function just negate the values in m3, m7 and m11 (the translation)
temp.transpose3x3(); // This function transposes the upper left 3x3 of the matrix
return temp.getBuffer();
}
public class Camera {
private Matrix transformation;
...
public void rotateX(float theta) {
transformation.rotateX(-theta);
}
public void translate(Vector3D v) {
v.mul(-1.0f);
transformation.translate(v);
}
glLoadTransposeMatrix(CameraMatrix); [C]
glPushMatrix(); [C, C]
....
// Object:
glMultTransposeMatrix(ObjectMatrix); [CO, C ]
glPushMatrix(); [CO, CO, C]
// Child
glMultTransposeMatrix(ChildMatrix); [COK, CO, C]
public void renderScene(Scene scene) {
glPushMatrix();
// the Camera-transformation will be inverted
glLoadMatrix(scene.getCamera().toBuffer());
glPushMatrix();
// Iterate through objects in the scene
glLoadMatrix(obj.getTranslation().toBuffer));
drawObject(obj);
// If the object has children, iterate through them
glPushMatrix();
glLoadMatrix(child.getTranslation().toBuffer));
drawObject(child)
glPopMatrix();
glPopMatrix();
glPopMatrix();
}
Vector v = obj.getXAxis();
v.mul(2.0f);
obj.translate(v);
public void translate(Vector3D trans) {
this.translationMatrix.translate(trans);
this.location.mul(translationMatrix);
}
// In the class definition
public class Entity extends Object3D { ...
// In the game
...
private Entity enemy = new Entity();
...
// In the mouse handling
...
Object3D selected_object = world.getObject(Interact2D.getObjectID(result));
// Now I want to get the Entity-instance (e.g. enemy) from the selected_object
Page created in 0.021 seconds with 11 queries.