org.xith3d.scenegraph
Class GeometryTranslocator

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.NodeComponent
          extended by org.xith3d.scenegraph.Geometry
              extended by org.xith3d.scenegraph.GeometryTranslocator
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.VertexContainer

public class GeometryTranslocator
extends Geometry

A geometry translocator provides an optimized method for drawing many copies of a geometry array at different locations. This wraps any standard geometry array.

Each translocator node specifies the start vertex index, the vertex count, the color and a transformation matrix. You can specify as many translocator nodes as desired.

This allows for high speed rendering of these transloctor nodes because the geometry is setup and bound once before looping through and rendering each object. This makes it ideal for displaying grass, weeds and other types of vegetation which represents nothing more than variations on a theme.

It is up to the programmer to optimize the translocator nodes for Frustum culling. Generally the nodes are adjusted one a per frame basis by the application.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.xith3d.scenegraph.Geometry
Geometry.Optimization
 
Field Summary
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
GeometryTranslocator(GeometryArray geom)
           
 
Method Summary
 void addNode(TranslocatorNode node)
           
 void clearNodes()
           
 GeometryTranslocator cloneNodeComponent(boolean forceDuplicate)
          
protected  void duplicateNodeComponent(NodeComponent original, boolean forceDuplicate)
          
 void freeOpenGLResources(CanvasPeer canvasPeer)
          This method frees OpenGL resources (names) for all this NodeComponent and all child-components.
 GeometryArray getGeometry()
           
 java.util.ArrayList<TranslocatorNode> getNodes()
           
 int getTexCoordSize(int unit)
          
 boolean getVertex(int i, org.openmali.vecmath2.Tuple3f pos)
           
 int getVertexCount()
           
 int getVertexFormat()
          
 boolean hasColorAlpha()
          
 boolean hasColors()
          
 boolean hasFeature(int flag)
          
 boolean hasIndex()
          
 boolean hasNormals()
          
 boolean hasTextureCoordinates()
          
 boolean hasVertexAttributes()
          
 boolean isStrip()
          
 boolean isTriangulatable()
          
 boolean isTriangulated()
          
 void setGeometry(GeometryArray g)
           
 
Methods inherited from class org.xith3d.scenegraph.Geometry
getCachedBounds, getOptimization, isBoundsDirty, setBoundsDirty, setCachedBounds, setOptimization
 
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, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeometryTranslocator

public GeometryTranslocator(GeometryArray geom)
Method Detail

setGeometry

public void setGeometry(GeometryArray g)

getGeometry

public final GeometryArray getGeometry()

clearNodes

public void clearNodes()

addNode

public void addNode(TranslocatorNode node)

getNodes

public final java.util.ArrayList<TranslocatorNode> getNodes()

getVertexFormat

public final int getVertexFormat()

Specified by:
getVertexFormat in class Geometry
Returns:
the format of the vertices in this object.

hasFeature

public final boolean hasFeature(int flag)

Specified by:
hasFeature in class Geometry

getVertexCount

public final int getVertexCount()

getVertex

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

hasNormals

public final boolean hasNormals()

Specified by:
hasNormals in class Geometry

hasColors

public final boolean hasColors()

Specified by:
hasColors in class Geometry

hasColorAlpha

public final boolean hasColorAlpha()

Specified by:
hasColorAlpha in class Geometry

hasTextureCoordinates

public final boolean hasTextureCoordinates()

Specified by:
hasTextureCoordinates in class Geometry

getTexCoordSize

public final int getTexCoordSize(int unit)

Specified by:
getTexCoordSize in class Geometry

hasVertexAttributes

public final boolean hasVertexAttributes()

Specified by:
hasVertexAttributes in class Geometry

hasIndex

public final boolean hasIndex()

Specified by:
hasIndex in class Geometry
Returns:
true, if this Geometry has an Index

isStrip

public final boolean isStrip()

Specified by:
isStrip in class Geometry
Returns:
true, if this Geometry is a Strip

isTriangulatable

public final boolean isTriangulatable()

Specified by:
isTriangulatable in class Geometry
Returns:
true, if this Geometry is built of triangles or can at least be interpreted as triangles.

isTriangulated

public final boolean isTriangulated()

Specified by:
isTriangulated in class Geometry
Returns:
true, if this Geometry is built of triangles.

duplicateNodeComponent

protected void duplicateNodeComponent(NodeComponent original,
                                      boolean forceDuplicate)

Overrides:
duplicateNodeComponent in class NodeComponent

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

cloneNodeComponent

public GeometryTranslocator cloneNodeComponent(boolean forceDuplicate)

Specified by:
cloneNodeComponent in class Geometry