/** * Generates a view matrix for a first person camera looking towards positive-Z by default <br> * (Rotations in order Y-X-Z) * * @param eye position of the camera * @param pitch rotation around X * @param yaw rotation around Y * @param roll rotation around Z * @return a view matrix representing the camera transformations */ public static Matrix FPViewLH(Vector eye, double pitch, double yaw, double roll) { return Matrix.translate(Vector.mul(eye, -1)).mul(Matrix.rotationYXZ(-yaw, pitch, roll)); }
public static Matrix rotationYXZ(double yaw, double pitch, double roll) { return Matrix.rotationY(yaw).mul(Matrix.rotationX(pitch).mul(Matrix.rotationZ(roll))); }
/** * Generates a view matrix for a first person camera looking towards positive-Z by default <br> * (Rotations in order Y-X-Z) * * @param eye position of the camera * @param rotation rotation of the camera * @return a view matrix representing the camera transformations */ public static Matrix FPViewLH(Vector eye, Vector rotation) { Vector rot = new Vector(rotation); rot.Y = -rot.Y; return Matrix.translate(Vector.mul(eye, -1)).mul(Matrix.rotationZYX(rot)); }
public Matrix mul(Matrix other) { this.setData(Matrix.mul(this, other)); return this; }
public static Matrix rotationXYZ(Vector rotation) { return Matrix.rotationXYZ(rotation.X, rotation.Y, rotation.Z); }
public static Matrix rotationZYX(Vector rotation) { return Matrix.rotationZYX(rotation.Z, rotation.Y, rotation.X); }
public static Matrix rotationZXY(Vector rotation) { return Matrix.rotationZXY(rotation.Z, rotation.X, rotation.Y); }