Jogamp
Fix TAB: Replace all TAB with 4 spaces
authorSven Gothel <sgothel@jausoft.com>
Fri, 8 Apr 2011 19:35:34 +0000 (21:35 +0200)
committerSven Gothel <sgothel@jausoft.com>
Fri, 8 Apr 2011 19:35:34 +0000 (21:35 +0200)
117 files changed:
src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
src/jogl/classes/com/jogamp/graph/curve/Region.java
src/jogl/classes/com/jogamp/graph/curve/RegionFactory.java
src/jogl/classes/com/jogamp/graph/curve/tess/CDTriangulator2D.java
src/jogl/classes/com/jogamp/graph/font/Font.java
src/jogl/classes/com/jogamp/graph/geom/AABBox.java
src/jogl/classes/com/jogamp/graph/geom/Outline.java
src/jogl/classes/com/jogamp/graph/geom/Triangle.java
src/jogl/classes/com/jogamp/graph/geom/Vertex.java
src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
src/jogl/classes/com/jogamp/graph/math/Quaternion.java
src/jogl/classes/com/jogamp/graph/math/VectorUtil.java
src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
src/jogl/classes/com/jogamp/opengl/util/Locator.java
src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
src/jogl/classes/jogamp/graph/curve/tess/Loop.java
src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
src/jogl/classes/jogamp/graph/math/plane/Crossing.java
src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java
src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java
src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java
src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java
src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt
src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java
src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java
src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java
src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java
src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java
src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java
src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
src/jogl/native/macosx/ContextUpdater.h
src/jogl/native/macosx/ContextUpdater.m
src/jogl/native/macosx/MacOSXWindowSystemInterface.m
src/jogl/native/openmax/omx_tool.c
src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java
src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java
src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java
src/test/com/jogamp/opengl/test/bugs/Issue344Base.java
src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java
src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java
src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIControl.java
src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java
src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java
src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java
src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java
src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java
src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/gears/TestGearsGLJPanelAWTBug450.java
src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00NEWT.java
src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java

index 827717a..724380f 100755 (executable)
@@ -50,13 +50,13 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D;
  * <br><br>\r
  * Example to creating an Outline Shape:\r
  * <pre>\r
-       addVertex(...)\r
-       addVertex(...)\r
-       addVertex(...)\r
-       addEnptyOutline()\r
-       addVertex(...)\r
-       addVertex(...)\r
-       addVertex(...)\r
+      addVertex(...)\r
+      addVertex(...)\r
+      addVertex(...)\r
+      addEnptyOutline()\r
+      addVertex(...)\r
+      addVertex(...)\r
+      addVertex(...)\r
  * </pre>\r
  * \r
  * The above will create two outlines each with three vertices. By adding these two outlines to \r
@@ -72,10 +72,10 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D;
  * \r
  * <br>Example: <br>\r
  * <pre>\r
-       addVertex(0,0, true);\r
-       addVertex(0,1, false);\r
-       addVertex(1,1, false);\r
-       addVertex(1,0, true);\r
+      addVertex(0,0, true);\r
+      addVertex(0,1, false);\r
+      addVertex(1,1, false);\r
+      addVertex(1,0, true);\r
  * </pre>\r
  * \r
  * The above snippet defines a cubic nurbs curve where (0,1 and 1,1) \r
@@ -83,8 +83,8 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D;
  *  \r
  * <i>Implementation Notes:</i><br>\r
  * <ul>\r
- *             <li> The first vertex of any outline belonging to the shape should be on-curve</li>\r
- *             <li> Intersections between off-curved parts of the outline is not handled</li>\r
+ *    <li> The first vertex of any outline belonging to the shape should be on-curve</li>\r
+ *    <li> Intersections between off-curved parts of the outline is not handled</li>\r
  * </ul>\r
  * \r
  * @see Outline\r
@@ -92,216 +92,216 @@ import com.jogamp.graph.curve.tess.CDTriangulator2D;
  */\r
 public class OutlineShape {\r
 \r
-       public static final int QUADRATIC_NURBS = 10;\r
-       private final Vertex.Factory<? extends Vertex> vertexFactory;\r
+    public static final int QUADRATIC_NURBS = 10;\r
+    private final Vertex.Factory<? extends Vertex> vertexFactory;\r
 \r
-       /** The list of {@link Outline}s that are part of this \r
-        *  outline shape.\r
-        */\r
-       private ArrayList<Outline> outlines = new ArrayList<Outline>(3);\r
+    /** The list of {@link Outline}s that are part of this \r
+     *  outline shape.\r
+     */\r
+    private ArrayList<Outline> outlines = new ArrayList<Outline>(3);\r
 \r
-       /** Create a new Outline based Shape\r
-        */\r
-       public OutlineShape(Vertex.Factory<? extends Vertex> factory) {\r
-               vertexFactory = factory;\r
-               outlines.add(new Outline());\r
-       }\r
+    /** Create a new Outline based Shape\r
+     */\r
+    public OutlineShape(Vertex.Factory<? extends Vertex> factory) {\r
+        vertexFactory = factory;\r
+        outlines.add(new Outline());\r
+    }\r
 \r
-       /** Returns the associated vertex factory of this outline shape\r
-        * @return Vertex.Factory object\r
-        */\r
-       public final Vertex.Factory<? extends Vertex> vertexFactory() { return vertexFactory; }\r
+    /** Returns the associated vertex factory of this outline shape\r
+     * @return Vertex.Factory object\r
+     */\r
+    public final Vertex.Factory<? extends Vertex> vertexFactory() { return vertexFactory; }\r
 \r
-       /** Add a new empty {@link Outline} \r
-        * to the shape, this new outline will\r
-        * be placed at the end of the outline list.\r
-        \r
-        * After a call to this function all new vertices added\r
-        * will belong to the new outline\r
-        */\r
-       public void addEmptyOutline(){\r
-               outlines.add(new Outline());\r
-       }\r
+    /** Add a new empty {@link Outline} \r
+     * to the shape, this new outline will\r
+     * be placed at the end of the outline list.\r
+     * \r
+     * After a call to this function all new vertices added\r
+     * will belong to the new outline\r
+     */\r
+    public void addEmptyOutline(){\r
+        outlines.add(new Outline());\r
+    }\r
 \r
-       /** Adds an {@link Outline} to the OutlineShape object\r
-        * if last outline of the shape is empty, it will replace\r
-        * that last Outline with the new one. If outline is empty,\r
-        * it will do nothing.\r
-        * @param outline an Outline object\r
-        */\r
-       public void addOutline(Outline outline){\r
-               if(outline.isEmpty()){\r
-                       return;\r
-               }\r
-               if(getLastOutline().isEmpty()){\r
-                       outlines.remove(getLastOutline());\r
-               }\r
-               outlines.add(outline);\r
-       }\r
+    /** Adds an {@link Outline} to the OutlineShape object\r
+     * if last outline of the shape is empty, it will replace\r
+     * that last Outline with the new one. If outline is empty,\r
+     * it will do nothing.\r
+     * @param outline an Outline object\r
+     */\r
+    public void addOutline(Outline outline){\r
+        if(outline.isEmpty()){\r
+            return;\r
+        }\r
+        if(getLastOutline().isEmpty()){\r
+            outlines.remove(getLastOutline());\r
+        }\r
+        outlines.add(outline);\r
+    }\r
 \r
-       /** Adds a vertex to the last open outline in the\r
-        *  shape. \r
-        * @param v the vertex to be added to the OutlineShape\r
-        */\r
-       public final void addVertex(Vertex v){\r
-               getLastOutline().addVertex(v);\r
-       }\r
+    /** Adds a vertex to the last open outline in the\r
+     *  shape. \r
+     * @param v the vertex to be added to the OutlineShape\r
+     */\r
+    public final void addVertex(Vertex v){\r
+        getLastOutline().addVertex(v);\r
+    }\r
 \r
-       /** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute\r
-        * of the vertex. The 2D vertex will be represented as Z=0.\r
-        \r
-        * @param x the x coordinate\r
-        * @param y the y coordniate\r
-        * @param onCurve flag if this vertex is on the final curve or defines a curved region\r
-        * of the shape around this vertex.\r
-        */\r
-       public final void addVertex(float x, float y, boolean onCurve) {\r
-               getLastOutline().addVertex(vertexFactory, x, y, onCurve);\r
-       }\r
+    /** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute\r
+     * of the vertex. The 2D vertex will be represented as Z=0.\r
+     * \r
+     * @param x the x coordinate\r
+     * @param y the y coordniate\r
+     * @param onCurve flag if this vertex is on the final curve or defines a curved region\r
+     * of the shape around this vertex.\r
+     */\r
+    public final void addVertex(float x, float y, boolean onCurve) {\r
+        getLastOutline().addVertex(vertexFactory, x, y, onCurve);\r
+    }\r
 \r
-       /** Add a 3D {@link Vertex} to the last outline by defining the coordniate attribute\r
-        * of the vertex.\r
-        * @param x the x coordinate\r
-        * @param y the y coordniate\r
-        * @param z the z coordniate\r
-        * @param onCurve flag if this vertex is on the final curve or defines a curved region\r
-        * of the shape around this vertex.\r
-        */\r
-       public final void addVertex(float x, float y, float z, boolean onCurve) {\r
-               getLastOutline().addVertex(vertexFactory, x, y, z, onCurve);\r
-       }\r
+    /** Add a 3D {@link Vertex} to the last outline by defining the coordniate attribute\r
+     * of the vertex.\r
+     * @param x the x coordinate\r
+     * @param y the y coordniate\r
+     * @param z the z coordniate\r
+     * @param onCurve flag if this vertex is on the final curve or defines a curved region\r
+     * of the shape around this vertex.\r
+     */\r
+    public final void addVertex(float x, float y, float z, boolean onCurve) {\r
+        getLastOutline().addVertex(vertexFactory, x, y, z, onCurve);\r
+    }\r
 \r
-       /** Add a vertex to the last outline by passing a float array and specifying the \r
-        * offset and length in which. The attributes of the vertex are located. \r
-        * The attributes should be continuous (stride = 0).\r
-        * Attributes which value are not set (when length less than 3) \r
-        * are set implicitly to zero.\r
-        * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from\r
-        * @param offset the offset in the buffer to the x coordinate\r
-        * @param length the number of attributes to pick from the buffer (maximum 3)\r
-        * @param onCurve flag if this vertex is on the final curve or defines a curved region\r
-        * of the shape around this vertex.\r
-        */\r
-       public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {\r
-               getLastOutline().addVertex(vertexFactory, coordsBuffer, offset, length, onCurve);\r
-       }       \r
+    /** Add a vertex to the last outline by passing a float array and specifying the \r
+     * offset and length in which. The attributes of the vertex are located. \r
+     * The attributes should be continuous (stride = 0).\r
+     * Attributes which value are not set (when length less than 3) \r
+     * are set implicitly to zero.\r
+     * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from\r
+     * @param offset the offset in the buffer to the x coordinate\r
+     * @param length the number of attributes to pick from the buffer (maximum 3)\r
+     * @param onCurve flag if this vertex is on the final curve or defines a curved region\r
+     * of the shape around this vertex.\r
+     */\r
+    public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {\r
+        getLastOutline().addVertex(vertexFactory, coordsBuffer, offset, length, onCurve);\r
+    }    \r
 \r
-       /** Closes the last outline in the shape\r
-        * if last vertex is not equal to first vertex.\r
-        * A new temp vertex is added at the end which \r
-        * is equal to the first.\r
-        */\r
-       public void closeLastOutline(){\r
-               getLastOutline().setClosed(true);\r
-       }\r
+    /** Closes the last outline in the shape\r
+     * if last vertex is not equal to first vertex.\r
+     * A new temp vertex is added at the end which \r
+     * is equal to the first.\r
+     */\r
+    public void closeLastOutline(){\r
+        getLastOutline().setClosed(true);\r
+    }\r
 \r
-       /** Get the last added outline to the list\r
-        * of outlines that define the shape\r
-        * @return the last outline\r
-        */\r
-       public final Outline getLastOutline(){\r
-               return outlines.get(outlines.size()-1);\r
-       }\r
-       /** Make sure that the outlines represent\r
-        * the specified destinationType, if not\r
-        * transform outlines to destination type.\r
-        * @param destinationType The curve type needed\r
-        */\r
-       public void transformOutlines(int destinationType){\r
-               if(destinationType == QUADRATIC_NURBS){\r
-                       transformOutlinesQuadratic();\r
-               }\r
-       }\r
+    /** Get the last added outline to the list\r
+     * of outlines that define the shape\r
+     * @return the last outline\r
+     */\r
+    public final Outline getLastOutline(){\r
+        return outlines.get(outlines.size()-1);\r
+    }\r
+    /** Make sure that the outlines represent\r
+     * the specified destinationType, if not\r
+     * transform outlines to destination type.\r
+     * @param destinationType The curve type needed\r
+     */\r
+    public void transformOutlines(int destinationType){\r
+        if(destinationType == QUADRATIC_NURBS){\r
+            transformOutlinesQuadratic();\r
+        }\r
+    }\r
 \r
-       private void transformOutlinesQuadratic(){\r
-               ArrayList<Outline> newOutlines = new ArrayList<Outline>(3);\r
+    private void transformOutlinesQuadratic(){\r
+        ArrayList<Outline> newOutlines = new ArrayList<Outline>(3);\r
 \r
-               /**loop over the outlines and make sure no\r
-                * adj off-curve vertices\r
-                */\r
-               for(Outline outline:outlines){\r
-                       Outline newOutline = new Outline();\r
+        /**loop over the outlines and make sure no\r
+         * adj off-curve vertices\r
+         */\r
+        for(Outline outline:outlines){\r
+            Outline newOutline = new Outline();\r
 \r
-                       ArrayList<Vertex> vertices = outline.getVertices();\r
-                       int size =vertices.size()-1;\r
-                       for(int i=0;i<size;i++){\r
-                               Vertex currentVertex = vertices.get(i);\r
-                               Vertex nextVertex = vertices.get((i+1)%size);\r
-                               if(!(currentVertex.isOnCurve()) && !(nextVertex.isOnCurve())) {\r
-                                       newOutline.addVertex(currentVertex);\r
+            ArrayList<Vertex> vertices = outline.getVertices();\r
+            int size =vertices.size()-1;\r
+            for(int i=0;i<size;i++){\r
+                Vertex currentVertex = vertices.get(i);\r
+                Vertex nextVertex = vertices.get((i+1)%size);\r
+                if(!(currentVertex.isOnCurve()) && !(nextVertex.isOnCurve())) {\r
+                    newOutline.addVertex(currentVertex);\r
 \r
-                                       float[] newCoords = VectorUtil.mid(currentVertex.getCoord(), nextVertex.getCoord());\r
-                                       newOutline.addVertex(vertexFactory, newCoords, 0, 3, true);\r
-                               }\r
-                               else {\r
-                                       newOutline.addVertex(currentVertex);\r
-                               }\r
-                       }\r
-                       newOutlines.add(newOutline);\r
-               }\r
-               outlines = newOutlines;\r
-       }\r
+                    float[] newCoords = VectorUtil.mid(currentVertex.getCoord(), nextVertex.getCoord());\r
+                    newOutline.addVertex(vertexFactory, newCoords, 0, 3, true);\r
+                }\r
+                else {\r
+                    newOutline.addVertex(currentVertex);\r
+                }\r
+            }\r
+            newOutlines.add(newOutline);\r
+        }\r
+        outlines = newOutlines;\r
+    }\r
 \r
-       private void generateVertexIds(){\r
-               int maxVertexId = 0;\r
-               for(Outline outline:outlines){\r
-                       ArrayList<Vertex> vertices = outline.getVertices();\r
-                       for(Vertex vert:vertices){\r
-                               vert.setId(maxVertexId);\r
-                               maxVertexId++;\r
-                       }\r
-               }\r
-       }\r
+    private void generateVertexIds(){\r
+        int maxVertexId = 0;\r
+        for(Outline outline:outlines){\r
+            ArrayList<Vertex> vertices = outline.getVertices();\r
+            for(Vertex vert:vertices){\r
+                vert.setId(maxVertexId);\r
+                maxVertexId++;\r
+            }\r
+        }\r
+    }\r
 \r
-       /** @return the list of vertices associated with the \r
-        * {@code Outline} list of this object\r
-        */\r
-       public ArrayList<Vertex> getVertices(){\r
-               ArrayList<Vertex> vertices = new ArrayList<Vertex>();\r
-               for(Outline polyline:outlines){\r
-                       vertices.addAll(polyline.getVertices());\r
-               }\r
-               return vertices;\r
-       }\r
+    /** @return the list of vertices associated with the \r
+     * {@code Outline} list of this object\r
+     */\r
+    public ArrayList<Vertex> getVertices(){\r
+        ArrayList<Vertex> vertices = new ArrayList<Vertex>();\r
+        for(Outline polyline:outlines){\r
+            vertices.addAll(polyline.getVertices());\r
+        }\r
+        return vertices;\r
+    }\r
 \r
-       /** Triangulate the outline shape generating a list of triangles\r
-        * @return an arraylist of triangles representing the filled region\r
-        * which is produced by the combination of the outlines \r
-        */\r
-       public ArrayList<Triangle> triangulate(){\r
-               return triangulate(0.5f);\r
-       }\r
+    /** Triangulate the outline shape generating a list of triangles\r
+     * @return an arraylist of triangles representing the filled region\r
+     * which is produced by the combination of the outlines \r
+     */\r
+    public ArrayList<Triangle> triangulate(){\r
+        return triangulate(0.5f);\r
+    }\r
 \r
-       /**Triangulate the {@link OutlineShape} generating a list of triangles\r
-        * @param sharpness defines the curvature strength around the off-curve vertices.\r
-        * defaults to 0.5f\r
-        * @return an arraylist of triangles representing the filled region\r
-        * which is produced by the combination of the outlines\r
-        */\r
-       public ArrayList<Triangle> triangulate(float sharpness){\r
-               if(outlines.size() == 0){\r
-                       return null;\r
-               }\r
-               sortOutlines();\r
-               generateVertexIds();\r
-               \r
-               CDTriangulator2D triangulator2d = new CDTriangulator2D(sharpness);\r
-               for(int index = 0; index< outlines.size();index++){\r
-                       Outline outline = outlines.get(index);\r
-                       triangulator2d.addCurve(outline);\r
-               }\r
-               \r
-               ArrayList<Triangle> triangles = triangulator2d.generateTriangulation();\r
-               triangulator2d.reset();\r
+    /**Triangulate the {@link OutlineShape} generating a list of triangles\r
+     * @param sharpness defines the curvature strength around the off-curve vertices.\r
+     * defaults to 0.5f\r
+     * @return an arraylist of triangles representing the filled region\r
+     * which is produced by the combination of the outlines\r
+     */\r
+    public ArrayList<Triangle> triangulate(float sharpness){\r
+        if(outlines.size() == 0){\r
+            return null;\r
+        }\r
+        sortOutlines();\r
+        generateVertexIds();\r
+        \r
+        CDTriangulator2D triangulator2d = new CDTriangulator2D(sharpness);\r
+        for(int index = 0; index< outlines.size();index++){\r
+            Outline outline = outlines.get(index);\r
+            triangulator2d.addCurve(outline);\r
+        }\r
+        \r
+        ArrayList<Triangle> triangles = triangulator2d.generateTriangulation();\r
+        triangulator2d.reset();\r
 \r
-               return triangles;\r
-       }\r
+        return triangles;\r
+    }\r
 \r
-       /** Sort the outlines from large\r
-        *  to small depending on the AABox\r
-        */\r
-       private void sortOutlines() {\r
-               Collections.sort(outlines);\r
-               Collections.reverse(outlines);\r
-       }\r
+    /** Sort the outlines from large\r
+     *  to small depending on the AABox\r
+     */\r
+    private void sortOutlines() {\r
+        Collections.sort(outlines);\r
+        Collections.reverse(outlines);\r
+    }\r
 }\r
index cc21af8..926ab54 100755 (executable)
@@ -49,94 +49,94 @@ import com.jogamp.opengl.util.PMVMatrix;
 public interface Region {\r
     public static final boolean DEBUG = Debug.debug("graph.curve");\r
     \r
-       /** The vertices index in an OGL object\r
-        */\r
-       public static int VERTEX_ATTR_IDX = 0;\r
-       public static String VERTEX_ATTR_NAME = "v_position";\r
+    /** The vertices index in an OGL object\r
+     */\r
+    public static int VERTEX_ATTR_IDX = 0;\r
+    public static String VERTEX_ATTR_NAME = "v_position";\r
 \r
-       /** The Texture Coord index in an OGL object\r
-        */\r
-       public static int TEXCOORD_ATTR_IDX = 1;\r
-       public static String TEXCOORD_ATTR_NAME = "texCoord";\r
-       \r
+    /** The Texture Coord index in an OGL object\r
+     */\r
+    public static int TEXCOORD_ATTR_IDX = 1;\r
+    public static String TEXCOORD_ATTR_NAME = "texCoord";\r
+    \r
     /** The color index in an OGL object\r
      */\r
     public static int COLOR_ATTR_IDX = 2;\r
     public static String COLOR_ATTR_NAME = "v_color";\r
     \r
-       /** single pass rendering, fast, but AA might not be perfect */\r
-       public static int SINGLE_PASS = 1;\r
-       \r
-       /** two pass rendering, slower and more resource hungry (FBO), but AA is perfect */\r
-       public static int TWO_PASS    = 2;\r
-       \r
-       /** Updates a graph region by updating the ogl related\r
-        *  objects for use in rendering. if called for the first time\r
-        *  it initialize the objects. \r
-        */\r
-       public void update();\r
-       \r
-       /** Renders the associated OGL objects specifying\r
-        * current width/hight of window for multi pass rendering\r
-        * of the region.\r
-        * @param matrix current {@link PMVMatrix}.\r
-        * @param vp_width current screen width\r
-        * @param vp_height current screen height\r
-        * @param width texture width for mp rendering\r
-        \r
-        * @see update()\r
-        */\r
-       public void render(PMVMatrix matrix, int vp_width, int vp_height, int width);\r
-       \r
-       /** Adds a list of {@link Triangle} objects to the Region\r
-        * These triangles are to be binded to OGL objects \r
-        * on the next call to {@code update}\r
-        * @param tris an arraylist of triangle objects\r
-        \r
-        * @see update()\r
-        */\r
-       public void addTriangles(ArrayList<Triangle> tris);\r
-       \r
-       /** Get the current number of vertices associated\r
-        * with this region. This number is not necessary equal to \r
-        * the OGL binded number of vertices.\r
-        * @return vertices count\r
-        \r
-        * @see isDirty()\r
-        */\r
-       public int getNumVertices();\r
-       \r
-       /** Adds a list of {@link Vertex} objects to the Region\r
-        * These vertices are to be binded to OGL objects \r
-        * on the next call to {@code update}\r
-        * @param verts an arraylist of vertex objects\r
-        \r
-        * @see update()\r
-        */\r
-       public void addVertices(ArrayList<Vertex> verts);\r
-       \r
-       /** Check if this region is dirty. A region is marked dirty\r
-        * when new Vertices, Triangles, and or Lines are added after a \r
-        * call to update()\r
-        * @return true if region is Dirty, false otherwise\r
-        \r
-        * @see update();\r
-        */\r
-       public boolean isDirty();\r
-       \r
-       /** Delete and clean the associated OGL\r
-        *  objects\r
-        */\r
-       public void destroy();\r
-       \r
-       public AABBox getBounds(); \r
-       \r
-       public boolean isFlipped();\r
-       \r
-       /** Set if the y coordinate of the region should be flipped\r
-        *  {@code y=-y} used mainly for fonts since they use opposite vertex\r
-        *  as origion\r
-        * @param flipped flag if the coordinate is flipped defaults to false.\r
-        */\r
-       public void setFlipped(boolean flipped);\r
+    /** single pass rendering, fast, but AA might not be perfect */\r
+    public static int SINGLE_PASS = 1;\r
+    \r
+    /** two pass rendering, slower and more resource hungry (FBO), but AA is perfect */\r
+    public static int TWO_PASS    = 2;\r
+    \r
+    /** Updates a graph region by updating the ogl related\r
+     *  objects for use in rendering. if called for the first time\r
+     *  it initialize the objects. \r
+     */\r
+    public void update();\r
+    \r
+    /** Renders the associated OGL objects specifying\r
+     * current width/hight of window for multi pass rendering\r
+     * of the region.\r
+     * @param matrix current {@link PMVMatrix}.\r
+     * @param vp_width current screen width\r
+     * @param vp_height current screen height\r
+     * @param width texture width for mp rendering\r
+     * \r
+     * @see update()\r
+     */\r
+    public void render(PMVMatrix matrix, int vp_width, int vp_height, int width);\r
+    \r
+    /** Adds a list of {@link Triangle} objects to the Region\r
+     * These triangles are to be binded to OGL objects \r
+     * on the next call to {@code update}\r
+     * @param tris an arraylist of triangle objects\r
+     * \r
+     * @see update()\r
+     */\r
+    public void addTriangles(ArrayList<Triangle> tris);\r
+    \r
+    /** Get the current number of vertices associated\r
+     * with this region. This number is not necessary equal to \r
+     * the OGL binded number of vertices.\r
+     * @return vertices count\r
+     * \r
+     * @see isDirty()\r
+     */\r
+    public int getNumVertices();\r
+    \r
+    /** Adds a list of {@link Vertex} objects to the Region\r
+     * These vertices are to be binded to OGL objects \r
+     * on the next call to {@code update}\r
+     * @param verts an arraylist of vertex objects\r
+     * \r
+     * @see update()\r
+     */\r
+    public void addVertices(ArrayList<Vertex> verts);\r
+    \r
+    /** Check if this region is dirty. A region is marked dirty\r
+     * when new Vertices, Triangles, and or Lines are added after a \r
+     * call to update()\r
+     * @return true if region is Dirty, false otherwise\r
+     * \r
+     * @see update();\r
+     */\r
+    public boolean isDirty();\r
+    \r
+    /** Delete and clean the associated OGL\r
+     *  objects\r
+     */\r
+    public void destroy();\r
+    \r
+    public AABBox getBounds(); \r
+    \r
+    public boolean isFlipped();\r
+    \r
+    /** Set if the y coordinate of the region should be flipped\r
+     *  {@code y=-y} used mainly for fonts since they use opposite vertex\r
+     *  as origion\r
+     * @param flipped flag if the coordinate is flipped defaults to false.\r
+     */\r
+    public void setFlipped(boolean flipped);\r
 }\r
