com.jmex.model
Class Loader

java.lang.Object
  extended by com.jmex.model.Loader

public abstract class Loader
extends java.lang.Object

Generic abstract Loader class for FileFormat Loaders to inherit from to standardize file loading. Future file loaders should extend this class.

Author:
Jack Lindamood

Field Summary
protected  java.net.URL baseUrl
           
protected  boolean dirty
           
static long LOAD_ALL
           
static long LOAD_CONTROLLERS
           
 long loadFlags
           
static long PRECOMPUTE_BOUNDS
           
 
Constructor Summary
Loader()
          Default Constructor.
Loader(int flags)
          Constructs file loader with given flags.
 
Method Summary
abstract  Node fetchCopy()
          Returns a copy of the previously loaded file.
 java.net.URL getBase()
          Returns base path for textures
 long getLoadFlags()
          Returns the current flag state, as a long
 Node load(java.lang.String s)
          Loads a MilkShape file from the path in the string s.
abstract  Node load(java.net.URL url)
          Loads a URL, similar to load(String s)
 void removeLoadFlag(long flag)
          Removes the given flag, setting it to false
 void setBase(java.net.URL path)
          Sets the base path to load textures from.
 void setLoadFlag(long flag)
          Sets the give flag to true
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loadFlags

public long loadFlags

LOAD_CONTROLLERS

public static final long LOAD_CONTROLLERS
See Also:
Constant Field Values

LOAD_ALL

public static final long LOAD_ALL
See Also:
Constant Field Values

PRECOMPUTE_BOUNDS

public static final long PRECOMPUTE_BOUNDS
See Also:
Constant Field Values

dirty

protected boolean dirty

baseUrl

protected java.net.URL baseUrl
Constructor Detail

Loader

public Loader()
Default Constructor. Flags are LOAD_ALL by default.


Loader

public Loader(int flags)
Constructs file loader with given flags.

Parameters:
flags - The flags for this file loader
Method Detail

setBase

public void setBase(java.net.URL path)
Sets the base path to load textures from.

Parameters:
path - New texture path

getBase

public java.net.URL getBase()
Returns base path for textures

Returns:
URL to base path

fetchCopy

public abstract Node fetchCopy()
Returns a copy of the previously loaded file. The two should be able to operate separately acording to the needs of the loader, but are allowed and encouraged to share as much as posible.

Returns:
A node to the new copy

load

public Node load(java.lang.String s)
Loads a MilkShape file from the path in the string s. All texture/alpha maps associated with the file are by default in the same directory as the .ms3d file specified. Texture directory can be changed by a call to setBasePath(String), allowing the programmer to seperate storage of model files and pictures.

Parameters:
s - Filename
Returns:
Node to the loaded file.
Throws:
JmeException - Either .ms3d file or texture files don't exist
See Also:
Node

load

public abstract Node load(java.net.URL url)
Loads a URL, similar to load(String s)

Parameters:
url - URL to load
Returns:
Node to the loaded file

setLoadFlag

public void setLoadFlag(long flag)
Sets the give flag to true

Parameters:
flag - New flag to set

removeLoadFlag

public void removeLoadFlag(long flag)
Removes the given flag, setting it to false

Parameters:
flag - The flag to remove

getLoadFlags

public long getLoadFlags()
Returns the current flag state, as a long

Returns:
long to represent current flag state