org.xith3d.scenegraph
Class Geometry

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.NodeComponent
          extended by org.xith3d.scenegraph.Geometry
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.VertexContainer
Direct Known Subclasses:
GeometryStripArray, IndexedGeometryArray, LineArray, PointArray, QuadArray, TriangleArray

public abstract class Geometry
extends NodeComponent
implements org.openmali.spatial.VertexContainer

A Geometry contains mesh data. Usually a Appearance is associated to it, both composing a Shape3D


Nested Class Summary
static class Geometry.Optimization
           
 
Field Summary
static int BY_REFERENCE
           
static int COLORS
           
static int COORDINATES
           
protected  GeometryDataContainer dataContainer
           
static int INTERLEAVED
           
static int NORMALS
           
static int TEXTURE_COORDINATES
           
static int VERTEX_ATTRIBUTES
           
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
Geometry(org.jagatoo.opengl.enums.GeometryArrayType type, boolean hasIndex, int coordsSize, int vertexCount, int[] stripVertexCounts, int indexCount)
           
 
Method Summary
 void addData(float[] coordData, float[] texCoordData, float[] normalData, float[] colorData)
          Super fast method add a bunch of data right into the data elements.
 void addData(org.openmali.vecmath2.Tuple3f translate, int numVertices, float[] coordData, float[] texCoordData, float[] normalData, float alpha)
          Super fast method for moving a bunch of data into the data elements.
 void addData(org.openmali.vecmath2.Tuple3f translate, int numVertices, float[] coordData, float[] texCoordData, float[] normalData, float[] colorData)
          Super fast method for moving a bunch of data into the data elements.
 void calculateFaceNormals()
          This method calculates face normals and applies them to the Geometry.
 void calculateFaceNormals(boolean apply, org.openmali.vecmath2.Vector3f[] faceNormals, org.openmali.vecmath2.Vector3f[] vertexNormals)
          This method calculates face normals (each orthogonal to its face).
abstract  Geometry cloneNodeComponent(boolean forceDuplicate)
          
protected  void duplicateNodeComponent(NodeComponent original, boolean forceDuplicate)
          
protected  void finalize()
          
 void flipNormals()
          Flips (inverts, negates) all the normals of this Geometry.
 void freeOpenGLResources(CanvasPeer canvasPeer)
          This method frees OpenGL resources (names) for all this NodeComponent and all child-components.
 org.openmali.vecmath2.Colorf getColor(int vertexIndex, org.openmali.vecmath2.Colorf colorf)
          Gets the color of the vertex at the specified index.
 void getColor(int vertexIndex, float[] floatArray)
          Gets the color of the vertex at the specified index.
 GeomNioFloatData getColorData()
           
 float[] getColorRefFloat()
           
 void getColors(int vertexIndex, float[] floatArray)
          Gets the color of the vertex at the specified index.
 long getColorsOffset()
           
 int getColorsSize()
           
 void getCoordinate(int vertexIndex, float[] floatArray)
           
<T extends org.openmali.vecmath2.Tuple3f>
T
getCoordinate(int index, T point)
           
 void getCoordinates(int vertexIndex, float[] floatArray)
           
 void getCoordinates(int vertexIndex, org.openmali.vecmath2.Tuple3f[] point3fArray)
           
 GeomNioFloatData getCoordinatesData()
           
 long getCoordinatesOffset()
           
 int getCoordinatesSize()
           
 float[] getCoordRefFloat()
           
 int getFaceSize()
           
 int getInitialVertexIndex()
           
 GeomNioFloatData getInterleavedData()
           
 int getMaxVertexCount()
           
 void getNormal(int vertexIndex, float[] floatArray)
           
 org.openmali.vecmath2.Vector3f getNormal(int index, org.openmali.vecmath2.Vector3f normal)
           
 float[] getNormalRefFloat()
           
 void getNormals(int vertexIndex, float[] floatArray)
           
 void getNormals(int index0, org.openmali.vecmath2.Vector3f[] vector3fArray)
           
 GeomNioFloatData getNormalsData()
           
 long getNormalsOffset()
           
 int getNormalsSize()
           
 int getNumTextureUnits()
           
 SceneGraphOpenGLReferences getOpenGLReference_DL_GeomData()
           
 SceneGraphOpenGLReferences getOpenGLReference_DL_TexCoords()
           
 SceneGraphOpenGLReferences getOpenGLReference_DL()
           
 Geometry.Optimization getOptimization()
           
 float[] getTexCoordRefFloat(int unit)
           
 GeomNioFloatData getTexCoordsData(int unit)
           
 int getTexCoordSetCount()
          Deprecated. replaced by getNumTextureUnits()
 int[] getTexCoordSetMap()
           
 void getTexCoordSetMap(int[] intArray)
          Gets the map for texture coordinates to texture units.
 int getTexCoordSize(int unit)
           
 long getTexCoordsOffset(int unit)
           
 void getTextureCoordinate(int unit, int vertexIndex, float[] floatArray)
          Gets the texture coordinate of the vertex at the specified index for the specified coordinates set.
