Package org.lwjgl.util.vector
Class Matrix4f
java.lang.Object
org.lwjgl.util.vector.Matrix
org.lwjgl.util.vector.Matrix4f
- All Implemented Interfaces:
Serializable
Holds a 4x4 float matrix.
- Author:
- foo
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Matrix4f
Add two matrices together and place the result in a third matrix.float
invert()
Invert this matrixstatic Matrix4f
Invert the source matrix and put the result in the destinationload
(FloatBuffer buf) Load from a float buffer.Load from another matrix4fstatic Matrix4f
Copy the source matrix to the destination matrixloadTranspose
(FloatBuffer buf) Load from a float buffer.static Matrix4f
Multiply the right matrix by the left and place the result in a third matrix.negate()
Negate this matrixNegate this matrix and place the result in a destination matrix.static Matrix4f
Negate this matrix and place the result in a destination matrix.Rotates the matrix around the given axis the specified angleRotates the matrix around the given axis the specified anglestatic Matrix4f
Rotates the source matrix around the given axis the specified angle and put the result in the destination matrix.Scales this matrixstatic Matrix4f
Scales the source matrix and put the result in the destination matrixSet this matrix to be the identity matrix.static Matrix4f
Set the given matrix to be the identity matrix.setZero()
Set this matrix to 0.static Matrix4f
Set the given matrix to 0.store
(FloatBuffer buf) Store this matrix in a float buffer.store3f
(FloatBuffer buf) Store the rotation portion of this matrix in a float buffer.Store this matrix in a float buffer.static Matrix4f
Subtract the right matrix from the left and place the result in a third matrix.toString()
Returns a string representation of this matrixstatic Vector4f
Transform a Vector by a matrix and return the result in a destination vector.Translate this matrixTranslate this matrix and stash the result in another matrixstatic Matrix4f
Translate the source matrix and stash the result in the destination matrixTranslate this matrixTranslate this matrix and stash the result in another matrixstatic Matrix4f
Translate the source matrix and stash the result in the destination matrixTranspose this matrixTranspose this matrix and place the result in another matrixstatic Matrix4f
Transpose the source matrix and place the result in the destination matrix
-
Field Details
-
m00
public float m00 -
m01
public float m01 -
m02
public float m02 -
m03
public float m03 -
m10
public float m10 -
m11
public float m11 -
m12
public float m12 -
m13
public float m13 -
m20
public float m20 -
m21
public float m21 -
m22
public float m22 -
m23
public float m23 -
m30
public float m30 -
m31
public float m31 -
m32
public float m32 -
m33
public float m33
-
-
Constructor Details
-
Matrix4f
public Matrix4f()Construct a new matrix, initialized to the identity. -
Matrix4f
-
-
Method Details
-
toString
Returns a string representation of this matrix -
setIdentity
Set this matrix to be the identity matrix.- Specified by:
setIdentity
in classMatrix
- Returns:
- this
-
setIdentity
Set the given matrix to be the identity matrix.- Parameters:
m
- The matrix to set to the identity- Returns:
- m
-
setZero
Set this matrix to 0. -
setZero
Set the given matrix to 0.- Parameters:
m
- The matrix to set to 0- Returns:
- m
-
load
Load from another matrix4f- Parameters:
src
- The source matrix- Returns:
- this
-
load
Copy the source matrix to the destination matrix- Parameters:
src
- The source matrixdest
- The destination matrix, or null of a new one is to be created- Returns:
- The copied matrix
-
load
Load from a float buffer. The buffer stores the matrix in column major (OpenGL) order. -
loadTranspose
Load from a float buffer. The buffer stores the matrix in row major (maths) order.- Specified by:
loadTranspose
in classMatrix
- Parameters:
buf
- A float buffer to read from- Returns:
- this
-
store
Store this matrix in a float buffer. The matrix is stored in column major (openGL) order. -
storeTranspose
Store this matrix in a float buffer. The matrix is stored in row major (maths) order.- Specified by:
storeTranspose
in classMatrix
- Parameters:
buf
- The buffer to store this matrix in- Returns:
- this
-
store3f
Store the rotation portion of this matrix in a float buffer. The matrix is stored in column major (openGL) order.- Parameters:
buf
- The buffer to store this matrix in
-
add
Add two matrices together and place the result in a third matrix.- Parameters:
left
- The left source matrixright
- The right source matrixdest
- The destination matrix, or null if a new one is to be created- Returns:
- the destination matrix
-
sub
Subtract the right matrix from the left and place the result in a third matrix.- Parameters:
left
- The left source matrixright
- The right source matrixdest
- The destination matrix, or null if a new one is to be created- Returns:
- the destination matrix
-
mul
Multiply the right matrix by the left and place the result in a third matrix.- Parameters:
left
- The left source matrixright
- The right source matrixdest
- The destination matrix, or null if a new one is to be created- Returns:
- the destination matrix
-
transform
Transform a Vector by a matrix and return the result in a destination vector.- Parameters:
left
- The left matrixright
- The right vectordest
- The destination vector, or null if a new one is to be created- Returns:
- the destination vector
-
transpose
Transpose this matrix -
translate
Translate this matrix- Parameters:
vec
- The vector to translate by- Returns:
- this
-
translate
Translate this matrix- Parameters:
vec
- The vector to translate by- Returns:
- this
-
scale
Scales this matrix- Parameters:
vec
- The vector to scale by- Returns:
- this
-
scale
Scales the source matrix and put the result in the destination matrix- Parameters:
vec
- The vector to scale bysrc
- The source matrixdest
- The destination matrix, or null if a new matrix is to be created- Returns:
- The scaled matrix
-
rotate
Rotates the matrix around the given axis the specified angle- Parameters:
angle
- the angle, in radians.axis
- The vector representing the rotation axis. Must be normalized.- Returns:
- this
-
rotate
Rotates the matrix around the given axis the specified angle- Parameters:
angle
- the angle, in radians.axis
- The vector representing the rotation axis. Must be normalized.dest
- The matrix to put the result, or null if a new matrix is to be created- Returns:
- The rotated matrix
-
rotate
Rotates the source matrix around the given axis the specified angle and put the result in the destination matrix.- Parameters:
angle
- the angle, in radians.axis
- The vector representing the rotation axis. Must be normalized.src
- The matrix to rotatedest
- The matrix to put the result, or null if a new matrix is to be created- Returns:
- The rotated matrix
-
translate
Translate this matrix and stash the result in another matrix- Parameters:
vec
- The vector to translate bydest
- The destination matrix or null if a new matrix is to be created- Returns:
- the translated matrix
-
translate
Translate the source matrix and stash the result in the destination matrix- Parameters:
vec
- The vector to translate bysrc
- The source matrixdest
- The destination matrix or null if a new matrix is to be created- Returns:
- The translated matrix
-
translate
Translate this matrix and stash the result in another matrix- Parameters:
vec
- The vector to translate bydest
- The destination matrix or null if a new matrix is to be created- Returns:
- the translated matrix
-
translate
Translate the source matrix and stash the result in the destination matrix- Parameters:
vec
- The vector to translate bysrc
- The source matrixdest
- The destination matrix or null if a new matrix is to be created- Returns:
- The translated matrix
-
transpose
Transpose this matrix and place the result in another matrix- Parameters:
dest
- The destination matrix or null if a new matrix is to be created- Returns:
- the transposed matrix
-
transpose
Transpose the source matrix and place the result in the destination matrix- Parameters:
src
- The source matrixdest
- The destination matrix or null if a new matrix is to be created- Returns:
- the transposed matrix
-
determinant
public float determinant()- Specified by:
determinant
in classMatrix
- Returns:
- the determinant of the matrix
-
invert
Invert this matrix -
invert
Invert the source matrix and put the result in the destination- Parameters:
src
- The source matrixdest
- The destination matrix, or null if a new matrix is to be created- Returns:
- The inverted matrix if successful, null otherwise
-
negate
Negate this matrix -
negate
Negate this matrix and place the result in a destination matrix.- Parameters:
dest
- The destination matrix, or null if a new matrix is to be created- Returns:
- the negated matrix
-
negate
Negate this matrix and place the result in a destination matrix.- Parameters:
src
- The source matrixdest
- The destination matrix, or null if a new matrix is to be created- Returns:
- The negated matrix
-