jme.locale.external.feature
Class WaterMesh

java.lang.Object
  extended byjme.locale.external.feature.WaterMesh
All Implemented Interfaces:
Water

public class WaterMesh
extends java.lang.Object
implements Water

WaterMesh creates a mesh that represents water height values. This mesh contains a wave origin that causes ripples to flow outward.

Version:
$Id: WaterMesh.java,v 1.2 2003/09/03 16:20:51 mojomonkey Exp $
Author:
Mark Powell

Constructor Summary
WaterMesh(int size, int spacing, float amplitude)
          Constructor instantiates a WaterMesh object.
 
Method Summary
 void render()
          render displays the water mesh to the view port.
 void setBaseHeight(float height)
          setBaseHeight sets the height of the water.
 void setOrigin(int x, int z)
          setOrigin sets the originating point of the water mesh.
 void setTexture(java.lang.String filename)
          setTexture sets the texture used for the watermesh.
 void setWindSpeed(int speed)
          setWindSpeed sets the speed of the winds that generate the waves.
 void update(float time)
          update sets the coordinates of the mesh to properly simulate the rise and fall of waves.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaterMesh

public WaterMesh(int size,
                 int spacing,
                 float amplitude)
Constructor instantiates a WaterMesh object. The attributes of the water mesh are defined as the passed parameters.

Parameters:
size - the size of the mesh, where the total area is defined as size x size.
spacing - defines the distance between each vertex.
amplitude - defines the amount a vertex can travel along the y axis.
Throws:
MonkeyGLException - is thrown if water mesh is created before the OpenGL context.
MonkeyRuntimeException - if size is negative.
Method Detail

setTexture

public void setTexture(java.lang.String filename)
setTexture sets the texture used for the watermesh.

Parameters:
filename - the image file.

setBaseHeight

public void setBaseHeight(float height)
setBaseHeight sets the height of the water.

Parameters:
height - the height of the water.

setOrigin

public void setOrigin(int x,
                      int z)
setOrigin sets the originating point of the water mesh.

Parameters:
x - the x coordinate of the origin.
z - the y coordinate of the origin.

setWindSpeed

public void setWindSpeed(int speed)
setWindSpeed sets the speed of the winds that generate the waves.

Parameters:
speed - the speed of the winds, which generated the waves.

update

public void update(float time)
update sets the coordinates of the mesh to properly simulate the rise and fall of waves.

Specified by:
update in interface Water
Parameters:
time - the time between frames.

render

public void render()
render displays the water mesh to the view port.

Specified by:
render in interface Water