|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjme.lighting.AbstractLightMap
jme.lighting.SlopeLighting
SlopeLighting
creates a light map based on a given heightmap.
This is based on Charlie Van Noland's algorithm. Slope lighting simply
takes the difference between two vertices (heighthwise) and determines
a lighting value. Direction for comparision is important and direction
can only be an increment of 45 degrees. Thus, the direction parameters
can be combinations of 1 and -2. I.e. 1,1 1,-1 -1,-1 -1,1.
Field Summary |
Fields inherited from class jme.lighting.AbstractLightMap |
color, lightMap |
Constructor Summary | |
SlopeLighting(AbstractHeightMap heightMap,
int dirX,
int dirZ,
float minBright,
float maxBright,
int softness)
Constructor sets the lighting attributes and calls createLighting initializing the light map. |
Method Summary | |
void |
createLighting()
createLighting generates the latest lightmap
from the available data set. |
void |
setDirX(int dirX)
setDirX sets the direction of the light on the X axis. |
void |
setDirZ(int dirZ)
setDirZ sets the direction of the light on the Z axis. |
void |
setHeightMap(AbstractHeightMap map)
setHeightMap sets the heightmap for the slope calculations. |
void |
setMaxBright(float maxBright)
setMaxBright sets the maximum brightness value for any
given point. |
void |
setMinBright(float minBright)
setMinBright sets the minimum brightness value for any
given point. |
void |
setSoftness(int softness)
setSoftness sets the amount to blend shadows. |
Methods inherited from class jme.lighting.AbstractLightMap |
getColor, getShade, setColor |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SlopeLighting(AbstractHeightMap heightMap, int dirX, int dirZ, float minBright, float maxBright, int softness)
createLighting
initializing the light map.
heightMap
- the height map to use for the slopes.dirX
- the x direction of the light source, 1 or -1dirZ
- the z direction of the light source, 1 or -1minBright
- the minimum brightness 0 to 1.maxBright
- the maximum brightness 0 to 1softness
- how much to blend light values, higher
value more soft.
MonkeyRuntimeException
- if either direction is anything
other than 1 or -1, either brightness is not between 0 and 1, or
heightmap is null.Method Detail |
public void createLighting()
createLighting
generates the latest lightmap
from the available data set. A call to createLighting
is required to generate lighting for any changes of attributes, during
construction this is called to insure a valid lightmap is available.
public void setDirX(int dirX)
setDirX
sets the direction of the light on the X axis.
This value must be either 1 or -1.
dirX
- direction of the light on the x axis.
MonkeyRuntimeException
- if dirX is not 1 or -1.public void setDirZ(int dirZ)
setDirZ
sets the direction of the light on the Z axis.
This value must be either 1 or -1.
dirZ
- direction of the light on the z axis.
MonkeyRuntimeException
- if dirZ is not 1 or -1.public void setMaxBright(float maxBright)
setMaxBright
sets the maximum brightness value for any
given point.
maxBright
- the maximum brightness for a point.
MonkeyRuntimeException
- if maxBright is not between 0 and 1.public void setMinBright(float minBright)
setMinBright
sets the minimum brightness value for any
given point.
minBright
- the minimum brightness for a point.
MonkeyRuntimeException
- if minBright is not between 0 and 1.public void setSoftness(int softness)
setSoftness
sets the amount to blend shadows. The
higher the number the more blending will be done. It is recommend
to keep the number between 10 and 40.
softness
- the amount to blend shadows.public void setHeightMap(AbstractHeightMap map)
setHeightMap
sets the heightmap for the slope calculations.
map
- the heightmap for slope calculations.
MonkeyRuntimeException
- if map is null.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |