diff options
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java | 5 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java | 18 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java index 075a65ec9..94293a947 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java @@ -121,6 +121,7 @@ public class VBORegion2PES2 implements Region{ verticesBuffer.put(v.getY()); } verticesBuffer.put(v.getZ()); + if(flipped){ box.resize(v.getX(), -1*v.getY(), v.getZ()); } @@ -347,4 +348,8 @@ public class VBORegion2PES2 implements Region{ public void setFlipped(boolean flipped) { this.flipped = flipped; } + + public AABBox getBounds(){ + return box; + } } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 701549d46..8f83d4d04 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -37,6 +37,7 @@ import javax.media.opengl.GLContext; import com.jogamp.common.nio.Buffers; import com.jogamp.graph.curve.Region; +import com.jogamp.graph.geom.AABBox; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; import com.jogamp.opengl.util.PMVMatrix; @@ -55,11 +56,14 @@ public class VBORegionSPES2 implements Region{ private boolean flipped = false; private boolean dirty = false; + private AABBox box = null; + public VBORegionSPES2(GLContext context){ this.context =context; } public void update(){ + box = new AABBox(); GL2ES2 gl = context.getGL().getGL2ES2(); ShortBuffer indicies = Buffers.newDirectShortBuffer(triangles.size() * 3); @@ -93,14 +97,21 @@ public class VBORegionSPES2 implements Region{ FloatBuffer verticesBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 3); for(Vertex v:vertices){ - verticesBuffer.put(v.getX()); + if(flipped){ + verticesBuffer.put(v.getX()); verticesBuffer.put(-1*v.getY()); + verticesBuffer.put(v.getZ()); + + box.resize(v.getX(),-1*v.getY(),v.getZ()); } else{ + verticesBuffer.put(v.getX()); verticesBuffer.put(v.getY()); + verticesBuffer.put(v.getZ()); + + box.resize(v.getX(),v.getY(),v.getZ()); } - verticesBuffer.put(v.getZ()); } verticesBuffer.rewind(); @@ -182,4 +193,7 @@ public class VBORegionSPES2 implements Region{ public void setFlipped(boolean flipped) { this.flipped = flipped; } + public AABBox getBounds(){ + return box; + } } |