index d3b978b..91bbbd7 100755 (executable)
@@ -41,22 +41,22 @@ import jogamp.graph.curve.opengl.VBORegion2PES2;
  * @see Region\r
  */\r
 public class RegionFactory {\r
-       \r
-       /**Create a Region based on the GLContext attached\r
-        * @param context the current {@link GLContext}\r
-        * @param st the {@link ShaderState} object\r
-        * @param type can be one of Region.SINGLE_PASS or Region.TWO_PASS\r
-        * @return region \r
-        */\r
-       public static Region create(GLContext context, ShaderState st, int type){\r
-           if( !context.isGL2ES2() ) {\r
-               throw new GLException("At least a GL2ES2 GL context is required. Given: " + context);\r
-           }\r
-               if( Region.TWO_PASS == type ){\r
-                       return new VBORegion2PES2(context, st);\r
-               }\r
-               else{\r
-                       return new VBORegionSPES2(context);\r
-               }\r
-       }\r
+    \r
+    /**Create a Region based on the GLContext attached\r
+     * @param context the current {@link GLContext}\r
+     * @param st the {@link ShaderState} object\r
+     * @param type can be one of Region.SINGLE_PASS or Region.TWO_PASS\r
+     * @return region \r
+     */\r
+    public static Region create(GLContext context, ShaderState st, int type){\r
+        if( !context.isGL2ES2() ) {\r
+            throw new GLException("At least a GL2ES2 GL context is required. Given: " + context);\r
+        }\r
+        if( Region.TWO_PASS == type ){\r
+            return new VBORegion2PES2(context, st);\r
+        }\r
+        else{\r
+            return new VBORegionSPES2(context);\r
+        }\r
+    }\r
 }\r
index a2e4ca5..42eebf7 100644 (file)
@@ -48,169 +48,169 @@ import jogamp.opengl.Debug;
  */
 public class CDTriangulator2D {
 
-       protected static final boolean DEBUG = Debug.debug("Triangulation");
-       
-       private float sharpness = 0.5f;
-       private ArrayList<Loop> loops;
-       private ArrayList<Vertex> vertices;
-       
-       private ArrayList<Triangle> triangles;
-       private int maxTriID = 0;
+    protected static final boolean DEBUG = Debug.debug("Triangulation");
+    
+    private float sharpness = 0.5f;
+    private ArrayList<Loop> loops;
+    private ArrayList<Vertex> vertices;
+    
+    private ArrayList<Triangle> triangles;
+    private int maxTriID = 0;
 
-       
-       public CDTriangulator2D() {
-               this(0.5f);
-       }
-       
-       /** Constructor for a new Delaunay triangulator
-        * @param curveSharpness the curvature around
-        *  the off-curve vertices
-        */
-       public CDTriangulator2D(float curveSharpness) {
-               this.sharpness = curveSharpness;
-               reset();
-       }
-       
-       /** Reset the triangulation to initial state
-        *  Clearing cached data
-        */
-       public void reset() {
-               maxTriID = 0;
-               vertices = new ArrayList<Vertex>();
-               triangles = new ArrayList<Triangle>(3);
-               loops = new ArrayList<Loop>();
-       }
-       
-       /** Add a curve to the list of profiles provided
-        * @param polyline a bounding {@link Outline}
-        */
-       public void addCurve(Outline polyline){
-               Loop loop = null;
-               
-               if(!loops.isEmpty()){
-                       loop = getContainerLoop(polyline);
-               }
-               
-               if(loop == null) {
-                       GraphOutline outline = new GraphOutline(polyline);
-                       GraphOutline innerPoly = extractBoundaryTriangles(outline, false);
-                       vertices.addAll(polyline.getVertices());
-                       loop = new Loop(innerPoly, VectorUtil.CCW);
-                       loops.add(loop);
-               }
-               else {
-                       GraphOutline outline = new GraphOutline(polyline);
-                       GraphOutline innerPoly = extractBoundaryTriangles(outline, true);
-                       vertices.addAll(innerPoly.getPoints());
-                       loop.addConstraintCurve(innerPoly);
-               }
-       }
-       
-       /** Generate the triangulation of the provided 
-        *  List of {@link Outline}s
-        */
-       public ArrayList<Triangle> generateTriangulation(){     
-               for(int i=0;i<loops.size();i++) {
-                       Loop loop = loops.get(i);
-                       int numTries = 0;
-                       int size = loop.computeLoopSize();
-                       while(!loop.isSimplex()){
-                               Triangle tri = null;
-                               if(numTries > size){
-                                       tri = loop.cut(false);
-                               }
-                               else{
-                                       tri = loop.cut(true);
-                               }
-                               numTries++;
+    
+    public CDTriangulator2D() {
+        this(0.5f);
+    }
+    
+    /** Constructor for a new Delaunay triangulator
+     * @param curveSharpness the curvature around
+     *  the off-curve vertices
+     */
+    public CDTriangulator2D(float curveSharpness) {
+        this.sharpness = curveSharpness;
+        reset();
+    }
+    
+    /** Reset the triangulation to initial state
+     *  Clearing cached data
+     */
+    public void reset() {
+        maxTriID = 0;
+        vertices = new ArrayList<Vertex>();
+        triangles = new ArrayList<Triangle>(3);
+        loops = new ArrayList<Loop>();
+    }
+    
+    /** Add a curve to the list of profiles provided
+     * @param polyline a bounding {@link Outline}
+     */
+    public void addCurve(Outline polyline){
+        Loop loop = null;
+        
+        if(!loops.isEmpty()){
+            loop = getContainerLoop(polyline);
+        }
+        
+        if(loop == null) {
+            GraphOutline outline = new GraphOutline(polyline);
+            GraphOutline innerPoly = extractBoundaryTriangles(outline, false);
+            vertices.addAll(polyline.getVertices());
+            loop = new Loop(innerPoly, VectorUtil.CCW);
+            loops.add(loop);
+        }
+        else {
+            GraphOutline outline = new GraphOutline(polyline);
+            GraphOutline innerPoly = extractBoundaryTriangles(outline, true);
+            vertices.addAll(innerPoly.getPoints());
+            loop.addConstraintCurve(innerPoly);
+        }
+    }
+    
+    /** Generate the triangulation of the provided 
+     *  List of {@link Outline}s
+     */
+    public ArrayList<Triangle> generateTriangulation(){    
+        for(int i=0;i<loops.size();i++) {
+            Loop loop = loops.get(i);
+            int numTries = 0;
+            int size = loop.computeLoopSize();
+            while(!loop.isSimplex()){
+                Triangle tri = null;
+                if(numTries > size){
+                    tri = loop.cut(false);
+                }
+                else{
+                    tri = loop.cut(true);
+                }
+                numTries++;
 
-                               if(tri != null) {
-                                       numTries = 0;
-                                       size--;
-                                       tri.setId(maxTriID++);
-                                       triangles.add(tri);
-                                       if(DEBUG){
-                                               System.err.println(tri);
-                                       }
-                               }
-                               if(numTries > size*2){
-                                       if(DEBUG){
-                                               System.err.println("Triangulation not complete!");
-                                       }
-                                       break;
-                               }
-                       }
-                       Triangle tri = loop.cut(true);
-                       if(tri != null)
-                               triangles.add(tri);
-               }
-               return triangles;
-       }
+                if(tri != null) {
+                    numTries = 0;
+                    size--;
+                    tri.setId(maxTriID++);
+                    triangles.add(tri);
+                    if(DEBUG){
+                        System.err.println(tri);
+                    }
+                }
+                if(numTries > size*2){
+                    if(DEBUG){
+                        System.err.println("Triangulation not complete!");
+                    }
+                    break;
+                }
+            }
+            Triangle tri = loop.cut(true);
+            if(tri != null)
+                triangles.add(tri);
+        }
+        return triangles;
+    }
 
-       private GraphOutline extractBoundaryTriangles(GraphOutline outline, boolean hole){
-               GraphOutline innerOutline = new GraphOutline();
-               ArrayList<GraphVertex> outVertices = outline.getGraphPoint();
-               int size = outVertices.size();
-               for(int i=0; i < size; i++) {
-                       GraphVertex currentVertex = outVertices.get(i);
-                       GraphVertex gv0 = outVertices.get((i+size-1)%size);
-                       GraphVertex gv2 = outVertices.get((i+1)%size);
-                       GraphVertex gv1 = currentVertex;
-                       
-                       if(!currentVertex.getPoint().isOnCurve()) {
-                           Vertex v0 = gv0.getPoint().clone();
-                           Vertex v2 = gv2.getPoint().clone();
-                           Vertex v1 = gv1.getPoint().clone();
-                               
-                               gv0.setBoundaryContained(true);
-                               gv1.setBoundaryContained(true);
-                               gv2.setBoundaryContained(true);
-                               
-                               Triangle t= null;
-                               boolean holeLike = false;
-                               if(VectorUtil.ccw(v0,v1,v2)){
-                                       t = new Triangle(v0, v1, v2);
-                               }
-                               else {
-                                       holeLike = true;
-                                       t = new Triangle(v2, v1, v0);
-                               }
-                               t.setId(maxTriID++);
-                               triangles.add(t);
-                               if(DEBUG){
-                                       System.err.println(t);
-                               }
-                               if(hole || holeLike) {
-                                       v0.setTexCoord(0, -0.1f);
-                                       v2.setTexCoord(1, -0.1f);
-                                       v1.setTexCoord(0.5f, -1*sharpness -0.1f);
-                                       innerOutline.addVertex(currentVertex);
-                               }
-                               else {
-                                       v0.setTexCoord(0, 0.1f);
-                                       v2.setTexCoord(1, 0.1f);
-                                       v1.setTexCoord(0.5f, sharpness+0.1f);
-                               }
-                       }
-                       else {
-                               if(!gv2.getPoint().isOnCurve() || !gv0.getPoint().isOnCurve()){
-                                       currentVertex.setBoundaryContained(true);
-                               }
-                               innerOutline.addVertex(currentVertex);
-                       }
-               }
-               return innerOutline;
-       }
-       
-       private Loop getContainerLoop(Outline polyline){
-           ArrayList<Vertex> vertices = polyline.getVertices();
-           for(Vertex vert: vertices){
-                       for (Loop loop:loops){
-                               if(loop.checkInside(vert)){
-                                       return loop;
-                               }
-                       }
-           }
-               return null;
-       }
+    private GraphOutline extractBoundaryTriangles(GraphOutline outline, boolean hole){
+        GraphOutline innerOutline = new GraphOutline();
+        ArrayList<GraphVertex> outVertices = outline.getGraphPoint();
+        int size = outVertices.size();
+        for(int i=0; i < size; i++) {
+            GraphVertex currentVertex = outVertices.get(i);
+            GraphVertex gv0 = outVertices.get((i+size-1)%size);
+            GraphVertex gv2 = outVertices.get((i+1)%size);
+            GraphVertex gv1 = currentVertex;
+            
+            if(!currentVertex.getPoint().isOnCurve()) {
+                Vertex v0 = gv0.getPoint().clone();
+                Vertex v2 = gv2.getPoint().clone();
+                Vertex v1 = gv1.getPoint().clone();
+                
+                gv0.setBoundaryContained(true);
+                gv1.setBoundaryContained(true);
+                gv2.setBoundaryContained(true);
+                
+                Triangle t= null;
+                boolean holeLike = false;
+                if(VectorUtil.ccw(v0,v1,v2)){
+                    t = new Triangle(v0, v1, v2);
+                }
+                else {
+                    holeLike = true;
+                    t = new Triangle(v2, v1, v0);
+                }
+                t.setId(maxTriID++);
+                triangles.add(t);
+                if(DEBUG){
+                    System.err.println(t);
+                }
+                if(hole || holeLike) {
+                    v0.setTexCoord(0, -0.1f);
+                    v2.setTexCoord(1, -0.1f);
+                    v1.setTexCoord(0.5f, -1*sharpness -0.1f);
+                    innerOutline.addVertex(currentVertex);
+                }
+                else {
+                    v0.setTexCoord(0, 0.1f);
+                    v2.setTexCoord(1, 0.1f);
+                    v1.setTexCoord(0.5f, sharpness+0.1f);
+                }
+            }
+            else {
+                if(!gv2.getPoint().isOnCurve() || !gv0.getPoint().isOnCurve()){
+                    currentVertex.setBoundaryContained(true);
+                }
+                innerOutline.addVertex(currentVertex);
+            }
+        }
+        return innerOutline;
+    }
+    
+    private Loop getContainerLoop(Outline polyline){
+        ArrayList<Vertex> vertices = polyline.getVertices();
+        for(Vertex vert: vertices){
+            for (Loop loop:loops){
+                if(loop.checkInside(vert)){
+                    return loop;
+                }
+            }
+        }
+        return null;
+    }
 }
