Top Description Fields Constructors Methods
org.lwjgl.util.vector

public Class Matrix4f

extends Matrix
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, java.nio.FloatBuffer

Holds a 4x4 float matrix.
Author
foo

Field Summary

Modifier and TypeField and Description
public float
public float
public float
public float
public float
public float
public float
public float
public float
public float
public float
public float
public float
public float
public float
public float
private static final long

Constructor Summary

AccessConstructor and Description
public
Matrix4f()

Construct a new matrix, initialized to the identity.

public
Matrix4f(final Matrix4f src)

Method Summary

Modifier and TypeMethod and Description
public static Matrix4f

Returns:

the destination matrix
add
(Matrix4f
The left source matrix
left
,
Matrix4f
The right source matrix
right
,
Matrix4f
The destination matrix, or null if a new one is to be created
dest
)

Add two matrices together and place the result in a third matrix.

public float

Returns:

the determinant of the matrix
determinant
()

Implements abstract org.lwjgl.util.vector.Matrix.determinant.

private static float

Returns:

result
determinant3x3
(float t00, float t01, float t02, float t10, float t11, float t12, float t20, float t21, float t22)

Calculate the determinant of a 3x3 matrix

public Matrix

Returns:

this if successful, null otherwise
invert
()

Implements abstract org.lwjgl.util.vector.Matrix.invert.

Invert this matrix
public static Matrix4f

Returns:

The inverted matrix if successful, null otherwise
invert
(Matrix4f
The source matrix
src
,
Matrix4f
The destination matrix, or null if a new matrix is to be created
dest
)

Invert the source matrix and put the result in the destination

public Matrix4f

Returns:

this
load
(Matrix4f
The source matrix
src
)

Load from another matrix4f

public static Matrix4f

Returns:

The copied matrix
load
(Matrix4f
The source matrix
src
,
Matrix4f
The destination matrix, or null of a new one is to be created
dest
)

Copy the source matrix to the destination matrix

public Matrix

Returns:

this
load
(FloatBuffer
A float buffer to read from
buf
)

Implements abstract org.lwjgl.util.vector.Matrix.load.

Load from a float buffer.
public Matrix

Returns:

this
loadTranspose
(FloatBuffer
A float buffer to read from
buf
)

Implements abstract org.lwjgl.util.vector.Matrix.loadTranspose.

Load from a float buffer.
public static Matrix4f

Returns:

the destination matrix
mul
(Matrix4f
The left source matrix
left
,
Matrix4f
The right source matrix
right
,
Matrix4f
The destination matrix, or null if a new one is to be created
dest
)

Multiply the right matrix by the left and place the result in a third matrix.

public Matrix

Returns:

this
negate
()

Implements abstract org.lwjgl.util.vector.Matrix.negate.

Negate this matrix
public Matrix4f

Returns:

the negated matrix
negate
(Matrix4f
The destination matrix, or null if a new matrix is to be created
dest
)

Negate this matrix and place the result in a destination matrix.

public static Matrix4f

Returns:

The negated matrix
negate
(Matrix4f
The source matrix
src
,
Matrix4f
The destination matrix, or null if a new matrix is to be created
dest
)

Negate this matrix and place the result in a destination matrix.

public Matrix4f

Returns:

this
rotate
(float
the angle, in radians.
angle
,
Vector3f
The vector representing the rotation axis. Must be normalized.
axis
)

Rotates the matrix around the given axis the specified angle

public Matrix4f

Returns:

The rotated matrix
rotate
(float
the angle, in radians.
angle
,
Vector3f
The vector representing the rotation axis. Must be normalized.
axis
,
Matrix4f
The matrix to put the result, or null if a new matrix is to be created
dest
)

Rotates the matrix around the given axis the specified angle

public static Matrix4f

Returns:

The rotated matrix
rotate
(float
the angle, in radians.
angle
,
Vector3f
The vector representing the rotation axis. Must be normalized.
axis
,
Matrix4f
The matrix to rotate
src
,
Matrix4f
The matrix to put the result, or null if a new matrix is to be created
dest
)

Rotates the source matrix around the given axis the specified angle and put the result in the destination matrix.

public Matrix4f

Returns:

this
scale
(Vector3f
The vector to scale by
vec
)

Scales this matrix

public static Matrix4f

Returns:

The scaled matrix
scale
(Vector3f
The vector to scale by
vec
,
Matrix4f
The source matrix
src
,
Matrix4f
The destination matrix, or null if a new matrix is to be created
dest
)

Scales the source matrix and put the result in the destination matrix

public Matrix

Returns:

this
setIdentity
()

Implements abstract org.lwjgl.util.vector.Matrix.setIdentity.

Set this matrix to be the identity matrix.
public static Matrix4f

Returns:

