diff options
author | Sven Göthel <sgothel@jausoft.com> | 2024-01-22 06:35:25 +0100 |
---|---|---|
committer | Sven Göthel <sgothel@jausoft.com> | 2024-01-22 06:35:25 +0100 |
commit | 5f9fb7159fa33bc979e5050d384b6939658049bd (patch) | |
tree | 09bdadf5c05ad007435a6f97a6153fa22702cfc6 /src/demos | |
parent | bf096870c73898963558bef5c9d75760f9f76290 (diff) |
Bug 1489 - GraphUI Group: Resolve Performance Regression in Scene.pickShape(): Drop invisible and clipped shapes
After implementing Bug 1487 (Frustum Clipping/Culling) and using thousands of shapes within one Group mostly culled (outside of frustum),
overall mouse Scene.pickShape() caused tremendous lagging.
This is caused by Scene.pickShape() traversing through _all_ shapes,
rendered ones, invisible ones and culled ones.
+++
Solution is to have Scene and Group provide a pre-sorted list
of actually rendered shapes, i.e. isVisible() and not culled.
Scene.pickShape() can now use this reduced and pre-sorted list
reducing the load considerably.
+++
Further
- cleanup TreeTool
- rename Container methods:
-- setFrustumCullingEnabled() -> setPMvCullingEnabled()
-- isFrustumCullingEnabled() -> isPMvCullingEnabled()
- supply Container with
-- isCullingEnabled()
-- List<Shape> getRenderedShapes()
-- isOutside()
-- isOutside2()
-- forAllRendered()
Diffstat (limited to 'src/demos')
8 files changed, 10 insertions, 9 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java index fa2ae7f3b..546362990 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java @@ -184,7 +184,7 @@ public class FontView01 { final Scene scene = new Scene(options.graphAASamples); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - scene.setFrustumCullingEnabled(true); + scene.setPMvCullingEnabled(true); scene.attachInputListenerTo(window); window.addGLEventListener(scene); @@ -282,6 +282,7 @@ public class FontView01 { final Group glyphGrid = new Group(new GridLayout(gridDim.columns, glyphGridCellSize*0.9f, glyphGridCellSize*0.9f, Alignment.FillCenter, new Gap(glyphGridCellSize*0.1f))); glyphGrid.setInteractive(true).setDragAndResizeable(false).setToggleable(false).setName("GlyphGrid"); addGlyphs(reqCaps.getGLProfile(), font, glyphGrid, gridDim, showUnderline, showLabel, fontStatus, fontInfo, glyphMouseListener); + glyphGrid.setRelayoutOnDirtyShapes(false); // avoid group re-validate to ease load in Group.isShapeDirty() w/ thousands of glyphs if( VERBOSE_UI ) { glyphGrid.validate(reqCaps.getGLProfile()); System.err.println("GlyphGrid "+glyphGrid); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java index daea00d4f..f5d373a50 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBox01.java @@ -115,7 +115,7 @@ public class UILayoutBox01 { System.err.println("Z16-Precision: zDist -1f, zNear 0.1f "+FloatUtil.getZBufferEpsilon(zBits, -1f, 0.1f)); System.err.println("Z16-Precision: current "+scene.getZEpsilon(zBits)); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - scene.setFrustumCullingEnabled(true); + scene.setPMvCullingEnabled(true); scene.attachInputListenerTo(window); window.addGLEventListener(scene); window.setVisible(true); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java index 9cec36c41..9c9a3b702 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutBoxGridOffset01.java @@ -113,7 +113,7 @@ public class UILayoutBoxGridOffset01 { System.err.println("Z16-Precision: zDist -1f, zNear 0.1f "+FloatUtil.getZBufferEpsilon(zBits, -1f, 0.1f)); System.err.println("Z16-Precision: current "+scene.getZEpsilon(zBits)); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - scene.setFrustumCullingEnabled(true); + scene.setPMvCullingEnabled(true); scene.attachInputListenerTo(window); window.addGLEventListener(scene); window.setVisible(true); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java index c1b041b42..9f7cf5873 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UILayoutGrid01.java @@ -114,7 +114,7 @@ public class UILayoutGrid01 { System.err.println("Z16-Precision: zDist -1f, zNear 0.1f "+FloatUtil.getZBufferEpsilon(zBits, -1f, 0.1f)); System.err.println("Z16-Precision: current "+scene.getZEpsilon(zBits)); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - scene.setFrustumCullingEnabled(true); + scene.setPMvCullingEnabled(true); scene.attachInputListenerTo(window); window.addGLEventListener(scene); window.setVisible(true); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java index 8fe758330..19b0bdc4d 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid00.java @@ -128,7 +128,7 @@ public class UIMediaGrid00 { final Scene scene = new Scene(options.graphAASamples); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - scene.setFrustumCullingEnabled(true); + scene.setPMvCullingEnabled(true); scene.attachInputListenerTo(window); window.addGLEventListener(scene); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java index 158cde085..8ceaabc88 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIMediaGrid01.java @@ -186,7 +186,7 @@ public class UIMediaGrid01 { final Scene scene = new Scene(options.graphAASamples); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - scene.setFrustumCullingEnabled(true); + scene.setPMvCullingEnabled(true); scene.attachInputListenerTo(window); window.addGLEventListener(scene); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java index fdec041d1..58b971e7a 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java @@ -186,8 +186,8 @@ public class UISceneDemo03 { final AnimGroup animGroup = new AnimGroup(null); scene.addShape(animGroup); - scene.setFrustumCullingEnabled(true); - animGroup.setFrustumCullingEnabled(true); + scene.setPMvCullingEnabled(true); + animGroup.setPMvCullingEnabled(true); final Animator animator = new Animator(0 /* w/o AWT */); animator.setUpdateFPSFrames(1 * 60, null); // System.err); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java index c5df5e5ef..acf3a5699 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java @@ -100,7 +100,7 @@ public class UISceneDemo11 { scene.setPMVMatrixSetup(new MyPMVMatrixSetup()); scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); scene.addShape(groupA0); - scene.setFrustumCullingEnabled(true); + scene.setPMvCullingEnabled(true); final Animator animator = new Animator(0 /* w/o AWT */); |