j3d.org Code

org.j3d.renderer.java3d.loaders
Class BTLoader

java.lang.Object
  extended bycom.sun.j3d.loaders.LoaderBase
      extended byorg.j3d.renderer.java3d.loaders.HeightMapLoader
          extended byorg.j3d.renderer.java3d.loaders.BTLoader
All Implemented Interfaces:
BinaryLoader, HeightMapSource, com.sun.j3d.loaders.Loader, ManagedLoader

public class BTLoader
extends HeightMapLoader
implements BinaryLoader, ManagedLoader

Loader for the VTerrain Project's BT file format.

The mesh produced is, by default, triangle strip arrays. The X axis represents East-West and the Z-axis represents North-South. +X is east, -Z is North. Texture coordinates are generated for the extents based on a single 0-1 scale for the width of the object.

The loader produces a single mesh that represents the file's contents. No further processing is performed in the current implementation to break the points into smaller tiles or use multi-resolution terrain structures.

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

Version:
$Revision: 1.1 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class com.sun.j3d.loaders.LoaderBase
basePath, baseUrl, loadFlags
 
Fields inherited from interface com.sun.j3d.loaders.Loader
LOAD_ALL, LOAD_BACKGROUND_NODES, LOAD_BEHAVIOR_NODES, LOAD_FOG_NODES, LOAD_LIGHT_NODES, LOAD_SOUND_NODES, LOAD_VIEW_GROUPS
 
Constructor Summary
BTLoader()
          Construct a new default loader with no flags set
BTLoader(int flags)
          Construct a new loader with the given flags set.
 
Method Summary
 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.
 com.sun.j3d.loaders.Scene load(java.io.InputStream is)
          Load the scene from the given reader.
 com.sun.j3d.loaders.Scene load(java.io.Reader reader)
          Load the scene from the given reader.
 com.sun.j3d.loaders.Scene load(java.lang.String filename)
          Load a scene from the given filename.
 com.sun.j3d.loaders.Scene load(java.net.URL url)
          Load a scene from the named URL.
 void setCapabilityOverrideMap(java.util.Map capBits, java.util.Map freqBits)
          Provide the set of mappings that override anything that the loader might set.
 void setCapabilityRequiredMap(java.util.Map capBits, java.util.Map freqBits)
          Set the mapping of capability bits that the user would like to make sure is set.
 
Methods inherited from class com.sun.j3d.loaders.LoaderBase
getBasePath, getBaseUrl, getFlags, setBasePath, setBaseUrl, setFlags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.j3d.loaders.Loader
getBasePath, getBaseUrl, getFlags, setBasePath, setBaseUrl, setFlags
 

Constructor Detail

BTLoader

public BTLoader()
Construct a new default loader with no flags set


BTLoader

public BTLoader(int flags)
Construct a new loader with the given flags set.

Parameters:
flags - The list of flags to be set
Method Detail

setCapabilityOverrideMap

public void setCapabilityOverrideMap(java.util.Map capBits,
                                     java.util.Map freqBits)
Provide the set of mappings that override anything that the loader might set.

If the key is set, but the value is null or zero length, then all capabilities on that node will be disabled. If the key is set the values override all settings that the loader may wish to normally make. This can be very dangerous if the loader is used for a file format that includes its own internal animation engine, so be very careful with this request.

Specified by:
setCapabilityOverrideMap in interface ManagedLoader
Parameters:
capBits - The capability bits to be set
freqBits - The frequency bits to be set

setCapabilityRequiredMap

public void setCapabilityRequiredMap(java.util.Map capBits,
                                     java.util.Map freqBits)
Set the mapping of capability bits that the user would like to make sure is set. The end output is that the capabilities are the union of what the loader wants and what the user wants.

If the map contains a key, but the value is null or zero length, the request is ignored.

Specified by:
setCapabilityRequiredMap in interface ManagedLoader
Parameters:
capBits - The capability bits to be set
freqBits - The frequency bits to be set

load

public com.sun.j3d.loaders.Scene load(java.io.InputStream is)
                               throws com.sun.j3d.loaders.IncorrectFormatException,
                                      com.sun.j3d.loaders.ParsingErrorException
Load the scene from the given reader. Always throws an exception as the file format is binary only and readers don't handle this.

Specified by:
load in interface BinaryLoader
Parameters:
is - The source of input characters
Returns:
A description of the scene
Throws:
com.sun.j3d.loaders.IncorrectFormatException - The file is binary
com.sun.j3d.loaders.ParsingErrorException - Syntax and/or semantic parsing problems

load

public com.sun.j3d.loaders.Scene load(java.io.Reader reader)
                               throws com.sun.j3d.loaders.IncorrectFormatException
Load the scene from the given reader. Always throws an exception as the file format is binary only and readers don't handle this.

Specified by:
load in interface com.sun.j3d.loaders.Loader
Parameters:
reader - The source of input characters
Returns:
A description of the scene
Throws:
com.sun.j3d.loaders.IncorrectFormatException - The file is binary

load

public com.sun.j3d.loaders.Scene load(java.lang.String filename)
                               throws java.io.FileNotFoundException,
                                      com.sun.j3d.loaders.IncorrectFormatException,
                                      com.sun.j3d.loaders.ParsingErrorException
Load a scene from the given filename. The scene instance returned by this loader will have textures already loaded.

Specified by:
load in interface com.sun.j3d.loaders.Loader
Parameters:
filename - The name of the file to load
Returns:
A description of the scene
Throws:
java.io.FileNotFoundException - The reader can't find the file
com.sun.j3d.loaders.IncorrectFormatException - The file is not one our loader understands
com.sun.j3d.loaders.ParsingErrorException - An error parsing the file

load

public com.sun.j3d.loaders.Scene load(java.net.URL url)
                               throws java.io.FileNotFoundException,
                                      com.sun.j3d.loaders.IncorrectFormatException,
                                      com.sun.j3d.loaders.ParsingErrorException
Load a scene from the named URL. The scene instance returned by this loader will have textures already loaded.

Specified by:
load in interface com.sun.j3d.loaders.Loader
Parameters:
url - The URL instance to load data from
Returns:
A description of the scene
Throws:
java.io.FileNotFoundException - The reader can't find the file
com.sun.j3d.loaders.IncorrectFormatException - The file is not one our loader understands
com.sun.j3d.loaders.ParsingErrorException - An error parsing the file

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

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

j3d.org Code

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