m
setIdentity
(Matrix4f
The matrix to set to the identity
m
)

Set the given matrix to be the identity matrix.

public Matrix

Returns:

this
setZero
()

Implements abstract org.lwjgl.util.vector.Matrix.setZero.

Set this matrix to 0.
public static Matrix4f

Returns:

m
setZero
(Matrix4f
The matrix to set to 0
m
)

Set the given matrix to 0.

public Matrix
store(FloatBuffer
The buffer to store this matrix in
buf
)

Implements abstract org.lwjgl.util.vector.Matrix.store.

Store this matrix in a float buffer.
public Matrix
store3f(FloatBuffer
The buffer to store this matrix in
buf
)

Store the rotation portion of this matrix in a float buffer.

public Matrix
storeTranspose(FloatBuffer
The buffer to store this matrix in
buf
)

Implements abstract org.lwjgl.util.vector.Matrix.storeTranspose.

Store this matrix in a float buffer.
public static Matrix4f

Returns:

the destination matrix
sub
(Matrix4f
The left source matrix
left
,
Matrix4f
The right source matrix
right
,
Matrix4f
The destination matrix, or null if a new one is to be created
dest
)

Subtract the right matrix from the left and place the result in a third matrix.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of this matrix
public static Vector4f

Returns:

the destination vector
transform
(Matrix4f
The left matrix
left
,
Vector4f
The right vector
right
,
Vector4f
The destination vector, or null if a new one is to be created
dest
)

Transform a Vector by a matrix and return the result in a destination vector.

public Matrix4f

Returns:

this
translate
(Vector2f
The vector to translate by
vec
)

Translate this matrix

public Matrix4f

Returns:

this
translate
(Vector3f
The vector to translate by
vec
)

Translate this matrix

public Matrix4f

Returns:

the translated matrix
translate
(Vector3f
The vector to translate by
vec
,
Matrix4f
The destination matrix or null if a new matrix is to be created
dest
)

Translate this matrix and stash the result in another matrix

public static Matrix4f

Returns:

The translated matrix
translate
(Vector3f
The vector to translate by
vec
,
Matrix4f
The source matrix
src
,
Matrix4f
The destination matrix or null if a new matrix is to be created
dest
)

Translate the source matrix and stash the result in the destination matrix

public Matrix4f

Returns:

the translated matrix
translate
(Vector2f
The vector to translate by
vec
,
Matrix4f
The destination matrix or null if a new matrix is to be created
dest
)

Translate this matrix and stash the result in another matrix

public static Matrix4f

Returns:

The translated matrix
translate
(Vector2f
The vector to translate by
vec
,
Matrix4f
The source matrix
src
,
Matrix4f
The destination matrix or null if a new matrix is to be created
dest
)

Translate the source matrix and stash the result in the destination matrix

public Matrix

Returns:

this
transpose
()

Implements abstract org.lwjgl.util.vector.Matrix.transpose.

Transpose this matrix
public Matrix4f

Returns:

the transposed matrix
transpose
(Matrix4f
The destination matrix or null if a new matrix is to be created
dest
)

Transpose this matrix and place the result in another matrix

public static Matrix4f

Returns:

the transposed matrix
transpose
(Matrix4f
The source matrix
src
,
Matrix4f
The destination matrix or null if a new matrix is to be created
dest
)

Transpose the source matrix and place the result in the destination matrix

Field Detail

m00back to summary
public float m00
m01back to summary
public float m01
m02back to summary
public float m02
m03back to summary
public float m03
m10back to summary
public float m10
m11back to summary
public float m11
m12back to summary
public float m12
m13back to summary
public float m13
m20back to summary
public float m20
m21back to summary
public float m21
m22back to summary
public float m22
m23back to summary
public float m23
m30back to summary
public float m30
m31back to summary
public float m31
m32back to summary
public float m32
m33back to summary
public float m33
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

Matrix4fback to summary
public Matrix4f()

Construct a new matrix, initialized to the identity.

Matrix4fback to summary
public Matrix4f(final Matrix4f src)

Method Detail

addback to summary
public static Matrix4f add(Matrix4f left, Matrix4f right, Matrix4f dest)

Add two matrices together and place the result in a third matrix.

Parameters
left:Matrix4f

The left source matrix

right:Matrix4f

The right source matrix

dest:Matrix4f

The destination matrix, or null if a new one is to be created

Returns:Matrix4f

the destination matrix

determinantback to summary
public float determinant()

Implements abstract org.lwjgl.util.vector.Matrix.determinant.

Returns:float

the determinant of the matrix

determinant3x3back to summary
private static float determinant3x3(float t00, float t01, float t02, float t10, float t11, float t12, float t20, float t21, float t22)

Calculate the determinant of a 3x3 matrix

