org.jagatoo.geometry
Class GeometryDataContainer

java.lang.Object
  extended by org.jagatoo.geometry.SimpleGeometryDataContainer
      extended by org.jagatoo.geometry.GeometryDataContainer
All Implemented Interfaces:
org.openmali.spatial.VertexContainer

public class GeometryDataContainer
extends SimpleGeometryDataContainer

This is the advanced (regular) version of a geometry data container. It additionally holds (or can hold) normals, colors, texture-coordinates and vertex-attributes.


Field Summary
protected  GeomNioFloatData colors
           
static int COLORS
           
protected  int colorSize
           
protected  long colorsOffset
           
protected  GeomNioFloatData normals
           
static int NORMALS
           
protected  long normalsOffset
           
protected  GeomNioFloatData[] texCoords
           
protected  long[] texCoordsOffsets
           
static int TEXTURE_COORDINATES
           
static int VERTEX_ATTRIBUTES
           
protected  GeomNioFloatData[] vertexAttribs
           
protected  long[] vertexAttribsOffsets
           
 
Fields inherited from class org.jagatoo.geometry.SimpleGeometryDataContainer
BY_REFERENCE, COORDINATES, coords, coordsOffset, indexData, INTERLEAVED, interleavedData, isInterleaved, maxVertices, numIndices, numVertices, reversed
 
