public class Matrix4f extends Object
Constructor and Description |
---|
Matrix4f()
Creates a new identity 4x4 matrix
|
Matrix4f(float[] dataArray)
Creates a new matrix and sets its values from the given
parameter
|
Modifier and Type | Method and Description |
---|---|
float |
get(int x,
int y)
Returns the value for a given row and column
|
float[] |
getArray()
Return a reference to the internal array representing matrix
values.
|
boolean |
inverse()
Sets the current matrix to its inverse
|
boolean |
inverseTranspose()
Sets the current matrix to its inverse transpose
|
void |
load(Matrix3f src)
Sets the values of the matrix to those of the parameter
|
void |
load(Matrix4f src)
Sets the values of the matrix to those of the parameter
|
void |
loadFrustum(float l,
float r,
float b,
float t,
float n,
float f)
Sets current values to be a perspective projection matrix
|
void |
loadIdentity()
Sets the matrix values to identity
|
void |
loadMultiply(Matrix4f lhs,
Matrix4f rhs)
Sets current values to be the result of multiplying two given
matrices
|
void |
loadOrtho(float l,
float r,
float b,
float t,
float n,
float f)
Set current values to be an orthographic projection matrix
|
void |
loadOrthoWindow(int w,
int h)
Set current values to be an orthographic projection matrix
with the right and bottom clipping planes set to the given
values.
|
void |
loadPerspective(float fovy,
float aspect,
float near,
float far)
Sets current values to be a perspective projection matrix
|
void |
loadProjectionNormalized(int w,
int h)
Helper function to set the current values to a perspective
projection matrix with aspect ratio defined by the parameters
and (near, far), (bottom, top) mapping to (-1, 1) at z = 0
|
void |
loadRotate(float rot,
float x,
float y,
float z)
Sets current values to be a rotation matrix of certain angle
about a given axis
|
void |
loadScale(float x,
float y,
float z)
Sets current values to be a scale matrix of given dimensions
|
void |
loadTranslate(float x,
float y,
float z)
Sets current values to be a translation matrix of given
dimensions
|
void |
multiply(Matrix4f rhs)
Post-multiplies the current matrix by a given parameter
|
void |
rotate(float rot,
float x,
float y,
float z)
Modifies the current matrix by post-multiplying it with a
rotation matrix of certain angle about a given axis
|
void |
scale(float x,
float y,
float z)
Modifies the current matrix by post-multiplying it with a
scale matrix of given dimensions
|
void |
set(int x,
int y,
float v)
Sets the value for a given row and column
|
void |
translate(float x,
float y,
float z)
Modifies the current matrix by post-multiplying it with a
translation matrix of given dimensions
|
void |
transpose()
Sets the current matrix to its transpose
|
public Matrix4f()
public Matrix4f(float[] dataArray)
dataArray
- values to set the matrix to, must be 16
floats longpublic float[] getArray()
public float get(int x, int y)
x
- column of the value to returny
- row of the value to returnpublic void set(int x, int y, float v)
x
- column of the value to sety
- row of the value to setpublic void loadIdentity()
public void load(Matrix4f src)
src
- matrix to load the values frompublic void load(Matrix3f src)
src
- matrix to load the values frompublic void loadRotate(float rot, float x, float y, float z)
rot
- angle of rotationx
- rotation axis xy
- rotation axis yz
- rotation axis zpublic void loadScale(float x, float y, float z)
x
- scale component xy
- scale component yz
- scale component zpublic void loadTranslate(float x, float y, float z)
x
- translation component xy
- translation component yz
- translation component zpublic void loadMultiply(Matrix4f lhs, Matrix4f rhs)
lhs
- left hand side matrixrhs
- right hand side matrixpublic void loadOrtho(float l, float r, float b, float t, float n, float f)
l
- location of the left vertical clipping planer
- location of the right vertical clipping planeb
- location of the bottom horizontal clipping planet
- location of the top horizontal clipping planen
- location of the near clipping planef
- location of the far clipping planepublic void loadOrthoWindow(int w, int h)
w
- location of the right vertical clipping planeh
- location of the bottom horizontal clipping planepublic void loadFrustum(float l, float r, float b, float t, float n, float f)
l
- location of the left vertical clipping planer
- location of the right vertical clipping planeb
- location of the bottom horizontal clipping planet
- location of the top horizontal clipping planen
- location of the near clipping plane, must be positivef
- location of the far clipping plane, must be positivepublic void loadPerspective(float fovy, float aspect, float near, float far)
fovy
- vertical field of view angle in degreesaspect
- aspect ratio of the screennear
- near cliping plane, must be positivefar
- far clipping plane, must be positivepublic void loadProjectionNormalized(int w, int h)
w
- screen widthh
- screen heightpublic void multiply(Matrix4f rhs)
rhs
- right hand side to multiply bypublic void rotate(float rot, float x, float y, float z)
rot
- angle of rotationx
- rotation axis xy
- rotation axis yz
- rotation axis zpublic void scale(float x, float y, float z)
x
- scale component xy
- scale component yz
- scale component zpublic void translate(float x, float y, float z)
x
- translation component xy
- translation component yz
- translation component zpublic boolean inverse()
public boolean inverseTranspose()
public void transpose()