aboutsummaryrefslogtreecommitdiffstats
path: root/src/graphui/classes/com/jogamp/graph/ui/widgets
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-22 06:35:25 +0100
committerSven Göthel <[email protected]>2024-01-22 06:35:25 +0100
commit5f9fb7159fa33bc979e5050d384b6939658049bd (patch)
tree09bdadf5c05ad007435a6f97a6153fa22702cfc6 /src/graphui/classes/com/jogamp/graph/ui/widgets
parentbf096870c73898963558bef5c9d75760f9f76290 (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/graphui/classes/com/jogamp/graph/ui/widgets')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java35
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/widgets/RangedGroup.java4
2 files changed, 21 insertions, 18 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java b/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java
index 4c5a6d1f0..1e6a37be4 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/widgets/MediaPlayer.java
@@ -115,7 +115,9 @@ public class MediaPlayer extends Widget {
final float ctrlCellWidth = (aratio-2*borderSzS)/ctrlCells;
final float ctrlCellHeight = ctrlCellWidth;
- final float ctrlSliderHeight = ctrlCellHeight/15f;
+ final float ctrlSliderHeightMin = ctrlCellHeight/15f; // bar-height
+ final float ctrlSliderHeightMax = 3f * ctrlSliderHeightMin; // knob-height
+ final float infoGroupHeight = 1/7f;
final Shape[] zoomReplacement = { null };
final Vec3f[] zoomOrigScale = { null };
@@ -131,11 +133,10 @@ public class MediaPlayer extends Widget {
final RangeSlider ctrlSlider;
{
- final float knobScale = 3f;
- final float knobHeight = ctrlSliderHeight * knobScale;
- ctrlSlider = new RangeSlider(renderModes, new Vec2f(aratio - knobHeight, ctrlSliderHeight), knobScale, new Vec2f(0, 100), 1, 0);
- final float dx = knobHeight / 2f;
- final float dy = ( knobHeight - ctrlSliderHeight ) * 0.5f;
+ final float knobScale = ctrlSliderHeightMax / ctrlSliderHeightMin;
+ ctrlSlider = new RangeSlider(renderModes, new Vec2f(aratio - ctrlSliderHeightMax, ctrlSliderHeightMin), knobScale, new Vec2f(0, 100), 1, 0);
+ final float dx = ctrlSliderHeightMax / 2f;
+ final float dy = ( ctrlSliderHeightMax - ctrlSliderHeightMin ) * 0.5f;
ctrlSlider.setPaddding(new Padding(0, dx, ctrlCellHeight-dy, dx));
}
ctrlSlider.setName("mp.slider");
@@ -210,11 +211,10 @@ public class MediaPlayer extends Widget {
infoGroup.setName("mp.info").setInteractive(false);
this.addShape( infoGroup.setVisible(false) );
{
- final float sz = 1/7f;
- final Rectangle rect = new Rectangle(renderModes & ~Region.AA_RENDERING_MASK, aratio, sz, 0);
+ final Rectangle rect = new Rectangle(renderModes & ~Region.AA_RENDERING_MASK, aratio, infoGroupHeight, 0);
rect.setName("mp.info.blend").setInteractive(false);
rect.setColor(0, 0, 0, alphaBlend);
- rect.setPaddding(new Padding(0, 0, 1f-sz, 0));
+ rect.setPaddding(new Padding(0, 0, 1f-infoGroupHeight, 0));
infoGroup.addShape(rect);
}
{
@@ -468,13 +468,6 @@ public class MediaPlayer extends Widget {
this.setBorderColor(borderColorA);
} else {
this.setBorderColor(borderColor);
- }
- if( ctrlGroup.isActive() || ctrlSlider.isActive() ) {
- ctrlSlider.setVisible(true);
- ctrlBlend.setVisible(true);
- ctrlGroup.setVisible(true);
- infoGroup.setVisible(true);
- } else {
ctrlSlider.setVisible(false);
ctrlBlend.setVisible(false);
ctrlGroup.setVisible(false);
@@ -483,6 +476,16 @@ public class MediaPlayer extends Widget {
});
this.addMouseListener(new Shape.MouseGestureAdapter() {
@Override
+ public void mouseMoved(final MouseEvent e) {
+ final Shape.EventInfo shapeEvent = (Shape.EventInfo) e.getAttachment();
+ final Vec3f p = shapeEvent.objPos;
+ final boolean c = ( ctrlCellHeight + ctrlSliderHeightMax ) > p.y() || p.y() > ( 1f - infoGroupHeight );
+ ctrlSlider.setVisible(c);
+ ctrlBlend.setVisible(c);
+ ctrlGroup.setVisible(c);
+ infoGroup.setVisible(c);
+ }
+ @Override
public void mouseReleased(final MouseEvent e) {
mButton.setPressedColorMod(1f, 1f, 1f, 1f);
}
diff --git a/src/graphui/classes/com/jogamp/graph/ui/widgets/RangedGroup.java b/src/graphui/classes/com/jogamp/graph/ui/widgets/RangedGroup.java
index 838a39254..9143a9431 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/widgets/RangedGroup.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/widgets/RangedGroup.java
@@ -171,9 +171,9 @@ public class RangedGroup extends Widget {
// Mv pre-multiplied Frustum, clippedContent is on same PMV
final Frustum clipFrustum = tempC00.set( clippedContent.getBounds() ).transform( pmv.getMv() ).updateFrustumPlanes(tempF00);
- content.setClipFrustum(clipFrustum);
+ content.setClipMvFrustum(clipFrustum);
super.drawImpl0(gl, renderer, rgba);
- content.setClipFrustum(null);
+ content.setClipMvFrustum(null);
}
}
private final Frustum tempF00 = new Frustum(); // OK, synchronized