com.tirix.anim8or
Class Anim8orLoader

java.lang.Object
  extended by com.sun.j3d.loaders.LoaderBase
      extended by com.tirix.anim8or.Anim8orLoader
All Implemented Interfaces:
Loader

public class Anim8orLoader
extends LoaderBase

Anim8orLoader - gathers facilities to load 3D meshes, figures, sequences and scenes from an Anim8or file.

Author:
Thierry Arnoux (c)2004

Nested Class Summary
static interface Anim8orLoader.ResourceLoader
          An interface encapsulating the resource access.
 
Field Summary
static boolean compatibilityMode
           
static Logger logger
           
protected  Anim8orLoader.ResourceLoader resourceLoader
           
protected static int SF_HAS_NORMALS
           
protected static int SF_HAS_TEXTURE
           
protected static int SF_SHOW_BACK
           
 
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
Anim8orLoader()
          Constructs a new Anim8orLoader using a default resource loader.
Anim8orLoader(Anim8orLoader.ResourceLoader loader)
          Constructs a new Anim8orLoader using the specified resource loader.
 
Method Summary
static void debug(String type, String name, String more)
           
 Scene load(Reader reader)
          Loads an Anim8orFile from a Reader.
 Scene load(Reader reader, String fileName)
          Loads an Anim8orFile from a Reader.
 Scene load(String fileName)
          Loads an Anim8orFile from a file.
 Scene load(URL url)
          Loads an Anim8orFile from an URL.
 Anim8orRepository parseFile(SimpleTokenizer st)
          parses a complete Anim8or file.
 void parseSkippedChunk(SimpleTokenizer st)
          parses an unused block
 void setResourceLoader(Anim8orLoader.ResourceLoader loader)
          Sets the resource loader to be used by this Anim8orLoader.
static void severe(SimpleTokenizer.ParsingException e)
           
static void warn(Throwable t)
           
 
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
 

Field Detail

logger

public static Logger logger

compatibilityMode

public static boolean compatibilityMode

SF_SHOW_BACK

protected static int SF_SHOW_BACK

SF_HAS_NORMALS

protected static int SF_HAS_NORMALS

SF_HAS_TEXTURE

protected static int SF_HAS_TEXTURE

resourceLoader

protected Anim8orLoader.ResourceLoader resourceLoader
Constructor Detail

Anim8orLoader

public Anim8orLoader()
Constructs a new Anim8orLoader using a default resource loader.


Anim8orLoader

public Anim8orLoader(Anim8orLoader.ResourceLoader loader)
Constructs a new Anim8orLoader using the specified resource loader.

Method Detail

debug

public static void debug(String type,
                         String name,
                         String more)

warn

public static void warn(Throwable t)

severe

public static void severe(SimpleTokenizer.ParsingException e)
                   throws SimpleTokenizer.ParsingException
Throws:
SimpleTokenizer.ParsingException

setResourceLoader

public void setResourceLoader(Anim8orLoader.ResourceLoader loader)
Sets the resource loader to be used by this Anim8orLoader.

Parameters:
loader -

load

public Scene load(String fileName)
           throws FileNotFoundException,
                  IncorrectFormatException,
                  ParsingErrorException
Loads an Anim8orFile from a file.

Parameters:
fileName - - the name of the file to be loaded.
Returns:
the loaded scene
Throws:
FileNotFoundException
IncorrectFormatException
ParsingErrorException

load

public Scene load(URL url)
           throws FileNotFoundException,
                  IncorrectFormatException,
                  ParsingErrorException
Loads an Anim8orFile from an URL.

Parameters:
url -
Returns:
the loaded scene
Throws:
FileNotFoundException
IncorrectFormatException
ParsingErrorException

load

public Scene load(Reader reader)
           throws FileNotFoundException,
                  IncorrectFormatException,
                  ParsingErrorException
Loads an Anim8orFile from a Reader.

Parameters:
reader -
Returns:
the loaded scene
Throws:
FileNotFoundException
IncorrectFormatException
ParsingErrorException

load

public Scene load(Reader reader,
                  String fileName)
           throws FileNotFoundException,
                  IncorrectFormatException,
                  ParsingErrorException
Loads an Anim8orFile from a Reader. The file name is given in order to display correcly debug and error information.

Parameters:
reader -
fileName -
Returns:
the loaded scene
Throws:
FileNotFoundException
IncorrectFormatException
ParsingErrorException

parseFile

public Anim8orRepository parseFile(SimpleTokenizer st)
                            throws SimpleTokenizer.ParsingException
parses a complete Anim8or file.

Parameters:
st - the tokenizer
Returns:
the parsed file, as an Anim8orRepository
Throws:
SimpleTokenizer.ParsingException

parseSkippedChunk

public void parseSkippedChunk(SimpleTokenizer st)
                       throws SimpleTokenizer.ParsingException
parses an unused block

Parameters:
st -
Throws:
SimpleTokenizer.ParsingException