index d8c30c6..1010d4f 100644 (file)
@@ -52,27 +52,27 @@ public interface Font {
     public static final int NAME_DESIGNER = 9;
     
     
-       /**
-        * Metrics for font
-        
-        * Depending on the font's direction, horizontal or vertical,
-        * the following tables shall be used:
-        
-        * Vertical http://developer.apple.com/fonts/TTRefMan/RM06/Chap6vhea.html
+    /**
+     * Metrics for font
+     * 
+     * Depending on the font's direction, horizontal or vertical,
+     * the following tables shall be used:
+     * 
+     * Vertical http://developer.apple.com/fonts/TTRefMan/RM06/Chap6vhea.html
      * Horizontal http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html
-        */
+     */
     public interface Metrics {  
-           float getAscent(float pixelSize);
-           float getDescent(float pixelSize);
-           float getLineGap(float pixelSize);
-           float getMaxExtend(float pixelSize);            
-           float getScale(float pixelSize);
-           AABBox getBBox(float pixelSize);
+        float getAscent(float pixelSize);
+        float getDescent(float pixelSize);
+        float getLineGap(float pixelSize);
+        float getMaxExtend(float pixelSize);        
+        float getScale(float pixelSize);
+        AABBox getBBox(float pixelSize);
     }
 
-       /**
-        * Glyph for font
-        */
+    /**
+     * Glyph for font
+     */
     public interface Glyph {
         public Font getFont();
         public char getSymbol();
index 17a805b..8a604ec 100644 (file)
@@ -36,176 +36,176 @@ import com.jogamp.graph.math.VectorUtil;
  * 
  */
 public class AABBox {
-       private float[] low = {Float.MAX_VALUE,Float.MAX_VALUE,Float.MAX_VALUE};
-       private float[] high = {-1*Float.MAX_VALUE,-1*Float.MAX_VALUE,-1*Float.MAX_VALUE};
-       private float[] center = new float[3];
+    private float[] low = {Float.MAX_VALUE,Float.MAX_VALUE,Float.MAX_VALUE};
+    private float[] high = {-1*Float.MAX_VALUE,-1*Float.MAX_VALUE,-1*Float.MAX_VALUE};
+    private float[] center = new float[3];
 
-       /** Create a Axis Aligned bounding box (AABBox) 
-        * where the low and and high MAX float Values.
-        */
-       public AABBox() {}
+    /** Create a Axis Aligned bounding box (AABBox) 
+     * where the low and and high MAX float Values.
+     */
+    public AABBox() {}
 
-       /** Create an AABBox specifying the coordinates 
-        * of the low and high
-        * @param lx min x-coordinate
-        * @param ly min y-coordnate
-        * @param lz min z-coordinate
-        * @param hx max x-coordinate
-        * @param hy max y-coordinate
-        * @param hz max z-coordinate
-        */
-       public AABBox(float lx, float ly, float lz,
-                       float hx, float hy, float hz)
-       {
-               resize(lx, ly, lz);
-               resize(hx, hy, hz);
+    /** Create an AABBox specifying the coordinates 
+     * of the low and high
+     * @param lx min x-coordinate
+     * @param ly min y-coordnate
+     * @param lz min z-coordinate
+     * @param hx max x-coordinate
+     * @param hy max y-coordinate
+     * @param hz max z-coordinate
+     */
+    public AABBox(float lx, float ly, float lz,
+            float hx, float hy, float hz)
+    {
+        resize(lx, ly, lz);
+        resize(hx, hy, hz);
 
-               computeCenter();
-       }
-       
-       /** Create a AABBox defining the low and high
-        * @param low min xyz-coordinates
-        * @param high max xyz-coordinates
-        */
-       public AABBox(float[] low, float[] high)
-       {
-               resize(low[0],low[1],low[2]);
-               resize(high[0],high[1],high[2]);
+        computeCenter();
+    }
+    
+    /** Create a AABBox defining the low and high
+     * @param low min xyz-coordinates
+     * @param high max xyz-coordinates
+     */
+    public AABBox(float[] low, float[] high)
+    {
+        resize(low[0],low[1],low[2]);
+        resize(high[0],high[1],high[2]);
 
-               computeCenter();
-       }
-       
-       /** Get the max xyz-coordinates
-        * @return a float array containing the max xyz coordinates
-        */
-       public float[] getHigh() 
-       {
-               return high;
-       }
-       
-       private void setHigh(float hx, float hy, float hz) 
-       {
-               this.high[0] = hx;
-               this.high[1] = hy;
-               this.high[2] = hz;
-       }
-       
-       /** Get the min xyz-coordinates
-        * @return a float array containing the min xyz coordinates
-        */
-       public float[] getLow() 
-       {
-               return low;
-       }
-       
-       private void setLow(float lx, float ly, float lz) 
-       {
-               this.low[0] = lx;
-               this.low[1] = ly;
-               this.low[2] = lz;
-       }
+        computeCenter();
+    }
+    
+    /** Get the max xyz-coordinates
+     * @return a float array containing the max xyz coordinates
+     */
+    public float[] getHigh() 
+    {
+        return high;
+    }
+    
+    private void setHigh(float hx, float hy, float hz) 
+    {
+        this.high[0] = hx;
+        this.high[1] = hy;
+        this.high[2] = hz;
+    }
+    
+    /** Get the min xyz-coordinates
+     * @return a float array containing the min xyz coordinates
+     */
+    public float[] getLow() 
+    {
+        return low;
+    }
+    
+    private void setLow(float lx, float ly, float lz) 
+    {
+        this.low[0] = lx;
+        this.low[1] = ly;
+        this.low[2] = lz;
+    }
 
-       /** Resize the AABBox to encapsulate another AABox
-        * @param newBox AABBox to be encapsulated in
-        */
-       public void resize(AABBox newBox)
-       {
-               float[] newLow = newBox.getLow();
-               float[] newHigh = newBox.getHigh();
+    /** Resize the AABBox to encapsulate another AABox
+     * @param newBox AABBox to be encapsulated in
+     */
+    public void resize(AABBox newBox)
+    {
+        float[] newLow = newBox.getLow();
+        float[] newHigh = newBox.getHigh();
 
-               /** test low */
-               if (newLow[0] < low[0])
-                       low[0] = newLow[0];
-               if (newLow[1] < low[1])
-                       low[1] = newLow[1];
-               if (newLow[2] < low[2])
-                       low[2] = newLow[2];
+        /** test low */
+        if (newLow[0] < low[0])
+            low[0] = newLow[0];
+        if (newLow[1] < low[1])
+            low[1] = newLow[1];
+        if (newLow[2] < low[2])
+            low[2] = newLow[2];
 
-               /** test high */
-               if (newHigh[0] > high[0])
-                       high[0] = newHigh[0];
-               if (newHigh[1] > high[1])
-                       high[1] = newHigh[1];
-               if (newHigh[2] > high[2])
-                       high[2] = newHigh[2];
+        /** test high */
+        if (newHigh[0] > high[0])
+            high[0] = newHigh[0];
+        if (newHigh[1] > high[1])
+            high[1] = newHigh[1];
+        if (newHigh[2] > high[2])
+            high[2] = newHigh[2];
 
-               computeCenter();
-       }
+        computeCenter();
+    }
 
-       private void computeCenter()
-       {
-               center[0] = (high[0] + low[0])/2;
-               center[1] = (high[1] + low[1])/2;
-               center[2] = (high[2] + low[2])/2;
-       }
+    private void computeCenter()
+    {
+        center[0] = (high[0] + low[0])/2;
+        center[1] = (high[1] + low[1])/2;
+        center[2] = (high[2] + low[2])/2;
+    }
 
-       /** Resize the AABBox to encapsulate the passed
-        * xyz-coordinates. 
-        * @param x x-axis coordinate value
-        * @param y y-axis coordinate value
-        * @param z z-axis coordinate value
-        */
-       public void resize(float x, float y, float z)
-       {       
-               /** test low */
-               if (x < low[0])
-                       low[0] = x;
-               if (y < low[1])
-                       low[1] = y;
-               if (z < low[2])
-                       low[2] = z;
+    /** Resize the AABBox to encapsulate the passed
+     * xyz-coordinates. 
+     * @param x x-axis coordinate value
+     * @param y y-axis coordinate value
+     * @param z z-axis coordinate value
+     */
+    public void resize(float x, float y, float z)
+    {    
+        /** test low */
+        if (x < low[0])
+            low[0] = x;
+        if (y < low[1])
+            low[1] = y;
+        if (z < low[2])
+            low[2] = z;
 
-               /** test high */
-               if (x > high[0])
-                       high[0] = x;
-               if (y > high[1])
-                       high[1] = y;
-               if (z > high[2])
-                       high[2] = z;
-               
-               computeCenter();
-       }
+        /** test high */
+        if (x > high[0])
+            high[0] = x;
+        if (y > high[1])
+            high[1] = y;
+        if (z > high[2])
+            high[2] = z;
+        
+        computeCenter();
+    }
 
-       /** Check if the x & y coordinates are bounded/contained
-        *  by this AABBox
-        * @param x  x-axis coordinate value
-        * @param y  y-axis coordinate value
-        * @return true if  x belong to (low.x, high.x) and
-        * y belong to (low.y, high.y)
-        */
-       public boolean contains(float x, float y){
-               if(x<low[0] || x>high[0]){
-                       return false;
-               }
-               if(y<low[1]|| y>high[1]){
-                       return false;
-               }
-               return true;
-       }
-       
-       /** Check if the xyz coordinates are bounded/contained
-        *  by this AABBox.
-        * @param x x-axis coordinate value
-        * @param y y-axis coordinate value
-        * @param z z-axis coordinate value
-        * @return true if  x belong to (low.x, high.x) and
-        * y belong to (low.y, high.y) and  z belong to (low.z, high.z)
-        */
-       public boolean contains(float x, float y, float z){
-               if(x<low[0] || x>high[0]){
-                       return false;
-               }
-               if(y<low[1]|| y>high[1]){
-                       return false;
-               }
-               if(z<low[2] || z>high[2]){
-                       return false;
-               }
-               return true;
-       }
-       
+    /** Check if the x & y coordinates are bounded/contained
+     *  by this AABBox
+     * @param x  x-axis coordinate value
+     * @param y  y-axis coordinate value
+     * @return true if  x belong to (low.x, high.x) and
+     * y belong to (low.y, high.y)
+     */
+    public boolean contains(float x, float y){
+        if(x<low[0] || x>high[0]){
+            return false;
+        }
+        if(y<low[1]|| y>high[1]){
+            return false;
+        }
+        return true;
+    }
+    
+    /** Check if the xyz coordinates are bounded/contained
+     *  by this AABBox.
+     * @param x x-axis coordinate value
+     * @param y y-axis coordinate value
+     * @param z z-axis coordinate value
+     * @return true if  x belong to (low.x, high.x) and
+     * y belong to (low.y, high.y) and  z belong to (low.z, high.z)
+     */
+    public boolean contains(float x, float y, float z){
+        if(x<low[0] || x>high[0]){
+            return false;
+        }
+        if(y<low[1]|| y>high[1]){
+            return false;
+        }
+        if(z<low[2] || z>high[2]){
+            return false;
+        }
+        return true;
+    }
+    
     /** Check if there is a common region between this AABBox and the passed
-     *         2D region irrespective of z range
+     *     2D region irrespective of z range
      * @param x lower left x-coord
      * @param y lower left y-coord
      * @param w width
@@ -213,87 +213,87 @@ public class AABBox {
      * @return true if this AABBox might have a common region with this 2D region
      */
     public boolean intersects(float x, float y, float w, float h) {
-       if (w <= 0 || h <= 0) {
-           return false;
-       }
-       
-       final float _w = getWidth();
-       final float _h = getHeight();           
-       if (_w <= 0 || _h <= 0) {
-           return false;
-       }
-       
-       final float x0 = getMinX();
-       final float y0 = getMinY();
-       return (x + w > x0 &&
-                   y + h > y0 &&
-                   x < x0 + _w &&
-               y < y0 + _h);
+        if (w <= 0 || h <= 0) {
+            return false;
+        }
+        
+        final float _w = getWidth();
+        final float _h = getHeight();        
+        if (_w <= 0 || _h <= 0) {
+            return false;
+        }
+        
+        final float x0 = getMinX();
+        final float y0 = getMinY();
+        return (x + w > x0 &&
+                y + h > y0 &&
+                x < x0 + _w &&
+                y < y0 + _h);
     }
 
-       
-       /** Get the size of the Box where the size is represented by the 
-        * length of the vector between low and high.
-        * @return a float representing the size of the AABBox
-        */
-       public float getSize(){
-               return VectorUtil.computeLength(low, high);
-       }
+    
+    /** Get the size of the Box where the size is represented by the 
+     * length of the vector between low and high.
+     * @return a float representing the size of the AABBox
+     */
+    public float getSize(){
+        return VectorUtil.computeLength(low, high);
+    }
 
-       /**Get the Center of the AABBox
-        * @return the xyz-coordinates of the center of the AABBox
-        */
-       public float[] getCenter() {
-               return center;
-       }
+    /**Get the Center of the AABBox
+     * @return the xyz-coordinates of the center of the AABBox
+     */
+    public float[] getCenter() {
+        return center;
+    }
 
-       /** Scale the AABBox by a constant
-        * @param size a constant float value
-        */
-       public void scale(float size) {
-               float[] diffH = new float[3];
-               diffH[0] = high[0] - center[0];
-               diffH[1] = high[1] - center[1];
-               diffH[2] = high[2] - center[2];
-               
-               diffH = VectorUtil.scale(diffH, size);
-               
-               float[] diffL = new float[3];
-               diffL[0] = low[0] - center[0];
-               diffL[1] = low[1] - center[1];
-               diffL[2] = low[2] - center[2];
-               
-               diffL = VectorUtil.scale(diffL, size);
-               
-               high = VectorUtil.vectorAdd(center, diffH);
-               low = VectorUtil.vectorAdd(center, diffL);
-       }
+    /** Scale the AABBox by a constant
+     * @param size a constant float value
+     */
+    public void scale(float size) {
+        float[] diffH = new float[3];
+        diffH[0] = high[0] - center[0];
+        diffH[1] = high[1] - center[1];
+        diffH[2] = high[2] - center[2];
+        
+        diffH = VectorUtil.scale(diffH, size);
+        
+        float[] diffL = new float[3];
+        diffL[0] = low[0] - center[0];
+        diffL[1] = low[1] - center[1];
+        diffL[2] = low[2] - center[2];
+        
+        diffL = VectorUtil.scale(diffL, size);
+        
+        high = VectorUtil.vectorAdd(center, diffH);
+        low = VectorUtil.vectorAdd(center, diffL);
+    }
 
-       public float getMinX() {
-               return low[0];
-       }
-       
-       public float getMinY() {
-               return low[1];
-       }
-       
-       public float getWidth(){
-               return high[0] - low[0];
-       }
-       
-       public float getHeight() {
-               return high[1] - low[1];
-       }
-       
-       public float getDepth() {
-               return high[2] - low[2];
-       }
-       public AABBox clone(){
-               return new AABBox(this.low, this.high);
-       }
-       
-       public String toString() {
-           return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
-                       center[0]+"/"+center[1]+"/"+center[1]+" ]";
-       }
+    public float getMinX() {
+        return low[0];
+    }
+    
+    public float getMinY() {
+        return low[1];
+    }
+    
+    public float getWidth(){
+        return high[0] - low[0];
+    }
+    
+    public float getHeight() {
+        return high[1] - low[1];
+    }
+    
+    public float getDepth() {
+        return high[2] - low[2];
+    }
+    public AABBox clone(){
+        return new AABBox(this.low, this.high);
+    }
+    
+    public String toString() {
+        return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
+                    center[0]+"/"+center[1]+"/"+center[1]+" ]";
+    }
 }
index a805adf..315be00 100644 (file)
@@ -44,133 +44,133 @@ import com.jogamp.graph.math.VectorUtil;
  *  @see OutlineShape, Region
  */
 public class Outline implements Comparable<Outline> {
-       
-       private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3);
-       private boolean closed = false;
-       private AABBox box = new AABBox();
-       
-       /**Create an outline defined by control vertices.
-        * An outline can contain off Curve vertices which define curved
-        * regions in the outline.
-        */
-       public Outline(){
-               
-       }
-       
-       /** Add a vertex to the outline. The {@link Vertex} is added at the 
-        * end of the outline loop/strip.
-        * @param vertex Vertex to be added
-        */
-       public final void addVertex(Vertex vertex) {
-               vertices.add(vertex);
-               box.resize(vertex.getX(), vertex.getY(), vertex.getZ());
-       }
-       
-       /**  Add a {@link Vertex} by specifying its 2D attributes to the outline. 
-        * The {@link Vertex} is added at the 
-        * end of the outline loop/strip. 
-        * @param factory a {@link Factory} to get the required Vertex impl
-        * @param x the x coordinate
-        * @param y the y coordinate
-        * @param onCurve flag if this vertex is on the final curve or defines a curved region
-        * of the shape around this vertex.
-        */
-       public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, boolean onCurve) {
-               addVertex(factory, x, y, 0f, onCurve);
-       }
-       
-       /** Add a {@link Vertex} by specifying its 3D attributes to the outline. 
-        * The {@link Vertex} is added at the 
-        * end of the outline loop/strip. 
-        * @param factory  a {@link Factory} to get the required Vertex impl
-        * @param x the x coordinate
-        * @param y the y coordinate
-        * @param z the z coordinate
-        * @param onCurve flag if this vertex is on the final curve or defines a curved region
-        * of the shape around this vertex.
-        */
-       public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, float z, boolean onCurve) {
-               Vertex v = factory.create(x, y, z);
-               v.setOnCurve(onCurve);
-               addVertex(v);
-       }
-       
-       /** Add a vertex to the outline by passing a float array and specifying the 
-        * offset and length in which. The attributes of the vertex are located. 
-        * The attributes should be continuous (stride = 0).
-        * Attributes which value are not set (when length less than 3) 
-        * are set implicitly to zero.
-        * @param factory  a {@link Factory} to get the required Vertex impl
-        * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
-        * @param offset the offset in the buffer to the x coordinate
-        * @param length the number of attributes to pick from the buffer (maximum 3)
-        * @param onCurve flag if this vertex is on the final curve or defines a curved region
-        * of the shape around this vertex.
-        */
-       public final void addVertex(Vertex.Factory<? extends Vertex> factory, float[] coordsBuffer, int offset, int length, boolean onCurve) {
-               Vertex v = factory.create(coordsBuffer, offset, length);
-               v.setOnCurve(onCurve);
-               addVertex(v);
-       }
-       
-       public Vertex getVertex(int index){
-               return vertices.get(index);
-       }
-       
-       public boolean isEmpty(){
-               return (vertices.size() == 0);
-       }
-       public Vertex getLastVertex(){
-               if(isEmpty()){
-                       return null;
-               }
-               return vertices.get(vertices.size()-1);
-       }
-       
-       public ArrayList<Vertex> getVertices() {
-               return vertices;
-       }
-       public void setVertices(ArrayList<Vertex> vertices) {
-               this.vertices = vertices;
-       }
-       public AABBox getBox() {
-               return box;
-       }
-       public boolean isClosed() {
-               return closed;
-       }
-       
-       /** define if this outline is closed or not.
-        * if set to closed, checks if the last vertex is 
-        * equal to the first vertex. If not Equal adds a
-        * vertex at the end to the list.
-        * @param closed
-        */
-       public void setClosed(boolean closed) {
-               this.closed = closed;
-               if(closed){
-                   Vertex first = vertices.get(0);
-                   Vertex last = getLastVertex();
-                       if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){
-                               Vertex v = first.clone();
-                               vertices.add(v);
-                       }
-               }
-       }
-       
-       /** Compare two outlines with Bounding Box area
-        * as criteria. 
-        * @see java.lang.Comparable#compareTo(java.lang.Object)
-        */
-       public int compareTo(Outline outline) {
-               float size = box.getSize();
-               float newSize = outline.getBox().getSize();
-               if(size < newSize){
-                       return -1;
-               }
-               else if(size > newSize){
-                       return 1;
-               }
-               return 0;
-       }
+    
+    private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3);
+    private boolean closed = false;
+    private AABBox box = new AABBox();
+    
+    /**Create an outline defined by control vertices.
+     * An outline can contain off Curve vertices which define curved
+     * regions in the outline.
+     */
+    public Outline(){
+        
+    }
+    
+    /** Add a vertex to the outline. The {@link Vertex} is added at the 
+     * end of the outline loop/strip.
+     * @param vertex Vertex to be added
+     */
+    public final void addVertex(Vertex vertex) {
+        vertices.add(vertex);
+        box.resize(vertex.getX(), vertex.getY(), vertex.getZ());
+    }
+    
+    /**  Add a {@link Vertex} by specifying its 2D attributes to the outline. 
+     * The {@link Vertex} is added at the 
+     * end of the outline loop/strip. 
+     * @param factory a {@link Factory} to get the required Vertex impl
+     * @param x the x coordinate
+     * @param y the y coordinate
+     * @param onCurve flag if this vertex is on the final curve or defines a curved region
+     * of the shape around this vertex.
+     */
+    public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, boolean onCurve) {
+        addVertex(factory, x, y, 0f, onCurve);
+    }
+    
+    /** Add a {@link Vertex} by specifying its 3D attributes to the outline. 
+     * The {@link Vertex} is added at the 
+     * end of the outline loop/strip. 
+     * @param factory  a {@link Factory} to get the required Vertex impl
+     * @param x the x coordinate
+     * @param y the y coordinate
+     * @param z the z coordinate
+     * @param onCurve flag if this vertex is on the final curve or defines a curved region
+     * of the shape around this vertex.
+     */
+    public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, float z, boolean onCurve) {
+        Vertex v = factory.create(x, y, z);
+        v.setOnCurve(onCurve);
+        addVertex(v);
+    }
+    
+    /** Add a vertex to the outline by passing a float array and specifying the 
+     * offset and length in which. The attributes of the vertex are located. 
+     * The attributes should be continuous (stride = 0).
+     * Attributes which value are not set (when length less than 3) 
+     * are set implicitly to zero.
+     * @param factory  a {@link Factory} to get the required Vertex impl
+     * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
+     * @param offset the offset in the buffer to the x coordinate
+     * @param length the number of attributes to pick from the buffer (maximum 3)
+     * @param onCurve flag if this vertex is on the final curve or defines a curved region
+     * of the shape around this vertex.
+     */
+    public final void addVertex(Vertex.Factory<? extends Vertex> factory, float[] coordsBuffer, int offset, int length, boolean onCurve) {
+        Vertex v = factory.create(coordsBuffer, offset, length);
+        v.setOnCurve(onCurve);
+        addVertex(v);
+    }
+    
+    public Vertex getVertex(int index){
+        return vertices.get(index);
+    }
+    
+    public boolean isEmpty(){
+        return (vertices.size() == 0);
+    }
+    public Vertex getLastVertex(){
+        if(isEmpty()){
+            return null;
+        }
+        return vertices.get(vertices.size()-1);
+    }
+    
+    public ArrayList<Vertex> getVertices() {
+        return vertices;
+    }
+    public void setVertices(ArrayList<Vertex> vertices) {
+        this.vertices = vertices;
+    }
+    public AABBox getBox() {
+        return box;
+    }
+    public boolean isClosed() {
+        return closed;
+    }
+    
+    /** define if this outline is closed or not.
+     * if set to closed, checks if the last vertex is 
+     * equal to the first vertex. If not Equal adds a
+     * vertex at the end to the list.
+     * @param closed
+     */
+    public void setClosed(boolean closed) {
+        this.closed = closed;
+        if(closed){
+            Vertex first = vertices.get(0);
+            Vertex last = getLastVertex();
+            if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){
+                Vertex v = first.clone();
+                vertices.add(v);
+            }
+        }
+    }
+    
+    /** Compare two outlines with Bounding Box area
+     * as criteria. 
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
+    public int compareTo(Outline outline) {
+        float size = box.getSize();
+        float newSize = outline.getBox().getSize();
+        if(size < newSize){
+            return -1;
+        }
+        else if(size > newSize){
+            return 1;
+        }
+        return 0;
+    }
 }
index d13e8dd..fb34de2 100644 (file)
 package com.jogamp.graph.geom;
 
 public class Triangle {
-       private int id = Integer.MAX_VALUE;
-       final private Vertex[] vertices;
-       private boolean[] boundaryEdges = new boolean[3];
-       private boolean[] boundaryVertices = null;
+    private int id = Integer.MAX_VALUE;
+    final private Vertex[] vertices;
+    private boolean[] boundaryEdges = new boolean[3];
+    private boolean[] boundaryVertices = null;
 
-       public Triangle(Vertex ... v123){
-               vertices = v123;
-       }
+    public Triangle(Vertex ... v123){
+        vertices = v123;
+    }
 
-       public int getId() {
-               return id;
-       }
+    public int getId() {
+        return id;
+    }
 
-       public void setId(int id) {
-               this.id = id;
-       }
+    public void setId(int id) {
+        this.id = id;
+    }
 
-       public Vertex[] getVertices() {
-               return vertices;
-       }
-       
-       public boolean isEdgesBoundary() {
-               return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
-       }
-       
-       public boolean isVerticesBoundary() {
-               return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
-       }
+    public Vertex[] getVertices() {
+        return vertices;
+    }
+    
+    public boolean isEdgesBoundary() {
+        return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
+    }
+    
+    public boolean isVerticesBoundary() {
+        return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
+    }
 
-       public void setEdgesBoundary(boolean[] boundary) {
-               this.boundaryEdges = boundary;
-       }
-       
-       public boolean[] getEdgeBoundary() {
-               return boundaryEdges;
-       }
-       
-       public boolean[] getVerticesBoundary() {
-               return boundaryVertices;
-       }
+    public void setEdgesBoundary(boolean[] boundary) {
+        this.boundaryEdges = boundary;
+    }
+    
+    public boolean[] getEdgeBoundary() {
+        return boundaryEdges;
+    }
+    
+    public boolean[] getVerticesBoundary() {
+        return boundaryVertices;
+    }
 
-       public void setVerticesBoundary(boolean[] boundaryVertices) {
-               this.boundaryVertices = boundaryVertices;
-       }
-       
-       public String toString() {
-               return "Tri ID: " + id + "\n" +  vertices[0]  + "\n" +  vertices[1] + "\n" +  vertices[2];
-       }
+    public void setVerticesBoundary(boolean[] boundaryVertices) {
+        this.boundaryVertices = boundaryVertices;
+    }
+    
+    public String toString() {
+        return "Tri ID: " + id + "\n" +  vertices[0]  + "\n" +  vertices[1] + "\n" +  vertices[2];
+    }
 }
index 0e4e5e8..859add9 100644 (file)
@@ -32,49 +32,49 @@ package com.jogamp.graph.geom;
  */
 public interface Vertex extends Comparable<Vertex>, Cloneable {
 
-       public static interface Factory <T extends Vertex> {
-               T create();
+    public static interface Factory <T extends Vertex> {
+        T create();
 
-               T create(float x, float y);
+        T create(float x, float y);
 
-               T create(float x, float y, float z);
+        T create(float x, float y, float z);
 
-               T create(float[] coordsBuffer, int offset, int length); 
-       }
-       
-       void setCoord(float x, float y);
+        T create(float[] coordsBuffer, int offset, int length);    
+    }
+    
+    void setCoord(float x, float y);
 
-       void setCoord(float x, float y, float z);
+    void setCoord(float x, float y, float z);
 
-       void setCoord(float[] coordsBuffer, int offset, int length);
-       
-       float[] getCoord();
+    void setCoord(float[] coordsBuffer, int offset, int length);
+    
+    float[] getCoord();
 
-       void setX(float x);
+    void setX(float x);
 
-       void setY(float y);
+    void setY(float y);
 
-       void setZ(float z);
+    void setZ(float z);
 
-       float getX();
+    float getX();
 
-       float getY();
+    float getY();
 
-       float getZ();
+    float getZ();
 
-       boolean isOnCurve();
+    boolean isOnCurve();
 
-       void setOnCurve(boolean onCurve);
+    void setOnCurve(boolean onCurve);
 
-       int getId();
-       
-       void setId(int id);
-       
-       int compareTo(Vertex p);
-       
-       float[] getTexCoord();
-       
-       void setTexCoord(float s, float t);
-       
-       Vertex clone();
+    int getId();
+    
+    void setId(int id);
+    
+    int compareTo(Vertex p);
+    
+    float[] getTexCoord();
+    
+    void setTexCoord(float s, float t);
+    
+    Vertex clone();
 }
index 681067e..6241d60 100644 (file)
@@ -36,143 +36,143 @@ import com.jogamp.graph.math.VectorUtil;
  *
  */
 public class SVertex implements Vertex {
-       private int id = Integer.MAX_VALUE;
-       protected float[] coord = new float[3];
-       protected boolean onCurve = true;
-       private float[] texCoord = new float[2];
-       
-       static final Factory factory = new Factory();
-       
-       public static Factory factory() { return factory; } 
-       
-       public static class Factory implements Vertex.Factory<SVertex> {
-               @Override
-               public SVertex create() {
-                       return new SVertex();
-               }
-
-               @Override
-               public SVertex create(float x, float y) {
-                       return new SVertex(x, y);
-               }
-
-               @Override
-               public SVertex create(float x, float y, float z) {
-                       return new SVertex(x, y, z);
-               }
-
-               @Override
-               public SVertex create(float[] coordsBuffer, int offset, int length) {
-                       return new SVertex(coordsBuffer, offset, length);
-               }               
-       }
-       
-       public SVertex() {
-       }
-
-       public SVertex(float x, float y) {
-               setCoord(x, y);
-       }
-       public SVertex(float x, float y, float z) {
-               setCoord(x, y, z);
-       }       
-       public SVertex(float[] coordsBuffer, int offset, int length) {
-               setCoord(coordsBuffer, offset, length);
-       }
-               
-       public void setCoord(float x, float y) {
-               this.coord[0] = x;
-               this.coord[1] = y;
-               this.coord[2] = 0f;
-       }
-
-       public void setCoord(float x, float y, float z) {
-               this.coord[0] = x;
-               this.coord[1] = y;
-               this.coord[2] = z;
-       }
-
-       public void setCoord(float[] coordsBuffer, int offset, int length) {
-               if(length > coordsBuffer.length - offset) {
-                       throw new IndexOutOfBoundsException("coordsBuffer too small: "+coordsBuffer.length+" - "+offset+" < "+length);
-               }
-               if(length > 3) {
-                       throw new IndexOutOfBoundsException("length too big: "+length+" > "+3);
-               }               
-               int i=0;
-               while(i<length) {
-                       this.coord[i++] = coordsBuffer[offset++];
-               }
-       }
-               
-       public float[] getCoord() {
-               return coord;
-       }
-
-       public void setX(float x) {
-               this.coord[0] = x;
-       }
-
-       public void setY(float y) {
-               this.coord[1] = y;
-       }
-
-       public void setZ(float z) {
-               this.coord[2] = z;
-       }
-
-       public float getX() {
-               return this.coord[0];
-       }
-
-       public float getY() {
-               return this.coord[1];
-       }
-
-       public float getZ() {
-               return this.coord[2];
-       }
-
-       public boolean isOnCurve() {
-               return onCurve;
-       }
-
-       public void setOnCurve(boolean onCurve) {
-               this.onCurve = onCurve;
-       }
-
-       public int getId(){
-               return id;
-       }
-       
-       public void setId(int id){
-               this.id = id;
-       }
-       
-       public int compareTo(Vertex p) {
-               if(VectorUtil.checkEquality(coord, p.getCoord())) {
-                       return 0;
-               }
-               return -1;
-       }
-       
-       public float[] getTexCoord() {
-               return texCoord;
-       }
-
-       public void setTexCoord(float s, float t) {
-               this.texCoord[0] = s;
-               this.texCoord[1] = t;
-       }
-       
-       public SVertex clone(){
-               SVertex v = new SVertex(this.coord, 0, 3);
-               v.setOnCurve(this.onCurve);
-               return v;
-       }
-       
-       public String toString() {
-               return "[ID: " + id + " X: " + coord[0]
-                       + " Y: " + coord[1] + " Z: " + coord[2] + "]";
-       }
+    private int id = Integer.MAX_VALUE;
+    protected float[] coord = new float[3];
+    protected boolean onCurve = true;
+    private float[] texCoord = new float[2];
+    
+    static final Factory factory = new Factory();
+    
+    public static Factory factory() { return factory; } 
+    
+    public static class Factory implements Vertex.Factory<SVertex> {
+        @Override
+        public SVertex create() {
+            return new SVertex();
+        }
+
+        @Override
+        public SVertex create(float x, float y) {
+            return new SVertex(x, y);
+        }
+
+        @Override
+        public SVertex create(float x, float y, float z) {
+            return new SVertex(x, y, z);
+        }
+
+        @Override
+        public SVertex create(float[] coordsBuffer, int offset, int length) {
+            return new SVertex(coordsBuffer, offset, length);
+        }        
+    }
+    
+    public SVertex() {
+    }
+
+    public SVertex(float x, float y) {
+        setCoord(x, y);
+    }
+    public SVertex(float x, float y, float z) {
+        setCoord(x, y, z);
+    }    
+    public SVertex(float[] coordsBuffer, int offset, int length) {
+        setCoord(coordsBuffer, offset, length);
+    }
+        
+    public void setCoord(float x, float y) {
+        this.coord[0] = x;
+        this.coord[1] = y;
+        this.coord[2] = 0f;
+    }
+
+    public void setCoord(float x, float y, float z) {
+        this.coord[0] = x;
+        this.coord[1] = y;
+        this.coord[2] = z;
+    }
+
+    public void setCoord(float[] coordsBuffer, int offset, int length) {
+        if(length > coordsBuffer.length - offset) {
+            throw new IndexOutOfBoundsException("coordsBuffer too small: "+coordsBuffer.length+" - "+offset+" < "+length);
+        }
+        if(length > 3) {
+            throw new IndexOutOfBoundsException("length too big: "+length+" > "+3);
+        }        
+        int i=0;
+        while(i<length) {
+            this.coord[i++] = coordsBuffer[offset++];
+        }
+    }
+        
+    public float[] getCoord() {
+        return coord;
+    }
+
+    public void setX(float x) {
+        this.coord[0] = x;
+    }
+
+    public void setY(float y) {
+        this.coord[1] = y;
+    }
+
+    public void setZ(float z) {
+        this.coord[2] = z;
+    }
+
+    public float getX() {
+        return this.coord[0];
+    }
+
+    public float getY() {
+        return this.coord[1];
+    }
+
+    public float getZ() {
+        return this.coord[2];
+    }
+
+    public boolean isOnCurve() {
+        return onCurve;
+    }
+
+    public void setOnCurve(boolean onCurve) {
+        this.onCurve = onCurve;
+    }
+
+    public int getId(){
+        return id;
+    }
+    
+    public void setId(int id){
+        this.id = id;
+    }
+    
+    public int compareTo(Vertex p) {
+        if(VectorUtil.checkEquality(coord, p.getCoord())) {
+            return 0;
+        }
+        return -1;
+    }
+    
+    public float[] getTexCoord() {
+        return texCoord;
+    }
+
+    public void setTexCoord(float s, float t) {
+        this.texCoord[0] = s;
+        this.texCoord[1] = t;
+    }
+    
+    public SVertex clone(){
+        SVertex v = new SVertex(this.coord, 0, 3);
+        v.setOnCurve(this.onCurve);
+        return v;
+    }
+    
+    public String toString() {
+        return "[ID: " + id + " X: " + coord[0]
+                + " Y: " + coord[1] + " Z: " + coord[2] + "]";
+    }
 }
