pool the vectors
parent
49ad68c9d4
commit
dcf8b41c5c
|
@ -37,14 +37,18 @@ public class Maths
|
|||
return matrix;
|
||||
}
|
||||
|
||||
private static final Vector3f XVEC = new Vector3f(1, 0, 0);
|
||||
private static final Vector3f YVEC = new Vector3f(0, 1, 0);
|
||||
private static final Vector3f ZVEC = new Vector3f(0, 0, 1);
|
||||
|
||||
public static Matrix4f createTransformationMatrix(Vector3f translation, float rx, float ry, float rz, Vector3f scale)
|
||||
{
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.setIdentity();
|
||||
Matrix4f.translate(translation, matrix, matrix);
|
||||
Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1, 0, 0), matrix, matrix);
|
||||
Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0, 1, 0), matrix, matrix);
|
||||
Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0, 0, 1), matrix, matrix);
|
||||
Matrix4f.rotate((float) Math.toRadians(rx), XVEC, matrix, matrix);
|
||||
Matrix4f.rotate((float) Math.toRadians(ry), YVEC, matrix, matrix);
|
||||
Matrix4f.rotate((float) Math.toRadians(rz), ZVEC, matrix, matrix);
|
||||
Matrix4f.scale(scale, matrix, matrix);
|
||||
return matrix;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue