summaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-03-15 05:47:01 +0100
committerSven Gothel <[email protected]>2014-03-15 05:47:01 +0100
commite4641e304fbc64a5d185a39c6ca6357cc678e013 (patch)
tree002f2597b7462f8a510adc3adcd37bafb8d5c1a2 /src/test/com/jogamp
parente2ceb1af352ec73967f2c15341d10fa3069b0a84 (diff)
Bug 801: Outline/OutlineShape tranform and sort fixes ; Quaternion: Reduce muls in rotateVector
Quaternion: - rotateVector(..): Reduce multiplication count by 17 Graph: - Outline - add: transform - fix compareTo .. use EPSILON - OutlineShape - add transform - fix compareTo .. use EPSILON - use Comparator<Outline> in sortOutlines to avoid reversal of list - Extract OutlineShapeXForm, pairing { OutlineShape, AffineTransform }
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java20
5 files changed, 14 insertions, 20 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
index 4fceb4f2b..7fcb9a848 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
@@ -215,7 +215,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
final PMVMatrix pmv = renderer.getMatrix();
renderer.resetModelview(null);
renderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f);
- if( renderer.getRenderState().isHintBitSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
+ if( renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}
final float pixelSizeFName = font.getPixelSize(fontSizeFName, dpiH);
@@ -238,7 +238,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
final String modeS = Region.getRenderModeString(renderer.getRenderModes());
final String text = String.format("%03.1f/%03.1f fps, v-sync %d, fontSize [head %.1f, bottom %.1f], %s-samples [%d, this %d], td %4.1f, blend %b, alpha-bits %d",
lfps, tfps, gl.getSwapInterval(), fontSizeHead, fontSizeBottom, modeS, getSampleCount()[0], sampleCountFPS[0], td,
- renderer.getRenderState().isHintBitSet(RenderState.BITHINT_BLENDING_ENABLED),
+ renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED),
drawable.getChosenGLCapabilities().getAlphaBits());
// bottom, half line up
@@ -279,7 +279,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
renderer.translate(null, getXTran(), getYTran(), getZTran());
renderer.rotate(gl, getAngle(), 0, 1, 0);
renderer.setColorStatic(gl, 1.0f, 0.0f, 0.0f);
- if( renderer.getRenderState().isHintBitSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
+ if( renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
gl.glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
index 6804fdab1..c377bb71c 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
@@ -328,7 +328,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
final String modeS = Region.getRenderModeString(renderer.getRenderModes());
final String text = String.format("%03.1f/%03.1f fps, v-sync %d, fontSize %.1f, %s-samples %d, td %4.1f, blend %b, alpha-bits %d",
lfps, tfps, gl.getSwapInterval(), fontSizeFixed, modeS, sampleCount[0], td,
- renderer.getRenderState().isHintBitSet(RenderState.BITHINT_BLENDING_ENABLED),
+ renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED),
drawable.getChosenGLCapabilities().getAlphaBits());
if(null != fpsLabel) {
fpsLabel.clear(gl, renderer);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java
index 243be4e68..4d79e5ad7 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java
@@ -32,6 +32,7 @@ import javax.media.opengl.GL2ES2;
import jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.graph.curve.OutlineShape;
+import com.jogamp.graph.curve.OutlineShapeXForm;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.TextRegionUtil;
import com.jogamp.graph.font.Font;
@@ -94,7 +95,7 @@ public class Label extends UIShape {
final float[] tmp = new float[3];
@Override
public void visit(OutlineShape shape, AffineTransform t) {
- shapes.add(new TransformedShape(shape, new AffineTransform(t)));
+ shapes.add(new OutlineShapeXForm(shape, new AffineTransform(t)));
final AABBox sbox = shape.getBounds();
t.transform(sbox.getLow(), tmp);
box.resize(tmp, 0);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java
index 0e49d1bee..c1f984519 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java
@@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.graph.demos.ui;
import javax.media.opengl.GL2ES2;
import com.jogamp.graph.curve.OutlineShape;
+import com.jogamp.graph.curve.OutlineShapeXForm;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.geom.Vertex;
@@ -135,7 +136,7 @@ public abstract class RIButton extends UIShape {
label.locTranslate( ( box.getWidth() - lbox1.getWidth() ) / 1f,
-1f * ( box.getHeight() - lbox1.getHeight() ) / 1f );
- shapes.add(new TransformedShape(shape, null));
+ shapes.add(new OutlineShapeXForm(shape, null));
System.err.println("XXX.UIShape.RIButton: Added Shape: "+shape+", "+box);
}
private void createSharpOutline(OutlineShape shape, AABBox lbox) {
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java
index 4db7da3ac..768c95765 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java
@@ -35,6 +35,7 @@ import jogamp.graph.geom.plane.AffineTransform;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.OutlineShapeXForm;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
@@ -45,16 +46,7 @@ import com.jogamp.opengl.math.geom.AABBox;
public abstract class UIShape {
private final Factory<? extends Vertex> vertexFactory;
- public class TransformedShape {
- public final OutlineShape shape;
- public final AffineTransform t;
-
- public TransformedShape(final OutlineShape shape, final AffineTransform t) {
- this.shape = shape;
- this.t = t;
- }
- }
- protected final ArrayList<TransformedShape> shapes;
+ protected final ArrayList<OutlineShapeXForm> shapes;
protected static final int DIRTY_SHAPE = 1 << 0 ;
protected static final int DIRTY_POSITION = 1 << 1 ;
@@ -76,7 +68,7 @@ public abstract class UIShape {
public UIShape(Factory<? extends Vertex> factory) {
this.vertexFactory = factory;
- this.shapes = new ArrayList<TransformedShape>();
+ this.shapes = new ArrayList<OutlineShapeXForm>();
this.box = new AABBox();
}
@@ -151,7 +143,7 @@ public abstract class UIShape {
return 0 != ( dirty & DIRTY_REGION ) ;
}
- public ArrayList<TransformedShape> getShapes() { return shapes; }
+ public ArrayList<OutlineShapeXForm> getShapes() { return shapes; }
public final AABBox getBounds() { return box; }
@@ -186,7 +178,7 @@ public abstract class UIShape {
_color = selectedColor;
}
if(!select){
- if( renderer.getRenderState().isHintBitSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
+ if( renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) {
gl.glClearColor(_color[0], _color[1], _color[2], 0.0f);
}
renderer.setColorStatic(gl, _color[0], _color[1], _color[2]);
@@ -249,7 +241,7 @@ public abstract class UIShape {
}
final int shapeCount = shapes.size();
for(int i=0; i<shapeCount; i++) {
- final TransformedShape tshape = shapes.get(i);
+ final OutlineShapeXForm tshape = shapes.get(i);
final AffineTransform t2;
if( null != tshape.t ) {
if( null != t ) {