index b77a5fa..38638dc 100755 (executable)
@@ -30,353 +30,353 @@ package com.jogamp.graph.math;
 import jogamp.graph.math.MathFloat;\r
 \r
 public class Quaternion {\r
-       protected float x,y,z,w;\r
+    protected float x,y,z,w;\r
 \r
-       public Quaternion(){\r
+    public Quaternion(){\r
 \r
-       }\r
-       \r
-       public Quaternion(float x, float y, float z, float w) {\r
-               this.x = x;\r
-               this.y = y;\r
-               this.z = z;\r
-               this.w = w;\r
-       }\r
-       \r
-       /** Constructor to create a rotation based quaternion from two vectors\r
-        * @param vector1\r
-        * @param vector2\r
-        */\r
-       public Quaternion(float[] vector1, float[] vector2) \r
-       {\r
-               float theta = (float)MathFloat.acos(dot(vector1, vector2));\r
-               float[] cross = cross(vector1,vector2);\r
-               cross = normalizeVec(cross);\r
+    }\r
+    \r
+    public Quaternion(float x, float y, float z, float w) {\r
+        this.x = x;\r
+        this.y = y;\r
+        this.z = z;\r
+        this.w = w;\r
+    }\r
+    \r
+    /** Constructor to create a rotation based quaternion from two vectors\r
+     * @param vector1\r
+     * @param vector2\r
+     */\r
+    public Quaternion(float[] vector1, float[] vector2) \r
+    {\r
+        float theta = (float)MathFloat.acos(dot(vector1, vector2));\r
+        float[] cross = cross(vector1,vector2);\r
+        cross = normalizeVec(cross);\r
 \r
-               this.x = (float)MathFloat.sin(theta/2)*cross[0];\r
-               this.y = (float)MathFloat.sin(theta/2)*cross[1];\r
-               this.z = (float)MathFloat.sin(theta/2)*cross[2];\r
-               this.w = (float)MathFloat.cos(theta/2);\r
-               this.normalize();\r
-       }\r
-       \r
-       /** Transform the rotational quaternion to axis based rotation angles\r
-        * @return new float[4] with ,theta,Rx,Ry,Rz\r
-        */\r
-       public float[] toAxis()\r
-       {\r
-               float[] vec = new float[4];\r
-               float scale = (float)MathFloat.sqrt(x * x + y * y + z * z);\r
-               vec[0] =(float) MathFloat.acos(w) * 2.0f;\r
-               vec[1] = x / scale;\r
-               vec[2] = y / scale;\r
-               vec[3] = z / scale;\r
-               return vec;\r
-       }\r
-       \r
-       /** Normalize a vector\r
-        * @param vector input vector\r
-        * @return normalized vector\r
-        */\r
-       private float[] normalizeVec(float[] vector)\r
-       {\r
-               float[] newVector = new float[3];\r
+        this.x = (float)MathFloat.sin(theta/2)*cross[0];\r
+        this.y = (float)MathFloat.sin(theta/2)*cross[1];\r
+        this.z = (float)MathFloat.sin(theta/2)*cross[2];\r
+        this.w = (float)MathFloat.cos(theta/2);\r
+        this.normalize();\r
+    }\r
+    \r
+    /** Transform the rotational quaternion to axis based rotation angles\r
+     * @return new float[4] with ,theta,Rx,Ry,Rz\r
+     */\r
+    public float[] toAxis()\r
+    {\r
+        float[] vec = new float[4];\r
+        float scale = (float)MathFloat.sqrt(x * x + y * y + z * z);\r
+        vec[0] =(float) MathFloat.acos(w) * 2.0f;\r
+        vec[1] = x / scale;\r
+        vec[2] = y / scale;\r
+        vec[3] = z / scale;\r
+        return vec;\r
+    }\r
+    \r
+    /** Normalize a vector\r
+     * @param vector input vector\r
+     * @return normalized vector\r
+     */\r
+    private float[] normalizeVec(float[] vector)\r
+    {\r
+        float[] newVector = new float[3];\r
 \r
-               float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);\r
-               if(d> 0.0f)\r
-               {\r
-                       newVector[0] = vector[0]/d;\r
-                       newVector[1] = vector[1]/d;\r
-                       newVector[2] = vector[2]/d;\r
-               }\r
-               return newVector;\r
-       }\r
-       /** compute the dot product of two points\r
-        * @param vec1 vector 1\r
-        * @param vec2 vector 2\r
-        * @return the dot product as float\r
-        */\r
-       private float dot(float[] vec1, float[] vec2)\r
-       {\r
-               return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);\r
-       }\r
-       /** cross product vec1 x vec2\r
-        * @param vec1 vector 1\r
-        * @param vec2 vecttor 2\r
-        * @return the resulting vector\r
-        */\r
-       private float[] cross(float[] vec1, float[] vec2)\r
-       {\r
-               float[] out = new float[3];\r
+        float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);\r
+        if(d> 0.0f)\r
+        {\r
+            newVector[0] = vector[0]/d;\r
+            newVector[1] = vector[1]/d;\r
+            newVector[2] = vector[2]/d;\r
+        }\r
+        return newVector;\r
+    }\r
+    /** compute the dot product of two points\r
+     * @param vec1 vector 1\r
+     * @param vec2 vector 2\r
+     * @return the dot product as float\r
+     */\r
+    private float dot(float[] vec1, float[] vec2)\r
+    {\r
+        return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);\r
+    }\r
+    /** cross product vec1 x vec2\r
+     * @param vec1 vector 1\r
+     * @param vec2 vecttor 2\r
+     * @return the resulting vector\r
+     */\r
+    private float[] cross(float[] vec1, float[] vec2)\r
+    {\r
+        float[] out = new float[3];\r
 \r
-               out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];\r
-               out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];\r
-               out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];\r
+        out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];\r
+        out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];\r
+        out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];\r
 \r
-               return out;\r
-       }\r
-       public float getW() {\r
-               return w;\r
-       }\r
-       public void setW(float w) {\r
-               this.w = w;\r
-       }\r
-       public float getX() {\r
-               return x;\r
-       }\r
-       public void setX(float x) {\r
-               this.x = x;\r
-       }\r
-       public float getY() {\r
-               return y;\r
-       }\r
-       public void setY(float y) {\r
-               this.y = y;\r
-       }\r
-       public float getZ() {\r
-               return z;\r
-       }\r
-       public void setZ(float z) {\r
-               this.z = z;\r
-       }\r
+        return out;\r
+    }\r
+    public float getW() {\r
+        return w;\r
+    }\r
+    public void setW(float w) {\r
+        this.w = w;\r
+    }\r
+    public float getX() {\r
+        return x;\r
+    }\r
+    public void setX(float x) {\r
+        this.x = x;\r
+    }\r
+    public float getY() {\r
+        return y;\r
+    }\r
+    public void setY(float y) {\r
+        this.y = y;\r
+    }\r
+    public float getZ() {\r
+        return z;\r
+    }\r
+    public void setZ(float z) {\r
+        this.z = z;\r
+    }\r
 \r
-       /** Add a quaternion\r
-        * @param q quaternion\r
-        */\r
-       public void add(Quaternion q)\r
-       {\r
-               x+=q.x;\r
-               y+=q.y;\r
-               z+=q.z;\r
-       }\r
-       \r
-       /** Subtract a quaternion\r
-        * @param q quaternion\r
-        */\r
-       public void subtract(Quaternion q)\r
-       {\r
-               x-=q.x;\r
-               y-=q.y;\r
-               z-=q.z;\r
-       }\r
-       \r
-       /** Divide a quaternion by a constant\r
-        * @param n a float to divide by\r
-        */\r
-       public void divide(float n)\r
-       {\r
-               x/=n;\r
-               y/=n;\r
-               z/=n;\r
-       }\r
-       \r
-       /** Multiply this quaternion by \r
-        * the param quaternion\r
-        * @param q a quaternion to multiply with\r
-        */\r
-       public void mult(Quaternion q)\r
-       {\r
-               float w1 = w*q.w - (x*q.x + y*q.y + z*q.z);\r
+    /** Add a quaternion\r
+     * @param q quaternion\r
+     */\r
+    public void add(Quaternion q)\r
+    {\r
+        x+=q.x;\r
+        y+=q.y;\r
+        z+=q.z;\r
+    }\r
+    \r
+    /** Subtract a quaternion\r
+     * @param q quaternion\r
+     */\r
+    public void subtract(Quaternion q)\r
+    {\r
+        x-=q.x;\r
+        y-=q.y;\r
+        z-=q.z;\r
+    }\r
+    \r
+    /** Divide a quaternion by a constant\r
+     * @param n a float to divide by\r
+     */\r
+    public void divide(float n)\r
+    {\r
+        x/=n;\r
+        y/=n;\r
+        z/=n;\r
+    }\r
+    \r
+    /** Multiply this quaternion by \r
+     * the param quaternion\r
+     * @param q a quaternion to multiply with\r
+     */\r
+    public void mult(Quaternion q)\r
+    {\r
+        float w1 = w*q.w - (x*q.x + y*q.y + z*q.z);\r
 \r
-               float x1 = w*q.z + q.w*z + y*q.z - z*q.y;\r
-               float y1 = w*q.x + q.w*x + z*q.x - x*q.z;\r
-               float z1 = w*q.y + q.w*y + x*q.y - y*q.x;\r
+        float x1 = w*q.z + q.w*z + y*q.z - z*q.y;\r
+        float y1 = w*q.x + q.w*x + z*q.x - x*q.z;\r
+        float z1 = w*q.y + q.w*y + x*q.y - y*q.x;\r
 \r
-               w = w1;\r
-               x = x1;\r
-               y = y1;\r
-               z = z1; \r
-       }\r
-       \r
-       /** Multiply a quaternion by a constant\r
-        * @param n a float constant\r
-        */\r
-       public void mult(float n)\r
-       {\r
-               x*=n;\r
-               y*=n;\r
-               z*=n;\r
-       }\r
-       \r
-       /** Normalize a quaternion required if  \r
-        *  to be used as a rotational quaternion\r
-        */\r
-       public void normalize()\r
-       {\r
-               float norme = (float)MathFloat.sqrt(w*w + x*x + y*y + z*z);\r
-               if (norme == 0.0f)\r
-               {\r
-                       w = 1.0f; \r
-                       x = y = z = 0.0f;\r
-               }\r
-               else\r
-               {\r
-                       float recip = 1.0f/norme;\r
+        w = w1;\r
+        x = x1;\r
+        y = y1;\r
+        z = z1; \r
+    }\r
+    \r
+    /** Multiply a quaternion by a constant\r
+     * @param n a float constant\r
+     */\r
+    public void mult(float n)\r
+    {\r
+        x*=n;\r
+        y*=n;\r
+        z*=n;\r
+    }\r
+    \r
+    /** Normalize a quaternion required if  \r
+     *  to be used as a rotational quaternion\r
+     */\r
+    public void normalize()\r
+    {\r
+        float norme = (float)MathFloat.sqrt(w*w + x*x + y*y + z*z);\r
+        if (norme == 0.0f)\r
+        {\r
+            w = 1.0f; \r
+            x = y = z = 0.0f;\r
+        }\r
+        else\r
+        {\r
+            float recip = 1.0f/norme;\r
 \r
-                       w *= recip;\r
-                       x *= recip;\r
-                       y *= recip;\r
-                       z *= recip;\r
-               }\r
-       }\r
-       \r
-       /** Invert the quaternion If rotational, \r
-        * will produce a the inverse rotation\r
-        */\r
-       public void inverse()\r
-       {\r
-               float norm = w*w + x*x + y*y + z*z;\r
+            w *= recip;\r
+            x *= recip;\r
+            y *= recip;\r
+            z *= recip;\r
+        }\r
+    }\r
+    \r
+    /** Invert the quaternion If rotational, \r
+     * will produce a the inverse rotation\r
+     */\r
+    public void inverse()\r
+    {\r
+        float norm = w*w + x*x + y*y + z*z;\r
 \r
-               float recip = 1.0f/norm;\r
+        float recip = 1.0f/norm;\r
 \r
-               w *= recip;\r
-               x = -1*x*recip;\r
-               y = -1*y*recip;\r
-               z = -1*z*recip;\r
-       }\r
-       \r
-       /** Transform this quaternion to a\r
-        * 4x4 column matrix representing the rotation\r
-        * @return new float[16] column matrix 4x4 \r
-        */\r
-       public float[] toMatrix()\r
-       {\r
-               float[] matrix = new float[16];\r
-               matrix[0] = 1.0f - 2*y*y - 2*z*z;\r
-               matrix[1] = 2*x*y + 2*w*z;\r
-               matrix[2] = 2*x*z - 2*w*y;\r
-               matrix[3] = 0;\r
+        w *= recip;\r
+        x = -1*x*recip;\r
+        y = -1*y*recip;\r
+        z = -1*z*recip;\r
+    }\r
+    \r
+    /** Transform this quaternion to a\r
+     * 4x4 column matrix representing the rotation\r
+     * @return new float[16] column matrix 4x4 \r
+     */\r
+    public float[] toMatrix()\r
+    {\r
+        float[] matrix = new float[16];\r
+        matrix[0] = 1.0f - 2*y*y - 2*z*z;\r
+        matrix[1] = 2*x*y + 2*w*z;\r
+        matrix[2] = 2*x*z - 2*w*y;\r
+        matrix[3] = 0;\r
 \r
-               matrix[4] = 2*x*y - 2*w*z;\r
-               matrix[5] = 1.0f - 2*x*x - 2*z*z;\r
-               matrix[6] = 2*y*z + 2*w*x;\r
-               matrix[7] = 0;\r
+        matrix[4] = 2*x*y - 2*w*z;\r
+        matrix[5] = 1.0f - 2*x*x - 2*z*z;\r
+        matrix[6] = 2*y*z + 2*w*x;\r
+        matrix[7] = 0;\r
 \r
-               matrix[8]  = 2*x*z + 2*w*y;\r
-               matrix[9]  = 2*y*z - 2*w*x;\r
-               matrix[10] = 1.0f - 2*x*x - 2*y*y;\r
-               matrix[11] = 0;\r
+        matrix[8]  = 2*x*z + 2*w*y;\r
+        matrix[9]  = 2*y*z - 2*w*x;\r
+        matrix[10] = 1.0f - 2*x*x - 2*y*y;\r
+        matrix[11] = 0;\r
 \r
-               matrix[12] = 0;\r
-               matrix[13] = 0;\r
-               matrix[14] = 0;\r
-               matrix[15] = 1;\r
-               return matrix;\r
-       }\r
-       \r
-       /** Set this quaternion from a Sphereical interpolation\r
-        *  of two param quaternion, used mostly for rotational animation\r
-        * @param a initial quaternion\r
-        * @param b target quaternion\r
-        * @param t float between 0 and 1 representing interp.\r
-        */\r
-       public void slerp(Quaternion a,Quaternion b, float t)\r
-       {\r
-               float omega, cosom, sinom, sclp, sclq;\r
-               cosom = a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;\r
-               if ((1.0f+cosom) > MathFloat.E) {\r
-                       if ((1.0f-cosom) > MathFloat.E) {\r
-                               omega = (float)MathFloat.acos(cosom);\r
-                               sinom = (float)MathFloat.sin(omega);\r
-                               sclp = (float)MathFloat.sin((1.0f-t)*omega) / sinom;\r
-                               sclq = (float)MathFloat.sin(t*omega) / sinom;\r
-                       }\r
-                       else {\r
-                               sclp = 1.0f - t;\r
-                               sclq = t;\r
-                       }\r
-                       x = sclp*a.x + sclq*b.x;\r
-                       y = sclp*a.y + sclq*b.y;\r
-                       z = sclp*a.z + sclq*b.z;\r
-                       w = sclp*a.w + sclq*b.w;\r
-               }\r
-               else {\r
-                       x =-a.y;\r
-                       y = a.x;\r
-                       z =-a.w;\r
-                       w = a.z;\r
-                       sclp = MathFloat.sin((1.0f-t) * MathFloat.PI * 0.5f);\r
-                       sclq = MathFloat.sin(t * MathFloat.PI * 0.5f);\r
-                       x = sclp*a.x + sclq*b.x;\r
-                       y = sclp*a.y + sclq*b.y;\r
-                       z = sclp*a.z + sclq*b.z;\r
-               }\r
-       }\r
-       \r
-       /** Check if this quaternion is empty, ie (0,0,0,1)\r
-        * @return true if empty, false otherwise\r
-        */\r
-       public boolean isEmpty()\r
-       {\r
-               if (w==1 && x==0 && y==0 && z==0)\r
-                       return true;\r
-               return false;\r
-       }\r
-       \r
-       /** Check if this quaternion represents an identity\r
-        * matrix, for rotation.\r
-        * @return true if it is an identity rep., false otherwise\r
-        */\r
-       public boolean isIdentity()\r
-       {\r
-               if (w==0 && x==0 && y==0 && z==0)\r
-                       return true;\r
-               return false;\r
-       }\r
-       \r
-       /** compute the quaternion from a 3x3 column matrix\r
-        * @param m 3x3 column matrix \r
-        */\r
-       public void setFromMatrix(float[] m) {\r
-               float T= m[0] + m[4] + m[8] + 1;\r
-               if (T>0){\r
-                       float S = 0.5f / (float)MathFloat.sqrt(T);\r
-                       w = 0.25f / S;\r
-                       x = ( m[5] - m[7]) * S;\r
-                       y = ( m[6] - m[2]) * S;\r
-                       z = ( m[1] - m[3] ) * S;\r
-               }\r
-               else{\r
-                       if ((m[0] > m[4])&(m[0] > m[8])) { \r
-                               float S = MathFloat.sqrt( 1.0f + m[0] - m[4] - m[8] ) * 2f; // S=4*qx \r
-                               w = (m[7] - m[5]) / S;\r
-                               x = 0.25f * S;\r
-                               y = (m[3] + m[1]) / S; \r
-                               z = (m[6] + m[2]) / S; \r
-                       \r
-                       else if (m[4] > m[8]) { \r
-                               float S = MathFloat.sqrt( 1.0f + m[4] - m[0] - m[8] ) * 2f; // S=4*qy\r
-                               w = (m[6] - m[2]) / S;\r
-                               x = (m[3] + m[1]) / S; \r
-                               y = 0.25f * S;\r
-                               z = (m[7] + m[5]) / S; \r
-                       \r
-                       else { \r
-                               float S = MathFloat.sqrt( 1.0f + m[8] - m[0] - m[4] ) * 2f; // S=4*qz\r
-                               w = (m[3] - m[1]) / S;\r
-                               x = (m[6] + m[2]) / S; \r
-                               y = (m[7] + m[5]) / S; \r
-                               z = 0.25f * S;\r
-                       \r
-               }\r
-       }\r
-       \r
-       /** Check if the the 3x3 matrix (param) is in fact \r
-        * an affine rotational matrix\r
-        * @param m 3x3 column matrix\r
-        * @return true if representing a rotational matrix, false otherwise\r
-        */\r
-       public boolean isRotationMatrix(float[] m) {\r
-               double epsilon = 0.01; // margin to allow for rounding errors\r
-               if (MathFloat.abs(m[0]*m[3] + m[3]*m[4] + m[6]*m[7]) > epsilon) return false;\r
-               if (MathFloat.abs(m[0]*m[2] + m[3]*m[5] + m[6]*m[8]) > epsilon) return false;\r
-               if (MathFloat.abs(m[1]*m[2] + m[4]*m[5] + m[7]*m[8]) > epsilon) return false;\r
-               if (MathFloat.abs(m[0]*m[0] + m[3]*m[3] + m[6]*m[6] - 1) > epsilon) return false;\r
-               if (MathFloat.abs(m[1]*m[1] + m[4]*m[4] + m[7]*m[7] - 1) > epsilon) return false;\r
-               if (MathFloat.abs(m[2]*m[2] + m[5]*m[5] + m[8]*m[8] - 1) > epsilon) return false;\r
-               return (MathFloat.abs(determinant(m)-1) < epsilon);\r
-       }\r
-       private float determinant(float[] m) {\r
-             return m[0]*m[4]*m[8] + m[3]*m[7]*m[2] + m[6]*m[1]*m[5] - m[0]*m[7]*m[5] - m[3]*m[1]*m[8] - m[6]*m[4]*m[2];\r
-       }\r
+        matrix[12] = 0;\r
+        matrix[13] = 0;\r
+        matrix[14] = 0;\r
+        matrix[15] = 1;\r
+        return matrix;\r
+    }\r
+    \r
+    /** Set this quaternion from a Sphereical interpolation\r
+     *  of two param quaternion, used mostly for rotational animation\r
+     * @param a initial quaternion\r
+     * @param b target quaternion\r
+     * @param t float between 0 and 1 representing interp.\r
+     */\r
+    public void slerp(Quaternion a,Quaternion b, float t)\r
+    {\r
+        float omega, cosom, sinom, sclp, sclq;\r
+        cosom = a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;\r
+        if ((1.0f+cosom) > MathFloat.E) {\r
+            if ((1.0f-cosom) > MathFloat.E) {\r
+                omega = (float)MathFloat.acos(cosom);\r
+                sinom = (float)MathFloat.sin(omega);\r
+                sclp = (float)MathFloat.sin((1.0f-t)*omega) / sinom;\r
+                sclq = (float)MathFloat.sin(t*omega) / sinom;\r
+            }\r
+            else {\r
+                sclp = 1.0f - t;\r
+                sclq = t;\r
+            }\r
+            x = sclp*a.x + sclq*b.x;\r
+            y = sclp*a.y + sclq*b.y;\r
+            z = sclp*a.z + sclq*b.z;\r
+            w = sclp*a.w + sclq*b.w;\r
+        }\r
+        else {\r
+            x =-a.y;\r
+            y = a.x;\r
+            z =-a.w;\r
+            w = a.z;\r
+            sclp = MathFloat.sin((1.0f-t) * MathFloat.PI * 0.5f);\r
+            sclq = MathFloat.sin(t * MathFloat.PI * 0.5f);\r
+            x = sclp*a.x + sclq*b.x;\r
+            y = sclp*a.y + sclq*b.y;\r
+            z = sclp*a.z + sclq*b.z;\r
+        }\r
+    }\r
+    \r
+    /** Check if this quaternion is empty, ie (0,0,0,1)\r
+     * @return true if empty, false otherwise\r
+     */\r
+    public boolean isEmpty()\r
+    {\r
+        if (w==1 && x==0 && y==0 && z==0)\r
+            return true;\r
+        return false;\r
+    }\r
+    \r
+    /** Check if this quaternion represents an identity\r
+     * matrix, for rotation.\r
+     * @return true if it is an identity rep., false otherwise\r
+     */\r
+    public boolean isIdentity()\r
+    {\r
+        if (w==0 && x==0 && y==0 && z==0)\r
+            return true;\r
+        return false;\r
+    }\r
+    \r
+    /** compute the quaternion from a 3x3 column matrix\r
+     * @param m 3x3 column matrix \r
+     */\r
+    public void setFromMatrix(float[] m) {\r
+        float T= m[0] + m[4] + m[8] + 1;\r
+        if (T>0){\r
+            float S = 0.5f / (float)MathFloat.sqrt(T);\r
+            w = 0.25f / S;\r
+            x = ( m[5] - m[7]) * S;\r
+            y = ( m[6] - m[2]) * S;\r
+            z = ( m[1] - m[3] ) * S;\r
+        }\r
+        else{\r
+            if ((m[0] > m[4])&(m[0] > m[8])) { \r
+                float S = MathFloat.sqrt( 1.0f + m[0] - m[4] - m[8] ) * 2f; // S=4*qx \r
+                w = (m[7] - m[5]) / S;\r
+                x = 0.25f * S;\r
+                y = (m[3] + m[1]) / S; \r
+                z = (m[6] + m[2]) / S; \r
+            } \r
+            else if (m[4] > m[8]) { \r
+                float S = MathFloat.sqrt( 1.0f + m[4] - m[0] - m[8] ) * 2f; // S=4*qy\r
+                w = (m[6] - m[2]) / S;\r
+                x = (m[3] + m[1]) / S; \r
+                y = 0.25f * S;\r
+                z = (m[7] + m[5]) / S; \r
+            } \r
+            else { \r
+                float S = MathFloat.sqrt( 1.0f + m[8] - m[0] - m[4] ) * 2f; // S=4*qz\r
+                w = (m[3] - m[1]) / S;\r
+                x = (m[6] + m[2]) / S; \r
+                y = (m[7] + m[5]) / S; \r
+                z = 0.25f * S;\r
+            } \r
+        }\r
+    }\r
+    \r
+    /** Check if the the 3x3 matrix (param) is in fact \r
+     * an affine rotational matrix\r
+     * @param m 3x3 column matrix\r
+     * @return true if representing a rotational matrix, false otherwise\r
+     */\r
+    public boolean isRotationMatrix(float[] m) {\r
+        double epsilon = 0.01; // margin to allow for rounding errors\r
+        if (MathFloat.abs(m[0]*m[3] + m[3]*m[4] + m[6]*m[7]) > epsilon) return false;\r
+        if (MathFloat.abs(m[0]*m[2] + m[3]*m[5] + m[6]*m[8]) > epsilon) return false;\r
+        if (MathFloat.abs(m[1]*m[2] + m[4]*m[5] + m[7]*m[8]) > epsilon) return false;\r
+        if (MathFloat.abs(m[0]*m[0] + m[3]*m[3] + m[6]*m[6] - 1) > epsilon) return false;\r
+        if (MathFloat.abs(m[1]*m[1] + m[4]*m[4] + m[7]*m[7] - 1) > epsilon) return false;\r
+        if (MathFloat.abs(m[2]*m[2] + m[5]*m[5] + m[8]*m[8] - 1) > epsilon) return false;\r
+        return (MathFloat.abs(determinant(m)-1) < epsilon);\r
+    }\r
+    private float determinant(float[] m) {\r
+          return m[0]*m[4]*m[8] + m[3]*m[7]*m[2] + m[6]*m[1]*m[5] - m[0]*m[7]*m[5] - m[3]*m[1]*m[8] - m[6]*m[4]*m[2];\r
+    }\r
 }\r
index cca9a45..7cbb742 100755 (executable)
@@ -35,261 +35,261 @@ import com.jogamp.graph.geom.Vertex;
 \r
 public class VectorUtil {\r
 \r
-       public static final int CW = -1;\r
-       public static final int CCW = 1;\r
-       public static final int COLLINEAR = 0;\r
+    public static final int CW = -1;\r
+    public static final int CCW = 1;\r
+    public static final int COLLINEAR = 0;\r
 \r
-       /** compute the dot product of two points\r
-        * @param vec1 vector 1\r
-        * @param vec2 vector 2\r
-        * @return the dot product as float\r
-        */\r
-       public static float dot(float[] vec1, float[] vec2)\r
-       {\r
-               return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);\r
-       }\r
-       /** Normalize a vector\r
-        * @param vector input vector\r
-        * @return normalized vector\r
-        */\r
-       public static float[] normalize(float[] vector)\r
-       {\r
-               float[] newVector = new float[3];\r
+    /** compute the dot product of two points\r
+     * @param vec1 vector 1\r
+     * @param vec2 vector 2\r
+     * @return the dot product as float\r
+     */\r
+    public static float dot(float[] vec1, float[] vec2)\r
+    {\r
+        return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);\r
+    }\r
+    /** Normalize a vector\r
+     * @param vector input vector\r
+     * @return normalized vector\r
+     */\r
+    public static float[] normalize(float[] vector)\r
+    {\r
+        float[] newVector = new float[3];\r
 \r
-               float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);\r
-               if(d> 0.0f)\r
-               {\r
-                       newVector[0] = vector[0]/d;\r
-                       newVector[1] = vector[1]/d;\r
-                       newVector[2] = vector[2]/d;\r
-               }\r
-               return newVector;\r
-       }\r
+        float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);\r
+        if(d> 0.0f)\r
+        {\r
+            newVector[0] = vector[0]/d;\r
+            newVector[1] = vector[1]/d;\r
+            newVector[2] = vector[2]/d;\r
+        }\r
+        return newVector;\r
+    }\r
 \r
