diff options
author | Rami Santina <[email protected]> | 2011-03-25 12:00:55 +0200 |
---|---|---|
committer | Rami Santina <[email protected]> | 2011-03-25 12:00:55 +0200 |
commit | 526af50c03af2e00a028caf4b8504e6c3f3c4221 (patch) | |
tree | 69b63713bc99051f26bb7ca172ed5464fec13485 /src/com/jogamp/graph/geom | |
parent | b01b243241635ab4d210aa88cdbff6cc5713a815 (diff) |
Refactored Vertex Point PointTex GraphPoint namings
Vertex class --> SVertex (Simple vertex wwhere memory impl is float[])
Point interface --> Vertex (which combines in it PointTex Interface)
GraphPoint --> GraphVertex
Diffstat (limited to 'src/com/jogamp/graph/geom')
-rw-r--r-- | src/com/jogamp/graph/geom/Line.java | 2 | ||||
-rw-r--r-- | src/com/jogamp/graph/geom/Outline.java | 14 | ||||
-rw-r--r-- | src/com/jogamp/graph/geom/PointTex.java | 37 | ||||
-rw-r--r-- | src/com/jogamp/graph/geom/Triangle.java | 2 | ||||
-rw-r--r-- | src/com/jogamp/graph/geom/Vertex.java (renamed from src/com/jogamp/graph/geom/Point.java) | 14 | ||||
-rw-r--r-- | src/com/jogamp/graph/geom/opengl/SVertex.java (renamed from src/com/jogamp/graph/geom/opengl/Vertex.java) | 37 |
6 files changed, 36 insertions, 70 deletions
diff --git a/src/com/jogamp/graph/geom/Line.java b/src/com/jogamp/graph/geom/Line.java index dbdee569c..92d1b007f 100644 --- a/src/com/jogamp/graph/geom/Line.java +++ b/src/com/jogamp/graph/geom/Line.java @@ -27,7 +27,7 @@ */ package com.jogamp.graph.geom; -public class Line <T extends Point> { +public class Line <T extends Vertex> { private T v1; private T v2; diff --git a/src/com/jogamp/graph/geom/Outline.java b/src/com/jogamp/graph/geom/Outline.java index b8b824a1c..d9bde4177 100644 --- a/src/com/jogamp/graph/geom/Outline.java +++ b/src/com/jogamp/graph/geom/Outline.java @@ -29,7 +29,7 @@ package com.jogamp.graph.geom; import java.util.ArrayList; -import com.jogamp.graph.geom.Point; +import com.jogamp.graph.geom.Vertex; import jogamp.graph.math.VectorFloatUtil; @@ -45,7 +45,7 @@ import jogamp.graph.math.VectorFloatUtil; * @see OutlineShape, Region * */ -public class Outline<T extends Point> implements Comparable<Outline<T>>{ +public class Outline<T extends Vertex> implements Comparable<Outline<T>>{ private ArrayList<T> vertices = new ArrayList<T>(3); private boolean closed = false; @@ -68,20 +68,20 @@ public class Outline<T extends Point> implements Comparable<Outline<T>>{ box.resize(vertex.getX(), vertex.getY(), vertex.getZ()); } - public final void addVertex(Point.Factory<? extends Point> factory, float x, float y, boolean onCurve) { + public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, boolean onCurve) { addVertex(factory, x, y, 0f, onCurve); } @SuppressWarnings("unchecked") - public final void addVertex(Point.Factory<? extends Point> factory, float x, float y, float z, boolean onCurve) { - Point v = factory.create(x, y, z); + 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((T)v); } @SuppressWarnings("unchecked") - public final void addVertex(Point.Factory<? extends Point> factory, float[] coordsBuffer, int offset, int length, boolean onCurve) { - Point v = factory.create(coordsBuffer, offset, length); + 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((T)v); } diff --git a/src/com/jogamp/graph/geom/PointTex.java b/src/com/jogamp/graph/geom/PointTex.java deleted file mode 100644 index 59f7ee0c6..000000000 --- a/src/com/jogamp/graph/geom/PointTex.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2011 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package com.jogamp.graph.geom; - -/** - * A Point with texture coordinates - */ -public interface PointTex extends Point { - float[] getTexCoord(); - - void setTexCoord(float s, float t); -} diff --git a/src/com/jogamp/graph/geom/Triangle.java b/src/com/jogamp/graph/geom/Triangle.java index 341a4483b..7b11ba23d 100644 --- a/src/com/jogamp/graph/geom/Triangle.java +++ b/src/com/jogamp/graph/geom/Triangle.java @@ -27,7 +27,7 @@ */ package com.jogamp.graph.geom; -public class Triangle<T extends PointTex> { +public class Triangle<T extends Vertex> { private int id = Integer.MAX_VALUE; final private T[] vertices; private boolean[] boundaryEdges = new boolean[3]; diff --git a/src/com/jogamp/graph/geom/Point.java b/src/com/jogamp/graph/geom/Vertex.java index 5f85801f8..9d19c89f6 100644 --- a/src/com/jogamp/graph/geom/Point.java +++ b/src/com/jogamp/graph/geom/Vertex.java @@ -28,11 +28,11 @@ package com.jogamp.graph.geom; /** - * A point with custom memory layout using custom factory. + * A Vertex with custom memory layout using custom factory. */ -public interface Point extends Comparable<Point>, Cloneable { +public interface Vertex extends Comparable<Vertex>, Cloneable { - public static interface Factory <T extends Point> { + public static interface Factory <T extends Vertex> { T create(); T create(float x, float y); @@ -72,7 +72,11 @@ public interface Point extends Comparable<Point>, Cloneable { void setId(int id); - int compareTo(Point p); + int compareTo(Vertex p); - Point clone(); + float[] getTexCoord(); + + void setTexCoord(float s, float t); + + Vertex clone(); } diff --git a/src/com/jogamp/graph/geom/opengl/Vertex.java b/src/com/jogamp/graph/geom/opengl/SVertex.java index 77d18d7f5..86b95854d 100644 --- a/src/com/jogamp/graph/geom/opengl/Vertex.java +++ b/src/com/jogamp/graph/geom/opengl/SVertex.java @@ -29,10 +29,9 @@ package com.jogamp.graph.geom.opengl; import jogamp.graph.math.VectorFloatUtil; -import com.jogamp.graph.geom.Point; -import com.jogamp.graph.geom.PointTex; +import com.jogamp.graph.geom.Vertex; -public class Vertex implements PointTex { +public class SVertex implements Vertex { private int id = Integer.MAX_VALUE; protected float[] coord = new float[3]; protected boolean onCurve = true; @@ -42,25 +41,25 @@ public class Vertex implements PointTex { public static Factory factory() { return factory; } - public static class Factory implements Point.Factory<Vertex> { + public static class Factory implements Vertex.Factory<SVertex> { @Override - public Vertex create() { - return new Vertex(); + public SVertex create() { + return new SVertex(); } @Override - public Vertex create(float x, float y) { - return new Vertex(x, y); + public SVertex create(float x, float y) { + return new SVertex(x, y); } @Override - public Vertex create(float x, float y, float z) { - return new Vertex(x, y, z); + public SVertex create(float x, float y, float z) { + return new SVertex(x, y, z); } @Override - public Vertex create(float[] coordsBuffer, int offset, int length) { - return new Vertex(coordsBuffer, offset, length); + public SVertex create(float[] coordsBuffer, int offset, int length) { + return new SVertex(coordsBuffer, offset, length); } /* @Override @@ -69,16 +68,16 @@ public class Vertex implements PointTex { } */ } - public Vertex() { + public SVertex() { } - public Vertex(float x, float y) { + public SVertex(float x, float y) { setCoord(x, y); } - public Vertex(float x, float y, float z) { + public SVertex(float x, float y, float z) { setCoord(x, y, z); } - public Vertex(float[] coordsBuffer, int offset, int length) { + public SVertex(float[] coordsBuffer, int offset, int length) { setCoord(coordsBuffer, offset, length); } @@ -151,7 +150,7 @@ public class Vertex implements PointTex { this.id = id; } - public int compareTo(Point p) { + public int compareTo(Vertex p) { if(VectorFloatUtil.checkEquality(coord, p.getCoord())) { return 0; } @@ -167,8 +166,8 @@ public class Vertex implements PointTex { this.texCoord[1] = t; } - public Vertex clone(){ - Vertex v = new Vertex(this.coord, 0, 3); + public SVertex clone(){ + SVertex v = new SVertex(this.coord, 0, 3); v.setOnCurve(this.onCurve); return v; } |