com.jme.scene.lod
Class ClodMesh

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.scene.Geometry
          extended bycom.jme.scene.TriMesh
              extended bycom.jme.scene.lod.ClodMesh
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AreaClodMesh

public class ClodMesh
extends TriMesh

ClodMesh originally ported from David Eberly's c++, modifications and enhancements made from there.

This class is an extention of TriMesh that allows the option of rendering a trimesh at various degrees of accuracy.

Version:
$Id: ClodMesh.java,v 1.18 2005/01/10 20:30:45 renanse Exp $
Author:
Joshua Slack, Jack Lindamood (javadoc only)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jme.scene.TriMesh
indices, triangleQuantity
 
Fields inherited from class com.jme.scene.Geometry
bound, color, colorBuf, normal, normBuf, texBuf, texture, vertBuf, vertex, vertQuantity
 
Fields inherited from class com.jme.scene.Spatial
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
ClodMesh()
          Empty Constructor to be used internally only.
ClodMesh(java.lang.String name)
          Creates a new ClodMesh without any information.
ClodMesh(java.lang.String name, TriMesh data, CollapseRecord[] records)
          Creates a ClodMesh that is a duplicate of the given TriMesh's geometric information.
ClodMesh(java.lang.String name, Vector3f[] vertices, Vector3f[] normal, ColorRGBA[] color, Vector2f[] texture, int[] indices, CollapseRecord[] records)
          Creates a clod mesh with the given information.
 
Method Summary
 int chooseTargetRecord(Renderer r)
          This function should not be called manually.
 void create(CollapseRecord[] records)
          This function sets the records information for this ClodMesh.
 void draw(Renderer r)
          Called during rendering.
 int getRecordQuantity()
          Returns the number of records this ClodMesh currently uses.
 CollapseRecord[] getRecords()
          Returns the current collapse records array.
 int getTargetRecord()
          Returns the currently set target record.
 void setRecords(CollapseRecord[] records)
          Sets the records this ClodMesh will use to collapse triangles.
 void setTargetRecord(int target)
          Sets the current target record to the target value.
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, drawBounds, findCollisions, findTriangleCollision, findTrianglePick, findWorldRotMat, getIndexAsBuffer, getIndices, getMeshAsTriangles, getTriangle, getTriangle, getTriangleQuantity, hasCollision, hasTriangleCollision, putClone, reconstruct, setIndexBuffer, setIndices, updateCollisionTree, updateIndexBuffer
 
Methods inherited from class com.jme.scene.Geometry
applyRenderState, applyStates, copyTextureCoords, findPick, getAllTextures, getCloneID, getColorAsFloatBuffer, getColors, getModelBound, getNormalAsFloatBuffer, getNormals, getNumberOfUnits, getTextureAsFloatBuffer, getTextureAsFloatBuffer, getTextures, getTextures, getVBOColorID, getVBONormalID, getVBOTextureID, getVBOVertexID, getVerticeAsFloatBuffer, getVertices, getVertQuantity, isVBOColorEnabled, isVBONormalEnabled, isVBOTextureEnabled, isVBOVertexEnabled, randomVertice, reconstruct, setAllTextures, setColor, setColors, setFloatBuffer, setForceView, setModelBound, setNormal, setNormalBuffer, setNormals, setRandomColors, setSolidColor, setTexture, setTexture, setTextureBuffer, setTextureCoord, setTextures, setTextures, setVBOColorEnabled, setVBOColorID, setVBONormalEnabled, setVBONormalID, setVBOTextureEnabled, setVBOTextureID, setVBOVertexEnabled, setVBOVertexID, setVertex, setVertexBuffer, setVertices, updateColorBuffer, updateColorBuffer, updateModelBound, updateNormalBuffer, updateNormalBuffer, updateTextureBuffer, updateTextureBuffer, updateTextureBuffer, updateVertexBuffer, updateVertexBuffer, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, applyDefaultStates, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, isForceCulled, isForceView, onDraw, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setWorldBound, setZOrder, toString, updateGeometricState, updateRenderState, updateRenderState, updateWorldData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClodMesh

