32 lines
746 B
Java
Executable File
32 lines
746 B
Java
Executable File
package projectzombie.display;
|
|
|
|
import gl_engine.matrix.Matrix4;
|
|
import gl_engine.vec.Vec2d;
|
|
import projectzombie.Main;
|
|
|
|
public class Camera
|
|
{
|
|
public double angle = 45;
|
|
private Matrix4 matrix;
|
|
|
|
public static Camera camera;
|
|
|
|
public Camera()
|
|
{
|
|
Matrix4 identity = Matrix4.identity();
|
|
Vec2d pos = Main.player.pos;
|
|
angle = Main.player.angle;
|
|
|
|
identity = Matrix4.multiply(identity, Matrix4.translate(-pos.x + 0.5, 0, -pos.y + 0.5));
|
|
identity = Matrix4.multiply(identity, Matrix4.rotate(angle + 180, 0, 1, 0));
|
|
identity = Matrix4.multiply(identity, Matrix4.rotate(-45, 1, 0, 0));
|
|
identity = Matrix4.multiply(identity, Matrix4.translate(0, 0, -16));
|
|
|
|
matrix = identity;
|
|
}
|
|
|
|
public Matrix4 getMatrix() {
|
|
return matrix;
|
|
}
|
|
}
|