public class Matrix4 extends Object
FloatUtil
matrix functionality in an object oriented manner.
Unlike PMVMatrix
, this class only represents one single matrix
without a complete GLMatrixFunc
implementation,
allowing this class to be more lightweight.
Implementation is not mature - WIP and subject to change.
Constructor and Description |
---|
Matrix4() |
Modifier and Type | Method and Description |
---|---|
float |
determinant() |
float[] |
getMatrix() |
boolean |
invert() |
void |
loadIdentity() |
void |
makeFrustum(float left,
float right,
float bottom,
float top,
float zNear,
float zFar) |
void |
makeOrtho(float left,
float right,
float bottom,
float top,
float zNear,
float zFar) |
void |
makePerspective(float fovy_rad,
float aspect,
float zNear,
float zFar) |
void |
multMatrix(float[] m)
Multiply matrix: [this] = [this] x [m]
|
void |
multMatrix(float[] m,
int m_offset)
Multiply matrix: [this] = [this] x [m]
|
void |
multMatrix(Matrix4 m)
Multiply matrix: [this] = [this] x [m]
|
void |
multVec(float[] v_in,
float[] v_out) |
void |
multVec(float[] v_in,
int v_in_offset,
float[] v_out,
int v_out_offset) |
void |
rotate(float angrad,
float x,
float y,
float z) |
void |
rotate(Quaternion quat)
Rotate the current matrix with the given
Quaternion 's rotation matrix representation . |
void |
scale(float x,
float y,
float z) |
void |
translate(float x,
float y,
float z) |
void |
transpose() |
public final float[] getMatrix()
public final void loadIdentity()
public final void multMatrix(float[] m, int m_offset)
m
- 4x4 matrix in column-major orderpublic final void multMatrix(float[] m)
m
- 4x4 matrix in column-major orderpublic final void multMatrix(Matrix4 m)
m
- 4x4 matrix in column-major orderpublic final void multVec(float[] v_in, float[] v_out)
v_in
- 4-component column-vectorv_out
- this * v_inpublic final void multVec(float[] v_in, int v_in_offset, float[] v_out, int v_out_offset)
v_in
- 4-component column-vectorv_out
- this * v_inpublic final void translate(float x, float y, float z)
public final void scale(float x, float y, float z)
public final void rotate(float angrad, float x, float y, float z)
public final void rotate(Quaternion quat)
Quaternion
's rotation matrix representation
.public final void transpose()
public final float determinant()
public final boolean invert()
public final void makeOrtho(float left, float right, float bottom, float top, float zNear, float zFar)
public final void makeFrustum(float left, float right, float bottom, float top, float zNear, float zFar) throws GLException
left
- right
- bottom
- top
- zNear
- zFar
- GLException
- with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0,
or if left == right, or bottom == top, or zNear == zFar.public final void makePerspective(float fovy_rad, float aspect, float zNear, float zFar) throws GLException
fovy_rad
- aspect
- zNear
- zFar
- GLException
- with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.Copyright 2010 JogAmp Community.