Package org.oscim.renderer
Class GLMatrix
java.lang.Object
org.oscim.renderer.GLMatrix
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDepthOffset(int delta) add some offset (similar to glDepthOffset)voidCopy values from matvoidfinalize()Free native objectstatic voidfrustumM(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 planesvoidget(float[] m) Get the Matrix as float arraystatic booleaninvertM(float[] mInv, int mInvOffset, float[] m, int mOffset) Inverts a 4 x 4 matrix.static voidlookAt(float[] m, int offset, float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz) voidmultiplyLhs(GLMatrix lhs) Use this matrix as rhs, multiply it on lhs and store result.voidmultiplyMM(GLMatrix lhs, GLMatrix rhs) Multiply rhs onto lhs and store result in Matrix.voidmultiplyRhs(GLMatrix rhs) Multiply rhs onto Matrix.static voidorthoM(float[] m, int offset, float left, float right, float bottom, float top, float near, float far) voidprj(float[] vec3) Project Vector with Matrixvoidprj2D(float[] src, int src_offset, float[] dst, int dst_offset, int length) Project Vectors with Matrixvoidprj2D(float[] vec2, int offset, int length) Project Vectors with Matrixvoidprj3D(float[] vec3, int offset, int length) Project Vectors with Matrixvoidset(float[] m) Set the Matrix from float arrayvoidsetAsUniform(int location) Set Matrix with glUniformMatrixvoidSet identity matrixvoidsetRotation(float a, float x, float y, float z) Set rotationvoidsetScale(float x, float y, float z) Set scale factorvoidsetTranslation(float x, float y, float z) Set translationvoidsetTransScale(float tx, float ty, float scale) Set translation and x,y scalevoidsetValue(int pos, float value) Set single valuevoidtransposeM(GLMatrix mat) Transpose mat and store result in Matrix
-
Constructor Details
-
GLMatrix
public GLMatrix()
-
-
Method Details
-
set
public void set(float[] m) Set the Matrix from float array- Parameters:
m- float array to copy
-
get
public void get(float[] m) Get the Matrix as float array- Parameters:
m- float array to store Matrix
-
copy
Copy values from mat- Parameters:
mat- Matrix to copy
-
prj
public void prj(float[] vec3) Project Vector with Matrix- Parameters:
vec3- Vector to project
-
prj3D
public void prj3D(float[] vec3, int offset, int length) Project Vectors with Matrix- Parameters:
vec3- Vector to project
-
prj2D
public void prj2D(float[] vec2, int offset, int length) Project Vectors with Matrix- Parameters:
vec2- Vector to project
-
prj2D
public void prj2D(float[] src, int src_offset, float[] dst, int dst_offset, int length) Project Vectors with Matrix- Parameters:
vec2- Vector to project
-
multiplyRhs
Multiply rhs onto Matrix.- Parameters:
rhs- right hand side
-
multiplyLhs
Use this matrix as rhs, multiply it on lhs and store result.- Parameters:
lhs- right hand side
-
multiplyMM
Multiply rhs onto lhs and store result in Matrix. This matrix MUST be different from lhs and rhs! when combining matrices for vector projection this has the same effect first as applying rhs then lhs.- Parameters:
lhs- left hand siderhs- right hand side
-
transposeM
Transpose mat and store result in Matrix- Parameters:
mat- to transpose
-
setRotation
public void setRotation(float a, float x, float y, float z) Set rotation- Parameters:
a- angle in degreex- around x-axisy- around y-axisz- around z-axis
-
setTranslation
public void setTranslation(float x, float y, float z) Set translation- Parameters:
x- along x-axisy- along y-axisz- along z-axis
-
setScale
public void setScale(float x, float y, float z) Set scale factor- Parameters:
x- axisy- axisz- axis
-
setTransScale
public void setTransScale(float tx, float ty, float scale) Set translation and x,y scale- Parameters:
tx- translate xty- translate yscale- factor x,y
-
setAsUniform
public void setAsUniform(int location) Set Matrix with glUniformMatrix- Parameters:
location- GL location id
-
setValue
public void setValue(int pos, float value) Set single value- Parameters:
pos- at positionvalue- value to set
-
addDepthOffset
public void addDepthOffset(int delta) add some offset (similar to glDepthOffset)- Parameters:
delta- offset
-
setIdentity
public void setIdentity()Set identity matrix -
finalize
public void finalize()Free native object -
frustumM
public 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- Parameters:
m- the float array that holds the perspective matrixoffset- the offset into float array m where the perspective matrix data is written
-
invertM
public static boolean invertM(float[] mInv, int mInvOffset, float[] m, int mOffset) Inverts a 4 x 4 matrix.- Parameters:
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.- Returns:
- true if the matrix could be inverted, false if it could not.
-
lookAt
public static void lookAt(float[] m, int offset, float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz) -
orthoM
public static void orthoM(float[] m, int offset, float left, float right, float bottom, float top, float near, float far)
-