aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java9
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/Group.java26
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/widgets/RangedGroup.java13
3 files changed, 12 insertions, 36 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 fafd157ca..6ebf315bf 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/FontView01.java
@@ -58,7 +58,6 @@ import com.jogamp.graph.ui.widgets.RangeSlider;
import com.jogamp.graph.ui.widgets.RangedGroup;
import com.jogamp.graph.ui.widgets.RangedGroup.SliderParam;
import com.jogamp.math.Vec2f;
-import com.jogamp.math.Vec3f;
import com.jogamp.math.geom.AABBox;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -273,13 +272,7 @@ public class FontView01 {
System.err.println("GlyphGrid "+glyphGrid);
System.err.println("GlyphGrid "+glyphGrid.getLayout());
}
- // culling >= 2*cell-size outside of clipping box (vertical only), pixel-accurate clipping in-between until clipping-box
- final Vec3f clipCullingScale = new Vec3f(1f, 1f+2*glyphGridCellSize/glyphGridSize.y(), 1f);
- // final Vec3f clipCullingScale = new Vec3f(1f, 1f, 1f); // no pixel-accurate clipping, just culling in Group
- if( VERBOSE_UI ) {
- System.err.println("RangedGroup clipCullingScale "+clipCullingScale);
- }
- final RangedGroup glyphView = new RangedGroup(options.renderModes, glyphGrid, glyphGridSize, clipCullingScale,
+ final RangedGroup glyphView = new RangedGroup(options.renderModes, glyphGrid, glyphGridSize,
null,
new SliderParam(new Vec2f(glyphGridCellSize/4f, glyphGridSize.y()), glyphGridCellSize/10f, true));
glyphView.getVertSlider().setColor(0.3f, 0.3f, 0.3f, 0.7f);
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Group.java b/src/graphui/classes/com/jogamp/graph/ui/Group.java
index a4451501a..be34ecf3b 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/Group.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/Group.java
@@ -85,7 +85,6 @@ public class Group extends Shape implements Container {
private boolean widgetMode = false;
private boolean clipOnBounds = false;
private AABBox clipBBox = null;
- private final Vec3f clipCullingScale = new Vec3f();
/**
* Create a group of {@link Shape}s w/o {@link Group.Layout}.
@@ -126,40 +125,34 @@ public class Group extends Shape implements Container {
/**
* Enable {@link AABBox} clipping on {@link #getBounds()} for this group and its shapes as follows
* <ul>
- * <li>Discard {@link Shape} {@link #draw(GL2ES2, RegionRenderer) rendering} if completely outside of {@code clip-box*cullingScale}.</li>
- * <li>Otherwise perform pixel-accurate clipping inside the shader within [{@code clip-box} .. {@code clip-box*cullingScale}].</li>
- * <li>If {@code clip-box} >= {@code clip-box*cullingScale} for all axis, no pixel-accurate clipping is performed as shapes are culled before.</li>
+ * <li>Discard {@link Shape} {@link #draw(GL2ES2, RegionRenderer) rendering} if not intersecting {@code clip-box}.</li>
+ * <li>Otherwise perform pixel-accurate clipping inside the shader to {@code clip-box}.</li>
* </ul>
* <p>
* {@link #setClipBBox(AABBox)} takes precedence over {@link #setClipOnBounds(boolean)}.
* </p>
* @param v boolean to toggle clipping
- * @param cullingScale culling scale factor per axis for the {@code clip-box} to discard {@link #draw(GL2ES2, RegionRenderer) rendering} completely,
- * should be {@code >= 1} for each axis.
* @return this instance for chaining
* @see #setClipBBox(AABBox)
*/
- public Group setClipOnBounds(final boolean v, final Vec3f cullingScale) { clipOnBounds = v; clipCullingScale.set(cullingScale); return this; }
+ public Group setClipOnBounds(final boolean v) { clipOnBounds = v; return this; }
/** Returns {@link #setClipOnBounds(boolean)} value */
public boolean getClipOnBounds() { return clipOnBounds; }
/**
* Enable {@link AABBox} clipping on explicit given pre-multiplied Mv-matrix {@code clip-box} as follows
* <ul>
- * <li>Discard {@link Shape} {@link #draw(GL2ES2, RegionRenderer) rendering} if completely outside of {@code clip-box*cullingScale}.</li>
- * <li>Otherwise perform pixel-accurate clipping inside the shader within [{@code clip-box} .. {@code clip-box*cullingScale}].</li>
- * <li>If {@code clip-box} >= {@code clip-box*cullingScale} for all axis, no pixel-accurate clipping is performed as shapes are culled before.</li>
+ * <li>Discard {@link Shape} {@link #draw(GL2ES2, RegionRenderer) rendering} if not intersecting {@code clip-box}.</li>
+ * <li>Otherwise perform pixel-accurate clipping inside the shader to {@code clip-box}.</li>
* </ul>
* <p>
* {@link #setClipBBox(AABBox)} takes precedence over {@link #setClipOnBounds(boolean)}.
* </p>
* @param v {@link AABBox} pre-multiplied Mv-matrix
- * @param cullingScale culling scale factor per axis for the {@code clip-box} to discard {@link #draw(GL2ES2, RegionRenderer) rendering} completely,
- * should be {@code >= 1} for each axis.
* @return this instance for chaining
* @see #setClipOnBounds(boolean)
*/
- public Group setClipBBox(final AABBox v, final Vec3f cullingScale) { clipBBox = v; clipCullingScale.set(cullingScale); return this; }
+ public Group setClipBBox(final AABBox v) { clipBBox = v; return this; }
/** Returns {@link #setClipBBox(AABBox)} value */
public AABBox getClipBBox() { return clipBBox; }
@@ -293,10 +286,7 @@ public class Group extends Shape implements Container {
final AABBox origClipBox = renderer.getClipBBox();
final AABBox clipBox = useClipBBox ? clipBBox : box.transform(pmv.getMv(), tempBB0);
- if( clipCullingScale.x() > 1f || clipCullingScale.y() > 1f || clipCullingScale.z() > 1f) {
- renderer.setClipBBox( tempBB1.set(clipBox) ); // Mv pre-multiplied AABBox
- } // else clip-box >= 'clip-box*cullingScale' for all axis, no pixel-accurate clipping is performed as shapes are culled before
- clipBox.scale(clipCullingScale.x(), clipCullingScale.y(), clipCullingScale.z());
+ renderer.setClipBBox( tempBB1.set(clipBox) ); // Mv pre-multiplied AABBox
final int shapeCount = shapesS.length;
for(int i=0; i<shapeCount; i++) {
@@ -306,7 +296,7 @@ public class Group extends Shape implements Container {
shape.setTransformMv(pmv);
final AABBox childBox = shape.getBounds();
- if( clipBox.contains( childBox.transform(pmv.getMv(), tempBB0) ) &&
+ if( clipBox.intersects( childBox.transform(pmv.getMv(), tempBB0) ) &&
( !doFrustumCulling || !pmv.getFrustum().isAABBoxOutside( childBox ) ) )
{
shape.draw(gl, renderer);
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 8336a7631..f84c3cf5a 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/widgets/RangedGroup.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/widgets/RangedGroup.java
@@ -50,7 +50,6 @@ import com.jogamp.opengl.util.texture.TextureSequence;
public class RangedGroup extends Widget {
private final Group content;
private final Group clippedContent;
- private final Vec3f clipCullingScale;
private final RangeSlider horizSlider, vertSlider;
private final Vec2f contentPosZero = new Vec2f();
@@ -85,14 +84,10 @@ public class RangedGroup extends Widget {
* @param renderModes Graph's {@link Region} render modes, see {@link GLRegion#create(GLProfile, int, TextureSequence) create(..)}.
* @param content the {@link Group} with content to view
* @param contentSize the fixed size of the clipped content to view, i.e. page-size
- * @param cullingScale culling scale factor per axis for the {@code clip-box} to discard
- * {@link #draw(GL2ES2, RegionRenderer) rendering} completely outside of {@code clip-box*cullingScale}.
- * Pixel-accurate clipping is applied within [{@code clip-box} .. {@code clip-box*cullingScale}] if any scale-axis of {@code cullingScale} > 1.
- * See {@link Group#setClipBBox(AABBox, Vec3f)}.
* @param horizSliderParam optional horizontal slider parameters, null for none
* @param vertSliderParam optional vertical slider parameters, null for none
*/
- public RangedGroup(final int renderModes, final Group content, final Vec2f contentSize, final Vec3f cullingScale,
+ public RangedGroup(final int renderModes, final Group content, final Vec2f contentSize,
final SliderParam horizSliderParam, final SliderParam vertSliderParam)
{
super( new GridLayout(1 + (null != vertSliderParam ? 1 : 0), 0f, 0f, Alignment.None)); // vertical slider adds to the right column
@@ -101,7 +96,6 @@ public class RangedGroup extends Widget {
this.clippedContent.setFixedSize(contentSize);
this.clippedContent.addShape(content);
addShape(clippedContent);
- clipCullingScale = cullingScale;
if( null != horizSliderParam ) {
horizSlider = new RangeSlider(renderModes, horizSliderParam.size,
@@ -141,7 +135,6 @@ public class RangedGroup extends Widget {
public Group getContent() { return content; }
public Vec2f getContentSize() { return clippedContent.getFixedSize(); }
- public Vec3f getClipCullingScale() { return clipCullingScale; }
public Group getClippedContent() { return clippedContent; }
public RangeSlider getHorizSlider() { return horizSlider; }
public RangeSlider getVertSlider() { return vertSlider; }
@@ -173,9 +166,9 @@ public class RangedGroup extends Widget {
if( content.isVisible() ) {
// Mv pre-multiplied AABBox, clippedContent is on same PMV
final AABBox clipBBox = clippedContent.getBounds().transform(renderer.getMatrix().getMv(), tempBB);
- content.setClipBBox(clipBBox, clipCullingScale);
+ content.setClipBBox(clipBBox);
super.drawImpl0(gl, renderer, rgba);
- content.setClipBBox(null, clipCullingScale);
+ content.setClipBBox(null);
}
}
private final AABBox tempBB = new AABBox(); // OK, synchronized