<T extends org.openmali.vecmath2.TexCoordf<?>>
T
getTextureCoordinate(int unit, int vertexIndex, T texCoord)
          Gets the texture coordinate of the vertex at the specified index for the specified coordinates set.
 void getTextureCoordinates(int unit, int vertexIndex, float[] floatArray)
           
 boolean getTriangle(int i0, int i1, int i2, org.openmali.spatial.polygons.Triangle triangle)
          Retrieves the the n-th Triangle from the GeometryArray.
 org.jagatoo.opengl.enums.GeometryArrayType getType()
           
 int getValidVertexCount()
           
 boolean getVertex(int i, org.openmali.vecmath2.Tuple3f pos)
          
 GeomNioFloatData getVertexAttribData(int index)
           
 int getVertexAttribSize(int index)
           
 long getVertexAttribsOffset(int index)
           
 float getVertexAttribute(int attribIndex, int vertexIndex)
          Gets the vertex attribute of the vertex at the specified index for the specified attribute.
 void getVertexAttribute(int attribIndex, int vertexIndex, float[] floatArray)
           
 void getVertexAttribute(int attribIndex, int vertexIndex, org.openmali.vecmath2.TupleNf<?> value)
          Gets the vertex attribute of the vertex at the specified index for the specified attribute.
 void getVertexAttributes(int attribIndex, int vertexIndex, float[] floatArray)
           
 int getVertexAttributesCount()
           
 int getVertexCount()
          
 int getVertexFormat()
           
 boolean hasColorAlpha()
           
 boolean hasColors()
           
 boolean hasFeature(int flag)
           
 boolean hasIndex()
           
 boolean hasNormals()
           
 boolean hasTextureCoordinates()
           
 boolean hasTextureCoordinates(int unit)
           
 boolean hasVertexAttributes()
           
 boolean hasVertexAttributes(int attribIndex)
           
 void invertNormals()
          Inverts all the normals in place.
 boolean isBoundsDirty()
           
 boolean isInterleaved()
           
 boolean isStrip()
           
abstract  boolean isTriangulatable()
           
