de.javagl.swogl.geometry
Class AbstractGeometry

java.lang.Object
  extended by de.javagl.swogl.geometry.AbstractGeometry
All Implemented Interfaces:
Geometry

public class AbstractGeometry
extends java.lang.Object
implements Geometry

Abstract base implementation of a Geometry


Constructor Summary
protected AbstractGeometry()
          Creates a new AbytractGeometry
 
Method Summary
protected  void addNormal(javax.vecmath.Tuple3f normal)
          Adds copy of the given normal to this geometry
protected  void addTexCoord(javax.vecmath.TexCoord2f texCoord)
          Add copy of the given texture coordinate to this geometry
protected  void addTriangle(int i0, int i1, int i2)
          Add the triangle consisting of the given indices to this geometry.
protected  void addVertex(javax.vecmath.Tuple3f vertex)
          Add a copy of the given vertex to this geometry.
 boolean areTexCoordsModified()
          Returns whether the texture coordinates have been modified
 boolean areVerticesModified()
          Returns whether the vertices have been modified
 void getNormal(int index, javax.vecmath.Tuple3f normal)
          Stores the normal with the given index in the given argument
 int getNumTriangles()
          Returns the number of triangles in this Geometry
 int getNumVertices()
          Returns the number of vertices in this Geometry
 void getTexCoord(int index, javax.vecmath.Tuple2f texCoord)
          Stores the texture coordinates of the vertex with the given index in the given argument
 void getVertex(int index, javax.vecmath.Tuple3f vertex)
          Stores the vertex with the given index in the given argument
 int getVertexIndex(int index)
          Returns the specified vertex index.
 void setNormal(int index, javax.vecmath.Tuple3f normal)
          Sets the normal of the vertex with the given index After modifying vertices, setVerticesModified(true) should be called, so that the rendering may take the modified data into account.
 void setTexCoord(int index, javax.vecmath.Tuple2f texCoord)
          Set the texture coordinates of the vertex with the given index After modifying coordinates, setTexCoordsModified(true) should be called, so that the rendering may take the modified data into account.
 void setTexCoordsModified(boolean modified)
          Set the flag which indicates that the texture coordinates of this geometry have been modified, and should be updated by the renderer before the next rendering pass.
 void setVertex(int index, javax.vecmath.Tuple3f vertex)
          Set the coordinates of the vertex with the specified index.
 void setVerticesModified(boolean modified)
          Set the flag which indicates that the vertex positions of this geometry have been modified, and should be updated by the renderer before the next rendering pass.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGeometry

protected AbstractGeometry()
Creates a new AbytractGeometry

Method Detail

addVertex

protected void addVertex(javax.vecmath.Tuple3f vertex)
Add a copy of the given vertex to this geometry.

Parameters:
vertex - The vertex

addTexCoord

protected void addTexCoord(javax.vecmath.TexCoord2f texCoord)
Add copy of the given texture coordinate to this geometry

Parameters:
texCoord - The texture coordinate

addNormal

protected void addNormal(javax.vecmath.Tuple3f normal)
Adds copy of the given normal to this geometry

Parameters:
normal - The normal

addTriangle

protected void addTriangle(int i0,
                           int i1,
                           int i2)
Add the triangle consisting of the given indices to this geometry.

Parameters:
i0 - The first index
i1 - The second index
i2 - The third index

setVerticesModified

public void setVerticesModified(boolean modified)
Description copied from interface: Geometry
Set the flag which indicates that the vertex positions of this geometry have been modified, and should be updated by the renderer before the next rendering pass.

Specified by:
setVerticesModified in interface Geometry
Parameters:
modified - Whether the vertices have been modified

areVerticesModified

public boolean areVerticesModified()
Description copied from interface: Geometry
Returns whether the vertices have been modified

Specified by:
areVerticesModified in interface Geometry
Returns:
Whether the vertices have been modified

setTexCoordsModified

public void setTexCoordsModified(boolean modified)
Description copied from interface: Geometry
Set the flag which indicates that the texture coordinates of this geometry have been modified, and should be updated by the renderer before the next rendering pass.

Specified by:
setTexCoordsModified in interface Geometry
Parameters:
modified - Whether the texture coordinates have been modified

areTexCoordsModified

public boolean areTexCoordsModified()
Description copied from interface: Geometry
Returns whether the texture coordinates have been modified

Specified by:
areTexCoordsModified in interface Geometry
Returns:
Whether the texture coordinates have been modified

getNumTriangles

public int getNumTriangles()
Description copied from interface: Geometry
Returns the number of triangles in this Geometry

Specified by:
getNumTriangles in interface Geometry
Returns:
The number of triangles in this Geometry

getVertexIndex

public int getVertexIndex(int index)
Description copied from interface: Geometry
Returns the specified vertex index. Three consecutive indices are the indices of the vertices of a single triangle

Specified by:
getVertexIndex in interface Geometry
Parameters:
index - The number of the index to return
Returns:
The index

getNumVertices

public int getNumVertices()
Description copied from interface: Geometry
Returns the number of vertices in this Geometry

Specified by:
getNumVertices in interface Geometry
Returns:
The number of vertices in this Geometry

getVertex

public void getVertex(int index,
                      javax.vecmath.Tuple3f vertex)
Description copied from interface: Geometry
Stores the vertex with the given index in the given argument

Specified by:
getVertex in interface Geometry
Parameters:
index - The index of the vertex
vertex - Will store the vertex

setVertex

public void setVertex(int index,
                      javax.vecmath.Tuple3f vertex)
Description copied from interface: Geometry
Set the coordinates of the vertex with the specified index. After modifying vertices, setVerticesModified(true) should be called, so that the rendering may take the modified data into account.

Specified by:
setVertex in interface Geometry
Parameters:
index - The index of the vertex
vertex - The coordinates the vertex should have

getNormal

public void getNormal(int index,
                      javax.vecmath.Tuple3f normal)
Description copied from interface: Geometry
Stores the normal with the given index in the given argument

Specified by:
getNormal in interface Geometry
Parameters:
index - The index of the vertex whose normal should be obtained
normal - Will store the normal

setNormal

public void setNormal(int index,
                      javax.vecmath.Tuple3f normal)
Description copied from interface: Geometry
Sets the normal of the vertex with the given index After modifying vertices, setVerticesModified(true) should be called, so that the rendering may take the modified data into account.

Specified by:
setNormal in interface Geometry
Parameters:
index - The index of the vertex whose normal should be set
normal - The normal to set for the vertex

getTexCoord

public void getTexCoord(int index,
                        javax.vecmath.Tuple2f texCoord)
Description copied from interface: Geometry
Stores the texture coordinates of the vertex with the given index in the given argument

Specified by:
getTexCoord in interface Geometry
Parameters:
index - The index of the vertex whose texture coordinates should be obtained
texCoord - Will store the texture coordinates

setTexCoord

public void setTexCoord(int index,
                        javax.vecmath.Tuple2f texCoord)
Description copied from interface: Geometry
Set the texture coordinates of the vertex with the given index After modifying coordinates, setTexCoordsModified(true) should be called, so that the rendering may take the modified data into account.

Specified by:
setTexCoord in interface Geometry
Parameters:
index - The index of the vertex whose texture coordinates should be set
texCoord - The texture coordinates to set