public ClodMesh()
Empty Constructor to be used internally only.


ClodMesh

public ClodMesh(java.lang.String name)
Creates a new ClodMesh without any information. It is assumed a call to reconstruct and create will be called before this ClodMesh is used.

Parameters:
name - The name of the ClodMesh.
See Also:
TriMesh.reconstruct(com.jme.math.Vector3f[], com.jme.math.Vector3f[], com.jme.renderer.ColorRGBA[], com.jme.math.Vector2f[], int[]), create(com.jme.scene.lod.CollapseRecord[])

ClodMesh

public ClodMesh(java.lang.String name,
                TriMesh data,
                CollapseRecord[] records)
Creates a ClodMesh that is a duplicate of the given TriMesh's geometric information. RenderState and Controller information is not used and should be set manually if those are to be copied as well. The records parameter defines how the ClodMesh should collapse vertices. If null is given, records are generated by the ClodMesh automatically.

Parameters:
name - The name of the ClodMesh.
data - The TriMesh to copy information into for this mesh.
records - The collapse record(s) this ClodMesh should use. These modify how the ClodMesh collapses vertexes.

ClodMesh

public ClodMesh(java.lang.String name,
                Vector3f[] vertices,
                Vector3f[] normal,
                ColorRGBA[] color,
                Vector2f[] texture,
                int[] indices,
                CollapseRecord[] records)
Creates a clod mesh with the given information. A null for records causes the ClodMesh to generate its own records information.

Parameters:
name - The name of the ClodMesh.
vertices - The vertex information of this clod mesh.
normal - The per vertex normal information of this clod mesh.
color - The per vertex color information of this clod mesh.
texture - The per vertex texture information of this clod mesh.
indices - The index array of this TriMesh's triangles.
records - The collapse record(s) this ClodMesh should use. These modify how the ClodMesh collapses vertexes.
Method Detail

create

public void create(CollapseRecord[] records)
This function sets the records information for this ClodMesh. If non-null is passed, then the ClodMesh uses the passed CollapseRecord(s) to determine how the TriMesh's triangles should collapse. If null is passed, then the collapse records are created automatically with ClodCreator. In most cases, null will be passed.

Parameters:
records - The records for this ClodMesh to use, or null if it should generate its own.
See Also:
ClodCreator

draw

public void draw(Renderer r)
Called during rendering. Should not be called directly.

Overrides:
draw in class TriMesh
Parameters:
r - The renderer to draw this TriMesh with.

getRecordQuantity

public int getRecordQuantity()
Returns the number of records this ClodMesh currently uses.

Returns:
The current length of the records array.

chooseTargetRecord

public int chooseTargetRecord(Renderer r)
This function should not be called manually. It selects the correct target record based on the renderer used. For a basic ClodMesh, simply the currently set target record is used. The target record signals how to collapse this mesh's triangle information.

Parameters:
r - A renderer which aids in choosing the correct target record.
Returns:
The integer position in the records array for the target collapse record.

getTargetRecord

public int getTargetRecord()
Returns the currently set target record.

Returns:
The currently set target record.

getRecords

public CollapseRecord[] getRecords()
Returns the current collapse records array. This array is created in create()

Returns:
The current collapse records array.
See Also:
create(com.jme.scene.lod.CollapseRecord[])

setTargetRecord

public void setTargetRecord(int target)
Sets the current target record to the target value. If less than 0 is passed, 0 is used. If a value greater than the current records length is passed, then the maximum records length value is used.

Parameters:
target - The new target record to use.

setRecords

public void setRecords(CollapseRecord[] records)
Sets the records this ClodMesh will use to collapse triangles.

Parameters:
records - The new records information of this ClodMesh.