jme.lighting
Class AbstractLightMap

java.lang.Object
  extended byjme.lighting.AbstractLightMap
Direct Known Subclasses:
SlopeLighting

public abstract class AbstractLightMap
extends java.lang.Object

AbstractLightMap manages a data structure that contains light values. The structure is set up as a two dimensional array of floats, where the particular value of (x,y) is a float from 0 to 1. Where 1 is full brightness and 0 is complete darkness. It is intended to be used with the glColor*f method. As such, the class maintains a color that will define what color the light is. This allows for interesting effects, where an earth terrain may be (1,1,1), but a Mars terrain would be something like (1,0.4,0.7).

Version:
$Id: AbstractLightMap.java,v 1.2 2003/09/03 18:05:36 mojomonkey Exp $
Author:
Mark Powell

Field Summary
protected  Vector color
          the vector that defines the color the light is casting.
protected  float[][] lightMap
          the array of values corresponding to brightness values.
 
Constructor Summary
AbstractLightMap()
           
 
Method Summary
 Vector getColor()
          getColor returns the color vector of the lightmap.
 float getShade(int x, int z)
          getShade returns the shade value for the given coordinates of the lightmap.
 void setColor(Vector color)
          setColor sets the color vector of the lightmap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lightMap

protected float[][] lightMap
the array of values corresponding to brightness values.


color

protected Vector color
the vector that defines the color the light is casting.

Constructor Detail

AbstractLightMap

public AbstractLightMap()
Method Detail

getShade

public float getShade(int x,
                      int z)
getShade returns the shade value for the given coordinates of the lightmap. The shade is a value between 0 and 1.

Parameters:
x - the x coordinate of the light map.
z - the z coordinate of the light map.
Returns:
the shade value of the coordinate (between 0 and 1).

getColor

public Vector getColor()
getColor returns the color vector of the lightmap.

Returns:
the color vector of the lightmap.

setColor

public void setColor(Vector color)
setColor sets the color vector of the lightmap.

Parameters:
color - the new color for the lightmap.
Throws:
MonkeyRuntimeException - if color is null.