abstract  boolean isTriangulated()
           
 void makeInterleaved()
          Sets up the Geometry to be stored in a single NIO buffer for interleaved geometry.
 void makeInterleaved(int features, boolean colorAlpha, int[] tuSizes, int[] vaSizes)
          Sets up the Geometry to be stored in a single NIO buffer for interleaved geometry.
 void setBoundsDirty()
          Marks this Geometry's bounds dirty.
 void setColor(int vertexIndex, org.openmali.vecmath2.Colorf colorf)
          Sets the color of the vertex at the specified index.
 void setColor(int vertexIndex, float[] floatArray)
          Sets the color of the vertex at the specified index.
 void setColor(int vertexIndex, float r, float g, float b)
          Sets the color of the vertex at the specified index.
 void setColor(int vertexIndex, float r, float g, float b, float a)
          Sets the color of the vertex at the specified index.
 void setColorData(GeomNioFloatData data)
          Directly sets the color data buffer.
 void setColors(int vertexIndex, org.openmali.vecmath2.Colorf[] colorfArray)
          Sets the colors of the vertices starting at the specified index.
 void setColors(int vertexIndex, org.openmali.vecmath2.Colorf[] colorfArray, int startIndex, int length)
          Sets the colors of the vertices starting at the given index.
 void setColors(int vertexIndex, int colorSize, float[] floatArray)
          Sets the colors of the vertices starting at the specified index.
 void setColors(int vertexIndex, int colorSize, float[] floatArray, int startIndex, int length)
          Sets the colors of the vertices starting at the specified index.
 void setCoordinate(int vertexIndex, float[] floatArray)
          Sets the coordinates of the specified vertex.
 void setCoordinate(int vertexIndex, float x, float y, float z)
          Sets the coordinates of the vertex at the given index
 void setCoordinate(int vertexIndex, org.openmali.vecmath2.Tuple3f point3f)
          Sets the coordinates of the vertex at the given index
 void setCoordinateData(GeomNioFloatData data)
          Directly sets the coordinates data buffer.
 void setCoordinates(int vertexIndex, float[] floatArray)
          Sets the coordinates of the vertices starting at the specified index.
 void setCoordinates(int vertexIndex, float[] floatArray, int startIndex, int length)
          Sets the coordinates of the vertices starting at the specified index.
 void setCoordinates(int vertexIndex, java.util.List<org.openmali.vecmath2.Tuple3f> point3fList)
           
 void setCoordinates(int vertexIndex, org.openmali.vecmath2.Tuple3f[] point3fArray)
          Sets the coordinates of the vertices starting at the specified index.
 void setCoordinates(int vertexIndex, org.openmali.vecmath2.Tuple3f[] point3fArray, int startIndex, int length)
          Sets the coordinates of the vertices starting at the specified index
 void setInitialVertexIndex(int initialVertex)
          Sets the index of the first vertex which will be rendered from this geometry array.
 void setNormal(int vertexIndex, float[] floatArray)
          Sets the normal of the vertex at the given index.
 void setNormal(int vertexIndex, float x, float y, float z)
          Sets the normal of the vertex at the given index.
 void setNormal(int vertexIndex, org.openmali.vecmath2.Vector3f vector3f)
          Sets the normal of the vertex at the given index.
 void setNormalData(GeomNioFloatData data)
          Directly sets the normals data buffer.
 void setNormals(int vertexIndex, float[] floatArray)
          Sets the normals of the vertices starting at the specified index.
 void setNormals(int vertexIndex, float[] floatArray, int startIndex, int length)
          Sets the normals of the vertices starting at the specified index.
 void setNormals(int vertexIndex, org.openmali.vecmath2.Vector3f[] vector3fArray)
          Sets the normals of the vertices at the specified index.
 void setNormals(int vertexIndex, org.openmali.vecmath2.Vector3f[] vector3fArray, int startIndex, int length)
          Sets the normals of the vertices starting at the specified index.
 void setOptimization(Geometry.Optimization opt)
          Sets this Geometry's Optimization to be used.
 void setTexCoordData(int unit, GeomNioFloatData data)
          Directly sets the tex-coords data buffer for the guven texture-unit.
 void setTextureCoordinate(int unit, int vertexIndex, float s)
          Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.
 void setTextureCoordinate(int unit, int vertexIndex, float[] floatArray)
          Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.
 void setTextureCoordinate(int unit, int vertexIndex, float s, float t)
          Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.
 void setTextureCoordinate(int unit, int vertexIndex, float s, float t, float r)
          Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.
 void setTextureCoordinate(int unit, int vertexIndex, float s, float t, float r, float q)
          Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.
 void setTextureCoordinate(int unit, int vertexIndex, org.openmali.vecmath2.TexCoordf<?> texCoord)
          Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.
 void setTextureCoordinates(int unit, int vertexIndex, int texCoordSize, float[] floatArray)
          Sets the texture coordinate of the vertex starting at the specified index for the specified coordinates set.
 void setTextureCoordinates(int unit, int vertexIndex, int texCoordSize, float[] floatArray, int startIndex, int length)
          Sets the texture coordinate of the vertex starting at the specified index for the specified coordinates set.
 void setTextureCoordinates(int unit, int vertexIndex, org.openmali.vecmath2.TexCoordf<?>[] texCoordArray)
          Sets the texture coordinate of the vertex starting at the specified index for the specified coordinates set.
 void setTextureCoordinates(int unit, int vertexIndex, org.openmali.vecmath2.TexCoordf<?>[] texCoordArray, int startIndex, int length)
          Sets the texture coordinate of the vertex starting at the specified index for the specified coordinates set.
 boolean setTriangle(int i0, int i1, int i2, org.openmali.spatial.polygons.Triangle triangle)
          Applies the the n-th Triangle to the GeometryArray.
 boolean setTriangle(org.openmali.spatial.polygons.Triangle triangle)
          Applies the the n-th Triangle to the GeometryArray.
 void setValidVertexCount(int count)
          Sets the number of vertices which will be rendered from this geometry array.
 void setVertexAttribute(int attribIndex, int vertexIndex, float value)
          Sets the vertex attribute of the vertex at the specified index for the specified attribute.
 void setVertexAttribute(int attribIndex, int vertexIndex, float[] floatArray)
          Sets the vertex attribute of the vertex at the specified index for the specified attribute.
 void setVertexAttribute(int attribIndex, int vertexIndex, org.openmali.vecmath2.TupleNf<?> value)
          Sets the vertex attribute of the vertex at the specified index for the specified attribute.
 void setVertexAttributes(int attribIndex, int vertexIndex, float[] values, int attribSize)
          Sets the vertex attributes.
 void setVertexAttributes(int attribIndex, int vertexIndex, float[] values, int attribsSize, int startIndex, int length)
          Sets the vertex attributes.
 void setVertexAttributes(int attribIndex, int vertexIndex, org.openmali.vecmath2.TupleNf<?>[] values)
          Sets the vertex attributes.
 void setVertexAttributes(int attribIndex, int vertexIndex, org.openmali.vecmath2.TupleNf<?>[] values, int startIndex, int length)
          Sets the vertex attributes.
 java.lang.String toString()
          
 
Methods inherited from class org.xith3d.scenegraph.NodeComponent
freeOpenGLResources, getDuplicateOnCloneTree, getModListener, isChanged, isChanged2, setChanged, setDuplicateOnCloneTree, setModListener
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COORDINATES

public static final int COORDINATES
See Also:
Constant Field Values

NORMALS

public static final int NORMALS
See Also:
Constant Field Values

COLORS

public static final int COLORS
See Also:
Constant Field Values

TEXTURE_COORDINATES

public static final int TEXTURE_COORDINATES
See Also:
Constant Field Values

VERTEX_ATTRIBUTES

public static final int VERTEX_ATTRIBUTES
See Also:
Constant Field Values

BY_REFERENCE

public static final int BY_REFERENCE
See Also:
Constant Field Values

INTERLEAVED

public static final int INTERLEAVED
See Also:
Constant Field Values

dataContainer

protected final GeometryDataContainer dataContainer
Constructor Detail

Geometry

public Geometry(org.jagatoo.opengl.enums.GeometryArrayType type,
                boolean hasIndex,
                int coordsSize,
                int vertexCount,
                int[] stripVertexCounts,
                int indexCount)
Method Detail

getType

public final org.jagatoo.opengl.enums.GeometryArrayType getType()
Returns:
this Geometry's basic type (used by OpenGL).

isStrip

