summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java58
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java10
2 files changed, 34 insertions, 34 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
index d2e7403c2..1ebf8ce9f 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
@@ -45,13 +45,13 @@ public class Frustum {
/**
* Creates a defined instance w/ calculating the frustum
- * using the passed float[16] as premultiplied P*MV.
+ * using the passed float[16] as premultiplied MV*P (column major order)
*/
- public Frustum(float[] pmv, int pmv_off) {
+ public Frustum(float[] mvp, int pmv_off) {
for (int i = 0; i < 6; ++i) {
planes[i] = new Plane();
}
- update(pmv, pmv_off);
+ update(mvp, pmv_off);
}
public static class Plane {
@@ -81,68 +81,68 @@ public class Frustum {
/**
* Re-calculate the frustum
- * using the passed float[16] as premultiplied P*MV.
+ * using the passed float[16] as premultiplied MV*P (column major order).
*/
- public void update(float[] pmv, int pmv_off) {
+ public void update(float[] mvp, int mvp_off) {
// Left: [30+00, 31+01, 32+02, 33+03]
// comboMatrix.m[12] + comboMatrix.m[0];
{
final Plane p = planes[0];
final float[] p_n = p.n;
- p_n[0] = pmv[ pmv_off + 12 ] + pmv[ pmv_off + 0 ];
- p_n[1] = pmv[ pmv_off + 13 ] + pmv[ pmv_off + 1 ];
- p_n[2] = pmv[ pmv_off + 14 ] + pmv[ pmv_off + 2 ];
- p.d = pmv[ pmv_off + 15 ] + pmv[ pmv_off + 3 ];
+ p_n[0] = mvp[ mvp_off + 12 ] + mvp[ mvp_off + 0 ];
+ p_n[1] = mvp[ mvp_off + 13 ] + mvp[ mvp_off + 1 ];
+ p_n[2] = mvp[ mvp_off + 14 ] + mvp[ mvp_off + 2 ];
+ p.d = mvp[ mvp_off + 15 ] + mvp[ mvp_off + 3 ];
}
// Right: [30-00, 31-01, 32-02, 33-03]
{
final Plane p = planes[1];
final float[] p_n = p.n;
- p_n[0] = pmv[ pmv_off + 12 ] - pmv[ pmv_off + 0 ];
- p_n[1] = pmv[ pmv_off + 13 ] - pmv[ pmv_off + 1 ];
- p_n[2] = pmv[ pmv_off + 14 ] - pmv[ pmv_off + 2 ];
- p.d = pmv[ pmv_off + 15 ] - pmv[ pmv_off + 3 ];
+ p_n[0] = mvp[ mvp_off + 12 ] - mvp[ mvp_off + 0 ];
+ p_n[1] = mvp[ mvp_off + 13 ] - mvp[ mvp_off + 1 ];
+ p_n[2] = mvp[ mvp_off + 14 ] - mvp[ mvp_off + 2 ];
+ p.d = mvp[ mvp_off + 15 ] - mvp[ mvp_off + 3 ];
}
// Bottom: [30+10, 31+11, 32+12, 33+13]
{
final Plane p = planes[2];
final float[] p_n = p.n;
- p_n[0] = pmv[ pmv_off + 12 ] + pmv[ pmv_off + 4 ];
- p_n[1] = pmv[ pmv_off + 13 ] + pmv[ pmv_off + 5 ];
- p_n[2] = pmv[ pmv_off + 14 ] + pmv[ pmv_off + 6 ];
- p.d = pmv[ pmv_off + 15 ] + pmv[ pmv_off + 7 ];
+ p_n[0] = mvp[ mvp_off + 12 ] + mvp[ mvp_off + 4 ];
+ p_n[1] = mvp[ mvp_off + 13 ] + mvp[ mvp_off + 5 ];
+ p_n[2] = mvp[ mvp_off + 14 ] + mvp[ mvp_off + 6 ];
+ p.d = mvp[ mvp_off + 15 ] + mvp[ mvp_off + 7 ];
}
// Top: [30-10, 31-11, 32-12, 33-13]
{
final Plane p = planes[3];
final float[] p_n = p.n;
- p_n[0] = pmv[ pmv_off + 12 ] - pmv[ pmv_off + 4 ];
- p_n[1] = pmv[ pmv_off + 13 ] - pmv[ pmv_off + 5 ];
- p_n[2] = pmv[ pmv_off + 14 ] - pmv[ pmv_off + 6 ];
- p.d = pmv[ pmv_off + 15 ] - pmv[ pmv_off + 7 ];
+ p_n[0] = mvp[ mvp_off + 12 ] - mvp[ mvp_off + 4 ];
+ p_n[1] = mvp[ mvp_off + 13 ] - mvp[ mvp_off + 5 ];
+ p_n[2] = mvp[ mvp_off + 14 ] - mvp[ mvp_off + 6 ];
+ p.d = mvp[ mvp_off + 15 ] - mvp[ mvp_off + 7 ];
}
// Near: [30+20, 31+21, 32+22, 33+23]
{
final Plane p = planes[4];
final float[] p_n = p.n;
- p_n[0] = pmv[ pmv_off + 12 ] + pmv[ pmv_off + 8 ];
- p_n[1] = pmv[ pmv_off + 13 ] + pmv[ pmv_off + 9 ];
- p_n[2] = pmv[ pmv_off + 14 ] + pmv[ pmv_off + 10 ];
- p.d = pmv[ pmv_off + 15 ] + pmv[ pmv_off + 11 ];
+ p_n[0] = mvp[ mvp_off + 12 ] + mvp[ mvp_off + 8 ];
+ p_n[1] = mvp[ mvp_off + 13 ] + mvp[ mvp_off + 9 ];
+ p_n[2] = mvp[ mvp_off + 14 ] + mvp[ mvp_off + 10 ];
+ p.d = mvp[ mvp_off + 15 ] + mvp[ mvp_off + 11 ];
}
// Far: [30-20, 31-21, 32-22, 33-23]
{
final Plane p = planes[5];
final float[] p_n = p.n;
- p_n[0] = pmv[ pmv_off + 12 ] - pmv[ pmv_off + 8 ];
- p_n[1] = pmv[ pmv_off + 13 ] - pmv[ pmv_off + 9 ];
- p_n[2] = pmv[ pmv_off + 14 ] - pmv[ pmv_off + 10 ];
- p.d = pmv[ pmv_off + 15 ] - pmv[ pmv_off + 11 ];
+ p_n[0] = mvp[ mvp_off + 12 ] - mvp[ mvp_off + 8 ];
+ p_n[1] = mvp[ mvp_off + 13 ] - mvp[ mvp_off + 9 ];
+ p_n[2] = mvp[ mvp_off + 14 ] - mvp[ mvp_off + 10 ];
+ p.d = mvp[ mvp_off + 15 ] - mvp[ mvp_off + 11 ];
}
for (int i = 0; i < 6; ++i) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index 18129ba09..237596a81 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -275,7 +275,7 @@ public class PMVMatrix implements GLMatrixFunc {
requestMask = 0;
matrixMode = GL_MODELVIEW;
- mulPMV = null;
+ mulMVP = null;
frustum = null;
}
@@ -1040,10 +1040,10 @@ public class PMVMatrix implements GLMatrixFunc {
if( 0 != ( dirtyBits & ( DIRTY_FRUSTUM & requestMask ) ) ) {
if( null == frustum ) {
frustum = new Frustum();
- mulPMV = new float[16];
+ mulMVP = new float[16];
}
- FloatUtil.multMatrixf(matrixP, matrixMv, mulPMV, 0);
- frustum.update(mulPMV, 0);
+ FloatUtil.multMatrixf(matrixMv, matrixP, mulMVP, 0);
+ frustum.update(mulMVP, 0);
dirtyBits &= ~DIRTY_FRUSTUM;
mod = true;
}
@@ -1128,6 +1128,6 @@ public class PMVMatrix implements GLMatrixFunc {
protected int dirtyBits = DIRTY_ALL; // contains the dirty bits, i.e. hinting for update operation
protected int requestMask = 0; // may contain the requested dirty bits: DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW
protected ProjectFloat projectFloat;
- protected float[] mulPMV; // premultiplied PMV
+ protected float[] mulMVP; // premultiplied PMV
protected Frustum frustum;
}