com.jmex.terrain.util
Class RawHeightMap

java.lang.Object
  extended by com.jmex.terrain.util.AbstractHeightMap
      extended by com.jmex.terrain.util.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 the lowest point and pure white denotes the highest.

Version:
$Id: RawHeightMap.java 4133 2009-03-19 20:40:11Z blaine.dev $
Author:
Mark Powell

Field Summary
static int FORMAT_16BITBE
          Format specification for 16 bit big endian heightmaps
static int FORMAT_16BITLE
          Format specification for 16 bit little endian heightmaps
static int FORMAT_8BIT
          Format specification for 8 bit precision heightmaps
 
Fields inherited from class com.jmex.terrain.util.AbstractHeightMap
filter, heightData, heightScale, NORMALIZE_RANGE, size
 
Constructor Summary
RawHeightMap(float[] heightData)
           
RawHeightMap(java.io.InputStream stream, int size, int format, boolean swapxy)
           
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.
RawHeightMap(java.lang.String filename, int size, int format, boolean swapxy)
           
RawHeightMap(java.net.URL resource, int size, int format, boolean swapxy)
           
 
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.
 void setHeightStream(java.io.InputStream stream)
          setHeightStream sets the stream to use for the RAW data.
 
Methods inherited from class com.jmex.terrain.util.AbstractHeightMap
erodeTerrain, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setHeightAtPoint, setHeightScale, setMagnificationFilter, setSize, unloadHeightMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT_8BIT

public static final int FORMAT_8BIT
Format specification for 8 bit precision heightmaps

See Also:
Constant Field Values

FORMAT_16BITLE

public static final int FORMAT_16BITLE
Format specification for 16 bit little endian heightmaps

See Also:
Constant Field Values

FORMAT_16BITBE

public static final int FORMAT_16BITBE
Format specification for 16 bit big endian heightmaps

See Also:
Constant Field Values
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:
JmeException - if the filename is null or not RAW, and if the size is 0 or less.

RawHeightMap

public RawHeightMap(float[] heightData)

RawHeightMap

public RawHeightMap(java.lang.String filename,
                    int size,
                    int format,
                    boolean swapxy)

RawHeightMap

public RawHeightMap(java.io.InputStream stream,
                    int size,
                    int format,
                    boolean swapxy)

RawHeightMap

public RawHeightMap(java.net.URL resource,
                    int size,
                    int format,
                    boolean swapxy)
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 JmeException 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:
JmeException - if the file is null or not RAW.

setHeightStream

public void setHeightStream(java.io.InputStream stream)
setHeightStream sets the stream to use for the RAW data. A call to load is required to put the changes into effect.

Parameters:
stream - the new stream to use for the height data.
Throws:
JmeException - if the stream is null or not RAW.