-       /** Scales a vector by param\r
-        * @param vector input vector\r
-        * @param scale constant to scale by\r
-        * @return scaled vector\r
-        */\r
-       public static float[] scale(float[] vector, float scale)\r
-       {\r
-               float[] newVector = new float[3];\r
+    /** Scales a vector by param\r
+     * @param vector input vector\r
+     * @param scale constant to scale by\r
+     * @return scaled vector\r
+     */\r
+    public static float[] scale(float[] vector, float scale)\r
+    {\r
+        float[] newVector = new float[3];\r
 \r
-               newVector[0] = vector[0]*scale;\r
-               newVector[1] = vector[1]*scale;\r
-               newVector[2] = vector[2]*scale;\r
-               return newVector;\r
-       }\r
-       \r
-       /** Adds to vectors\r
-        * @param v1 vector 1\r
-        * @param v2 vector 2\r
-        * @return v1 + v2\r
-        */\r
-       public static float[] vectorAdd(float[] v1, float[] v2)\r
-       {\r
-               float[] newVector = new float[3];\r
+        newVector[0] = vector[0]*scale;\r
+        newVector[1] = vector[1]*scale;\r
+        newVector[2] = vector[2]*scale;\r
+        return newVector;\r
+    }\r
+    \r
+    /** Adds to vectors\r
+     * @param v1 vector 1\r
+     * @param v2 vector 2\r
+     * @return v1 + v2\r
+     */\r
+    public static float[] vectorAdd(float[] v1, float[] v2)\r
+    {\r
+        float[] newVector = new float[3];\r
 \r
-               newVector[0] = v1[0] + v2[0];\r
-               newVector[1] = v1[1] + v2[1];\r
-               newVector[2] = v1[2] + v2[2];\r
-               return newVector;\r
-       }\r
+        newVector[0] = v1[0] + v2[0];\r
+        newVector[1] = v1[1] + v2[1];\r
+        newVector[2] = v1[2] + v2[2];\r
+        return newVector;\r
+    }\r
 \r
-       /** cross product vec1 x vec2\r
-        * @param vec1 vector 1\r
-        * @param vec2 vecttor 2\r
-        * @return the resulting vector\r
-        */\r
-       public static float[] cross(float[] vec1, float[] vec2)\r
-       {\r
-               float[] out = new float[3];\r
+    /** cross product vec1 x vec2\r
+     * @param vec1 vector 1\r
+     * @param vec2 vecttor 2\r
+     * @return the resulting vector\r
+     */\r
+    public static float[] cross(float[] vec1, float[] vec2)\r
+    {\r
+        float[] out = new float[3];\r
 \r
-               out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];\r
-               out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];\r
-               out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];\r
+        out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];\r
+        out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];\r
+        out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];\r
 \r
-               return out;\r
-       }\r
+        return out;\r
+    }\r
 \r
-       /** Column Matrix Vector multiplication\r
-        * @param colMatrix column matrix (4x4)\r
-        * @param vec vector(x,y,z)\r
-        * @return result new float[3] \r
-        */\r
-       public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec)\r
-       {\r
-               float[] out = new float[3];\r
+    /** Column Matrix Vector multiplication\r
+     * @param colMatrix column matrix (4x4)\r
+     * @param vec vector(x,y,z)\r
+     * @return result new float[3] \r
+     */\r
+    public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec)\r
+    {\r
+        float[] out = new float[3];\r
 \r
-               out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12]; \r
-               out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13]; \r
-               out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14]; \r
+        out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12]; \r
+        out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13]; \r
+        out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14]; \r
 \r
-               return out;\r
-       }\r
-       \r
-       /** Matrix Vector multiplication\r
-        * @param rawMatrix column matrix (4x4)\r
-        * @param vec vector(x,y,z)\r
-        * @return result new float[3] \r
-        */\r
-       public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec)\r
-       {\r
-               float[] out = new float[3];\r
+        return out;\r
+    }\r
+    \r
+    /** Matrix Vector multiplication\r
+     * @param rawMatrix column matrix (4x4)\r
+     * @param vec vector(x,y,z)\r
+     * @return result new float[3] \r
+     */\r
+    public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec)\r
+    {\r
+        float[] out = new float[3];\r
 \r
-               out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3]; \r
-               out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7]; \r
-               out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11]; \r
+        out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3]; \r
+        out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7]; \r
+        out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11]; \r
 \r
-               return out;\r
-       }\r
-       \r
-       /** Calculate the midpoint of two values\r
-        * @param p1 first value\r
-        * @param p2 second vale\r
-        * @return midpoint\r
-        */\r
-       public static float mid(float p1, float p2)\r
-       {\r
-               return (p1+p2)/2.0f;\r
-       }\r
-       /** Calculate the midpoint of two points\r
-        * @param p1 first point\r
-        * @param p2 second point\r
-        * @return midpoint\r
-        */\r
-       public static float[] mid(float[] p1, float[] p2)\r
-       {\r
-               float[] midPoint = new float[3];\r
-               midPoint[0] = (p1[0] + p2[0])/2.0f;\r
-               midPoint[1] = (p1[1] + p2[1])/2.0f;\r
-               midPoint[2] = (p1[2] + p2[2])/2.0f;\r
+        return out;\r
+    }\r
+    \r
+    /** Calculate the midpoint of two values\r
+     * @param p1 first value\r
+     * @param p2 second vale\r
+     * @return midpoint\r
+     */\r
+    public static float mid(float p1, float p2)\r
+    {\r
+        return (p1+p2)/2.0f;\r
+    }\r
+    /** Calculate the midpoint of two points\r
+     * @param p1 first point\r
+     * @param p2 second point\r
+     * @return midpoint\r
+     */\r
+    public static float[] mid(float[] p1, float[] p2)\r
+    {\r
+        float[] midPoint = new float[3];\r
+        midPoint[0] = (p1[0] + p2[0])/2.0f;\r
+        midPoint[1] = (p1[1] + p2[1])/2.0f;\r
+        midPoint[2] = (p1[2] + p2[2])/2.0f;\r
 \r
-               return midPoint;\r
-       }\r
-       /** Compute the norm of a vector\r
-        * @param vec vector\r
-        * @return vorm\r
-        */\r
-       public static float norm(float[] vec)\r
-       {\r
-               return MathFloat.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);\r
-       }\r
-       /** Compute distance between 2 points\r
-        * @param p0 a ref point on the line\r
-        * @param vec vector representing the direction of the line\r
-        * @param point the point to compute the relative distance of\r
-        * @return distance float\r
-        */\r
-       public static float computeLength(float[] p0, float[] point)\r
-       {\r
-               float[] w = new float[]{point[0]-p0[0],point[1]-p0[1],point[2]-p0[2]};\r
+        return midPoint;\r
+    }\r
+    /** Compute the norm of a vector\r
+     * @param vec vector\r
+     * @return vorm\r
+     */\r
+    public static float norm(float[] vec)\r
+    {\r
+        return MathFloat.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);\r
+    }\r
+    /** Compute distance between 2 points\r
+     * @param p0 a ref point on the line\r
+     * @param vec vector representing the direction of the line\r
+     * @param point the point to compute the relative distance of\r
+     * @return distance float\r
+     */\r
+    public static float computeLength(float[] p0, float[] point)\r
+    {\r
+        float[] w = new float[]{point[0]-p0[0],point[1]-p0[1],point[2]-p0[2]};\r
 \r
-               float distance = MathFloat.sqrt(w[0]*w[0] + w[1]*w[1] + w[2]*w[2]);\r
+        float distance = MathFloat.sqrt(w[0]*w[0] + w[1]*w[1] + w[2]*w[2]);\r
 \r
-               return distance;\r
-       }\r
+        return distance;\r
+    }\r
 \r
-       /**Check equality of 2 vec3 vectors\r
-        * @param v1 vertex 1\r
-        * @param v2 vertex 2\r
-        * @return\r
-        */\r
-       public static boolean checkEquality(float[] v1, float[] v2)\r
-       {\r
-               if(Float.compare(v1[0], v2[0]) == 0 \r
-                               && Float.compare(v1[1] , v2[1]) == 0\r
-                               && Float.compare(v1[2], v2[2]) == 0 )\r
-                       return true;\r
-               return false;\r
-       }\r
+    /**Check equality of 2 vec3 vectors\r
+     * @param v1 vertex 1\r
+     * @param v2 vertex 2\r
+     * @return\r
+     */\r
+    public static boolean checkEquality(float[] v1, float[] v2)\r
+    {\r
+        if(Float.compare(v1[0], v2[0]) == 0 \r
+                && Float.compare(v1[1] , v2[1]) == 0\r
+                && Float.compare(v1[2], v2[2]) == 0 )\r
+            return true;\r
+        return false;\r
+    }\r
 \r
-       /** Compute the determinant of 3 vectors\r
-        * @param a vector 1\r
-        * @param b vector 2\r
-        * @param c vector 3\r
-        * @return the determinant value\r
-        */\r
-       public static float computeDeterminant(float[] a, float[] b, float[] c)\r
-       {\r
-               float area = a[0]*b[1]*c[2] + a[1]*b[2]*c[0] + a[2]*b[0]*c[1] - a[0]*b[2]*c[1] - a[1]*b[0]*c[2] - a[2]*b[1]*c[0];\r
-               return area;\r
-       }\r
+    /** Compute the determinant of 3 vectors\r
+     * @param a vector 1\r
+     * @param b vector 2\r
+     * @param c vector 3\r
+     * @return the determinant value\r
+     */\r
+    public static float computeDeterminant(float[] a, float[] b, float[] c)\r
+    {\r
+        float area = a[0]*b[1]*c[2] + a[1]*b[2]*c[0] + a[2]*b[0]*c[1] - a[0]*b[2]*c[1] - a[1]*b[0]*c[2] - a[2]*b[1]*c[0];\r
+        return area;\r
+    }\r
 \r
-       /** Check if three vertices are colliniear\r
-        * @param v1 vertex 1\r
-        * @param v2 vertex 2\r
-        * @param v3 vertex 3\r
-        * @return true if collinear, false otherwise\r
-        */\r
-       public static boolean checkCollinear(float[] v1, float[] v2, float[] v3)\r
-       {\r
-               return (computeDeterminant(v1, v2, v3) == VectorUtil.COLLINEAR);\r
-       }\r
+    /** Check if three vertices are colliniear\r
+     * @param v1 vertex 1\r
+     * @param v2 vertex 2\r
+     * @param v3 vertex 3\r
+     * @return true if collinear, false otherwise\r
+     */\r
+    public static boolean checkCollinear(float[] v1, float[] v2, float[] v3)\r
+    {\r
+        return (computeDeterminant(v1, v2, v3) == VectorUtil.COLLINEAR);\r
+    }\r
 \r
-       /** Compute Vector\r
-        * @param v1 vertex 1\r
-        * @param v2 vertex2 2\r
-        * @return Vector V1V2\r
-        */\r
-       public static float[] computeVector(float[] v1, float[] v2)\r
-       {\r
-               float[] vector = new float[3];\r
-               vector[0] = v2[0] - v1[0];\r
-               vector[1] = v2[1] - v1[1];\r
-               vector[2] = v2[2] - v1[2];\r
-               return vector;\r
-       }\r
+    /** Compute Vector\r
+     * @param v1 vertex 1\r
+     * @param v2 vertex2 2\r
+     * @return Vector V1V2\r
+     */\r
+    public static float[] computeVector(float[] v1, float[] v2)\r
+    {\r
+        float[] vector = new float[3];\r
+        vector[0] = v2[0] - v1[0];\r
+        vector[1] = v2[1] - v1[1];\r
+        vector[2] = v2[2] - v1[2];\r
+        return vector;\r
+    }\r
 \r
-       /** Check if vertices in triangle circumcircle\r
-        * @param a triangle vertex 1\r
-        * @param b triangle vertex 2\r
-        * @param c triangle vertex 3\r
-        * @param d vertex in question\r
-        * @return true if the vertex d is inside the circle defined by the \r
-        * vertices a, b, c. from paper by Guibas and Stolfi (1985).\r
-        */\r
-       public static boolean inCircle(Vertex a, Vertex b, Vertex c, Vertex d){\r
-               return (a.getX() * a.getX() + a.getY() * a.getY()) * triArea(b, c, d) -\r
-               (b.getX() * b.getX() + b.getY() * b.getY()) * triArea(a, c, d) +\r
-               (c.getX() * c.getX() + c.getY() * c.getY()) * triArea(a, b, d) -\r
-               (d.getX() * d.getX() + d.getY() * d.getY()) * triArea(a, b, c) > 0;\r
-       }\r
+    /** Check if vertices in triangle circumcircle\r
+     * @param a triangle vertex 1\r
+     * @param b triangle vertex 2\r
+     * @param c triangle vertex 3\r
+     * @param d vertex in question\r
+     * @return true if the vertex d is inside the circle defined by the \r
+     * vertices a, b, c. from paper by Guibas and Stolfi (1985).\r
+     */\r
+    public static boolean inCircle(Vertex a, Vertex b, Vertex c, Vertex d){\r
+        return (a.getX() * a.getX() + a.getY() * a.getY()) * triArea(b, c, d) -\r
+        (b.getX() * b.getX() + b.getY() * b.getY()) * triArea(a, c, d) +\r
+        (c.getX() * c.getX() + c.getY() * c.getY()) * triArea(a, b, d) -\r
+        (d.getX() * d.getX() + d.getY() * d.getY()) * triArea(a, b, c) > 0;\r
+    }\r
 \r
-       /** Computes oriented area of a triangle\r
-        * @param a first vertex\r
-        * @param b second vertex\r
-        * @param c third vertex\r
-        * @return compute twice the area of the oriented triangle (a,b,c), the area\r
-        * is positive if the triangle is oriented counterclockwise.\r
-        */\r
-       public static float triArea(Vertex a, Vertex b, Vertex c){\r
-               return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());\r
-       }\r
+    /** Computes oriented area of a triangle\r
+     * @param a first vertex\r
+     * @param b second vertex\r
+     * @param c third vertex\r
+     * @return compute twice the area of the oriented triangle (a,b,c), the area\r
+     * is positive if the triangle is oriented counterclockwise.\r
+     */\r
+    public static float triArea(Vertex a, Vertex b, Vertex c){\r
+        return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());\r
+    }\r
 \r
-       /** Check if points are in ccw order\r
-        * @param a first vertex\r
-        * @param b second vertex\r
-        * @param c third vertex\r
-        * @return true if the points a,b,c are in a ccw order\r
-        */\r
-       public static boolean ccw(Vertex a, Vertex b, Vertex c){\r
-               return triArea(a,b,c) > 0;\r
-       }\r
+    /** Check if points are in ccw order\r
+     * @param a first vertex\r
+     * @param b second vertex\r
+     * @param c third vertex\r
+     * @return true if the points a,b,c are in a ccw order\r
+     */\r
+    public static boolean ccw(Vertex a, Vertex b, Vertex c){\r
+        return triArea(a,b,c) > 0;\r
+    }\r
 \r
-       /** Computes the area of a list of vertices to check if ccw\r
-        * @param vertices\r
-        * @return positve area if ccw else negative area value\r
-        */\r
-       public static float area(ArrayList<Vertex> vertices) {\r
-               int n = vertices.size();\r
-               float area = 0.0f;\r
-               for (int p = n - 1, q = 0; q < n; p = q++)\r
-               {\r
-                       float[] pCoord = vertices.get(p).getCoord();\r
-                       float[] qCoord = vertices.get(q).getCoord();\r
-                       area += pCoord[0] * qCoord[1] - qCoord[0] * pCoord[1];\r
-               }\r
-               return area;\r
-       }\r
+    /** Computes the area of a list of vertices to check if ccw\r
+     * @param vertices\r
+     * @return positve area if ccw else negative area value\r
+     */\r
+    public static float area(ArrayList<Vertex> vertices) {\r
+        int n = vertices.size();\r
+        float area = 0.0f;\r
+        for (int p = n - 1, q = 0; q < n; p = q++)\r
+        {\r
+            float[] pCoord = vertices.get(p).getCoord();\r
+            float[] qCoord = vertices.get(q).getCoord();\r
+            area += pCoord[0] * qCoord[1] - qCoord[0] * pCoord[1];\r
+        }\r
+        return area;\r
+    }\r
 }\r