public final boolean isStrip()
Returns:
true, if this Geometry is a Strip

getFaceSize

public final int getFaceSize()
Returns:
the number of vertices per face (3 for triangles).

isTriangulatable

public abstract boolean isTriangulatable()
Returns:
true, if this Geometry is built of triangles or can at least be interpreted as triangles.

isTriangulated

public abstract boolean isTriangulated()
Returns:
true, if this Geometry is built of triangles.

getMaxVertexCount

public final int getMaxVertexCount()
Returns:
the maximum number of vertices, this geometry can hold.

getVertexCount

public int getVertexCount()

Specified by:
getVertexCount in interface org.openmali.spatial.VertexContainer

getVertex

public boolean getVertex(int i,
                         org.openmali.vecmath2.Tuple3f pos)

Specified by:
getVertex in interface org.openmali.spatial.VertexContainer

getVertexFormat

public final int getVertexFormat()
Returns:
the format of the vertices in this object.

isInterleaved

public final boolean isInterleaved()
Returns:
true, if this Geometry is constructed by interleaved data (one ByteBuffer for all data except index).

hasIndex

public final boolean hasIndex()
Returns:
true, if this Geometry has an Index.

hasColorAlpha

public final boolean hasColorAlpha()
Returns:
true, if this geometry's color component has an alpha channel.

hasFeature

public final boolean hasFeature(int flag)
Returns:
true, if this Geometry has the queried feature(s).

setOptimization

public void setOptimization(Geometry.Optimization opt)
Sets this Geometry's Optimization to be used.

Parameters:
opt -

getOptimization

public final Geometry.Optimization getOptimization()
Returns:
this Geometry's Optimization level.

setBoundsDirty

public void setBoundsDirty()
Marks this Geometry's bounds dirty. This will cause a bounds update when the Geometry is next rendered.


isBoundsDirty

public final boolean isBoundsDirty()
Returns:
true, if a bounds update is requested.

calculateFaceNormals

public void calculateFaceNormals(boolean apply,
                                 org.openmali.vecmath2.Vector3f[] faceNormals,
                                 org.openmali.vecmath2.Vector3f[] vertexNormals)
This method calculates face normals (each orthogonal to its face).

Parameters:
apply - if true, the normals are applied back to the Geometry
faceNormals - must be of size getTrianglesCount(), or null. It is filled with the face normals, if not null.
vertexNormals - must be of size getVertexCount(), or null. It is filled with the new vertex normals, if not null.
See Also:
calculateFaceNormals()

calculateFaceNormals

public void calculateFaceNormals()
This method calculates face normals and applies them to the Geometry.

See Also:
calculateFaceNormals(boolean, Vector3f[], Vector3f[])

invertNormals

public void invertNormals()
Inverts all the normals in place.


addData

public final void addData(float[] coordData,
                          float[] texCoordData,
                          float[] normalData,
                          float[] colorData)
Super fast method add a bunch of data right into the data elements.


addData

public final void addData(org.openmali.vecmath2.Tuple3f translate,
                          int numVertices,
                          float[] coordData,
                          float[] texCoordData,
                          float[] normalData,
                          float[] colorData)
Super fast method for moving a bunch of data into the data elements. The Positions are all translated according to the tuple passed in.


addData

public void addData(org.openmali.vecmath2.Tuple3f translate,
                    int numVertices,
                    float[] coordData,
                    float[] texCoordData,
                    float[] normalData,
                    float alpha)
Super fast method for moving a bunch of data into the data elements. The Positions are all translated according to the tuple passed in. The color for all the vertices are set the specified value


setCoordinateData

public final void setCoordinateData(GeomNioFloatData data)
Directly sets the coordinates data buffer.

Parameters:
data -

getCoordinatesData

public final GeomNioFloatData getCoordinatesData()
Returns:
the data buffer for coordinate data.

getCoordinatesSize

public final int getCoordinatesSize()
Returns:
3 for 3D-coordinates, etc.

getCoordinatesOffset

public final long getCoordinatesOffset()
Returns:
the offset in the data buffer, if this is interleaved data.

setNormalData

public void setNormalData(GeomNioFloatData data)
Directly sets the normals data buffer.

Parameters:
data -

getNormalsData

public final GeomNioFloatData getNormalsData()
Returns:
the data buffer for normal data.

getNormalsSize

public final int getNormalsSize()
Returns:
this size of normals (always 3).

getNormalsOffset

public final long getNormalsOffset()
Returns:
the offset in the data buffer, if this is interleaved data.

setColorData

public void setColorData(GeomNioFloatData data)
Directly sets the color data buffer.

Parameters:
data -

getColorData

public final GeomNioFloatData getColorData()
Returns:
the data buffer for color data.

getColorsSize

public final int getColorsSize()
Returns:
this size of colors (always 3 or 4, no alpha / alpha).

getColorsOffset

public final long getColorsOffset()
Returns:
the offset in the data buffer, if this is interleaved data.

setTexCoordData

public void setTexCoordData(int unit,
                            GeomNioFloatData data)
Directly sets the tex-coords data buffer for the guven texture-unit.

Parameters:
unit -
data -

getTexCoordsData

public final GeomNioFloatData getTexCoordsData(int unit)
Parameters:
unit -
Returns:
the data buffer for tex-coord data for the given texture-unit.

