jme.locale.external.data
Class RawHeightMap

java.lang.Object
  extended byjme.locale.external.data.AbstractHeightMap
      extended byjme.locale.external.data.RawHeightMap

public class RawHeightMap
extends AbstractHeightMap

RawHeightMap creates a height map from a RAW image file. The greyscale image denotes height based on the value of the pixel for each point. Where pure black denotes 0 and pure white denotes 255.

Version:
1
Author:
Mark Powell

Field Summary
 
Fields inherited from class jme.locale.external.data.AbstractHeightMap
filter, heightData, heightScale, size
 
Constructor Summary
RawHeightMap(java.lang.String filename, int size)
          Constructor creates a new RawHeightMap object and loads a RAW image file to use as a height field.
 
Method Summary
 boolean load()
          load fills the height data array with the appropriate data from the set RAW image.
 void setFilename(java.lang.String filename)
          setFilename sets the file to use for the RAW data.
 
Methods inherited from class jme.locale.external.data.AbstractHeightMap
erodeTerrain, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setFilter, setHeightAtPoint, setHeightScale, setSize, unloadHeightMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawHeightMap

public RawHeightMap(java.lang.String filename,
                    int size)
Constructor creates a new RawHeightMap object and loads a RAW image file to use as a height field. The greyscale image denotes the height of the terrain, where dark is low point and bright is high point. The values of the RAW correspond directly with the RAW values or 0 - 255.

Parameters:
filename - the RAW file to use as the heightmap.
size - the size of the RAW (must be square).
Throws:
MonkeyRuntimeException - if the filename is null or not RAW, and if the size is 0 or less.
Method Detail

load

public boolean load()
load fills the height data array with the appropriate data from the set RAW image. If the RAW image has not been set a MonkeyRuntimeException will be thrown.

Specified by:
load in class AbstractHeightMap
Returns:
true if the load is successfull, false otherwise.

setFilename

public void setFilename(java.lang.String filename)
setFilename sets the file to use for the RAW data. A call to load is required to put the changes into effect.

Parameters:
filename - the new file to use for the height data.
Throws:
MonkeyRuntimeException - if the file is null or not RAW.