index fc364b6..f59351a 100644 (file)
@@ -116,9 +116,9 @@ public class FPSAnimator extends AnimatorBase {
     }
 
     private void startTask() {
-       if(null != task) {
-               return;
-       }
+        if(null != task) {
+            return;
+        }
         long delay = (long) (1000.0f / (float) fps);
         task = new TimerTask() {
             public void run() {
@@ -165,12 +165,12 @@ public class FPSAnimator extends AnimatorBase {
         try {
             shouldRun = false;
             if(null != task) {
-                   task.cancel();
-                   task = null;
+                task.cancel();
+                task = null;
             }
             if(null != timer) {
-                   timer.cancel();
-                   timer = null;
+                timer.cancel();
+                timer = null;
             }
             animThread = null;
             try {
@@ -190,8 +190,8 @@ public class FPSAnimator extends AnimatorBase {
         try {
             shouldRun = false;
             if(null != task) {
-                   task.cancel();
-                   task = null;
+                task.cancel();
+                task = null;
             }
             animThread = null;
             try {
index 8dbd7cd..291cd77 100644 (file)
@@ -109,7 +109,7 @@ public class Locator {
         }
         if (file != null) {
             String res = new File(file, relativeFile).getPath();
-               // Handle things on Windows
+            // Handle things on Windows
             return res.replace('\\', '/');
         } else {
             return relativeFile;
index 8688217..de28dc7 100644 (file)
@@ -1590,7 +1590,7 @@ public class TextRenderer {
             int lengthInGlyphs = fullRunGlyphVector.getNumGlyphs();
             int i = 0;
             while (i < lengthInGlyphs) {
-               Character letter = CharacterCache.valueOf(inString.charAt(i));
+                Character letter = CharacterCache.valueOf(inString.charAt(i));
                 GlyphMetrics metrics = (GlyphMetrics) glyphMetricsCache.get(letter);
                 if (metrics == null) {
                     metrics = fullRunGlyphVector.getGlyphMetrics(i);
@@ -1656,7 +1656,7 @@ public class TextRenderer {
         // if the unicode or glyph ID would be out of bounds of the
         // glyph cache.
         private Glyph getGlyph(CharSequence inString,
-                                      GlyphMetrics glyphMetrics,
+                               GlyphMetrics glyphMetrics,
                                int index) {
             char unicodeID = inString.charAt(index);
 
index 8befc13..010ce66 100644 (file)
@@ -163,7 +163,7 @@ public class GLUT {
 
   public void glutSolidCylinder(double radius, double height, int slices, int stacks) {
     GL2 gl = GLUgl2.getCurrentGL2();
-       
+      
     // Prepare table of points for drawing end caps
     double [] x = new double[slices];
     double [] y = new double[slices];
@@ -174,7 +174,7 @@ public class GLUT {
       x[i] = Math.cos(angle) * radius;
       y[i] = Math.sin(angle) * radius;
     }
-       
+      
     // Draw bottom cap
     gl.glBegin(GL2.GL_TRIANGLE_FAN);
     gl.glNormal3d(0,0,-1);
@@ -184,7 +184,7 @@ public class GLUT {
     }
     gl.glVertex3d(x[0], y[0], 0);
     gl.glEnd();
-       
+      
     // Draw top cap
     gl.glBegin(GL2.GL_TRIANGLE_FAN);
     gl.glNormal3d(0,0,1);
@@ -194,7 +194,7 @@ public class GLUT {
     }
     gl.glVertex3d(x[0], y[0], height);
     gl.glEnd();
-       
+      
     // Draw walls
     quadObjInit(glu);
     glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL);
index 38f8ff9..c067e5c 100644 (file)
@@ -193,18 +193,18 @@ public class Texture {
     // Package-private constructor for creating a texture object which wraps
     // an existing texture ID from another package
     Texture(int textureID,
-           int target,
-           int texWidth,
-           int texHeight,
-           int imgWidth,
-           int imgHeight,
-           boolean mustFlipVertically) {
-       this.texID = textureID;
-       this.target = target;
-       this.mustFlipVertically = mustFlipVertically;
-       this.texWidth = texWidth;
-       this.texHeight = texHeight;
-       setImageSize(imgWidth, imgHeight, target);
+        int target,
+        int texWidth,
+        int texHeight,
+        int imgWidth,
+        int imgHeight,
+        boolean mustFlipVertically) {
+    this.texID = textureID;
+    this.target = target;
+    this.mustFlipVertically = mustFlipVertically;
+    this.texWidth = texWidth;
+    this.texHeight = texHeight;
+    setImageSize(imgWidth, imgHeight, target);
     }
 
     /**
index e86ff16..d21e9c5 100644 (file)
@@ -528,19 +528,19 @@ public class TextureIO {
      *                           texture
      */
     public static Texture newTexture(int textureID,
-                                    int target,
-                                    int texWidth,
-                                    int texHeight,
-                                    int imgWidth,
-                                    int imgHeight,
-                                    boolean mustFlipVertically) {
-       return new Texture(textureID,
-                          target,
-                          texWidth,
-                          texHeight,
-                          imgWidth,
-                          imgHeight,
-                          mustFlipVertically);
+                     int target,
+                     int texWidth,
+                     int texHeight,
+                     int imgWidth,
+                     int imgHeight,
+                     boolean mustFlipVertically) {
+    return new Texture(textureID,
+               target,
+               texWidth,
+               texHeight,
+               imgWidth,
+               imgHeight,
+               mustFlipVertically);
     }
 
     /**
index d5f4959..37dbc54 100644 (file)
@@ -37,7 +37,7 @@
  * and developed by Kenneth Bradley Russell and Christopher John Kline.
  */
 
-package        com.jogamp.opengl.util.texture.spi;
+package    com.jogamp.opengl.util.texture.spi;
 
 import java.io.DataInput;
 import java.io.DataInputStream;
@@ -65,16 +65,16 @@ import java.io.IOException;
  * for that functionality. It is not clear if it is ever going to be
  * functionally required to be able to read UTF data in a LittleEndianManner<p>
  *
- * @author     Robin Luiten
- * @version    1.1     15/Dec/1997
+ * @author    Robin Luiten
+ * @version    1.1    15/Dec/1997
  */
 public class LEDataInputStream extends FilterInputStream implements DataInput
 {
     /**
-     * To reuse        some of the     non     endian dependent methods from
-     * DataInputStreams        methods.
+     * To reuse    some of    the    non    endian dependent methods from
+     * DataInputStreams    methods.
      */
-    DataInputStream    dataIn;
+    DataInputStream    dataIn;
 
     public LEDataInputStream(InputStream in)
     {
@@ -84,29 +84,29 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
 
     public void close() throws IOException
     {
-        dataIn.close();                // better close as we create it.
+        dataIn.close();        // better close as we create it.
         // this will close underlying as well.
     }
 
-    public synchronized        final int read(byte     b[]) throws     IOException
+    public synchronized    final int read(byte    b[]) throws    IOException
     {
         return dataIn.read(b, 0, b.length);
     }
 
-    public synchronized        final int read(byte     b[], int off, int len) throws IOException
+    public synchronized    final int read(byte    b[], int off, int len) throws IOException
     {
-        int    rl = dataIn.read(b,     off, len);
+        int    rl = dataIn.read(b,    off, len);
         return rl;
     }
 
     public final void readFully(byte b[]) throws IOException
     {
-        dataIn.readFully(b,    0, b.length);
+        dataIn.readFully(b,    0, b.length);
     }
 
-    public final void readFully(byte b[], int off, int len)    throws IOException
+    public final void readFully(byte b[], int off, int len)    throws IOException
     {
-        dataIn.readFully(b,    off, len);
+        dataIn.readFully(b,    off, len);
     }
 
     public final int skipBytes(int n) throws IOException
@@ -116,23 +116,23 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
 
     public final boolean readBoolean() throws IOException
     {
-        int    ch = dataIn.read();
+        int    ch = dataIn.read();
         if (ch < 0)
             throw new EOFException();
         return (ch != 0);
     }
 
-    public final byte readByte() throws        IOException
+    public final byte readByte() throws    IOException
     {
-        int    ch = dataIn.read();
+        int    ch = dataIn.read();
         if (ch < 0)
             throw new EOFException();
         return (byte)(ch);
     }
 
-    public final int readUnsignedByte()        throws IOException
+    public final int readUnsignedByte()    throws IOException
     {
-        int    ch = dataIn.read();
+        int    ch = dataIn.read();
         if (ch < 0)
             throw new EOFException();
         return ch;
@@ -140,47 +140,47 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
 
     public final short readShort() throws IOException
     {
-        int    ch1     = dataIn.read();
-        int    ch2     = dataIn.read();
-        if ((ch1 | ch2)        < 0)
+        int    ch1    = dataIn.read();
+        int    ch2    = dataIn.read();
+        if ((ch1 | ch2)    < 0)
             throw new EOFException();
-        return (short)((ch1    << 0) + (ch2 << 8));
+        return (short)((ch1    << 0) +    (ch2 <<    8));
     }
 
-    public final int readUnsignedShort() throws        IOException
+    public final int readUnsignedShort() throws    IOException
     { 
-        int    ch1     = dataIn.read();
-        int    ch2     = dataIn.read();
-        if ((ch1 | ch2)        < 0)
+        int    ch1    = dataIn.read();
+        int    ch2    = dataIn.read();
+        if ((ch1 | ch2)    < 0)
             throw new EOFException();
-        return (ch1    << 0) + (ch2 << 8);
+        return (ch1    << 0) +    (ch2 <<    8);
     }
 
-    public final char readChar() throws        IOException
+    public final char readChar() throws    IOException
     {
-        int    ch1     = dataIn.read();
-        int    ch2     = dataIn.read();
-        if ((ch1 | ch2)        < 0)
+        int    ch1    = dataIn.read();
+        int    ch2    = dataIn.read();
+        if ((ch1 | ch2)    < 0)
             throw new EOFException();
-        return (char)((ch1 << 0) + (ch2        << 8));
+        return (char)((ch1 << 0) + (ch2    << 8));
     }
 
     public final int readInt() throws IOException
     {
-        int    ch1     = dataIn.read();
-        int    ch2     = dataIn.read();
-        int    ch3     = dataIn.read();
-        int    ch4     = dataIn.read();
-        if ((ch1 | ch2 | ch3 | ch4)    < 0)
+        int    ch1    = dataIn.read();
+        int    ch2    = dataIn.read();
+        int    ch3    = dataIn.read();
+        int    ch4    = dataIn.read();
+        if ((ch1 | ch2 | ch3 | ch4)    < 0)
             throw new EOFException();
-        return ((ch1 <<        0) + (ch2 << 8) + (ch3 << 16) + (ch4 << 24));
+        return ((ch1 <<    0) + (ch2 << 8)    + (ch3 << 16) +    (ch4 <<    24));
     }
 
-    public final long readLong() throws        IOException
+    public final long readLong() throws    IOException
     {
-        int    i1 = readInt();
-        int    i2 = readInt();
-        return ((long)(i1) & 0xFFFFFFFFL) +    (i2     << 32);
+        int    i1 = readInt();
+        int    i2 = readInt();
+        return ((long)(i1) & 0xFFFFFFFFL) +    (i2    << 32);
     }
 
     public final float readFloat() throws IOException
@@ -188,7 +188,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
         return Float.intBitsToFloat(readInt());
     }
 
-    public final double        readDouble() throws     IOException
+    public final double    readDouble() throws    IOException
     {
         return Double.longBitsToDouble(readLong());
     }
@@ -197,7 +197,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
      * dont call this it is not implemented.
      * @return empty new string 
      **/
-    public final String        readLine() throws IOException
+    public final String    readLine() throws IOException
     {
         return new String();
     }
@@ -206,7 +206,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
      * dont call this it is not implemented
      * @return empty new string 
      **/
-    public final String        readUTF() throws IOException
+    public final String    readUTF() throws IOException
     {
         return new String();
     }
@@ -215,7 +215,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
      * dont call this it is not implemented
      * @return empty new string 
      **/
-    public final static        String readUTF(DataInput in) throws     IOException
+    public final static    String readUTF(DataInput in) throws    IOException
     {
         return new String();
     }
index bb5040a..c60c91b 100644 (file)
@@ -477,7 +477,7 @@ public class SGIImage {
         for (int z = 0; z < zsize; z++) {
             for (int y = ystart; y != yend; y += yincr) {
                 // RLE-compress each row.
-         
+      
                 int x = 0;
                 byte count = 0;
                 boolean repeat_mode = false;
@@ -485,7 +485,7 @@ public class SGIImage {
                 int start_ptr = ptr;
                 int num_ptr = ptr++;
                 byte repeat_val = 0;
-         
+      
                 while (x < xsize) {
                     // see if we should switch modes
                     should_switch = false;
@@ -502,7 +502,7 @@ public class SGIImage {
                                 if (DEBUG)
                                     System.err.println("left side was " + ((int) imgref(data, x, y, z, xsize, ysize, zsize)) +
                                                        ", right side was " + (int)imgref(data, x+i, y, z, xsize, ysize, zsize));
-                         
+              
                                 if (imgref(data, x, y, z, xsize, ysize, zsize) !=
                                     imgref(data, x+i, y, z, xsize, ysize, zsize))
                                     should_switch = false;
@@ -530,7 +530,7 @@ public class SGIImage {
                                 repeat_mode = true;
                             repeat_val = imgref(data, x, y, z, xsize, ysize, zsize);
                         }
-                 
+          
                         if (x > 0) {
                             // reset the number pointer
                             num_ptr = ptr++;
@@ -538,7 +538,7 @@ public class SGIImage {
                             count = 0;
                         }
                     }
-                   
+            
                     // if not in repeat mode, copy element to ptr
                     if (!repeat_mode) {
                         rlebuf[ptr++] = imgref(data, x, y, z, xsize, ysize, zsize);
index 9352ad4..52628f6 100644 (file)
@@ -230,7 +230,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
       // Don't substitute a positive score for a smaller negative score
       if ((scoreClosestToZero == NO_SCORE) ||
           (Math.abs(score) < Math.abs(scoreClosestToZero) &&
-          ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) {
+       ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) {
         scoreClosestToZero = score;
         chosenIndex = i;
       }
index 4076dac..dc439f3 100644 (file)
@@ -745,9 +745,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
 
   @Override
   public String toString() {
-       final int dw = (null!=drawable) ? drawable.getWidth() : -1;
-       final int dh = (null!=drawable) ? drawable.getHeight() : -1;
-       
+    final int dw = (null!=drawable) ? drawable.getWidth() : -1;
+    final int dh = (null!=drawable) ? drawable.getHeight() : -1;
+    
     return "AWT-GLCanvas[Realized "+isRealized()+
                           ",\n\t"+((null!=drawable)?drawable.getClass().getName():"null-drawable")+                         
                           ",\n\tRealized "+isRealized()+
index 34b46a8..683a72d 100755 (executable)
@@ -43,10 +43,10 @@ import com.jogamp.opengl.util.glsl.ShaderState;
 \r
 \r
 public class RegionRendererImpl01 extends RegionRenderer {\r
-       /**Sharpness is equivalent to the value of t value of texture coord\r
-        * on the off-curve vertex. The high value of sharpness will \r
-        * result in high curvature.\r
-        */\r
+    /**Sharpness is equivalent to the value of t value of texture coord\r
+     * on the off-curve vertex. The high value of sharpness will \r
+     * result in high curvature.\r
+     */\r
     private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);\r
     GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);\r
     private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));\r
@@ -174,35 +174,35 @@ public class RegionRendererImpl01 extends RegionRenderer {
         }\r
     }\r
     \r
-       \r
-       @Override\r
+    \r
+    @Override\r
     public void renderOutlineShape(GL2ES2 gl, OutlineShape outlineShape, float[] position, int texSize) {\r
-               if(!isInitialized()){\r
-                       throw new GLException("RegionRendererImpl01: not initialized!");\r
-               }\r
-               int hashCode = getHashCode(outlineShape);\r
-               Region region = regions.get(hashCode);\r
-               \r
-               if(null == region) {\r
-                       region = createRegion(gl, outlineShape, mgl_sharpness.floatValue());\r
-                       regions.put(hashCode, region);\r
-               }               \r
-               region.render(pmvMatrix, vp_width, vp_height, texSize);\r
-       }\r
-       \r
-       @Override\r
+        if(!isInitialized()){\r
+            throw new GLException("RegionRendererImpl01: not initialized!");\r
+        }\r
+        int hashCode = getHashCode(outlineShape);\r
+        Region region = regions.get(hashCode);\r
+        \r
+        if(null == region) {\r
+            region = createRegion(gl, outlineShape, mgl_sharpness.floatValue());\r
+            regions.put(hashCode, region);\r
+        }        \r
+        region.render(pmvMatrix, vp_width, vp_height, texSize);\r
+    }\r
+    \r
+    @Override\r
     public void renderOutlineShapes(GL2ES2 gl, OutlineShape[] outlineShapes, float[] position, int texSize) {\r
         if(!isInitialized()){\r
             throw new GLException("RegionRendererImpl01: not initialized!");\r
         }\r
-               \r
-               int hashCode = getHashCode(outlineShapes);\r
-               Region region = regions.get(hashCode);\r
-               \r
-               if(null == region) {\r
+        \r
+        int hashCode = getHashCode(outlineShapes);\r
+        Region region = regions.get(hashCode);\r
+        \r
+        if(null == region) {\r
             region = createRegion(gl, outlineShapes, mgl_sharpness.floatValue());\r
-                       regions.put(hashCode, region);\r
-               }               \r
+            regions.put(hashCode, region);\r
+        }        \r
         region.render(pmvMatrix, vp_width, vp_height, texSize);\r
-       }       \r
+    }    \r
 }\r
index 69a8e47..bc94ab1 100644 (file)
@@ -44,39 +44,39 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
 import com.jogamp.opengl.util.glsl.ShaderProgram;
 
 public class TextRendererImpl01 extends TextRenderer {    
-       /**Sharpness is equivalent to the value of t value of texture coord
-        * on the off-curve vertex. The high value of sharpness will 
-        * result in high curvature.
-        */
+    /**Sharpness is equivalent to the value of t value of texture coord
+     * on the off-curve vertex. The high value of sharpness will 
+     * result in high curvature.
+     */
     private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);
     GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);
     private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));
     private GLUniformData mgl_strength = new GLUniformData("a_strength", 1.8f);
-       
-       public TextRendererImpl01(Vertex.Factory<? extends Vertex> factory, int type) {
-           super(factory, type);
-       }
+        
+    public TextRendererImpl01(Vertex.Factory<? extends Vertex> factory, int type) {
+        super(factory, type);
+    }
 
-       @Override
+    @Override
     protected boolean initImpl(GL2ES2 gl){
-               boolean VBOsupported = gl.isFunctionAvailable("glGenBuffers") &&
-                       gl.isFunctionAvailable("glBindBuffer") &&
-                       gl.isFunctionAvailable("glBufferData") &&
-                       gl.isFunctionAvailable("glDrawElements") &&
-                       gl.isFunctionAvailable("glVertexAttribPointer") &&
-                       gl.isFunctionAvailable("glDeleteBuffers");
-               
-               if(DEBUG) {
-                       System.err.println("TextRendererImpl01: VBO Supported = " + VBOsupported);
-               }
-               
-               if(!VBOsupported){
-                       return false;
-               }
-               
-               gl.glEnable(GL2ES2.GL_BLEND);
-               gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA);
-               
+        boolean VBOsupported = gl.isFunctionAvailable("glGenBuffers") &&
+            gl.isFunctionAvailable("glBindBuffer") &&
+            gl.isFunctionAvailable("glBufferData") &&
+            gl.isFunctionAvailable("glDrawElements") &&
+            gl.isFunctionAvailable("glVertexAttribPointer") &&
+            gl.isFunctionAvailable("glDeleteBuffers");
+        
+        if(DEBUG) {
+            System.err.println("TextRendererImpl01: VBO Supported = " + VBOsupported);
+        }
+        
+        if(!VBOsupported){
+            return false;
+        }
+        
+        gl.glEnable(GL2ES2.GL_BLEND);
+        gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA);
+        
         ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, TextRendererImpl01.class,
                 "shader", "shader/bin", "curverenderer01");
         ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, TextRendererImpl01.class,
@@ -95,62 +95,62 @@ public class TextRendererImpl01 extends TextRenderer {
         }
 
         st.attachShaderProgram(gl, sp);
-               
-               st.glUseProgram(gl, true);
+        
+        st.glUseProgram(gl, true);
 
-               pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
-               pmvMatrix.glLoadIdentity();
-               pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
-               pmvMatrix.glLoadIdentity();
-               
-               pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
-               pmvMatrix.glLoadIdentity();
-               resetModelview(null);
-               
-               mgl_PMVMatrix = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());                          
-               if(!st.glUniform(gl, mgl_PMVMatrix)) {
-                       if(DEBUG){
-                               System.err.println("Error setting PMVMatrix in shader: "+st);
-                       }
-                       return false;
-               }
-               
-               if(!st.glUniform(gl, mgl_sharpness)) {
-                       if(DEBUG){
-                               System.err.println("Error setting sharpness in shader: "+st);
-                       }
-                       return false;
-               }
-                               
-               if(!st.glUniform(gl, mgl_alpha)) {
-                       if(DEBUG){
-                               System.err.println("Error setting global alpha in shader: "+st);
-                       }
-                       return false;
-               }               
-               
-               if(!st.glUniform(gl, mgl_color)) {
-                       if(DEBUG){
-                               System.err.println("Error setting global color in shader: "+st);
-                       }
-                       return false;
-               }               
-               
-               if(!st.glUniform(gl, mgl_strength)) {
-                       System.err.println("Error setting antialias strength in shader: "+st);
-               }
-               
-               if(DEBUG) {
-                       System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
-               }               
-               return true;
-       }
-       
-       @Override
+        pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+        pmvMatrix.glLoadIdentity();
+        pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+        pmvMatrix.glLoadIdentity();
+        
+        pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+        pmvMatrix.glLoadIdentity();
+        resetModelview(null);
+        
+        mgl_PMVMatrix = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());                    
+        if(!st.glUniform(gl, mgl_PMVMatrix)) {
+            if(DEBUG){
+                System.err.println("Error setting PMVMatrix in shader: "+st);
+            }
+            return false;
+        }
+        
+        if(!st.glUniform(gl, mgl_sharpness)) {
+            if(DEBUG){
+                System.err.println("Error setting sharpness in shader: "+st);
+            }
+            return false;
+        }
+                
+        if(!st.glUniform(gl, mgl_alpha)) {
+            if(DEBUG){
+                System.err.println("Error setting global alpha in shader: "+st);
+            }
+            return false;
+        }        
+        
+        if(!st.glUniform(gl, mgl_color)) {
+            if(DEBUG){
+                System.err.println("Error setting global color in shader: "+st);
+            }
+            return false;
+        }        
+        
+        if(!st.glUniform(gl, mgl_strength)) {
+            System.err.println("Error setting antialias strength in shader: "+st);
+        }
+        
+        if(DEBUG) {
+            System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
+        }        
+        return true;
+    }
+    
+    @Override
     protected void disposeImpl(GL2ES2 gl) {
-           super.disposeImpl(gl);
-       }
-       
+        super.disposeImpl(gl);
+    }
+    
     @Override
     public float getAlpha() {
         return mgl_alpha.floatValue();
@@ -163,30 +163,30 @@ public class TextRendererImpl01 extends TextRenderer {
             st.glUniform(gl, mgl_alpha);
         }
     }
-       
-       @Override
+    
+    @Override
     public void setColor(GL2ES2 gl, float r, float g, float b){
-           FloatBuffer fb = (FloatBuffer) mgl_color.getBuffer();
-           fb.put(0, r);
-           fb.put(1, r);
-           fb.put(2, r);
-           if(null != gl && st.inUse()) {
-               st.glUniform(gl, mgl_color);
-           }
-       }
-       
-       @Override
+        FloatBuffer fb = (FloatBuffer) mgl_color.getBuffer();
+        fb.put(0, r);
+        fb.put(1, r);
+        fb.put(2, r);
+        if(null != gl && st.inUse()) {
+            st.glUniform(gl, mgl_color);
+        }
+    }
+    
+    @Override
     public void renderString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int texSize) {
-               if(!isInitialized()){
-                       throw new GLException("TextRendererImpl01: not initialized!");
-               }
-               GlyphString glyphString = getCachedGlyphString(font, str, fontSize);
-               if(null == glyphString) {
-                       glyphString = createString(gl, font, fontSize, str, mgl_sharpness.floatValue());
-                       addCachedGlyphString(font, str, fontSize, glyphString);
-               }
-               
-               glyphString.renderString3D(pmvMatrix, vp_width, vp_height, texSize);
-       }
-       
+        if(!isInitialized()){
+            throw new GLException("TextRendererImpl01: not initialized!");
+        }
+        GlyphString glyphString = getCachedGlyphString(font, str, fontSize);
+        if(null == glyphString) {
+            glyphString = createString(gl, font, fontSize, str, mgl_sharpness.floatValue());
+            addCachedGlyphString(font, str, fontSize, glyphString);
+        }
+        
+        glyphString.renderString3D(pmvMatrix, vp_width, vp_height, texSize);
+    }
+    
 }
index 81d9d18..0581496 100644 (file)
@@ -49,35 +49,35 @@ import com.jogamp.opengl.util.glsl.ShaderState;
 public class VBORegion2PES2  implements Region {
     private int numVertices = 0;
     
-       private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
-       private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
-       private GLArrayDataServer verticeTxtAttr = null;
-       private GLArrayDataServer texCoordTxtAttr = null;
-       private GLArrayDataServer indicesTxt = null;
+    private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
+    private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
+    private GLArrayDataServer verticeTxtAttr = null;
+    private GLArrayDataServer texCoordTxtAttr = null;
+    private GLArrayDataServer indicesTxt = null;
     private GLArrayDataServer verticeFboAttr = null;
     private GLArrayDataServer texCoordFboAttr = null;
     private GLArrayDataServer indicesFbo = null;
-       
-       private GLContext context;
-       
-       private boolean flipped = false;
-       
-       private boolean dirty = false;
-       
-       private AABBox box = null;
-       private FBObject fbo = null;
+    
+    private GLContext context;
+    
+    private boolean flipped = false;
+    
+    private boolean dirty = false;
+    
+    private AABBox box = null;
+    private FBObject fbo = null;
 
-       private int tex_width_c = 0;
-       private int tex_height_c = 0;
-       
-       private ShaderState st;
-       
-       public VBORegion2PES2(GLContext context, ShaderState st){
-               this.context =context;
-               this.st = st;
-               
-               GL2ES2 gl = context.getGL().getGL2ES2();
-               
+    private int tex_width_c = 0;
+    private int tex_height_c = 0;
+    
+    private ShaderState st;
+    
+    public VBORegion2PES2(GLContext context, ShaderState st){
+        this.context =context;
+        this.st = st;
+        
+        GL2ES2 gl = context.getGL().getGL2ES2();
+        
         indicesFbo = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false, 
                                                   2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);                
         indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
@@ -108,132 +108,132 @@ public class VBORegion2PES2  implements Region {
         if(DEBUG) {
             System.err.println("VBORegion2PES2 Create: " + this);
         }        
-       }
-       
-       public void update(){
-               GL2ES2 gl = context.getGL().getGL2ES2();
-               
+    }
+    
+    public void update(){
+        GL2ES2 gl = context.getGL().getGL2ES2();
+        
         destroyTxtAttr(gl);
         
         box = new AABBox();
 
         indicesTxt = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false, 
                                                triangles.size(), GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);        
-               for(Triangle t:triangles){
-                       if(t.getVertices()[0].getId() == Integer.MAX_VALUE){
-                               t.getVertices()[0].setId(numVertices++);
-                               t.getVertices()[1].setId(numVertices++);
-                               t.getVertices()[2].setId(numVertices++);
-                               
-                               vertices.add(t.getVertices()[0]);
-                               vertices.add(t.getVertices()[1]);
-                               vertices.add(t.getVertices()[2]);
-                               
-                               indicesTxt.puts((short) t.getVertices()[0].getId());
-                               indicesTxt.puts((short) t.getVertices()[1].getId());
-                               indicesTxt.puts((short) t.getVertices()[2].getId());
-                       }
-                       else{
-                               Vertex v1 = t.getVertices()[0];
-                               Vertex v2 = t.getVertices()[1];
-                               Vertex v3 = t.getVertices()[2];
-                               
-                               indicesTxt.puts((short) v1.getId());
-                               indicesTxt.puts((short) v2.getId());
-                               indicesTxt.puts((short) v3.getId());
-                       }
-               }
+        for(Triangle t:triangles){
+            if(t.getVertices()[0].getId() == Integer.MAX_VALUE){
+                t.getVertices()[0].setId(numVertices++);
+                t.getVertices()[1].setId(numVertices++);
+                t.getVertices()[2].setId(numVertices++);
+                
+                vertices.add(t.getVertices()[0]);
+                vertices.add(t.getVertices()[1]);
+                vertices.add(t.getVertices()[2]);
+                
+                indicesTxt.puts((short) t.getVertices()[0].getId());
+                indicesTxt.puts((short) t.getVertices()[1].getId());
+                indicesTxt.puts((short) t.getVertices()[2].getId());
+            }
+            else{
+                Vertex v1 = t.getVertices()[0];
+                Vertex v2 = t.getVertices()[1];
+                Vertex v3 = t.getVertices()[2];
+                
+                indicesTxt.puts((short) v1.getId());
+                indicesTxt.puts((short) v2.getId());
+                indicesTxt.puts((short) v3.getId());
+            }
+        }
         indicesTxt.seal(gl, true);
 
         verticeTxtAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false,
                                                    vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); 
         verticeTxtAttr.setLocation(Region.VERTEX_ATTR_IDX);
-               for(Vertex v:vertices){
-                   verticeTxtAttr.putf(v.getX());
-                       if(flipped){
-                           verticeTxtAttr.putf(-1*v.getY());
-                       } else {
-                           verticeTxtAttr.putf(v.getY());
-                       }
-                       verticeTxtAttr.putf(v.getZ());
-                       if(flipped){
-                               box.resize(v.getX(), -1*v.getY(), v.getZ());
-                       } else {
-                               box.resize(v.getX(), v.getY(), v.getZ());
-                       }
-               }
+        for(Vertex v:vertices){
+            verticeTxtAttr.putf(v.getX());
+            if(flipped){
+                verticeTxtAttr.putf(-1*v.getY());
+            } else {
+                verticeTxtAttr.putf(v.getY());
+            }
+            verticeTxtAttr.putf(v.getZ());
+            if(flipped){
+                box.resize(v.getX(), -1*v.getY(), v.getZ());
+            } else {
+                box.resize(v.getX(), v.getY(), v.getZ());
+            }
+        }
         verticeTxtAttr.seal(gl, true);     
-               
+        
         texCoordTxtAttr = GLArrayDataServer.createGLSL(gl, Region.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false,
                                                     vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
         texCoordTxtAttr.setLocation(Region.TEXCOORD_ATTR_IDX);
-               for(Vertex v:vertices){
-                       float[] tex = v.getTexCoord();
-                       texCoordTxtAttr.putf(tex[0]);
-                       texCoordTxtAttr.putf(tex[1]);
-               }
+        for(Vertex v:vertices){
+            float[] tex = v.getTexCoord();
+            texCoordTxtAttr.putf(tex[0]);
+            texCoordTxtAttr.putf(tex[1]);
+        }
         texCoordTxtAttr.seal(gl, true);
 
         // leave the buffers enabled for subsequent render call
         
-               dirty = false;
-       }
-       
-       public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
+        dirty = false;
+    }
+    
+    public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
         GL2ES2 gl = context.getGL().getGL2ES2();
-               if(null == matrix || vp_width <=0 || vp_height <= 0 || width <= 0){
-                       renderRegion(gl);
-               } else {
-                       if(width != tex_width_c){
+        if(null == matrix || vp_width <=0 || vp_height <= 0 || width <= 0){
+            renderRegion(gl);
+        } else {
+            if(width != tex_width_c){
                 renderRegion2FBO(gl, matrix, width);                
                 setupBBox2FboAttr(gl);
-                       }
-//                     System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
-                       renderFBO(gl, matrix, vp_width, vp_height);
-               }
-       }
-       
-       private void renderFBO(GL2ES2 gl, PMVMatrix matrix, int width, int hight) {
-           gl.glViewport(0, 0, width, hight);
-           if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, matrix.glGetPMvMatrixf()))){
-               System.out.println("Cnt set tex based mat");
-           }
-           gl.glEnable(GL2ES2.GL_TEXTURE_2D);
-           gl.glActiveTexture(GL2ES2.GL_TEXTURE0);
-           fbo.use(gl);
-           
-           st.glUniform(gl, new GLUniformData("texture", fbo.getTextureName()));
-           int loc = gl.glGetUniformLocation(st.shaderProgram().program(), "texture");
-           gl.glUniform1i(loc, 0);
-           
-           
+            }
+//            System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
+            renderFBO(gl, matrix, vp_width, vp_height);
+        }
+    }
+    
+    private void renderFBO(GL2ES2 gl, PMVMatrix matrix, int width, int hight) {
+        gl.glViewport(0, 0, width, hight);
+        if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, matrix.glGetPMvMatrixf()))){
+            System.out.println("Cnt set tex based mat");
+        }
+        gl.glEnable(GL2ES2.GL_TEXTURE_2D);
+        gl.glActiveTexture(GL2ES2.GL_TEXTURE0);
+        fbo.use(gl);
+        
+        st.glUniform(gl, new GLUniformData("texture", fbo.getTextureName()));
+        int loc = gl.glGetUniformLocation(st.shaderProgram().program(), "texture");
+        gl.glUniform1i(loc, 0);
+        
+        
         verticeFboAttr.enableBuffer(gl, true);       
         texCoordFboAttr.enableBuffer(gl, true);
         indicesFbo.enableBuffer(gl, true);
         
         gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementNumber() * indicesFbo.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);         