getTexCoordSize

public final int getTexCoordSize(int unit)
Returns:
the size of the texture coordinates of texture unit 'unit'. This is always (1, 2, 3 or 4).

getNumTextureUnits

public final int getNumTextureUnits()
Returns:
the number of texture units used in this Geometry.

getTexCoordSetCount

@Deprecated
public final int getTexCoordSetCount()
Deprecated. replaced by getNumTextureUnits()


getTexCoordSetMap

public final int[] getTexCoordSetMap()
Returns:
The map for texture coordinates to texture units. (for internal use only!)

getTexCoordSetMap

public final void getTexCoordSetMap(int[] intArray)
Gets the map for texture coordinates to texture units. (for internal use only!)

Parameters:
intArray -

getTexCoordsOffset

public final long getTexCoordsOffset(int unit)
Returns:
the offset in the data buffer, if this is interleaved data.

getVertexAttribData

public final GeomNioFloatData getVertexAttribData(int index)
Parameters:
index -
Returns:
the data buffer for vertex-attributes data.

getVertexAttribSize

public final int getVertexAttribSize(int index)
Parameters:
index -
Returns:
the size of the queried vertex attributes.

getVertexAttribsOffset

public final long getVertexAttribsOffset(int index)
Returns:
the offset in the data buffer, if this is interleaved data.

getInterleavedData

public final GeomNioFloatData getInterleavedData()
Returns:
the data buffer for interleaved data. If this Geometry is not interleaved, an error is thrown.

setInitialVertexIndex

public final void setInitialVertexIndex(int initialVertex)
Sets the index of the first vertex which will be rendered from this geometry array. The extact vertices which will be rendered is from InitialVertexIndex to InitialVertexIndex + ValidVertexCount-1.

Parameters:
initialVertex -

getInitialVertexIndex

public final int getInitialVertexIndex()
Returns:
the index of the first vertex which will be rendered from this geometry array. The extact vertices which will be rendered is from InitialVertexIndex to InitialVertexIndex + ValidVertexCount-1.

setValidVertexCount

public void setValidVertexCount(int count)
Sets the number of vertices which will be rendered from this geometry array. The extact vertices which will be rendered is from InitialVertexIndex to InitialVertexIndex + ValidVertexCount-1.

Parameters:
count -

getValidVertexCount

public final int getValidVertexCount()
Returns:
the number of vertices which will be rendered from this geometry array. The extact vertices which will be rendered is from InitialVertexIndex to InitialVertexIndex + ValidVertexCount-1.

setCoordinate

public final void setCoordinate(int vertexIndex,
                                float[] floatArray)
Sets the coordinates of the specified vertex. The coordinates should occupy the first three indices of the given array.


setCoordinates

public final void setCoordinates(int vertexIndex,
                                 float[] floatArray,
                                 int startIndex,
                                 int length)
Sets the coordinates of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to be modified.
floatArray - The new coordinates. The size of the array must be a multiple of 3.
startIndex - The index of the first coordinate in the given array. The first read item of the array will be startIndex*3.
length - The number of vertices to copy

setCoordinates

public final void setCoordinates(int vertexIndex,
                                 float[] floatArray)
Sets the coordinates of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to modify
floatArray - The new coordinates. The size of the array must be a multiple of 3.

setCoordinate

public final void setCoordinate(int vertexIndex,
                                org.openmali.vecmath2.Tuple3f point3f)
Sets the coordinates of the vertex at the given index

Parameters:
vertexIndex - The index of the vertex to modify
point3f - The new coordinates

setCoordinate

public final void setCoordinate(int vertexIndex,
                                float x,
                                float y,
                                float z)
Sets the coordinates of the vertex at the given index

Parameters:
vertexIndex - The index of the vertex to modify
x - The new coordinates
y - The new coordinates
z - The new coordinates

setCoordinates

public final void setCoordinates(int vertexIndex,
                                 org.openmali.vecmath2.Tuple3f[] point3fArray)
Sets the coordinates of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to modify
point3fArray - The new coordinates.

setCoordinates

public final void setCoordinates(int vertexIndex,
                                 org.openmali.vecmath2.Tuple3f[] point3fArray,
                                 int startIndex,
                                 int length)
Sets the coordinates of the vertices starting at the specified index

Parameters:
vertexIndex - The index of the first vertex to be modified.
point3fArray - The new coordinates
startIndex - The index of the first coordinate in the given array
length - The number of coordinates to copy

setCoordinates

public final void setCoordinates(int vertexIndex,
                                 java.util.List<org.openmali.vecmath2.Tuple3f> point3fList)

getCoordinate

public final <T extends org.openmali.vecmath2.Tuple3f> T getCoordinate(int index,
                                                                       T point)

getCoordinate

public final void getCoordinate(int vertexIndex,
                                float[] floatArray)

getCoordinates

public final void getCoordinates(int vertexIndex,
                                 org.openmali.vecmath2.Tuple3f[] point3fArray)

getCoordinates

public final void getCoordinates(int vertexIndex,
                                 float[] floatArray)

hasNormals

public final boolean hasNormals()
Returns:
true, if this geometry contains normal data.

setNormal

