public class GLMatrix
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
M00 |
static int |
M01 |
static int |
M02 |
static int |
M03 |
static int |
M10 |
static int |
M11 |
static int |
M12 |
static int |
M13 |
static int |
M20 |
static int |
M21 |
static int |
M22 |
static int |
M23 |
static int |
M30 |
static int |
M31 |
static int |
M32 |
static int |
M33 |
float[] |
tmp |
float[] |
val |
| Constructor and Description |
|---|
GLMatrix() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDepthOffset(int delta)
add some offset (similar to glDepthOffset)
|
void |
copy(GLMatrix m)
Copy values from mat
|
static void |
frustumM(float[] m,
int offset,
float left,
float right,
float bottom,
float top,
float near,
float far)
Define a projection matrix in terms of six clip planes
|
void |
get(float[] m)
Get the Matrix as float array
|
static boolean |
invertM(float[] mInv,
int mInvOffset,
float[] m,
int mOffset)
Inverts a 4 x 4 matrix.
|
void |
multiplyLhs(GLMatrix lhs)
Use this matrix as rhs, multiply it on lhs and store result.
|
void |
multiplyMM(GLMatrix lhs,
GLMatrix rhs)
Multiply rhs onto lhs and store result in Matrix.
|
void |
multiplyRhs(GLMatrix rhs)
Multiply rhs onto Matrix.
|
void |
prj(float[] vec3)
Project Vector with Matrix
|
void |
prj2D(float[] src,
int src_offset,
float[] dst,
int dst_offset,
int length)
Project Vectors with Matrix
|
void |
prj2D(float[] vec,
int offset,
int cnt) |
void |
prj3D(float[] vec,
int offset,
int cnt) |
void |
set(float[] values)
Sets the matrix to the given matrix as a float array.
|
void |
setAsUniform(int location)
Set Matrix with glUniformMatrix
|
void |
setIdentity()
Set identity matrix
|
void |
setRotation(float a,
float x,
float y,
float z)
Set rotation
|
void |
setScale(float x,
float y,
float z)
Set scale factor
|
void |
setTranslation(float x,
float y,
float z)
Set translation
|
void |
setTransScale(float tx,
float ty,
float scale)
Set translation and x,y scale
|
void |
setValue(int pos,
float value)
Set single value
|
void |
transposeM(GLMatrix mat)
Transpose mat and store result in Matrix
|
public static final int M00
public static final int M01
public static final int M02
public static final int M03
public static final int M10
public static final int M11
public static final int M12
public static final int M13
public static final int M20
public static final int M21
public static final int M22
public static final int M23
public static final int M30
public static final int M31
public static final int M32
public static final int M33
public final float[] tmp
public final float[] val
public void set(float[] values)
values - The matrix, in float form, that is to be copied. Remember
that this matrix is in column
major order.public void get(float[] m)
m - float array to store Matrixpublic void copy(GLMatrix m)
mat - Matrix to copypublic void prj(float[] vec3)
vec3 - Vector to projectpublic void prj3D(float[] vec,
int offset,
int cnt)
public void prj2D(float[] vec,
int offset,
int cnt)
public void prj2D(float[] src,
int src_offset,
float[] dst,
int dst_offset,
int length)
vec2 - Vector to projectpublic void multiplyRhs(GLMatrix rhs)
rhs - right hand sidepublic void multiplyLhs(GLMatrix lhs)
lhs - right hand sidepublic void multiplyMM(GLMatrix lhs, GLMatrix rhs)
lhs - left hand siderhs - right hand sidepublic void transposeM(GLMatrix mat)
mat - to transposepublic void setRotation(float a,
float x,
float y,
float z)
a - angle in degreex - around x-axisy - around y-axisz - around z-axispublic void setTranslation(float x,
float y,
float z)
x - along x-axisy - along y-axisz - along z-axispublic void setScale(float x,
float y,
float z)
x - axisy - axisz - axispublic void setTransScale(float tx,
float ty,
float scale)
tx - translate xty - translate yscale - factor x,ypublic void setAsUniform(int location)
location - GL location idpublic void setValue(int pos,
float value)
pos - at positionvalue - value to setpublic void addDepthOffset(int delta)
delta - offsetpublic void setIdentity()
public static void frustumM(float[] m,
int offset,
float left,
float right,
float bottom,
float top,
float near,
float far)
m - the float array that holds the perspective matrixoffset - the offset into float array m where the perspective
matrix data is writtenpublic static boolean invertM(float[] mInv,
int mInvOffset,
float[] m,
int mOffset)
mInv - the array that holds the output inverted matrixmInvOffset - an offset into mInv where the inverted matrix is
stored.m - the input arraymOffset - an offset into m where the matrix is stored.