aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-28 03:02:25 +0200
committerSven Gothel <[email protected]>2014-06-28 03:02:25 +0200
commitee774dce9e474e8ea961bd9b504d26e9321e1b15 (patch)
tree9af71ec07329226ae3882b5a586fd16292b45864 /src/jogl/classes/com/jogamp/opengl/util
parent0bded476868c5fdfe44502bfd55957469d0d72bb (diff)
Enhance FloatUtil: More optimizations, concludes commit 0bded476868c5fdfe44502bfd55957469d0d72bb
FloatUtil optimizations (unroll and linear memeory access): - transposeMatrix - invertMatrix (diff algo as well - 50% speed bump) - multMatrix - multMatrixVec FloatUtil added - matrixDeterminant(..) FloatUtil removed - Certain FloatBuffer variants are removed or at least marked deprecated.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/util')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index f79efad2f..079bd2987 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -174,6 +174,7 @@ public final class PMVMatrix implements GLMatrixFunc {
* @param a 4x4 matrix in column major order (OpenGL)
* @return matrix string representation
*/
+ @SuppressWarnings("deprecation")
public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a) {
return FloatUtil.matrixToString(sb, null, f, a, 0, 4, 4, false);
}
@@ -185,6 +186,7 @@ public final class PMVMatrix implements GLMatrixFunc {
* @param b 4x4 matrix in column major order (OpenGL)
* @return side by side representation
*/
+ @SuppressWarnings("deprecation")
public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a, FloatBuffer b) {
return FloatUtil.matrixToString(sb, null, f, a, 0, b, 0, 4, 4, false);
}
@@ -205,9 +207,9 @@ public final class PMVMatrix implements GLMatrixFunc {
// Mvit Modelview-Inverse-Transpose
matrixArray = new float[5*16];
- mP_offset = 0*16;
- mMv_offset = 1*16;
- mTex_offset = 4*16;
+ mP_offset = 0*16;
+ mMv_offset = 1*16;
+ mTex_offset = 4*16;
matrixPMvMvit = Buffers.slice2Float(matrixArray, 0*16, 4*16); // P + Mv + Mvi + Mvit
matrixPMvMvi = Buffers.slice2Float(matrixArray, 0*16, 3*16); // P + Mv + Mvi
@@ -535,17 +537,17 @@ public final class PMVMatrix implements GLMatrixFunc {
*/
public final void glLoadMatrix(final Quaternion quat) {
if(matrixMode==GL_MODELVIEW) {
- quat.toMatrix(matrixMv);
+ quat.toMatrix(matrixArray, mMv_offset);
matrixMv.reset();
dirtyBits |= DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM ;
modifiedBits |= MODIFIED_MODELVIEW;
} else if(matrixMode==GL_PROJECTION) {
- quat.toMatrix(matrixP);
+ quat.toMatrix(matrixArray, mP_offset);
matrixP.reset();
dirtyBits |= DIRTY_FRUSTUM ;
modifiedBits |= MODIFIED_PROJECTION;
} else if(matrixMode==GL.GL_TEXTURE) {
- quat.toMatrix(matrixTex);
+ quat.toMatrix(matrixArray, mTex_offset);
matrixTex.reset();
modifiedBits |= MODIFIED_TEXTURE;
}
@@ -597,6 +599,7 @@ public final class PMVMatrix implements GLMatrixFunc {
}
}
+ @SuppressWarnings("deprecation")
@Override
public final void glMultMatrixf(final FloatBuffer m) {
if(matrixMode==GL_MODELVIEW) {
@@ -1033,7 +1036,7 @@ public final class PMVMatrix implements GLMatrixFunc {
final int _matrixMviOffset = matrixMvi.position();
boolean res = false;
if( 0 != ( dirtyBits & DIRTY_INVERSE_MODELVIEW ) ) { // only if dirt; always requested at this point, see update()
- if( null == FloatUtil.invertMatrix(matrixArray, mMv_offset, _matrixMvi, _matrixMviOffset, mat4Tmp1) ) {
+ if( null == FloatUtil.invertMatrix(matrixArray, mMv_offset, _matrixMvi, _matrixMviOffset) ) {
throw new GLException(msgCantComputeInverse);
}
dirtyBits &= ~DIRTY_INVERSE_MODELVIEW;