public final void setNormal(int vertexIndex,
                            float[] floatArray)
Sets the normal of the vertex at the given index.

Parameters:
vertexIndex - The index of the vertex to modify
floatArray - The new normal data. Its size must be a multiple of 3.

setNormals

public final void setNormals(int vertexIndex,
                             float[] floatArray)
Sets the normals of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to modify
floatArray - The new normals. Its size must be a multiple of 3.

setNormals

public final void setNormals(int vertexIndex,
                             float[] floatArray,
                             int startIndex,
                             int length)
Sets the normals of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to modify
floatArray - The new normal data. Its size must be a multiple of 3.
startIndex - The first coordinate to use in the given array. The first element of the array to be used will be startIndex*3.
length - The number of vertices to modify

setNormal

public final void setNormal(int vertexIndex,
                            org.openmali.vecmath2.Vector3f vector3f)
Sets the normal of the vertex at the given index.

Parameters:
vertexIndex - THe index of the vertex to modify
vector3f - The new normal

setNormal

public final void setNormal(int vertexIndex,
                            float x,
                            float y,
                            float z)
Sets the normal of the vertex at the given index.

Parameters:
vertexIndex - THe index of the vertex to modify
x - The new normal
y - The new normal
z - The new normal

setNormals

public final void setNormals(int vertexIndex,
                             org.openmali.vecmath2.Vector3f[] vector3fArray)
Sets the normals of the vertices at the specified index.

Parameters:
vertexIndex - The index of the first vertex to modify
vector3fArray - The new normals

setNormals

public final void setNormals(int vertexIndex,
                             org.openmali.vecmath2.Vector3f[] vector3fArray,
                             int startIndex,
                             int length)
Sets the normals of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to modify
vector3fArray - The new normals
startIndex - The index of the first coordinate to use in the given array.
length - The number of vertices to modify

getNormal

public final org.openmali.vecmath2.Vector3f getNormal(int index,
                                                      org.openmali.vecmath2.Vector3f normal)

getNormal

public final void getNormal(int vertexIndex,
                            float[] floatArray)

getNormals

public final void getNormals(int vertexIndex,
                             float[] floatArray)

getNormals

public final void getNormals(int index0,
                             org.openmali.vecmath2.Vector3f[] vector3fArray)

flipNormals

public void flipNormals()
Flips (inverts, negates) all the normals of this Geometry.

Throws:
Error, - if this Geometry doesn't currently have normals.

hasColors

public final boolean hasColors()
Returns:
true, if this Geometry contains color data.

setColor

public final void setColor(int vertexIndex,
                           float[] floatArray)
Sets the color of the vertex at the specified index.

Parameters:
vertexIndex - The index of the vertex to modify
floatArray - The new color data. The first #colorSize elements will be used.

setColors

public final void setColors(int vertexIndex,
                            int colorSize,
                            float[] floatArray)
Sets the colors of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to modify
colorSize -
floatArray - The new color value. Its size must be a multiple of #colorSize.

setColors

public final void setColors(int vertexIndex,
                            int colorSize,
                            float[] floatArray,
                            int startIndex,
                            int length)
Sets the colors of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to be modified.
floatArray - The new color data. The size of the array must be a multiple of #colorSize.
colorSize -
startIndex - The index of the first color in the given array. The first read item of the array will be startIndex*colorSize.
length - The number of colors to copy

setColor

public final void setColor(int vertexIndex,
                           org.openmali.vecmath2.Colorf colorf)
Sets the color of the vertex at the specified index.

Parameters:
vertexIndex - The index of the vertex to modify
colorf - The new color.

setColor

public final void setColor(int vertexIndex,
                           float r,
                           float g,
                           float b)
Sets the color of the vertex at the specified index.

Parameters:
vertexIndex - The index of the vertex to modify
r -
g -
b -

setColor

public final void setColor(int vertexIndex,
                           float r,
                           float g,
                           float b,
                           float a)
Sets the color of the vertex at the specified index.

Parameters:
vertexIndex - The index of the vertex to modify
r -
g -
b -
a -

setColors

public final void setColors(int vertexIndex,
                            org.openmali.vecmath2.Colorf[] colorfArray)
Sets the colors of the vertices starting at the specified index.

Parameters:
vertexIndex - The index of the first vertex to modify.
colorfArray - The new color values.

setColors

public final void setColors(int vertexIndex,
                            org.openmali.vecmath2.Colorf[] colorfArray,
                            int startIndex,
                            int length)
Sets the colors of the vertices starting at the given index.

Parameters:
vertexIndex - The index of the first vertex to modify
colorfArray - The new color data.
startIndex - The index of the first color in the given array
length - The number of vertices to modify.

getColor

public final org.openmali.vecmath2.Colorf getColor(int vertexIndex,
                                                   org.openmali.vecmath2.Colorf colorf)
Gets the color of the vertex at the specified index.

Parameters:
vertexIndex - The index of the vertex to modify
colorf - The new color.

getColor

public final void getColor(int vertexIndex,
                           float[] floatArray)
Gets the color of the vertex at the specified index.

Parameters:
vertexIndex - The index of the vertex to modify
floatArray -

getColors

public final void getColors(int vertexIndex,
                            float[] floatArray)
