j3d.org Code

org.j3d.loaders.vterrain
Class BTParser

java.lang.Object
  extended by org.j3d.loaders.vterrain.BTParser
All Implemented Interfaces:
HeightMapSource

public class BTParser
extends java.lang.Object
implements HeightMapSource

A low-level parser for the VTerrain's Project BT file format.

The output of this parser is the flags and the raw height-field information.

The definition of the file format can be found at: http://www.vterrain.org/Implementation/BT.html

Version:
$Revision: 1.7 $
Author:
Paul Byrne, Justin Couch

Constructor Summary
BTParser()
          Construct a new parser with no stream set.
BTParser(java.io.InputStream is)
          Construct a new parser using the given stream.
 
Method Summary
 void clear()
          Clear the internal data structures used by this parser.
 float[] getGridStep()
          Fetch information about the real-world stepping sizes that this grid uses.
 BTHeader getHeader()
          Get the header used to describe the last stream parsed.
 float[][] getHeights()
          Return the height map created for the last stream parsed.
 float[][] parse()
          Do all the parsing work.
 void reset(java.io.InputStream is)
          Reset the parser to use the new stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTParser

public BTParser()
Construct a new parser with no stream set.


BTParser

public BTParser(java.io.InputStream is)
Construct a new parser using the given stream.

Parameters:
is - The stream to read data from
Method Detail

reset

public void reset(java.io.InputStream is)
Reset the parser to use the new stream. After calling this method all header and height information is reset to empty.

Parameters:
is - The new stream to use

clear

public void clear()
Clear the internal data structures used by this parser.


getHeader

public BTHeader getHeader()
Get the header used to describe the last stream parsed. If no stream has been parsed yet, this will return null.

Returns:
The header for the last read stream or null

getHeights

public float[][] getHeights()
Return the height map created for the last stream parsed. If no stream has been parsed yet, this will return null.

Specified by:
getHeights in interface HeightMapSource
Returns:
The array of heights in [row][column] order or null

getGridStep

public float[] getGridStep()
Fetch information about the real-world stepping sizes that this grid uses.

Specified by:
getGridStep in interface HeightMapSource
Returns:
The stepping information for width and depth

parse

public float[][] parse()
                throws java.io.IOException
Do all the parsing work. Convenience method for all to call internally

Returns:
A 2D array of the heighs read, if requested
Throws:
IncorrectFormatException - The file is not one our loader understands
ParsingErrorException - An error parsing the file
java.io.IOException

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org