-               
+        
         verticeFboAttr.enableBuffer(gl, false);       
         texCoordFboAttr.enableBuffer(gl, false);
         indicesFbo.enableBuffer(gl, false);
-       }
-       
-       private void setupBBox2FboAttr(GL2ES2 gl){
+    }
+    
+    private void setupBBox2FboAttr(GL2ES2 gl){
         verticeFboAttr.seal(gl, false);
         verticeFboAttr.rewind();
         
-        verticeFboAttr.putf(box.getLow()[0]);  verticeFboAttr.putf(box.getLow()[1]);  verticeFboAttr.putf(box.getLow()[2]);            
-               verticeFboAttr.putf(box.getLow()[0]);  verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);                     
-               verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);                             
-               verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]);  verticeFboAttr.putf(box.getLow()[2]);
-               
+        verticeFboAttr.putf(box.getLow()[0]);  verticeFboAttr.putf(box.getLow()[1]);  verticeFboAttr.putf(box.getLow()[2]);        
+        verticeFboAttr.putf(box.getLow()[0]);  verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);            
+        verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);                
+        verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]);  verticeFboAttr.putf(box.getLow()[2]);
+        
         verticeFboAttr.seal(gl, true);     
-       }
-       
-       private void renderRegion2FBO(GL2ES2 gl, PMVMatrix m, int tex_width){
-        tex_width_c = tex_width;           
-           tex_height_c = (int)(tex_width_c*box.getHeight()/box.getWidth());
-           
+    }
+    
+    private void renderRegion2FBO(GL2ES2 gl, PMVMatrix m, int tex_width){
+        tex_width_c = tex_width;        
+        tex_height_c = (int)(tex_width_c*box.getHeight()/box.getWidth());
+        
         // System.out.println("FBO Size: "+tex_width+" -> "+tex_height_c+"x"+tex_width_c);
         // System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5));
 
@@ -245,79 +245,79 @@ public class VBORegion2PES2  implements Region {
         if(null == fbo) {        
             fbo = new FBObject(tex_width_c, tex_height_c);
             // FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth
-           fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); 
-           // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
-           fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ?
+            fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); 
+            // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
+            fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ?
         } else {
             fbo.bind(gl);
         }
-               
-           //render texture
-               PMVMatrix tex_matrix = new PMVMatrix();
-           gl.glViewport(0, 0, tex_width_c, tex_height_c);
-           tex_matrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
-           tex_matrix.glLoadIdentity();
-           tex_matrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1);
-           
-           if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, tex_matrix.glGetPMvMatrixf()))){
-               System.out.println("Cnt set tex based mat");
-           }
-           
-           gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-           gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
-           renderRegion(gl);
+        
+        //render texture
+        PMVMatrix tex_matrix = new PMVMatrix();
+        gl.glViewport(0, 0, tex_width_c, tex_height_c);
+        tex_matrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+        tex_matrix.glLoadIdentity();
+        tex_matrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1);
+        
+        if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, tex_matrix.glGetPMvMatrixf()))){
+            System.out.println("Cnt set tex based mat");
+        }
+        
+        gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+        gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
+        renderRegion(gl);
 
-           fbo.unbind(gl);
-       }
-       
-       private void renderRegion(GL2ES2 gl) {
+        fbo.unbind(gl);
+    }
+    
+    private void renderRegion(GL2ES2 gl) {
         verticeTxtAttr.enableBuffer(gl, true);       
         texCoordTxtAttr.enableBuffer(gl, true);
         indicesTxt.enableBuffer(gl, true);        
-               
-        gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementNumber() * indicesTxt.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);          
-               
+        
+        gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementNumber() * indicesTxt.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);        
+        
         verticeTxtAttr.enableBuffer(gl, false);       
         texCoordTxtAttr.enableBuffer(gl, false);
         indicesTxt.enableBuffer(gl, false);        
-       }
-       
-       public void addTriangles(ArrayList<Triangle> tris) {
-               triangles.addAll(tris);
-               dirty = true;
-       }
-       
-       public int getNumVertices(){
-               return numVertices;
-       }
-       
-       public void addVertices(ArrayList<Vertex> verts){
-               vertices.addAll(verts);
-               numVertices = vertices.size();
-               dirty = true;
-       }
-       
-       public boolean isDirty(){
-               return dirty;
-       }
-       
-       public void destroy() {
-           if(DEBUG) {
-               System.err.println("VBORegion2PES2 Destroy: " + this);
-            }
-               GL2ES2 gl = context.getGL().getGL2ES2();
-               destroyFbo(gl);
+    }
+    
+    public void addTriangles(ArrayList<Triangle> tris) {
+        triangles.addAll(tris);
+        dirty = true;
+    }
+    
+    public int getNumVertices(){
+        return numVertices;
+    }
+    
+    public void addVertices(ArrayList<Vertex> verts){
+        vertices.addAll(verts);
+        numVertices = vertices.size();
+        dirty = true;
+    }
+    
+    public boolean isDirty(){
+        return dirty;
+    }
+    
+    public void destroy() {
+        if(DEBUG) {
+            System.err.println("VBORegion2PES2 Destroy: " + this);
+         }
+        GL2ES2 gl = context.getGL().getGL2ES2();
+        destroyFbo(gl);
         destroyTxtAttr(gl);
         destroyFboAttr(gl);        
         triangles.clear();
         vertices.clear();        
-       }       
-       final void destroyFbo(GL2ES2 gl) {
+    }    
+    final void destroyFbo(GL2ES2 gl) {
         if(null != fbo) {
             fbo.destroy(gl);
             fbo = null;
-        }          
-       }
+        }        
+    }
     final void destroyTxtAttr(GL2ES2 gl) {
         if(null != verticeTxtAttr) {
             verticeTxtAttr.destroy(gl);
@@ -331,7 +331,7 @@ public class VBORegion2PES2  implements Region {
             indicesTxt.destroy(gl);
             indicesTxt = null;
         }
-       }
+    }
     final void destroyFboAttr(GL2ES2 gl) {
         if(null != verticeFboAttr) {
             verticeFboAttr.destroy(gl);
@@ -347,15 +347,15 @@ public class VBORegion2PES2  implements Region {
         }
     }
     
-       public boolean isFlipped() {
-               return flipped;
-       }
+    public boolean isFlipped() {
+        return flipped;
+    }
 
-       public void setFlipped(boolean flipped) {
-               this.flipped = flipped;
-       }
-       
-       public AABBox getBounds(){
-               return box;
-       }
+    public void setFlipped(boolean flipped) {
+        this.flipped = flipped;
+    }
+    
+    public AABBox getBounds(){
+        return box;
+    }
 }
index 0d68be8..83cd6b8 100644 (file)
@@ -41,143 +41,143 @@ import com.jogamp.opengl.util.GLArrayDataServer;
 import com.jogamp.opengl.util.PMVMatrix;
 
 public class VBORegionSPES2  implements Region {
-       private int numVertices = 0;
-       
-       private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
-       private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
-       private GLArrayDataServer verticeAttr = null;
-       private GLArrayDataServer texCoordAttr = null;
-       private GLArrayDataServer indices = null;
-       
-       private GLContext context;
-       
-       private boolean flipped = false;
-       private boolean dirty = false;
-       
-       private AABBox box = null;
-       
-       public VBORegionSPES2(GLContext context){
-               this.context =context;
-       }
-       
-       public void update(){
-               box = new AABBox();
-               GL2ES2 gl = context.getGL().getGL2ES2();
-               
+    private int numVertices = 0;
+    
+    private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
+    private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
+    private GLArrayDataServer verticeAttr = null;
+    private GLArrayDataServer texCoordAttr = null;
+    private GLArrayDataServer indices = null;
+    
+    private GLContext context;
+    
+    private boolean flipped = false;
+    private boolean dirty = false;
+    
+    private AABBox box = null;
+    
+    public VBORegionSPES2(GLContext context){
+        this.context =context;
+    }
+    
+    public void update(){
+        box = new AABBox();
+        GL2ES2 gl = context.getGL().getGL2ES2();
+        
         destroy(gl);        
 
         indices = GLArrayDataServer.createGLSL(gl, null, 3, GL2ES2.GL_SHORT, false, 
                                                triangles.size(), GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);        
-               for(Triangle t:triangles){
-                       final Vertex[] t_vertices = t.getVertices();
-                       
-                       if(t_vertices[0].getId() == Integer.MAX_VALUE){
-                               t_vertices[0].setId(numVertices++);
-                               t_vertices[1].setId(numVertices++);
-                               t_vertices[2].setId(numVertices++);
-                                                               
-                               vertices.add(t.getVertices()[0]);
-                               vertices.add(t.getVertices()[1]);
-                               vertices.add(t.getVertices()[2]);
+        for(Triangle t:triangles){
+            final Vertex[] t_vertices = t.getVertices();
+            
+            if(t_vertices[0].getId() == Integer.MAX_VALUE){
+                t_vertices[0].setId(numVertices++);
+                t_vertices[1].setId(numVertices++);
+                t_vertices[2].setId(numVertices++);
+                                
+                vertices.add(t.getVertices()[0]);
+                vertices.add(t.getVertices()[1]);
+                vertices.add(t.getVertices()[2]);
 
-                               indices.puts((short) t.getVertices()[0].getId());
-                               indices.puts((short) t.getVertices()[1].getId());
-                               indices.puts((short) t.getVertices()[2].getId());
-                       }
-                       else{
-                               Vertex v1 = t_vertices[0];
-                               Vertex v2 = t_vertices[1];
-                               Vertex v3 = t_vertices[2];
-                               
-                               indices.puts((short) v1.getId());
-                               indices.puts((short) v2.getId());
-                               indices.puts((short) v3.getId());
-                       }
-               }
+                indices.puts((short) t.getVertices()[0].getId());
+                indices.puts((short) t.getVertices()[1].getId());
+                indices.puts((short) t.getVertices()[2].getId());
+            }
+            else{
+                Vertex v1 = t_vertices[0];
+                Vertex v2 = t_vertices[1];
+                Vertex v3 = t_vertices[2];
+                
+                indices.puts((short) v1.getId());
+                indices.puts((short) v2.getId());
+                indices.puts((short) v3.getId());
+            }
+        }
         indices.seal(gl, true);
-               
-               verticeAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false,
-                                                          vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); 
-               verticeAttr.setLocation(Region.VERTEX_ATTR_IDX);
-               for(Vertex v:vertices){
-                       
-                       if(flipped){
-                               verticeAttr.putf(v.getX());
-                               verticeAttr.putf(-1*v.getY());
-                               verticeAttr.putf(v.getZ());
-                               
-                               box.resize(v.getX(),-1*v.getY(),v.getZ());
-                       }
-                       else{
-                               verticeAttr.putf(v.getX());
-                               verticeAttr.putf(v.getY());
-                               verticeAttr.putf(v.getZ());
-                               
-                               box.resize(v.getX(),v.getY(),v.getZ());
-                       }
-               }
-        verticeAttr.seal(gl, true);            
+        
+        verticeAttr = GLArrayDataServer.createGLSL(gl, Region.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, false,
+                                                   vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); 
+        verticeAttr.setLocation(Region.VERTEX_ATTR_IDX);
+        for(Vertex v:vertices){
+            
+            if(flipped){
+                verticeAttr.putf(v.getX());
+                verticeAttr.putf(-1*v.getY());
+                verticeAttr.putf(v.getZ());
+                
+                box.resize(v.getX(),-1*v.getY(),v.getZ());
+            }
+            else{
+                verticeAttr.putf(v.getX());
+                verticeAttr.putf(v.getY());
+                verticeAttr.putf(v.getZ());
+                
+                box.resize(v.getX(),v.getY(),v.getZ());
+            }
+        }
+        verticeAttr.seal(gl, true);        
         
         texCoordAttr = GLArrayDataServer.createGLSL(gl, Region.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT, false,
                                                     vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
         texCoordAttr.setLocation(Region.TEXCOORD_ATTR_IDX);
-               for(Vertex v:vertices){
-                       float[] tex = v.getTexCoord();
-                       texCoordAttr.putf(tex[0]);
-                       texCoordAttr.putf(tex[1]);
-               }
-               texCoordAttr.seal(gl, true);
+        for(Vertex v:vertices){
+            float[] tex = v.getTexCoord();
+            texCoordAttr.putf(tex[0]);
+            texCoordAttr.putf(tex[1]);
+        }
+        texCoordAttr.seal(gl, true);
         
         verticeAttr.enableBuffer(gl, false);       
         texCoordAttr.enableBuffer(gl, false);
         indices.enableBuffer(gl, false);
         
-               dirty = false;
-       }
-       
-       private void render() {
-               GL2ES2 gl = context.getGL().getGL2ES2();
+        dirty = false;
+    }
+    
+    private void render() {
+        GL2ES2 gl = context.getGL().getGL2ES2();
 
         verticeAttr.enableBuffer(gl, true);       
         texCoordAttr.enableBuffer(gl, true);
         indices.enableBuffer(gl, true);
-               
-               gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementNumber() * indices.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);                 
-               
+        
+        gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementNumber() * indices.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);         
+        
         verticeAttr.enableBuffer(gl, false);       
         texCoordAttr.enableBuffer(gl, false);
         indices.enableBuffer(gl, false);
-       }
-       
-       public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
-               render();
-       }
-       
-       public void addTriangles(ArrayList<Triangle> tris) {
-               triangles.addAll(tris);
-               dirty = true;
-       }
-       
-       public int getNumVertices(){
-               return numVertices;
-       }
-       
-       public void addVertices(ArrayList<Vertex> verts){
-               vertices.addAll(verts);
-               numVertices = vertices.size();
-               dirty = true;
-       }
-       
-       public boolean isDirty(){
-               return dirty;
-       }
-       
-       public void destroy() {
-               GL2ES2 gl = context.getGL().getGL2ES2();
-               destroy(gl);            
-       }
-               
-    final void destroy(GL2ES2 gl) {            
+    }
+    
+    public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
+        render();
+    }
+    
+    public void addTriangles(ArrayList<Triangle> tris) {
+        triangles.addAll(tris);
+        dirty = true;
+    }
+    
+    public int getNumVertices(){
+        return numVertices;
+    }
+    
+    public void addVertices(ArrayList<Vertex> verts){
+        vertices.addAll(verts);
+        numVertices = vertices.size();
+        dirty = true;
+    }
+    
+    public boolean isDirty(){
+        return dirty;
+    }
+    
+    public void destroy() {
+        GL2ES2 gl = context.getGL().getGL2ES2();
+        destroy(gl);        
+    }
+        
+    final void destroy(GL2ES2 gl) {        
         if(null != verticeAttr) {
             verticeAttr.destroy(gl);
             verticeAttr = null;
@@ -190,16 +190,16 @@ public class VBORegionSPES2  implements Region {
             indices.destroy(gl);
             indices = null;
         }
-       }
-       
-       public boolean isFlipped() {
-               return flipped;
-       }
+    }
+    
+    public boolean isFlipped() {
+        return flipped;
+    }
 
