de.grogra.imp3d.objects
Class PolygonMesh

java.lang.Object
  extended by de.grogra.imp3d.objects.PolygonsBase
      extended by de.grogra.imp3d.objects.PolygonMesh
All Implemented Interfaces:
ContextDependent, Polygons, Polygonization, java.io.Serializable

public class PolygonMesh
extends PolygonsBase

This class encapsulates a static PolygonArray. Polygonalization is just making a copy of the stored polygon array to the output array.

Author:
Reinhard Hemmerling
See Also:
Serialized Form

Field Summary
protected  int[] indices
           
protected  float[] n
           
protected  int stamp
           
protected  float[] t
           
protected  float[] v
           
 
Fields inherited from interface de.grogra.imp3d.Polygonization
COMPUTE_NORMALS, COMPUTE_UV
 
Constructor Summary
PolygonMesh()
           
 
Method Summary
 float[] computeMaxMin()
          Computes max and min values of vertex data.
 float[] computeMaxMin(Matrix4d m)
          Computes max and min values of vertex data.
 int[] getIndexData()
           
 float[] getNormalData()
           
 int getStamp()
           
 float[] getTextureData()
           
 float[] getVertexData()
           
 void incrementStamp()
           
static void multiplyMatrixWithTuple3d(Matrix4d matrix, Tuple3d point)
          Multiplies matrix with point and writes result into point.
 void polygonize(ContextDependent source, GraphState gs, PolygonArray out, int flags, float flatness)
          Performs the polygonization of the source into polygons.
 void setIndexData(IntList indexData)
           
 void setNormalData(float[] normalData)
           
 void setTextureData(float[] textureData)
           
 void setVertexData(FloatList vertexData)
           
 void writeStamp(Cache.Entry cache, GraphState gs)
          Writes a stamp of the context into cache.
 
Methods inherited from class de.grogra.imp3d.objects.PolygonsBase
dependsOnContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indices

protected int[] indices

n

protected float[] n

stamp

protected int stamp

t

protected float[] t

v

protected float[] v
Constructor Detail

PolygonMesh

public PolygonMesh()
Method Detail

computeMaxMin

public float[] computeMaxMin()
Computes max and min values of vertex data. Needed for BoundingBox computation.

Returns:
Array{MaxX, MinX, MaxY, MinY, MaxZ, MinZ}

computeMaxMin

public float[] computeMaxMin(Matrix4d m)
Computes max and min values of vertex data. Needed for BoundingBox computation.

Parameters:
m - Use can use m to transform all vertices to global coordinates.
Returns:
Array{MaxX, MinX, MaxY, MinY, MaxZ, MinZ}

getIndexData

public final int[] getIndexData()

getNormalData

public final float[] getNormalData()

getStamp

public int getStamp()
Overrides:
getStamp in class PolygonsBase

getTextureData

public final float[] getTextureData()

getVertexData

public final float[] getVertexData()

incrementStamp

public void incrementStamp()

multiplyMatrixWithTuple3d

public static void multiplyMatrixWithTuple3d(Matrix4d matrix,
                                             Tuple3d point)
Multiplies matrix with point and writes result into point.

Parameters:
matrix -
point -

polygonize

public void polygonize(ContextDependent source,
                       GraphState gs,
                       PolygonArray out,
                       int flags,
                       float flatness)
Description copied from interface: Polygonization
Performs the polygonization of the source into polygons. The field out.userObject is not modified.

Parameters:
source - the data source as reported by a previous invocation of Polygonizable.getPolygonizableSource(GraphState) with the same gs
gs - the current graph state
out - the polygons are written to out
flags - combination of bit masks
flatness - a parameter for the degree of flatness, a typical value is 1

setIndexData

public void setIndexData(IntList indexData)

setNormalData

public void setNormalData(float[] normalData)

setTextureData

public void setTextureData(float[] textureData)

setVertexData

public void setVertexData(FloatList vertexData)

writeStamp

public void writeStamp(Cache.Entry cache,
                       GraphState gs)
Description copied from interface: ContextDependent
Writes a stamp of the context into cache. Based on this stamp, a cache detects whether the context of this object has changed or not.

Specified by:
writeStamp in interface ContextDependent
Overrides:
writeStamp in class PolygonsBase
Parameters:
cache - a cache entry to write the stamp
gs - the current graph state