com.jmex.effects.water
Class ProjectedGrid

java.lang.Object
  extended by com.jme.scene.Spatial
      extended by com.jme.scene.Geometry
          extended by com.jme.scene.TriMesh
              extended by com.jmex.effects.water.ProjectedGrid
All Implemented Interfaces:
Savable, java.io.Serializable

public class ProjectedGrid
extends TriMesh

ProjectedGrid Projected grid mesh

Author:
Rikard Herlitz (MrCoder)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme.scene.TriMesh
TriMesh.Mode
 
Nested classes/interfaces inherited from class com.jme.scene.Spatial
Spatial.CullHint, Spatial.LightCombineMode, Spatial.NormalsMode, Spatial.TextureCombineMode
 
Field Summary
(package private)  Vector3f adjacentPoint
           
 boolean freezeProjector
           
(package private)  Vector3f oppositePoint
          buildNormals calculates the normals of each vertex that makes up the block of terrain.
(package private)  Vector3f rootPoint
           
(package private)  Vector3f tempNorm
           
 boolean useReal
           
 
Fields inherited from class com.jme.scene.TriMesh
mode, triangleQuantity
 
Fields inherited from class com.jme.scene.Geometry
binormalBuf, bound, castsShadows, colorBuf, compVect, defaultColor, displayListID, enabled, fogBuf, hasDirtyVertices, states, tangentBuf, texBuf, vboInfo, vertQuantity
 
Fields inherited from class com.jme.scene.Spatial
cullHint, frustrumIntersects, geometricalControllers, isCollidable, lightCombineMode, localRotation, localScale, localTranslation, LOCKED_BOUNDS, LOCKED_BRANCH, LOCKED_MESH_DATA, LOCKED_NONE, LOCKED_SHADOWS, LOCKED_TRANSFORMS, lockedMode, name, normalsMode, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
ProjectedGrid(java.lang.String name, Camera cam, int sizeX, int sizeY, float texureScale, HeightGenerator heightGenerator)
           
 
Method Summary
 void draw(Renderer r)
          draw calls super to set the render state then passes itself to the renderer.
 Vector3f getSurfaceNormal(float x, float z, Vector3f store)
          getSurfaceNormal returns the normal of an arbitrary point on the terrain.
 Vector3f getSurfaceNormal(Vector2f position, Vector3f store)
          getSurfaceNormal returns the normal of an arbitrary point on the terrain.
 Vector3f getSurfaceNormal(Vector3f position, Vector3f store)
          getSurfaceNormal returns the normal of an arbitrary point on the terrain.
 void setDetailTexture(int unit, float repeat)
          setDetailTexture copies the texture coordinates from the first texture channel to another channel specified by unit, mulitplying by the factor specified by repeat so that the texture in that channel will be repeated that many times across the block.
 void switchFreeze()
           
 void update()
           
 
Methods inherited from class com.jme.scene.TriMesh
clearBuffers, findCollisions, findTriangleCollision, findTrianglePick, getIndexBuffer, getMaxIndex, getMeshAsTriangles, getMeshAsTrianglesVertices, getMode, getTriangle, getTriangle, getTriangleCount, getTriangleIndices, getVertIndex, hasCollision, hasTriangleCollision, randomPointOnTriangles, read, recalcTriangleQuantity, reconstruct, setIndexBuffer, setMode, setTriangleQuantity, write
 
Methods inherited from class com.jme.scene.Geometry
addTextureCoordinates, addTextureCoordinates, applyRenderState, checkTextureCoordinates, clearTextureBuffers, copyTextureCoordinates, copyTextureCoordinates, findPick, getBinormalBuffer, getColorBuffer, getDefaultColor, getDisplayListID, getFogBuffer, getLightState, getModelBound, getNormalBuffer, getNumberOfUnits, getTangentBuffer, getTextureCoords, getTextureCoords, getVBOInfo, getVertexBuffer, getVertexCount, getWorldCoords, getWorldNormals, hasDirtyVertices, isCastsShadows, lockMeshes, postdraw, predraw, randomVertex, reconstruct, resizeTextureIds, rotateNormals, rotatePoints, scaleTextureCoordinates, scaleTextureCoordinates, setBinormalBuffer, setCastsShadows, setColorBuffer, setDefaultColor, setDisplayListID, setFogCoordBuffer, setHasDirtyVertices, setLightState, setModelBound, setNormalBuffer, setRandomColors, setSolidColor, setTangentBuffer, setTextureCoords, setTextureCoords, setTextureCoords, setVBOInfo, setVertexBuffer, setVertexCount, sortLights, translatePoints, translatePoints, unlockMeshes, updateModelBound, updateWorldBound
 