Gets the color of the vertex at the specified index.

Parameters:
vertexIndex - The index of the vertex to modify
colorf - The new color.

hasTextureCoordinates

public final boolean hasTextureCoordinates()
Returns:
true, if this Geometry contains texture-coordinate data (for any texture-unit).

hasTextureCoordinates

public final boolean hasTextureCoordinates(int unit)
Returns:
true, if this Geometry contains texture-coordinate data (for the given texture-unit).

setTextureCoordinate

public final void setTextureCoordinate(int unit,
                                       int vertexIndex,
                                       float[] floatArray)
Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the vertex to modify
floatArray - The new texture coordinate data. Its size must be 2, 3 or 4.

setTextureCoordinates

public final void setTextureCoordinates(int unit,
                                        int vertexIndex,
                                        int texCoordSize,
                                        float[] floatArray)
Sets the texture coordinate of the vertex starting at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the first vertex to modify
texCoordSize - 1, 2, 3 or 4
floatArray - The new coordinate data. Its size must be a multiple of 2, 3 or 4 depending on texCoordSet format.

setTextureCoordinates

public final void setTextureCoordinates(int unit,
                                        int vertexIndex,
                                        int texCoordSize,
                                        float[] floatArray,
                                        int startIndex,
                                        int length)
Sets the texture coordinate of the vertex starting at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the first vertex to modify
texCoordSize -
floatArray - The new coordinate data. Its size must be a multiple of 2.
startIndex -
length -

setTextureCoordinate

public final void setTextureCoordinate(int unit,
                                       int vertexIndex,
                                       float s)
Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the vertex to modify
s -

setTextureCoordinate

public final void setTextureCoordinate(int unit,
                                       int vertexIndex,
                                       float s,
                                       float t)
Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the vertex to modify
s -
t -

setTextureCoordinate

public final void setTextureCoordinate(int unit,
                                       int vertexIndex,
                                       float s,
                                       float t,
                                       float r)
Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the vertex to modify
s -
t -
r -

setTextureCoordinate

public final void setTextureCoordinate(int unit,
                                       int vertexIndex,
                                       float s,
                                       float t,
                                       float r,
                                       float q)
Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the vertex to modify
s -
t -
r -
q -

setTextureCoordinate

public final void setTextureCoordinate(int unit,
                                       int vertexIndex,
                                       org.openmali.vecmath2.TexCoordf<?> texCoord)
Sets the texture coordinate of the vertex at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the vertex to modify
texCoord -

setTextureCoordinates

public final void setTextureCoordinates(int unit,
                                        int vertexIndex,
                                        org.openmali.vecmath2.TexCoordf<?>[] texCoordArray)
Sets the texture coordinate of the vertex starting at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the first vertex to modify
texCoordArray -

setTextureCoordinates

public final void setTextureCoordinates(int unit,
                                        int vertexIndex,
                                        org.openmali.vecmath2.TexCoordf<?>[] texCoordArray,
                                        int startIndex,
                                        int length)
Sets the texture coordinate of the vertex starting at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the first vertex to modify
texCoordArray -
startIndex -
length -

getTextureCoordinate

public final void getTextureCoordinate(int unit,
                                       int vertexIndex,
                                       float[] floatArray)
Gets the texture coordinate of the vertex at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the vertex to modify
floatArray - The new texture coordinate data. Its size must be 2, 3 or 4.

getTextureCoordinates

public final void getTextureCoordinates(int unit,
                                        int vertexIndex,
                                        float[] floatArray)

getTextureCoordinate

public final <T extends org.openmali.vecmath2.TexCoordf<?>> T getTextureCoordinate(int unit,
                                                                                   int vertexIndex,
                                                                                   T texCoord)
Gets the texture coordinate of the vertex at the specified index for the specified coordinates set.

Parameters:
unit - The coordinates set.
vertexIndex - The index of the vertex to modify
texCoord -

hasVertexAttributes

public final boolean hasVertexAttributes()
Returns:
true, if this Geometry contains vertex-attribute data.

hasVertexAttributes

public final boolean hasVertexAttributes(int attribIndex)
Parameters:
attribIndex -
Returns:
true, if this Geometry contains vertex-attribute data at the given index.

getVertexAttributesCount

public final int getVertexAttributesCount()
Returns:
the number of vertex attributes in the Geometry.

setVertexAttribute

public final void setVertexAttribute(int attribIndex,
                                     int vertexIndex,
                                     float[] floatArray)
Sets the vertex attribute of the vertex at the specified index for the specified attribute.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the vertex to modify
floatArray - The new attribute data. Its size must be 1, 2, 3 or 4.

setVertexAttributes

public final void setVertexAttributes(int attribIndex,
                                      int vertexIndex,
                                      float[] values,
                                      int attribSize)
Sets the vertex attributes.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the first vertex to modify
values - The new attribute data.
attribSize - the size of each attribute element (1, 2, 3, 4)

setVertexAttributes

public final void setVertexAttributes(int attribIndex,
                                      int vertexIndex,
                                      float[] values,
                                      int attribsSize,
                                      int startIndex,
                                      int length)
Sets the vertex attributes.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the first vertex to modify
values - The new attribute data.
attribsSize - (1, 2, 3, 4)
startIndex -
length -

