Package com.jogamp.opengl.math
Class Matrix4
- java.lang.Object
-
- com.jogamp.opengl.math.Matrix4
-
public class Matrix4 extends Object
Simple float array-backed float 4x4 matrix exposingFloatUtilmatrix functionality in an object oriented manner.Unlike
PMVMatrix, this class only represents one single matrix without a completeGLMatrixFuncimplementation, allowing this class to be more lightweight.Implementation is not mature - WIP and subject to change.
-
-
Constructor Summary
Constructors Constructor Description Matrix4()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatdeterminant()float[]getMatrix()booleaninvert()voidloadIdentity()voidmakeFrustum(float left, float right, float bottom, float top, float zNear, float zFar)voidmakeOrtho(float left, float right, float bottom, float top, float zNear, float zFar)voidmakePerspective(float fovy_rad, float aspect, float zNear, float zFar)voidmultMatrix(float[] m)Multiply matrix: [this] = [this] x [m]voidmultMatrix(float[] m, int m_offset)Multiply matrix: [this] = [this] x [m]voidmultMatrix(Matrix4 m)Multiply matrix: [this] = [this] x [m]voidmultVec(float[] v_in, float[] v_out)voidmultVec(float[] v_in, int v_in_offset, float[] v_out, int v_out_offset)voidrotate(float angrad, float x, float y, float z)voidrotate(Quaternion quat)Rotate the current matrix with the givenQuaternion's rotationmatrix representation.voidscale(float x, float y, float z)voidtranslate(float x, float y, float z)voidtranspose()
-
-
-
Method Detail
-
getMatrix
public final float[] getMatrix()
-
loadIdentity
public final void loadIdentity()
-
multMatrix
public final void multMatrix(float[] m, int m_offset)Multiply matrix: [this] = [this] x [m]- Parameters:
m- 4x4 matrix in column-major order
-
multMatrix
public final void multMatrix(float[] m)
Multiply matrix: [this] = [this] x [m]- Parameters:
m- 4x4 matrix in column-major order
-
multMatrix
public final void multMatrix(Matrix4 m)
Multiply matrix: [this] = [this] x [m]- Parameters:
m- 4x4 matrix in column-major order
-
multVec
public final void multVec(float[] v_in, float[] v_out)- Parameters:
v_in- 4-component column-vectorv_out- this * v_in
-
multVec
public final void multVec(float[] v_in, int v_in_offset, float[] v_out, int v_out_offset)- Parameters:
v_in- 4-component column-vectorv_out- this * v_in
-
translate
public final void translate(float x, float y, float z)
-
scale
public final void scale(float x, float y, float z)
-
rotate
public final void rotate(float angrad, float x, float y, float z)
-
rotate
public final void rotate(Quaternion quat)
Rotate the current matrix with the givenQuaternion's rotationmatrix representation.
-
transpose
public final void transpose()
-
determinant
public final float determinant()
-
invert
public final boolean invert()
-
makeOrtho
public final void makeOrtho(float left, float right, float bottom, float top, float zNear, float zFar)
-
makeFrustum
public final void makeFrustum(float left, float right, float bottom, float top, float zNear, float zFar) throws GLException- Parameters:
left-right-bottom-top-zNear-zFar-- Throws:
GLException- ifzNear <= 0orzFar <= zNearorleft == right, orbottom == top.- See Also:
FloatUtil.makeFrustum(float[], int, boolean, float, float, float, float, float, float)
-
makePerspective
public final void makePerspective(float fovy_rad, float aspect, float zNear, float zFar) throws GLException- Parameters:
fovy_rad-aspect-zNear-zFar-- Throws:
GLException- ifzNear <= 0orzFar <= zNear- See Also:
FloatUtil.makePerspective(float[], int, boolean, float, float, float, float)
-
-