Constructor Summary
protected GeometryDataContainer(GeometryArrayType type, boolean hasIndex, int coordsSize, int vertexCount, int[] stripCounts, int indexCount)
           
  GeometryDataContainer(GeometryArrayType type, int coordsSize, int vertexCount)
           
  GeometryDataContainer(GeometryArrayType type, int coordsSize, int vertexCount, int indexCount)
           
  GeometryDataContainer(GeometryArrayType type, int coordsSize, int vertexCount, int[] stripCounts)
           
  GeometryDataContainer(GeometryArrayType type, int coordsSize, int vertexCount, int[] stripCounts, 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(float translateX, float translateY, float translateZ, 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(float translateX, float translateY, float translateZ, int numVertices, float[] coordData, float[] texCoordData, float[] normalData, float[] colorData)
          Super fast method for moving a bunch of data into the data elements.
protected  void checkAttributeExistence(int attribIndex, int attribSize, boolean b)
           
protected  boolean checkColorsExistence(int colorSize, boolean b)
           
protected  boolean checkNormalsExistence(boolean b)
           
protected  boolean checkTexCoordExistence(int unit, int texCoordSize, boolean b)
           
protected  void copyFrom(SimpleGeometryDataContainer original, boolean forceDuplicate)
          Copies details from the given container.
protected  void createCoordinates()
           
 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 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()
           
 float[] getTexCoordRefFloat(int unit)
           
 GeomNioFloatData getTexCoordsData(int unit)
           
 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.
 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 getVertexFormat()
           
 boolean hasColorAlpha()
           
 boolean hasColors()
           
 boolean hasFeature(int flag)
           
 boolean hasNormals()
           
 boolean hasTextureCoordinates()
           
 boolean hasTextureCoordinates(int unit)
           
 boolean hasVertexAttributes()
           
 boolean hasVertexAttributes(int attribIndex)
           
 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 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 setCoordinateData(GeomNioFloatData data)
          Directly sets the coordinates data buffer.
 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 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.
 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.
 
Methods inherited from class org.jagatoo.geometry.SimpleGeometryDataContainer
checkCoordsExistence, getCoordinate, getCoordinate, getCoordinates, getCoordinates, getCoordinatesData, getCoordinatesOffset, getCoordinatesSize, getCoordRefFloat, getFaceSize, getIndex, getIndex, getIndexCount, getIndexData, getInitialIndex, getInterleavedData, getMaxVertexCount, getNumStrips, getStripCounts, getStripCounts, getType, getValidVertexCount, getVertex, getVertexCount, hasIndex, isInterleaved, isStrip, newNioFloatData, newNioIntData, setCoordinate, setCoordinate, setCoordinate, setCoordinates, setCoordinates, setCoordinates, setCoordinates, setCoordinates, setIndex, setIndex, setInitialIndex, setNioBuffers, setStripCounts, setTriangle, setValidVertexCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

normals

protected GeomNioFloatData normals

colors

protected GeomNioFloatData colors

texCoords

protected GeomNioFloatData[] texCoords

vertexAttribs

protected GeomNioFloatData[] vertexAttribs

colorSize

protected int colorSize

normalsOffset

protected long normalsOffset

colorsOffset

protected long colorsOffset

texCoordsOffsets

protected final long[] texCoordsOffsets

vertexAttribsOffsets

protected final long[] vertexAttribsOffsets
Constructor Detail

GeometryDataContainer

protected GeometryDataContainer(GeometryArrayType type,
                                boolean hasIndex,
                                int coordsSize,
                                int vertexCount,
                                int[] stripCounts,
                                int indexCount)

GeometryDataContainer

public GeometryDataContainer(GeometryArrayType type,
                             int coordsSize,
                             int vertexCount)

GeometryDataContainer

public GeometryDataContainer(GeometryArrayType type,
                             int coordsSize,
                             int vertexCount,
                             int indexCount)

GeometryDataContainer

public GeometryDataContainer(GeometryArrayType type,
                             int coordsSize,
                             int vertexCount,
                             int[] stripCounts)

GeometryDataContainer

public GeometryDataContainer(GeometryArrayType type,
                             int coordsSize,
                             int vertexCount,
                             int[] stripCounts,
                             int indexCount)
Method Detail

getVertexFormat

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

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).

addData

public 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 void addData(float translateX,
                    float translateY,
                    float translateZ,
                    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(float translateX,
                    float translateY,
                    float translateZ,
                    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 void setCoordinateData(GeomNioFloatData data)
Directly sets the coordinates data buffer.

Overrides:
setCoordinateData in class SimpleGeometryDataContainer
Parameters:
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.

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.

createCoordinates

protected void createCoordinates()
Overrides:
createCoordinates in class SimpleGeometryDataContainer

hasNormals

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

checkNormalsExistence

protected final boolean checkNormalsExistence(boolean b)

setNormal

public 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.

setNormal

public 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

setNormals

public 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 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 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

setNormals

public 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

setNormal

public 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

getNormal

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

getNormal

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

getNormals

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

getNormals

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

hasColors

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

checkColorsExistence

protected final boolean checkColorsExistence(int colorSize,
                                             boolean b)

setColor

public 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.

setColor

public 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.

setColors

public 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 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 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

setColors

public 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.

setColor

public 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 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 -

getColor

public 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 -

getColor

public 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.

getColors

public 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).

checkTexCoordExistence

protected final boolean checkTexCoordExistence(int unit,
                                               int texCoordSize,
                                               boolean b)

setTextureCoordinate

public 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.

setTextureCoordinate

public 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 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 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 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 -

setTextureCoordinates

public 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 -

setTextureCoordinate

public 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 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 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 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 -

getTextureCoordinate

public 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.

getTextureCoordinate

public <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 -

getTextureCoordinates

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

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.

checkAttributeExistence

protected final void checkAttributeExistence(int attribIndex,
                                             int attribSize,
                                             boolean b)

setVertexAttribute

public 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.

setVertexAttribute

public 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 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 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 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 -

setVertexAttributes

public 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 -

setVertexAttribute

public 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.

getVertexAttribute

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

getVertexAttribute

public 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.

getVertexAttributes

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

getVertexAttribute

public 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

setTriangle

public 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)

Overrides:
setTriangle in class SimpleGeometryDataContainer
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

getTriangle

public 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)

Overrides:
getTriangle in class SimpleGeometryDataContainer
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

getColorRefFloat

public float[] getColorRefFloat()

getNormalRefFloat

public float[] getNormalRefFloat()

getTexCoordRefFloat

public float[] getTexCoordRefFloat(int unit)

makeInterleaved

public 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 void makeInterleaved()
Sets up the Geometry to be stored in a single NIO buffer for interleaved geometry.


copyFrom

protected void copyFrom(SimpleGeometryDataContainer original,
                        boolean forceDuplicate)
Description copied from class: SimpleGeometryDataContainer
Copies details from the given container.

Overrides:
copyFrom in class SimpleGeometryDataContainer