setVertexAttribute

public final void setVertexAttribute(int attribIndex,
                                     int vertexIndex,
                                     float value)
Sets the vertex attribute of the vertex at the specified index for the specified attribute.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the vertex to modify
value - The new attribute data.

setVertexAttribute

public final void setVertexAttribute(int attribIndex,
                                     int vertexIndex,
                                     org.openmali.vecmath2.TupleNf<?> value)
Sets the vertex attribute of the vertex at the specified index for the specified attribute.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the vertex to modify
value - The new attribute data.

setVertexAttributes

public final void setVertexAttributes(int attribIndex,
                                      int vertexIndex,
                                      org.openmali.vecmath2.TupleNf<?>[] values)
Sets the vertex attributes.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the first vertex to modify
values - The new attribute data.

setVertexAttributes

public final void setVertexAttributes(int attribIndex,
                                      int vertexIndex,
                                      org.openmali.vecmath2.TupleNf<?>[] values,
                                      int startIndex,
                                      int length)
Sets the vertex attributes.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the first vertex to modify
values - The new attribute data.
startIndex -
length -

getVertexAttribute

public final void getVertexAttribute(int attribIndex,
                                     int vertexIndex,
                                     float[] floatArray)

getVertexAttributes

public final void getVertexAttributes(int attribIndex,
                                      int vertexIndex,
                                      float[] floatArray)

getVertexAttribute

public final float getVertexAttribute(int attribIndex,
                                      int vertexIndex)
Gets the vertex attribute of the vertex at the specified index for the specified attribute.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the vertex to modify

getVertexAttribute

public final void getVertexAttribute(int attribIndex,
                                     int vertexIndex,
                                     org.openmali.vecmath2.TupleNf<?> value)
Gets the vertex attribute of the vertex at the specified index for the specified attribute.

Parameters:
attribIndex - The attributes set.
vertexIndex - The index of the vertex to modify
value - The buffer for the attribute data.

setTriangle

public final boolean setTriangle(int i0,
                                 int i1,
                                 int i2,
                                 org.openmali.spatial.polygons.Triangle triangle)
Applies the the n-th Triangle to the GeometryArray. This method must be overridden by concrete classes to fix the vertex-index (e.g. for an IndexedTriangleArray)

Parameters:
i0 - the first triangle's vertex-index
i1 - the second triangle's vertex-index
i2 - the third triangle's vertex-index
triangle -
Returns:
true, if the triangle could be applied

setTriangle

public final boolean setTriangle(org.openmali.spatial.polygons.Triangle triangle)
Applies the the n-th Triangle to the GeometryArray. This method must be overridden by concrete classes to fix the vertex-index (e.g. for an IndexedTriangleArray)

Parameters:
triangle -
Returns:
true, if the triangle could be applied

getTriangle

public final boolean getTriangle(int i0,
                                 int i1,
                                 int i2,
                                 org.openmali.spatial.polygons.Triangle triangle)
Retrieves the the n-th Triangle from the GeometryArray. This method must be overridden by concrete classes to fix the vertex-index (e.g. for an IndexedTriangleArray)

Parameters:
i0 - the first triangle's vertex-index
i1 - the second triangle's vertex-index
i2 - the third triangle's vertex-index
triangle -
Returns:
true, if the triangle could be retrieved

getCoordRefFloat

public final float[] getCoordRefFloat()

getColorRefFloat

public final float[] getColorRefFloat()

getNormalRefFloat

public final float[] getNormalRefFloat()

getTexCoordRefFloat

public final float[] getTexCoordRefFloat(int unit)

getOpenGLReference_DL_GeomData

public final SceneGraphOpenGLReferences getOpenGLReference_DL_GeomData()

getOpenGLReference_DL_TexCoords

public final SceneGraphOpenGLReferences getOpenGLReference_DL_TexCoords()

getOpenGLReference_DL

public final SceneGraphOpenGLReferences getOpenGLReference_DL()

finalize

protected void finalize()

Overrides:
finalize in class java.lang.Object

freeOpenGLResources

public void freeOpenGLResources(CanvasPeer canvasPeer)
This method frees OpenGL resources (names) for all this NodeComponent and all child-components.

Specified by:
freeOpenGLResources in class NodeComponent

duplicateNodeComponent

protected void duplicateNodeComponent(NodeComponent original,
                                      boolean forceDuplicate)

Overrides:
duplicateNodeComponent in class NodeComponent

makeInterleaved

public final void makeInterleaved(int features,
                                  boolean colorAlpha,
                                  int[] tuSizes,
                                  int[] vaSizes)
Sets up the Geometry to be stored in a single NIO buffer for interleaved geometry.

Parameters:
features -
colorAlpha -
tuSizes - the sizes of the texture-units (may be null, if not contained in the features mask)
vaSizes - the sizes of the vertex-arrays (may be null, if not contained in the features mask)

makeInterleaved

public final void makeInterleaved()
Sets up the Geometry to be stored in a single NIO buffer for interleaved geometry.


toString

public java.lang.String toString()

Overrides:
toString in class SceneGraphObject

cloneNodeComponent

public abstract Geometry cloneNodeComponent(boolean forceDuplicate)

Specified by:
cloneNodeComponent in class NodeComponent