Returns:float

result

invertback to summary
public Matrix invert()

Implements abstract org.lwjgl.util.vector.Matrix.invert.

Invert this matrix

Returns:Matrix

this if successful, null otherwise

invertback to summary
public static Matrix4f invert(Matrix4f src, Matrix4f dest)

Invert the source matrix and put the result in the destination

Parameters
src:Matrix4f

The source matrix

dest:Matrix4f

The destination matrix, or null if a new matrix is to be created

Returns:Matrix4f

The inverted matrix if successful, null otherwise

loadback to summary
public Matrix4f load(Matrix4f src)

Load from another matrix4f

Parameters
src:Matrix4f

The source matrix

Returns:Matrix4f

this

loadback to summary
public static Matrix4f load(Matrix4f src, Matrix4f dest)

Copy the source matrix to the destination matrix

Parameters
src:Matrix4f

The source matrix

dest:Matrix4f

The destination matrix, or null of a new one is to be created

Returns:Matrix4f

The copied matrix

loadback to summary
public Matrix load(FloatBuffer buf)

Implements abstract org.lwjgl.util.vector.Matrix.load.

Load from a float buffer. The buffer stores the matrix in column major (OpenGL) order.

Parameters
buf:FloatBuffer

A float buffer to read from

Returns:Matrix

this

loadTransposeback to summary
public Matrix loadTranspose(FloatBuffer buf)

Implements abstract org.lwjgl.util.vector.Matrix.loadTranspose.

Load from a float buffer. The buffer stores the matrix in row major (maths) order.

Parameters
buf:FloatBuffer

A float buffer to read from

Returns:Matrix

this

mulback to summary
public static Matrix4f mul(Matrix4f left, Matrix4f right, Matrix4f dest)

Multiply the right matrix by the left and place the result in a third matrix.

Parameters
left:Matrix4f

The left source matrix

right:Matrix4f

The right source matrix

dest:Matrix4f

The destination matrix, or null if a new one is to be created

Returns:Matrix4f

the destination matrix

negateback to summary
public Matrix negate()

Implements abstract org.lwjgl.util.vector.Matrix.negate.

Negate this matrix

Returns:Matrix

this

negateback to summary
public Matrix4f negate(Matrix4f dest)

Negate this matrix and place the result in a destination matrix.

Parameters
dest:Matrix4f

The destination matrix, or null if a new matrix is to be created

Returns:Matrix4f

the negated matrix

negateback to summary
public static Matrix4f negate(Matrix4f src, Matrix4f dest)

Negate this matrix and place the result in a destination matrix.

Parameters
src:Matrix4f

The source matrix

dest:Matrix4f

The destination matrix, or null if a new matrix is to be created

Returns:Matrix4f

The negated matrix

rotateback to summary
public Matrix4f rotate(float angle, Vector3f axis)

Rotates the matrix around the given axis the specified angle

Parameters
angle:float

the angle, in radians.

axis:Vector3f

The vector representing the rotation axis. Must be normalized.

Returns:Matrix4f

this

rotateback to summary
public Matrix4f rotate(float angle, Vector3f axis, Matrix4f dest)

Rotates the matrix around the given axis the specified angle

Parameters
angle:float

the angle, in radians.

axis:Vector3f

The vector representing the rotation axis. Must be normalized.

dest:Matrix4f

The matrix to put the result, or null if a new matrix is to be created

Returns:Matrix4f

The rotated matrix

rotateback to summary
public static Matrix4f rotate(float angle, Vector3f axis, Matrix4f src, Matrix4f dest)

Rotates the source matrix around the given axis the specified angle and put the result in the destination matrix.

Parameters
angle:float

the angle, in radians.

axis:Vector3f

The vector representing the rotation axis. Must be normalized.

src:Matrix4f

The matrix to rotate

dest:Matrix4f

The matrix to put the result, or null if a new matrix is to be created

Returns:Matrix4f

The rotated matrix

scaleback to summary
public Matrix4f scale(Vector3f vec)

Scales this matrix

Parameters
vec:Vector3f

The vector to scale by

Returns:Matrix4f

this

scaleback to summary
public static Matrix4f scale(Vector3f vec, Matrix4f src, Matrix4f dest)

Scales the source matrix and put the result in the destination matrix

Parameters
vec:Vector3f

The vector to scale by

src:Matrix4f

The source matrix

dest:Matrix4f

The destination matrix, or null if a new matrix is to be created

Returns:Matrix4f

The scaled matrix

setIdentityback to summary
public Matrix setIdentity()

Implements abstract org.lwjgl.util.vector.Matrix.setIdentity.

Set this matrix to be the identity matrix.

Returns:Matrix

this

setIdentityback to summary
public static Matrix4f setIdentity(Matrix4f m)

