diff options
author | olamedia <[email protected]> | 2012-12-23 11:30:36 +0600 |
---|---|---|
committer | olamedia <[email protected]> | 2012-12-23 11:30:36 +0600 |
commit | f58bdfcb66353bb77213cab580bc49ef890417ad (patch) | |
tree | 2983a05d564891e92c115a679f9bfbf55465c755 /src/ru/olamedia/geom/Frustum.java | |
parent | 5320fd1dad5b77fa227e83fbbe0a958f2c5fc283 (diff) |
0.1.7
Diffstat (limited to 'src/ru/olamedia/geom/Frustum.java')
-rw-r--r-- | src/ru/olamedia/geom/Frustum.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ru/olamedia/geom/Frustum.java b/src/ru/olamedia/geom/Frustum.java index 2065157..1a9d58d 100644 --- a/src/ru/olamedia/geom/Frustum.java +++ b/src/ru/olamedia/geom/Frustum.java @@ -1,9 +1,43 @@ package ru.olamedia.geom; +import java.nio.FloatBuffer; + +import org.openmali.vecmath2.Matrix4f; + +import com.jogamp.opengl.util.PMVMatrix; + //import org.openmali.spatial.bodies.Frustum; public class Frustum extends org.openmali.spatial.bodies.Frustum { + protected PMVMatrix pmvMatrix; + protected int mvOffset; + public Frustum() { super(); } + + public Frustum(PMVMatrix matrix) { + super(); + this.pmvMatrix = matrix; + } + + public float[] getMatrixFloat(FloatBuffer b) { + if (pmvMatrix.usesBackingArray()) { + return b.array(); + } else { + int p = b.position(); + float[] pm = new float[16]; + b.get(pm, p, 16); + b.position(p); + return pm; + } + } + + public void compute() { + Matrix4f proj = new Matrix4f(getMatrixFloat(pmvMatrix.glGetPMatrixf())); + // proj.transpose(); + Matrix4f modl = new Matrix4f(getMatrixFloat(pmvMatrix.glGetMviMatrixf())); + // modl.transpose(); + compute(proj, modl); + } } |