-       public void setFlipped(boolean flipped) {
-               this.flipped = flipped;
-       }
-       public AABBox getBounds(){
-               return box;
-       }
+    public void setFlipped(boolean flipped) {
+        this.flipped = flipped;
+    }
+    public AABBox getBounds(){
+        return box;
+    }
 }
index 3a1ef51..166937f 100644 (file)
@@ -15,81 +15,81 @@ vec4 weights = vec4(0.075, 0.06, 0.045, 0.025);
 
 void main (void)
 {
-       vec2 rtex = vec2(abs(v_texCoord.x),abs(v_texCoord.y));
-       vec3 c = g_color;
-       
-       float alpha = 0.0;
-       
-       if((v_texCoord.x == 0.0) && (v_texCoord.y == 0.0)){
-               alpha = g_alpha;
-       }
-       else if((v_texCoord.x >= 5.0)){
-               vec2 dfx = dFdx(v_texCoord);
-               vec2 dfy = dFdy(v_texCoord);
-               
-               vec2 size = 1.0/textureSize(texture,0); //version 130
-               rtex -= 5.0;
-               vec4 t = texture2D(texture, rtex)* 0.18;
+    vec2 rtex = vec2(abs(v_texCoord.x),abs(v_texCoord.y));
+    vec3 c = g_color;
+    
+    float alpha = 0.0;
+    
+    if((v_texCoord.x == 0.0) && (v_texCoord.y == 0.0)){
+         alpha = g_alpha;
+    }
+    else if((v_texCoord.x >= 5.0)){
+        vec2 dfx = dFdx(v_texCoord);
+        vec2 dfy = dFdy(v_texCoord);
+        
+        vec2 size = 1.0/textureSize(texture,0); //version 130
+        rtex -= 5.0;
+        vec4 t = texture2D(texture, rtex)* 0.18;
 
-               t += texture2D(texture, rtex + size*(vec2(1, 0)))*weights.x;
-               t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x;
-               t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x;
-               t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x;
-               
-               t += texture2D(texture, rtex + 2.0*size*(vec2(1, 0))) *weights.y;
-               t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y;
-               t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y; 
-               t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y;
-               
-               t += texture2D(texture, rtex + 3.0*size*(vec2(1, 0))) *weights.z;
-               t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z;
-               t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z;
-               t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z;
-               
-               t += texture2D(texture, rtex + 4.0*size*(vec2(1, 0))) *weights.w;
-               t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w;
-               t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w;
-               t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w;
-               
-               if(t.w == 0.0){
-                       discard;
-               }
-               
-               c = t.xyz;
-               alpha = g_alpha* t.w;
-       }
-       ///////////////////////////////////////////////////////////
-       else if ((v_texCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)){
-               vec2 dtx = dFdx(rtex);
-               vec2 dty = dFdy(rtex);
-               
-               rtex.y -= 0.1;
-               
-               if(rtex.y < 0.0) {
-                       if(v_texCoord.y < 0.0)
-                               discard;
-                       else{
-                               rtex.y = 0.0;
-                       }
-               }
-               
-               vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x));
-               float position = rtex.y - (rtex.x * (1.0 - rtex.x));
-               float d = position/(length(f));
+        t += texture2D(texture, rtex + size*(vec2(1, 0)))*weights.x;
+        t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x;
+        t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x;
+        t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x;
+        
+        t += texture2D(texture, rtex + 2.0*size*(vec2(1, 0))) *weights.y;
+        t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y;
+        t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y; 
+        t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y;
+        
+        t += texture2D(texture, rtex + 3.0*size*(vec2(1, 0))) *weights.z;
+        t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z;
+        t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z;
+        t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z;
+        
+        t += texture2D(texture, rtex + 4.0*size*(vec2(1, 0))) *weights.w;
+        t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w;
+        t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w;
+        t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w;
+        
+        if(t.w == 0.0){
+            discard;
+        }
+        
+        c = t.xyz;
+        alpha = g_alpha* t.w;
+    }
+    ///////////////////////////////////////////////////////////
+    else if ((v_texCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)){
+          vec2 dtx = dFdx(rtex);
+          vec2 dty = dFdy(rtex);
+          
+          rtex.y -= 0.1;
+          
+          if(rtex.y < 0.0) {
+              if(v_texCoord.y < 0.0)
+                  discard;
+              else{
+                  rtex.y = 0.0;
+              }
+          }
+          
+          vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x));
+          float position = rtex.y - (rtex.x * (1.0 - rtex.x));
+          float d = position/(length(f));
 
-               float a = (0.5 - d * sign(v_texCoord.y));  
-               
-               if (a >= 1.0)  { 
-               alpha = g_alpha;
-       }  
-               else if (a <= 0.0) {
-                       alpha = 0.0;//discard;
-               }
-               else {           
-               alpha = g_alpha*a;
-               mix(b_color,g_color, a);
-       }
-       }
-       
+        float a = (0.5 - d * sign(v_texCoord.y));  
+        
+        if (a >= 1.0)  { 
+            alpha = g_alpha;
+        }  
+          else if (a <= 0.0) {
+               alpha = 0.0;//discard;
+           }
+          else {           
+            alpha = g_alpha*a;
+            mix(b_color,g_color, a);
+        }
+    }
+    
     gl_FragColor = vec4(c, alpha);
 }
index 5dae296..a0d1923 100644 (file)
@@ -33,49 +33,49 @@ import com.jogamp.graph.geom.Outline;
 import com.jogamp.graph.geom.Vertex;
 
 public class GraphOutline {
-       final private Outline outline;
-       final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3);
-       
-       public GraphOutline(){
-               this.outline = new Outline();
-       }
-       
-       /**Create a control polyline of control vertices
-        * the curve pieces can be identified by onCurve flag 
-        * of each cp the control polyline is open by default
-        */
-       public GraphOutline(Outline ol){
-               this.outline = ol;
-               ArrayList<Vertex> vertices = this.outline.getVertices();
-               for(Vertex v:vertices){
-                       this.controlpoints.add(new GraphVertex(v));
-               }
-       }
+    final private Outline outline;
+    final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3);
+    
+    public GraphOutline(){
+        this.outline = new Outline();
+    }
+    
+    /**Create a control polyline of control vertices
+     * the curve pieces can be identified by onCurve flag 
+     * of each cp the control polyline is open by default
+     */
+    public GraphOutline(Outline ol){
+        this.outline = ol;
+        ArrayList<Vertex> vertices = this.outline.getVertices();
+        for(Vertex v:vertices){
+            this.controlpoints.add(new GraphVertex(v));
+        }
+    }
 
-       public Outline getOutline() {
-               return outline;
-       }
+    public Outline getOutline() {
+        return outline;
+    }
 
-       /*public void setOutline(Outline<T> outline) {
-               this.outline = outline;
-       }*/
-       
+    /*public void setOutline(Outline<T> outline) {
+        this.outline = outline;
+    }*/
+    
 
-       public ArrayList<GraphVertex> getGraphPoint() {
-               return controlpoints;
-       }
-       
-       public ArrayList<Vertex> getPoints() {
-               return outline.getVertices();
-       }
+    public ArrayList<GraphVertex> getGraphPoint() {
+        return controlpoints;
+    }
+    
+    public ArrayList<Vertex> getPoints() {
+        return outline.getVertices();
+    }
 
-       /*public void setControlpoints(ArrayList<GraphPoint<T>> controlpoints) {
-               this.controlpoints = controlpoints;
-       }*/
+    /*public void setControlpoints(ArrayList<GraphPoint<T>> controlpoints) {
+        this.controlpoints = controlpoints;
+    }*/
 
-       public void addVertex(GraphVertex v) {
-               controlpoints.add(v);
-               outline.addVertex(v.getPoint());
-       }
-       
+    public void addVertex(GraphVertex v) {
+        controlpoints.add(v);
+        outline.addVertex(v.getPoint());
+    }
+    
 }
index b9f95a0..5efe57c 100644 (file)
@@ -32,89 +32,89 @@ import java.util.ArrayList;
 import com.jogamp.graph.geom.Vertex;
 
 public class GraphVertex {
-       private Vertex point;
-       private ArrayList<HEdge> edges = null;
-       private boolean boundaryContained = false;
-       
-       public GraphVertex(Vertex point) {
-               this.point = point;
-       }
+    private Vertex point;
+    private ArrayList<HEdge> edges = null;
+    private boolean boundaryContained = false;
+    
+    public GraphVertex(Vertex point) {
+        this.point = point;
+    }
 
-       public Vertex getPoint() {
-               return point;
-       }
-       
-       public float getX(){
-               return point.getX();
-       }
-       
-       public float getY(){
-               return point.getY();
-       }
-       
-       public float getZ(){
-               return point.getZ();
-       }
-       public float[] getCoord() {
-               return point.getCoord();
-       }
+    public Vertex getPoint() {
+        return point;
+    }
+    
+    public float getX(){
+        return point.getX();
+    }
+    
+    public float getY(){
+        return point.getY();
+    }
+    
+    public float getZ(){
+        return point.getZ();
+    }
+    public float[] getCoord() {
+        return point.getCoord();
+    }
 
-       public void setPoint(Vertex point) {
-               this.point = point;
-       }
+    public void setPoint(Vertex point) {
+        this.point = point;
+    }
 
-       public ArrayList<HEdge> getEdges() {
-               return edges;
-       }
+    public ArrayList<HEdge> getEdges() {
+        return edges;
+    }
 
-       public void setEdges(ArrayList<HEdge> edges) {
-               this.edges = edges;
-       }
-       
-       public void addEdge(HEdge edge){
-               if(edges == null){
-                       edges = new ArrayList<HEdge>();
-               }
-               edges.add(edge);
-       }
-       public void removeEdge(HEdge edge){
-               if(edges == null)
-                       return;
-               edges.remove(edge);
-               if(edges.size() == 0){
-                       edges = null;
-               }
-       }
-       public HEdge findNextEdge(GraphVertex nextVert){
-               for(HEdge e:edges){
-                       if(e.getNext().getGraphPoint() == nextVert){
-                               return e;
-                       }
-               }
-               return null;
-       }
-       public HEdge findBoundEdge(){
-               for(HEdge e:edges){
-                       if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){
-                               return e;
-                       }
-               }
-               return null;
-       }
-       public HEdge findPrevEdge(GraphVertex prevVert){
-               for(HEdge e:edges){
-                       if(e.getPrev().getGraphPoint() == prevVert){
-                               return e;
-                       }
-               }
-               return null;
-       }
-       
-       public boolean isBoundaryContained() {
-               return boundaryContained;
-       }
+    public void setEdges(ArrayList<HEdge> edges) {
+        this.edges = edges;
+    }
+    
+    public void addEdge(HEdge edge){
+        if(edges == null){
+            edges = new ArrayList<HEdge>();
+        }
+        edges.add(edge);
+    }
+    public void removeEdge(HEdge edge){
+        if(edges == null)
+            return;
+        edges.remove(edge);
+        if(edges.size() == 0){
+            edges = null;
+        }
+    }
+    public HEdge findNextEdge(GraphVertex nextVert){
+        for(HEdge e:edges){
+            if(e.getNext().getGraphPoint() == nextVert){
+                return e;
+            }
+        }
+        return null;
+    }
+    public HEdge findBoundEdge(){
+        for(HEdge e:edges){
+            if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){
+                return e;
+            }
+        }
+        return null;
+    }
+    public HEdge findPrevEdge(GraphVertex prevVert){
+        for(HEdge e:edges){
+            if(e.getPrev().getGraphPoint() == prevVert){
+                return e;
+            }
+        }
+        return null;
+    }
+    
+    public boolean isBoundaryContained() {
+        return boundaryContained;
+    }
 
-       public void setBoundaryContained(boolean boundaryContained) {
-               this.boundaryContained = boundaryContained;
-       }
+    public void setBoundaryContained(boolean boundaryContained) {
+        this.boundaryContained = boundaryContained;
+    }
 }
index d1bcc6e..4d29a81 100644 (file)
@@ -32,99 +32,99 @@ import com.jogamp.graph.geom.Triangle;
 
 
 public class HEdge {
-       public static int BOUNDARY = 3;
-       public static int INNER = 1;
-       public static int HOLE = 2;
-       
-       private GraphVertex vert;
-       private HEdge prev = null;
-       private HEdge next = null;
-       private HEdge sibling = null;
-       private int type = BOUNDARY;
-       private Triangle triangle = null;
-       
-       public HEdge(GraphVertex vert, int type) {
-               this.vert = vert;
-               this.type = type;
-       }
-
-       public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) {
-               this.vert = vert;
-               this.prev = prev;
-               this.next = next;
-               this.sibling = sibling;
-               this.type = type;
-       }
-
-       public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) {
-               this.vert = vert;
-               this.prev = prev;
-               this.next = next;
-               this.sibling = sibling;
-               this.type = type;
-               this.triangle = triangle;
-       }
-
-       public GraphVertex getGraphPoint() {
-               return vert;
-       }
-
-       public void setVert(GraphVertex vert) {
-               this.vert = vert;
-       }
-
-       public HEdge getPrev() {
-               return prev;
-       }
-
-       public void setPrev(HEdge prev) {
-               this.prev = prev;
-       }
-
-       public HEdge getNext() {
-               return next;
-       }
-
-       public void setNext(HEdge next) {
-               this.next = next;
-       }
-
-       public HEdge getSibling() {
-               return sibling;
-       }
-
-       public void setSibling(HEdge sibling) {
-               this.sibling = sibling;
-       }
-
-       public int getType() {
-               return type;
-       }
-
-       public void setType(int type) {
-               this.type = type;
-       }
-
-       public Triangle getTriangle() {
-               return triangle;
-       }
-
-       public void setTriangle(Triangle triangle) {
-               this.triangle = triangle;
-       }
-       
-       public static <T extends Vertex> void connect(HEdge first, HEdge next){
-               first.setNext(next);
-               next.setPrev(first);
-       }
-       
-       public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){
-               first.setSibling(second);
-               second.setSibling(first);
-       }
-       
-       public boolean vertexOnCurveVertex(){
-               return vert.getPoint().isOnCurve();
-       }
-       
+    public static int BOUNDARY = 3;
+    public static int INNER = 1;
+    public static int HOLE = 2;
+    
+    private GraphVertex vert;
+    private HEdge prev = null;
+    private HEdge next = null;
+    private HEdge sibling = null;
+    private int type = BOUNDARY;
+    private Triangle triangle = null;
+    
+    public HEdge(GraphVertex vert, int type) {
+        this.vert = vert;
+        this.type = type;
+    }
+
+    public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) {
+        this.vert = vert;
+        this.prev = prev;
+        this.next = next;
+        this.sibling = sibling;
+        this.type = type;
+    }
+
+    public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) {
+        this.vert = vert;
+        this.prev = prev;
+        this.next = next;
+        this.sibling = sibling;
+        this.type = type;
+        this.triangle = triangle;
+    }
+
+    public GraphVertex getGraphPoint() {
+        return vert;
+    }
+
+    public void setVert(GraphVertex vert) {
+        this.vert = vert;
+    }
+
+    public HEdge getPrev() {
+        return prev;
+    }
+
+    public void setPrev(HEdge prev) {
+        this.prev = prev;
+    }
+
+    public HEdge getNext() {
+        return next;
+    }
+
+    public void setNext(HEdge next) {
+        this.next = next;
+    }
+
+    public HEdge getSibling() {
+        return sibling;
+    }
+
+    public void setSibling(HEdge sibling) {
+        this.sibling = sibling;
+    }
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public Triangle getTriangle() {
+        return triangle;
+    }
+
+    public void setTriangle(Triangle triangle) {
+        this.triangle = triangle;
+    }
+    
+    public static <T extends Vertex> void connect(HEdge first, HEdge next){
+        first.setNext(next);
+        next.setPrev(first);
+    }
+    
+    public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){
+        first.setSibling(second);
+        second.setSibling(first);
+    }
+    
+    public boolean vertexOnCurveVertex(){
+        return vert.getPoint().isOnCurve();
+    }
+    
 }
index fd7736a..9e29d39 100644 (file)
@@ -36,338 +36,338 @@ import com.jogamp.graph.geom.Triangle;
 import com.jogamp.graph.math.VectorUtil;
 
 public class Loop {
-       private HEdge root = null;
-       private AABBox box = new AABBox();
-       private GraphOutline initialOutline = null;
-
-       public Loop(GraphOutline polyline, int direction){
-               initialOutline = polyline;
-               this.root = initFromPolyline(initialOutline, direction);
-       }
-
-       public HEdge getHEdge(){
-               return root;
-       }
-
-       public Triangle cut(boolean delaunay){
-               if(isSimplex()){
-                       Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(), 
-                                       root.getNext().getNext().getGraphPoint().getPoint());
-                       t.setVerticesBoundary(checkVerticesBoundary(root));
-                       return t;
-               }
-               HEdge prev = root.getPrev();
-               HEdge next1 = root.getNext();
-
-               HEdge next2 = findClosestValidNeighbor(next1.getNext(), delaunay);
-               if(next2 == null){
-                       root = root.getNext();
-                       return null;
-               }
-
-               GraphVertex v1 = root.getGraphPoint();
-               GraphVertex v2 = next1.getGraphPoint();
-               GraphVertex v3 = next2.getGraphPoint();
-
-               HEdge v3Edge = new HEdge(v3, HEdge.INNER);
-
-               HEdge.connect(v3Edge, root);
-               HEdge.connect(next1, v3Edge);
-
-               HEdge v3EdgeSib = v3Edge.getSibling();
-               if(v3EdgeSib == null){
-                       v3EdgeSib = new HEdge(v3Edge.getNext().getGraphPoint(), HEdge.INNER);
-                       HEdge.makeSiblings(v3Edge, v3EdgeSib);
-               }
-
-               HEdge.connect(prev, v3EdgeSib);
-               HEdge.connect(v3EdgeSib, next2);
-
-               Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
-               this.root = next2;
-               return t;
-       }
-
-       public boolean isSimplex(){
-               return (root.getNext().getNext().getNext() == root);
-       }
-
-       /**Create a connected list of half edges (loop)
-        * from the boundary profile
-        * @param direction requested winding of edges (CCW or CW)
-        */
-       private HEdge initFromPolyline(GraphOutline outline, int direction){
-               ArrayList<GraphVertex> vertices = outline.getGraphPoint();
-
-               if(vertices.size()<3) {
-                       throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size());
-               }
-               boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(),
-                               vertices.get(2).getPoint());
-               boolean invert = isCCW && (direction == VectorUtil.CW);
-
-               HEdge firstEdge = null;
-               HEdge lastEdge = null;
-               int index =0;
-               int max = vertices.size();
-
-               int edgeType =  HEdge.BOUNDARY;
-               if(invert){
-                       index = vertices.size() -1;
-                       max = -1;
-                       edgeType = HEdge.HOLE;
-               }
-
-               while(index != max){
-                       GraphVertex v1 = vertices.get(index);
-                       box.resize(v1.getX(), v1.getY(), v1.getZ());
-
-                       HEdge edge = new HEdge(v1, edgeType);
-
-                       v1.addEdge(edge);
-                       if(lastEdge != null){
-                               lastEdge.setNext(edge);
-                               edge.setPrev(lastEdge);
-                       }
-                       else{
-                               firstEdge = edge;
-                       }
-
-                       if(!invert){
-                               if(index == vertices.size()-1){
-                                       edge.setNext(firstEdge);
-                                       firstEdge.setPrev(edge);
-                               }
-                       }
-                       else if (index == 0){
-                               edge.setNext(firstEdge);
-                               firstEdge.setPrev(edge);
-                       }
-
-                       lastEdge = edge;
-
-                       if(!invert){
-                               index++;
-                       }
-                       else{
-                               index--;
-                       }
-               }
-               return firstEdge;
-       }
-
-       public void addConstraintCurve(GraphOutline polyline) {
-               //              GraphOutline outline = new GraphOutline(polyline);
-               /**needed to generate vertex references.*/
-               initFromPolyline(polyline, VectorUtil.CW); 
-
-               GraphVertex v3 = locateClosestVertex(polyline);
-               HEdge v3Edge = v3.findBoundEdge();
-               HEdge v3EdgeP = v3Edge.getPrev();
-               HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER);
-
-               HEdge.connect(root.getPrev(), crossEdge);
-               HEdge.connect(crossEdge, v3Edge);
-
-               HEdge crossEdgeSib = crossEdge.getSibling();
-               if(crossEdgeSib == null) {
-                       crossEdgeSib = new HEdge(crossEdge.getNext().getGraphPoint(), HEdge.INNER);
-                       HEdge.makeSiblings(crossEdge, crossEdgeSib);
-               }
-
-               HEdge.connect(v3EdgeP, crossEdgeSib);
-               HEdge.connect(crossEdgeSib, root);
-       }
-
-       /** Locates the vertex and update the loops root 
-        * to have (root + vertex) as closest pair 
-        * @param polyline the control polyline 
-        * to search for closestvertices
-        * @return the vertex that is closest to the newly set root Hedge.
-        */
-       private GraphVertex locateClosestVertex(GraphOutline polyline) {
-               HEdge closestE = null;
-               GraphVertex closestV = null;
-
-               float minDistance = Float.MAX_VALUE;
-               boolean inValid = false;
-               ArrayList<GraphVertex> initVertices = initialOutline.getGraphPoint();
-               ArrayList<GraphVertex> vertices = polyline.getGraphPoint();
-
-               for(int i=0; i< initVertices.size()-1; i++){
-                       GraphVertex v = initVertices.get(i);
-                       GraphVertex nextV = initVertices.get(i+1);
-                       for(GraphVertex cand:vertices){
-                               float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord());
-                               if(distance < minDistance){
-                                       for (GraphVertex vert:vertices){
-                                               if(vert == v || vert == nextV || vert == cand)
-                                                       continue;
-                                               inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(), 
-                                                               cand.getPoint(), vert.getPoint());
-                                               if(inValid){
-                                                       break;
-                                               }
-                                       }
-                                       if(!inValid){
-                                               closestV = cand;
-                                               minDistance = distance;
-                                               closestE = v.findBoundEdge();
-                                       }
-                               }
-
-                       }
-               }
-
-               if(closestE != null){
-                       root = closestE;
-               }
-
-               return closestV;
-       }
-
-       private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) {
-               HEdge next = root.getNext();
-
-               if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
-                               edge.getGraphPoint().getPoint())){
-                       return null;
-               }
-
-               HEdge candEdge = edge;
-               boolean inValid = false;
-
-               if(delaunay){
-                   Vertex cand = candEdge.getGraphPoint().getPoint();
-                       HEdge e = candEdge.getNext();
-                       while (e != candEdge){
-                               if(e.getGraphPoint() == root.getGraphPoint() 
-                                               || e.getGraphPoint() == next.getGraphPoint() 
-                                               || e.getGraphPoint().getPoint() == cand){
-                                       e = e.getNext();
-                                       continue;
-                               }
-                               inValid = VectorUtil.inCircle(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
-                                               cand, e.getGraphPoint().getPoint());
-                               if(inValid){
-                                       break;
-                               }
-                               e = e.getNext();
-                       }
-               }
-               if(!inValid){
-                       return candEdge;
-               }
-               return null;
-       }
-
-       /** Create a triangle from the param vertices only if
-        * the triangle is valid. IE not outside region.
-        * @param v1 vertex 1
-        * @param v2 vertex 2
-        * @param v3 vertex 3
-        * @param root and edge of this triangle
-        * @return the triangle iff it satisfies, null otherwise
-        */
-       private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){
-               Triangle t = new Triangle(v1, v2, v3);
-               t.setVerticesBoundary(checkVerticesBoundary(rootT));
-               return t;
-       }
-
-       private boolean[] checkVerticesBoundary(HEdge rootT) {
-               boolean[] boundary = new boolean[3];
-               HEdge e1 = rootT;
-               HEdge e2 = rootT.getNext();
-               HEdge e3 = rootT.getNext().getNext();
-
-               if(e1.getGraphPoint().isBoundaryContained()){