Set the given matrix to be the identity matrix.

Parameters
m:Matrix4f

The matrix to set to the identity

Returns:Matrix4f

m

setZeroback to summary
public Matrix setZero()

Implements abstract org.lwjgl.util.vector.Matrix.setZero.

Set this matrix to 0.

Returns:Matrix

this

setZeroback to summary
public static Matrix4f setZero(Matrix4f m)

Set the given matrix to 0.

Parameters
m:Matrix4f

The matrix to set to 0

Returns:Matrix4f

m

storeback to summary
public Matrix store(FloatBuffer buf)

Implements abstract org.lwjgl.util.vector.Matrix.store.

Store this matrix in a float buffer. The matrix is stored in column major (openGL) order.

Parameters
buf:FloatBuffer

The buffer to store this matrix in

Returns:Matrix

Doc from org.lwjgl.util.vector.Matrix.store.

this

store3fback to summary
public Matrix store3f(FloatBuffer buf)

Store the rotation portion of this matrix in a float buffer. The matrix is stored in column major (openGL) order.

Parameters
buf:FloatBuffer

The buffer to store this matrix in

storeTransposeback to summary
public Matrix storeTranspose(FloatBuffer buf)

Implements abstract org.lwjgl.util.vector.Matrix.storeTranspose.

Store this matrix in a float buffer. The matrix is stored in row major (maths) order.

Parameters
buf:FloatBuffer

The buffer to store this matrix in

Returns:Matrix

Doc from org.lwjgl.util.vector.Matrix.storeTranspose.

this

subback to summary
public static Matrix4f sub(Matrix4f left, Matrix4f right, Matrix4f dest)

Subtract the right matrix from the left and place the result in a third matrix.

Parameters
left:Matrix4f

The left source matrix

right:Matrix4f

The right source matrix

dest:Matrix4f

The destination matrix, or null if a new one is to be created

Returns:Matrix4f

the destination matrix

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this matrix

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

transformback to summary
public static Vector4f transform(Matrix4f left, Vector4f right, Vector4f dest)

Transform a Vector by a matrix and return the result in a destination vector.

Parameters
left:Matrix4f

The left matrix

right:Vector4f

The right vector

dest:Vector4f

The destination vector, or null if a new one is to be created

Returns:Vector4f

the destination vector

translateback to summary
public Matrix4f translate(Vector2f vec)

Translate this matrix

Parameters
vec:Vector2f

The vector to translate by

Returns:Matrix4f

this

translateback to summary
public Matrix4f translate(Vector3f vec)

Translate this matrix

Parameters
vec:Vector3f

The vector to translate by

Returns:Matrix4f

this

translateback to summary
public Matrix4f translate(Vector3f vec, Matrix4f dest)

Translate this matrix and stash the result in another matrix

Parameters
vec:Vector3f

The vector to translate by

dest:Matrix4f

The destination matrix or null if a new matrix is to be created

Returns:Matrix4f

the translated matrix

translateback to summary
public static Matrix4f translate(Vector3f vec, Matrix4f src, Matrix4f dest)

Translate the source matrix and stash the result in the destination matrix

Parameters
vec:Vector3f

The vector to translate by

src:Matrix4f

The source matrix

dest:Matrix4f

The destination matrix or null if a new matrix is to be created

Returns:Matrix4f

The translated matrix

translateback to summary
public Matrix4f translate(Vector2f vec, Matrix4f dest)

Translate this matrix and stash the result in another matrix

Parameters
vec:Vector2f

The vector to translate by

dest:Matrix4f

The destination matrix or null if a new matrix is to be created

Returns:Matrix4f

the translated matrix

translateback to summary
public static Matrix4f translate(Vector2f vec, Matrix4f src, Matrix4f dest)

Translate the source matrix and stash the result in the destination matrix

Parameters
vec:Vector2f

The vector to translate by

src:Matrix4f

The source matrix

dest:Matrix4f

The destination matrix or null if a new matrix is to be created

Returns:Matrix4f

The translated matrix

transposeback to summary
public Matrix transpose()

Implements abstract org.lwjgl.util.vector.Matrix.transpose.

Transpose this matrix

Returns:Matrix

this

transposeback to summary
public Matrix4f transpose(Matrix4f dest)

Transpose this matrix and place the result in another matrix

Parameters
dest:Matrix4f

The destination matrix or null if a new matrix is to be created

Returns:Matrix4f

the transposed matrix

transposeback to summary
public static Matrix4f transpose(Matrix4f src, Matrix4f dest)

Transpose the source matrix and place the result in the destination matrix

Parameters
src:Matrix4f

The source matrix

dest:Matrix4f

The destination matrix or null if a new matrix is to be created

Returns:Matrix4f

the transposed matrix