jme.locale.external.feature
Class WaterPlane

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

public class WaterPlane
extends java.lang.Object
implements Water

WaterPlane implements the Water interface and defines a water feature to be used with Terrain levels. The water is defined by a single quad with an applied texture and animation values. The supported animation is the water plane rising and falling and the texture sliding across the plane.

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

Constructor Summary
WaterPlane(int size, float baseLevel, float variation)
          Constructor instantiates a new WaterPlane object.
 
Method Summary
 void render()
          render renders a single quad with the set texture, color and location.
 void setColor(Vector color)
          setColor sets the color of the water texture.
 void setRepeat(float repeat)
          setRepeat sets the number of times to repeat the water texture across the quad.
 void setTexture(java.lang.String filename)
          setTexture sets the texture for the water plane.
 void setTextureAnimation(float x, float z)
          setTextureAnimation denotes the amount to move the texture across the water plane.
 void setTransparency(float transparency)
          setTransparency sets the transparency or alpha of the water plane.
 void setWaveSpeed(float speed)
          setWaveSpeed sets the speed to move the water plane up/down.
 void update(float time)
          update updates the location of the water plane and the setting for the texture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaterPlane

public WaterPlane(int size,
                  float baseLevel,
                  float variation)
Constructor instantiates a new WaterPlane object. The size of the plane is defined, as well as what elevation to set it at and how much to vary the elevation.

Parameters:
size - the size of the water plane.
baseLevel - the starting elevation of the plane.
variation - the amount to vary to height of the plane (base +- variation)
Throws:
MonkeyRuntimeException - if the size is less than zero.
Method Detail

setTexture

public void setTexture(java.lang.String filename)
setTexture sets the texture for the water plane.

Parameters:
filename - the image file to load the texture from.
Throws:
MonkeyRuntimeException - if filename is null.

setTextureAnimation

public void setTextureAnimation(float x,
                                float z)
setTextureAnimation denotes the amount to move the texture across the water plane. Both positive and negative values are supported to allow for animation in all directions.

Parameters:
x - the amount to move the texture on the x axis.
z - the amount to move the texture on the z axis.

setWaveSpeed

public void setWaveSpeed(float speed)
setWaveSpeed sets the speed to move the water plane up/down.

Parameters:
speed - the speed to move the water plane on the y-axis.

setColor

public void setColor(Vector color)
setColor sets the color of the water texture.

Parameters:
color - the color of the water texture.

setTransparency

public void setTransparency(float transparency)
setTransparency sets the transparency or alpha of the water plane. Completely opaque is 1 and completely transparent is 0.

Parameters:
transparency - the level of transparency for the water plane.

setRepeat

public void setRepeat(float repeat)
setRepeat sets the number of times to repeat the water texture across the quad. By default it will be repeated 16 times.

Parameters:
repeat - the number of times to repeat the water texture.

update

public void update(float time)
update updates the location of the water plane and the setting for the texture. The rise/fall of the plane's height is adjusted as well as the texture coordinates for animating.

Specified by:
update in interface Water
Parameters:
time - the time value for frame independant animations.

render

public void render()
render renders a single quad with the set texture, color and location.

Specified by:
render in interface Water