com.jme.scene.lod
Class AreaClodMesh

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

public class AreaClodMesh
extends ClodMesh

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

This class is an automatically updating ClodMesh that updates records acording to how much area the bounding volume takes up on the screen. Use it just like a normal ClodMesh, but allow it to update itself.

Version:
$Id: AreaClodMesh.java,v 1.15 2005/01/10 20:30:44 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
AreaClodMesh()
          Empty Constructor to be used internally only.
AreaClodMesh(java.lang.String name)
          Creates a new AreaClodMesh with the given name.
AreaClodMesh(java.lang.String name, TriMesh data, CollapseRecord[] records)
          Creates a clod mesh that mimics the given TriMesh's geometry information.
AreaClodMesh(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 is used during rendering to choose the correct target record for the AreaClodMesh acording to the information in the renderer.
 float getDistanceTolerance()
          Returns the amount of distance the camera must move from the center of this AreaClodMesh's bounding volume before a collapse is initiated.
 float getTrisPerPixel()
          Returns the currently set number of triangles per pixel this AreaClodMesh should fit on the screen.
 void setDistanceTolerance(float tolerance)
          Sets the amount of distance the camera must move from the center of this AreaClodMesh's bounding volume before a collapse is initiated.
 void setTargetRecord(int target)
          This function is ignored by AreaClodMesh because target records are updated automatically during draw.
 void setTrisPerPixel(float trisPerPixel)
          Sets the number of triangles per pixel this AreaClodMesh should try to fit on the screen.
 
Methods inherited from class com.jme.scene.lod.ClodMesh
create, draw, getRecordQuantity, getRecords, getTargetRecord, setRecords
 
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

AreaClodMesh

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


AreaClodMesh

public AreaClodMesh(java.lang.String name)
Creates a new AreaClodMesh with the given name. This should only be used if the users is going to call reconstruct and create on the clod mesh.

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

AreaClodMesh

public AreaClodMesh(java.lang.String name,
                    TriMesh data,
                    CollapseRecord[] records)
Creates a clod mesh that mimics the given TriMesh's geometry information. More specificly, RenderState and Controller information is not absorbed by this AreaClodMesh. A null for records causes the AreaClodMesh to generate its own records information.

Parameters:
name - The name of this new mesh.
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.

AreaClodMesh

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

chooseTargetRecord

public int chooseTargetRecord(Renderer r)
This function is used during rendering to choose the correct target record for the AreaClodMesh acording to the information in the renderer. This should not be called manually. Instead, allow it to be called automatically during rendering.

Overrides:
chooseTargetRecord in class ClodMesh
Parameters:
r - The Renderer to use.
Returns:
the target record this AreaClodMesh will use to collapse vertexes.

setTargetRecord

public void setTargetRecord(int target)
This function is ignored by AreaClodMesh because target records are updated automatically during draw.

Overrides:
setTargetRecord in class ClodMesh
Parameters:
target - Ignored.

getTrisPerPixel

public float getTrisPerPixel()
Returns the currently set number of triangles per pixel this AreaClodMesh should fit on the screen. The default value is 1.

Returns:
The current Triangles per pixel.

setTrisPerPixel

public void setTrisPerPixel(float trisPerPixel)
Sets the number of triangles per pixel this AreaClodMesh should try to fit on the screen. The default value is 1.

Parameters:
trisPerPixel - The new value for Triangles per pixel.

getDistanceTolerance

public float getDistanceTolerance()
Returns the amount of distance the camera must move from the center of this AreaClodMesh's bounding volume before a collapse is initiated. The default is 1.

Returns:
The current distance tolerance of collapsing.

setDistanceTolerance

public void setDistanceTolerance(float tolerance)
Sets the amount of distance the camera must move from the center of this AreaClodMesh's bounding volume before a collapse is initiated. The default is 1.

Parameters:
tolerance - The new distance tolerance.