diff options
author | Sven Gothel <[email protected]> | 2014-03-15 07:02:35 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-03-15 07:02:35 +0100 |
commit | 0b61e9a2641e38475a330303e49f6becf99158e1 (patch) | |
tree | 4d4bd7ead74950ce7df84d184519873bd83bf660 /src/jogl/classes/com/jogamp/graph | |
parent | e4641e304fbc64a5d185a39c6ca6357cc678e013 (diff) |
Bug 801: Remove Vertex.Factory from AffineTransform ; Add AABBox tranformed resize.
Diffstat (limited to 'src/jogl/classes/com/jogamp/graph')
5 files changed, 21 insertions, 21 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java index 0d3a61fac..63183bf68 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java +++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java @@ -332,7 +332,7 @@ public class OutlineShape implements Comparable<OutlineShape> { final Outline lo = getLastOutline(); lo.addVertex(v); if( 0 == ( dirtyBits & DIRTY_BOUNDS ) ) { - bbox.resize(lo.getBounds()); + bbox.resize(v.getCoord()); } // vertices.add(v); // FIXME: can do and remove DIRTY_VERTICES ? dirtyBits |= DIRTY_TRIANGLES | DIRTY_VERTICES; @@ -347,7 +347,7 @@ public class OutlineShape implements Comparable<OutlineShape> { final Outline lo = getLastOutline(); lo.addVertex(position, v); if( 0 == ( dirtyBits & DIRTY_BOUNDS ) ) { - bbox.resize(lo.getBounds()); + bbox.resize(v.getCoord()); } dirtyBits |= DIRTY_TRIANGLES | DIRTY_VERTICES; } @@ -653,11 +653,11 @@ public class OutlineShape implements Comparable<OutlineShape> { * Note: Triangulated data is lost in returned instance! * </p> */ - public OutlineShape transform(AffineTransform t) { + public final OutlineShape transform(final AffineTransform t) { final OutlineShape newOutlineShape = new OutlineShape(vertexFactory); final int osize = outlines.size(); for(int i=0; i<osize; i++) { - newOutlineShape.addOutline( outlines.get(i).transform(t) ); + newOutlineShape.addOutline( outlines.get(i).transform(t, vertexFactory) ); } return newOutlineShape; } diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index 853c837f5..bb0ed09d1 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -202,12 +202,12 @@ public abstract class Region { * The optional {@link AffineTransform} is applied to the bounding-box beforehand. * </p> */ - public final void addOutlineShape(final OutlineShape shape, final AffineTransform transform) { + public final void addOutlineShape(final OutlineShape shape, final AffineTransform t) { if( null != frustum ) { final AABBox shapeBox = shape.getBounds(); final AABBox shapeBoxT; - if( null != transform ) { - transform.transform(shapeBox, tmpBox); + if( null != t ) { + t.transform(shapeBox, tmpBox); shapeBoxT = tmpBox; } else { shapeBoxT = shapeBox; @@ -222,7 +222,7 @@ public abstract class Region { final List<Triangle> trisIn = shape.getTriangles(OutlineShape.VerticesState.QUADRATIC_NURBS); final ArrayList<Vertex> vertsIn = shape.getVertices(); if(DEBUG_INSTANCE) { - System.err.println("Region.addOutlineShape().0: tris: "+trisIn.size()+", verts "+vertsIn.size()+", transform "+transform); + System.err.println("Region.addOutlineShape().0: tris: "+trisIn.size()+", verts "+vertsIn.size()+", transform "+t); } final int idxOffset = numVertices; int vertsVNewIdxCount = 0, vertsTMovIdxCount = 0, vertsTNewIdxCount = 0, tris = 0; @@ -232,7 +232,7 @@ public abstract class Region { System.err.println("Region.addOutlineShape(): Processing Vertices"); } for(int i=0; i<vertsIn.size(); i++) { - pushNewVertexImpl(vertsIn.get(i), transform); + pushNewVertexImpl(vertsIn.get(i), t); vertsVNewIdxCount++; } if(DEBUG_INSTANCE) { @@ -261,9 +261,9 @@ public abstract class Region { if(Region.DEBUG_INSTANCE) { System.err.println("T["+i+"]: New Idx "+numVertices); } - pushNewVertexIdxImpl(triInVertices[0], transform); - pushNewVertexIdxImpl(triInVertices[1], transform); - pushNewVertexIdxImpl(triInVertices[2], transform); + pushNewVertexIdxImpl(triInVertices[0], t); + pushNewVertexIdxImpl(triInVertices[1], t); + pushNewVertexIdxImpl(triInVertices[2], t); vertsTNewIdxCount+=3; } tris++; diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java index 0721c4726..140e03cfb 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java @@ -128,7 +128,7 @@ public class TextRegionUtil { public final void visit(final OutlineShape shape, final AffineTransform t) { region.addOutlineShape(shape, t); } }; - processString(visitor, new AffineTransform(vertexFactory), font, pixelSize, str); + processString(visitor, new AffineTransform(), font, pixelSize, str); } /** diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java index b299524c0..5f6dd028f 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java @@ -87,7 +87,7 @@ public class Outline implements Cloneable, Comparable<Outline> { } vertices.add(position, vertex); if(!dirtyBBox) { - bbox.resize(vertex.getX(), vertex.getY(), vertex.getZ()); + bbox.resize(vertex.getCoord()); } } @@ -187,12 +187,12 @@ public class Outline implements Cloneable, Comparable<Outline> { /** * Return a transformed instance with all vertices are copied and transformed. */ - public final Outline transform(AffineTransform t) { + public final Outline transform(final AffineTransform t, final Vertex.Factory<? extends Vertex> vertexFactory) { final Outline newOutline = new Outline(); final int vsize = vertices.size(); for(int i=0; i<vsize; i++) { final Vertex v = vertices.get(i); - newOutline.addVertex(t.transform(v, null)); + newOutline.addVertex(t.transform(v, vertexFactory.create())); } newOutline.closed = this.closed; return newOutline; @@ -202,7 +202,7 @@ public class Outline implements Cloneable, Comparable<Outline> { dirtyBBox = false; bbox.reset(); for (int i=0; i<vertices.size(); i++) { - bbox.resize(vertices.get(i).getCoord(), 0); + bbox.resize(vertices.get(i).getCoord()); } } diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java index e353dd061..593d9cb24 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java @@ -67,11 +67,11 @@ public class Triangle { /** * Returns a transformed a clone of this instance using the given AffineTransform. */ - public Triangle transform(AffineTransform t) { + public Triangle transform(final AffineTransform t, final Vertex.Factory<? extends Vertex> vertexFactory) { final Triangle tri = new Triangle(id, boundaryEdges, boundaryVertices); - tri.vertices[0] = t.transform(vertices[0], null); - tri.vertices[1] = t.transform(vertices[1], null); - tri.vertices[2] = t.transform(vertices[2], null); + tri.vertices[0] = t.transform(vertices[0], vertexFactory.create()); + tri.vertices[1] = t.transform(vertices[1], vertexFactory.create()); + tri.vertices[2] = t.transform(vertices[2], vertexFactory.create()); return tri; } |