aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph/curve
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-06-27 18:16:43 +0200
committerSven Gothel <[email protected]>2014-06-27 18:16:43 +0200
commit0bded476868c5fdfe44502bfd55957469d0d72bb (patch)
tree8f3baefe8c7267a11dffacc4ba1814478c4b2123 /src/jogl/classes/jogamp/graph/curve
parent21b84da775fae5806481ecc658a207bf603126d5 (diff)
Enhance FloatUtil: Merge ProjectFloat features while adding optimized variations; PMVMatrix: Remove NIO buffer path, use backing-array only and FloatUtil direct.
- FloatUtil pptimized variants: - mapObjToWinCoords (gluProject) passing 'P x Mv' for batch operations - mapWinToObjCoords (gluUnProject) passing 'Inv(P x Mv)' for batch operations - mapWinToObjCoords (gluUnProject) passing 'Inv(P x Mv)' and two winz values for two ray picking resulting in two obj positions. (-> mapWinToRay) - PMVMatrix - dropped low performance NIO mode - simply use common backing-array and fixed offsets directly - drop ProjectFloat usage in favor of FloatUtil - reduce number of temporary arrays
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java18
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java17
2 files changed, 25 insertions, 10 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index a9aa8cfb0..b56a69b28 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -166,8 +166,8 @@ public class VBORegion2PMSAAES2 extends GLRegion {
gcu_ColorTexBBox = null;
}
- FloatUtil.makeIdentityf(pmvMatrix02, 0);
- FloatUtil.makeIdentityf(pmvMatrix02, 16);
+ FloatUtil.makeIdentity(pmvMatrix02, 0);
+ FloatUtil.makeIdentity(pmvMatrix02, 16);
gcu_PMVMatrix02 = new GLUniformData(UniformNames.gcu_PMVMatrix02, 4, 4, FloatBuffer.wrap(pmvMatrix02));
// Pass 2:
@@ -288,7 +288,11 @@ public class VBORegion2PMSAAES2 extends GLRegion {
private final AABBox drawWinBox = new AABBox();
private final int[] drawView = new int[] { 0, 0, 0, 0 };
- private final float[] drawTmpV3 = new float[3];
+ private final float[] drawVec4Tmp0 = new float[4];
+ private final float[] drawVec4Tmp1 = new float[4];
+ private final float[] drawVec4Tmp2 = new float[4];
+ private final float[] drawMat4PMv = new float[16];
+
private final int border = 2; // surrounding border, i.e. width += 2*border, height +=2*border
@Override
@@ -328,7 +332,11 @@ public class VBORegion2PMSAAES2 extends GLRegion {
// considering the sampleCount.
drawView[2] = vpWidth;
drawView[3] = vpHeight;
- box.mapToWindow(drawWinBox, renderer.getMatrix(), drawView, true /* useCenterZ */, drawTmpV3);
+
+ renderer.getMatrix().multPMvMatrixf(drawMat4PMv, 0);
+ box.mapToWindow(drawWinBox, drawMat4PMv, drawView, true /* useCenterZ */,
+ drawVec4Tmp0, drawVec4Tmp1, drawVec4Tmp2);
+
winWidth = drawWinBox.getWidth();
winHeight = drawWinBox.getHeight();
targetWinWidth = (int)Math.ceil(winWidth);
@@ -392,7 +400,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
fb.position(12);
}
gca_FboVerticesAttr.seal(true);
- FloatUtil.makeOrthof(pmvMatrix02, 0, true, minX, maxX, minY, maxY, -1, 1);
+ FloatUtil.makeOrtho(pmvMatrix02, 0, true, minX, maxX, minY, maxY, -1, 1);
useShaderProgram(gl, renderer, getRenderModes(), true, getQuality(), sampleCount[0]);
renderRegion2FBO(gl, rs, targetFboWidth, targetFboHeight, vpWidth, vpHeight, sampleCount);
} else if( isStateDirty() ) {
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 68a7b6dbd..861d889c1 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -201,8 +201,8 @@ public class VBORegion2PVBAAES2 extends GLRegion {
gcu_ColorTexBBox = null;
}
- FloatUtil.makeIdentityf(pmvMatrix02, 0);
- FloatUtil.makeIdentityf(pmvMatrix02, 16);
+ FloatUtil.makeIdentity(pmvMatrix02, 0);
+ FloatUtil.makeIdentity(pmvMatrix02, 16);
gcu_PMVMatrix02 = new GLUniformData(UniformNames.gcu_PMVMatrix02, 4, 4, FloatBuffer.wrap(pmvMatrix02));
// Pass 2:
@@ -333,7 +333,10 @@ public class VBORegion2PVBAAES2 extends GLRegion {
private final AABBox drawWinBox = new AABBox();
private final int[] drawView = new int[] { 0, 0, 0, 0 };
- private final float[] drawTmpV3 = new float[3];
+ private final float[] drawVec4Tmp0 = new float[4];
+ private final float[] drawVec4Tmp1 = new float[4];
+ private final float[] drawVec4Tmp2 = new float[4];
+ private final float[] drawMat4PMv = new float[16];
private final int border = 2; // surrounding border, i.e. width += 2*border, height +=2*border
@Override
@@ -373,7 +376,11 @@ public class VBORegion2PVBAAES2 extends GLRegion {
// considering the sampleCount.
drawView[2] = vpWidth;
drawView[3] = vpHeight;
- box.mapToWindow(drawWinBox, renderer.getMatrix(), drawView, true /* useCenterZ */, drawTmpV3);
+
+ renderer.getMatrix().multPMvMatrixf(drawMat4PMv, 0);
+ box.mapToWindow(drawWinBox, drawMat4PMv, drawView, true /* useCenterZ */,
+ drawVec4Tmp0, drawVec4Tmp1, drawVec4Tmp2);
+
winWidth = drawWinBox.getWidth();
winHeight = drawWinBox.getHeight();
targetWinWidth = (int)Math.ceil(winWidth);
@@ -512,7 +519,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
fb.position(12);
}
gca_FboVerticesAttr.seal(true);
- FloatUtil.makeOrthof(pmvMatrix02, 0, true, minX, maxX, minY, maxY, -1, 1);
+ FloatUtil.makeOrtho(pmvMatrix02, 0, true, minX, maxX, minY, maxY, -1, 1);
useShaderProgram(gl, renderer, getRenderModes(), true, getQuality(), sampleCount[0]);
renderRegion2FBO(gl, rs, targetFboWidth, targetFboHeight, newFboWidth, newFboHeight, vpWidth, vpHeight, sampleCount[0]);
} else if( isStateDirty() ) {