diff options
author | Sven Göthel <sgothel@jausoft.com> | 2024-02-05 17:23:41 +0100 |
---|---|---|
committer | Sven Göthel <sgothel@jausoft.com> | 2024-02-05 17:23:41 +0100 |
commit | eff91a9e29fc97d7e5051d9900e79ba9d044fb3a (patch) | |
tree | e0c14a3bf3608da6f334e348cacd790061b875b4 /src/graphui/classes/com/jogamp/graph/ui/Group.java | |
parent | 0ac7b2e59d5b41302f8e0ec7596d8f44447cf0a1 (diff) |
GraphUI: Add Shape.IO_DISCARDED and update it @ Scene/Group draw(); Prepare for experimental occlusion-culling
TreeTool's cullShapes(), actually a naive dumm occlusion test (*RENAME IT*),
would need to realize whether the shape/groups actually cover shapes below,
i.e. are not on same Z-Axis and transparent.
Hence, this is disabled in code and we rely on the Z buffer still,
just an idea ..
Diffstat (limited to 'src/graphui/classes/com/jogamp/graph/ui/Group.java')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/Group.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java index 245400700..f482605ea 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Group.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java @@ -399,6 +399,7 @@ public class Group extends Shape implements Container { final Shape[] shapeArray = shapes.toArray(drawShapeArray); // local-backup drawShapeArray = shapeArray; // keep backup Arrays.sort(shapeArray, 0, shapeCount, Shape.ZAscendingComparator); + // TreeTool.cullShapes(shapeArray, shapeCount); final List<Shape> iShapes = renderedShapes == renderedShapesB0 ? renderedShapesB1 : renderedShapesB0; iShapes.clear(); @@ -412,7 +413,7 @@ public class Group extends Shape implements Container { for(int i=0; i<shapeCount; i++) { final Shape shape = shapeArray[i]; - if( shape.isVisible() ) { + if( shape.isVisible() ) { // && !shape.isDiscarded() ) { pmv.pushMv(); shape.applyMatToMv(pmv); @@ -424,6 +425,9 @@ public class Group extends Shape implements Container { { shape.draw(gl, renderer); iShapes.add(shape); + shape.setDiscarded(false); + } else { + shape.setDiscarded(true); } pmv.popMv(); } @@ -432,12 +436,15 @@ public class Group extends Shape implements Container { } else { for(int i=0; i<shapeCount; i++) { final Shape shape = shapeArray[i]; - if( shape.isVisible() ) { + if( shape.isVisible() ) { // && !shape.isDiscarded() ) { pmv.pushMv(); shape.applyMatToMv(pmv); if( !doFrustumCulling || !pmv.getFrustum().isOutside( shape.getBounds() ) ) { shape.draw(gl, renderer); iShapes.add(shape); + shape.setDiscarded(false); + } else { + shape.setDiscarded(true); } pmv.popMv(); } |