Methods inherited from class com.jme.scene.Spatial
addController, calculateCollisions, calculatePick, clearControllers, clearRenderState, clearRenderState, getClassTag, getController, getControllerCount, getControllers, getCullHint, getLastFrustumIntersection, getLightCombineMode, getLocalCullHint, getLocalLightCombineMode, getLocalNormalsMode, getLocalRenderQueueMode, getLocalRotation, getLocalScale, getLocalTextureCombineMode, getLocalToWorldMatrix, getLocalTranslation, getLocks, getName, getNormalsMode, getParent, getRenderQueueMode, getRenderState, getRenderState, getTextureCombineMode, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, hasAncestor, isCollidable, localToWorld, lock, lock, lockBounds, lockBranch, lockMeshes, lockShadows, lockTransforms, lookAt, onDraw, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeController, removeFromParent, removeUserData, rotateUpTo, setCullHint, setIsCollidable, setLastFrustumIntersection, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setLocalTranslation, setLocks, setLocks, setName, setNormalsMode, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setUserData, setZOrder, setZOrder, toString, unlock, unlock, unlockBounds, unlockBranch, unlockMeshes, unlockShadows, unlockTransforms, updateGeometricState, updateRenderState, updateRenderState, updateWorldData, updateWorldRotation, updateWorldScale, updateWorldTranslation, updateWorldVectors, updateWorldVectors, worldToLocal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jme.util.export.Savable
getClassTag
 

Field Detail

freezeProjector

public boolean freezeProjector

useReal

public boolean useReal

oppositePoint

Vector3f oppositePoint
buildNormals calculates the normals of each vertex that makes up the block of terrain.


adjacentPoint

Vector3f adjacentPoint

rootPoint

Vector3f rootPoint

tempNorm

Vector3f tempNorm
Constructor Detail

ProjectedGrid

public ProjectedGrid(java.lang.String name,
                     Camera cam,
                     int sizeX,
                     int sizeY,
                     float texureScale,
                     HeightGenerator heightGenerator)
Method Detail

switchFreeze

public void switchFreeze()

draw

public void draw(Renderer r)
Description copied from class: TriMesh
draw calls super to set the render state then passes itself to the renderer. LOGIC: 1. If we're not RenderQueue calling draw goto 2, if we are, goto 3 2. If we are supposed to use queue, add to queue and RETURN, else 3 3. call super draw 4. tell renderer to draw me.

Overrides:
draw in class TriMesh
Parameters:
r - the renderer to display
See Also:
Spatial.draw(com.jme.renderer.Renderer)

update

public void update()

setDetailTexture

public void setDetailTexture(int unit,
                             float repeat)
setDetailTexture copies the texture coordinates from the first texture channel to another channel specified by unit, mulitplying by the factor specified by repeat so that the texture in that channel will be repeated that many times across the block.

Parameters:
unit - channel to copy coords to
repeat - number of times to repeat the texture across and down the block

getSurfaceNormal

public Vector3f getSurfaceNormal(Vector2f position,
                                 Vector3f store)
getSurfaceNormal returns the normal of an arbitrary point on the terrain. The normal is linearly interpreted from the normals of the 4 nearest defined points. If the point provided is not within the bounds of the height map, null is returned.

Parameters:
position - the vector representing the location to find a normal at.
store - the Vector3f object to store the result in. If null, a new one is created.
Returns:
the normal vector at the provided location.

getSurfaceNormal

public Vector3f getSurfaceNormal(Vector3f position,
                                 Vector3f store)
getSurfaceNormal returns the normal of an arbitrary point on the terrain. The normal is linearly interpreted from the normals of the 4 nearest defined points. If the point provided is not within the bounds of the height map, null is returned.

Parameters:
position - the vector representing the location to find a normal at. Only the x and z values are used.
store - the Vector3f object to store the result in. If null, a new one is created.
Returns:
the normal vector at the provided location.

getSurfaceNormal

public Vector3f getSurfaceNormal(float x,
                                 float z,
                                 Vector3f store)
getSurfaceNormal returns the normal of an arbitrary point on the terrain. The normal is linearly interpreted from the normals of the 4 nearest defined points. If the point provided is not within the bounds of the height map, null is returned.

Parameters:
x - the x coordinate to check.
z - the z coordinate to check.
store - the Vector3f object to store the result in. If null, a new one is created.
Returns:
the normal unit vector at the provided location.