Exemplo n.º 1
0
 /**
  * Create a Transformation Matrix 2D
  *
  * @param translation Position
  * @param scale Scale
  * @return Transformation Matrix 2D
  */
 public static Matrix4f createTransformationMatrix(Vector2f translation, Vector2f scale) {
   Matrix4f matrix = new Matrix4f();
   matrix.setIdentity();
   Matrix4f.translate(translation, matrix, matrix);
   Matrix4f.scale(new Vector3f(scale.x, scale.y, 1f), matrix, matrix);
   return matrix;
 }
Exemplo n.º 2
0
 /**
  * Create a Transformation Matrix 3D
  *
  * @param translation Position
  * @param rx Rotation X
  * @param ry Rotation Y
  * @param rz Rotation Z
  * @param scale Scale
  * @return Transformation Matrix 3D
  */
 public static Matrix4f createTransformationMatrix(
     Vector3f translation, float rx, float ry, float rz, float 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.scale(new Vector3f(scale, scale, scale), matrix, matrix);
   return matrix;
 }