- java.lang.Object
-
- org.spongepowered.math.matrix.Matrix4f
-
- All Implemented Interfaces:
Serializable,Matrixf
@Immutable public final class Matrix4f extends Object implements Matrixf, Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Matrix4f(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)Matrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)Matrix4f(Matrix2f m)Matrix4f(Matrix3f m)Matrix4f(MatrixNf m)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix4fabs()Matrix4fadd(Matrix4f m)Matrix4fceil()Vector4fcolumn(int col)static Matrix4fcreateLookAt(Vector3f eye, Vector3f at, Vector3f up)Creates a "look at" matrix for the given eye point.static Matrix4fcreateOrthographic(double right, double left, double top, double bottom, double near, double far)Creates an orthographic viewing frustum built from the provided valuesstatic Matrix4fcreateOrthographic(float right, float left, float top, float bottom, float near, float far)Creates an orthographic viewing frustum built from the provided valuesstatic Matrix4fcreatePerspective(double fov, double aspect, double near, double far)Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planesstatic Matrix4fcreatePerspective(float fov, float aspect, float near, float far)Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planesstatic Matrix4fcreateRotation(Complexf rot)static Matrix4fcreateRotation(Quaternionf rot)static Matrix4fcreateScaling(double scale)static Matrix4fcreateScaling(double x, double y, double z, double w)static Matrix4fcreateScaling(float scale)static Matrix4fcreateScaling(float x, float y, float z, float w)static Matrix4fcreateScaling(Vector4f v)static Matrix4fcreateTranslation(double x, double y, double z)static Matrix4fcreateTranslation(float x, float y, float z)static Matrix4fcreateTranslation(Vector3f v)floatdeterminant()Matrix4fdiv(double a)Matrix4fdiv(float a)Matrix4fdiv(Matrix4f m)booleanequals(Object other)Matrix4ffloor()static Matrix4ffrom(float n)static Matrix4ffrom(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)static Matrix4ffromDiagonal(float m00, float m11, float m22, float m33)floatget(int row, int col)inthashCode()Matrix4finvert()Matrix4fmul(double a)Matrix4fmul(float a)Matrix4fmul(Matrix4f m)Matrix4fnegate()Matrix4fpow(double pow)Matrix4fpow(float pow)Matrix4frotate(Complexf rot)Matrix4frotate(Quaternionf rot)Matrix4fround()Vector4frow(int row)Matrix4fscale(double scale)Matrix4fscale(double x, double y, double z, double w)Matrix4fscale(float scale)Matrix4fscale(float x, float y, float z, float w)Matrix4fscale(Vector4f v)Matrix4fsub(Matrix4f m)float[]toArray()float[]toArray(boolean columnMajor)Matrix4dtoDouble()Matrix4ftoFloat()Matrix2ftoMatrix2()Matrix3ftoMatrix3()MatrixNftoMatrixN()StringtoString()floattrace()Vector4ftransform(double x, double y, double z, double w)Vector4ftransform(float x, float y, float z, float w)Vector4ftransform(Vector4f v)Matrix4ftranslate(double x, double y, double z)Matrix4ftranslate(float x, float y, float z)Matrix4ftranslate(Vector3f v)Matrix4ftranspose()
-
-
-
Constructor Detail
-
Matrix4f
public Matrix4f(Matrix2f m)
-
Matrix4f
public Matrix4f(Matrix3f m)
-
Matrix4f
public Matrix4f(MatrixNf m)
-
Matrix4f
public Matrix4f(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
-
Matrix4f
public Matrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
-
-
Method Detail
-
mul
public Matrix4f mul(double a)
-
div
public Matrix4f div(double a)
-
pow
public Matrix4f pow(double pow)
-
translate
public Matrix4f translate(double x, double y, double z)
-
translate
public Matrix4f translate(float x, float y, float z)
-
scale
public Matrix4f scale(double scale)
-
scale
public Matrix4f scale(float scale)
-
scale
public Matrix4f scale(double x, double y, double z, double w)
-
scale
public Matrix4f scale(float x, float y, float z, float w)
-
rotate
public Matrix4f rotate(Quaternionf rot)
-
transform
public Vector4f transform(double x, double y, double z, double w)
-
transform
public Vector4f transform(float x, float y, float z, float w)
-
determinant
public float determinant()
- Specified by:
determinantin interfaceMatrixf
-
toMatrix2
public Matrix2f toMatrix2()
-
toMatrix3
public Matrix3f toMatrix3()
-
toMatrixN
public MatrixNf toMatrixN()
-
toArray
public float[] toArray()
-
from
public static Matrix4f from(float n)
-
from
public static Matrix4f from(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
-
fromDiagonal
public static Matrix4f fromDiagonal(float m00, float m11, float m22, float m33)
-
createScaling
public static Matrix4f createScaling(double scale)
-
createScaling
public static Matrix4f createScaling(float scale)
-
createScaling
public static Matrix4f createScaling(double x, double y, double z, double w)
-
createScaling
public static Matrix4f createScaling(float x, float y, float z, float w)
-
createTranslation
public static Matrix4f createTranslation(double x, double y, double z)
-
createTranslation
public static Matrix4f createTranslation(float x, float y, float z)
-
createRotation
public static Matrix4f createRotation(Quaternionf rot)
-
createLookAt
public static Matrix4f createLookAt(Vector3f eye, Vector3f at, Vector3f up)
Creates a "look at" matrix for the given eye point.- Parameters:
eye- The position of the cameraat- The point that the camera is looking atup- The "up" vector- Returns:
- A rotational transform that corresponds to a camera looking at the given point
-
createPerspective
public static Matrix4f createPerspective(double fov, double aspect, double near, double far)
Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planes- Parameters:
fov- The field of view in the x directionaspect- The aspect ratio, usually width/heightnear- The near plane, cannot be 0far- the far plane, far cannot equal near- Returns:
- A perspective projection matrix built from the given values
-
createPerspective
public static Matrix4f createPerspective(float fov, float aspect, float near, float far)
Creates a perspective projection matrix with the given (x) FOV, aspect, near and far planes- Parameters:
fov- The field of view in the x directionaspect- The aspect ratio, usually width/heightnear- The near plane, cannot be 0far- the far plane, far cannot equal near- Returns:
- A perspective projection matrix built from the given values
-
createOrthographic
public static Matrix4f createOrthographic(double right, double left, double top, double bottom, double near, double far)
Creates an orthographic viewing frustum built from the provided values- Parameters:
right- the right most plane of the viewing frustumleft- the left most plane of the viewing frustumtop- the top plane of the viewing frustumbottom- the bottom plane of the viewing frustumnear- the near plane of the viewing frustumfar- the far plane of the viewing frustum- Returns:
- A viewing frustum built from the provided values
-
createOrthographic
public static Matrix4f createOrthographic(float right, float left, float top, float bottom, float near, float far)
Creates an orthographic viewing frustum built from the provided values- Parameters:
right- the right most plane of the viewing frustumleft- the left most plane of the viewing frustumtop- the top plane of the viewing frustumbottom- the bottom plane of the viewing frustumnear- the near plane of the viewing frustumfar- the far plane of the viewing frustum- Returns:
- A viewing frustum built from the provided values
-
-