Package com.sun.j3d.loaders.lw3d
Class Lw3dLoader
java.lang.Object
com.sun.j3d.loaders.lw3d.Lw3dLoader
- All Implemented Interfaces:
Loader
This class implements the Loader API and allows users to load
Lightwave 3D scene files. In order to load properly, the object
files referred to in the scene files and the image files referred
to by the object files must all be specified with path and filenames
that are valid with respect to the directory in which the application
is being executed.
-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionDefault constructor.Lw3dLoader
(int flags) This constructor takes a flags word that specifies which types of scenefile items should be loaded into the scene. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
debugOutput
(int outputType, String theOutput) protected void
debugOutputLn
(int outputType, String theOutput) Returns the current base path setting.Returns the current base URL setting.int
getFlags()
Returns the current loading flags setting.getObject() iterates through the objectList checking the given name against the fileName and objectName of each object in turn.This method loads the Reader and returns the Scene containing the scene.This method loads the named file and returns the Scene containing the scene.This method loads the named file and returns the Scene containing the scene.void
setBasePath
(String pathName) This method sets the base path to be used when searching for all data files within a Lightwave scene.void
setBaseUrl
(URL url) This method sets the base URL name for data files associated with the file passed into the load(URL) method.void
setFlags
(int flags) This method sets the load flags for the file.
-
Field Details
-
debugPrinter
protected com.sun.j3d.loaders.lw3d.DebugOutput debugPrinter
-
-
Constructor Details
-
Lw3dLoader
public Lw3dLoader()Default constructor. Sets up default values for some variables. -
Lw3dLoader
public Lw3dLoader(int flags) This constructor takes a flags word that specifies which types of scenefile items should be loaded into the scene. The possible values are specified in the com.sun.j3d.loaders.Loader class.
-
-
Method Details
-
load
public Scene load(URL url) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException This method loads the named file and returns the Scene containing the scene. Any data files referenced by the Reader should be located in the same place as the named file; otherwise, users should specify an alternate base path with the setBaseUrl(URL) method.- Specified by:
load
in interfaceLoader
- Throws:
FileNotFoundException
IncorrectFormatException
ParsingErrorException
-
load
public Scene load(String fileName) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException This method loads the named file and returns the Scene containing the scene. Any data files referenced by this file should be located in the same place as the named file; otherwise users should specify an alternate base path with the setBasePath(String) method.- Specified by:
load
in interfaceLoader
- Throws:
FileNotFoundException
IncorrectFormatException
ParsingErrorException
-
load
public Scene load(Reader reader) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException This method loads the Reader and returns the Scene containing the scene. Any data files referenced by the Reader should be located in the user's current working directory.- Specified by:
load
in interfaceLoader
- Throws:
FileNotFoundException
IncorrectFormatException
ParsingErrorException
-
setBaseUrl
This method sets the base URL name for data files associated with the file passed into the load(URL) method. The basePath should be null by default, which is an indicator to the loader that it should look for any associated files starting from the same directory as the file passed into the load(URL) method.- Specified by:
setBaseUrl
in interfaceLoader
-
setBasePath
This method sets the base path to be used when searching for all data files within a Lightwave scene.- Specified by:
setBasePath
in interfaceLoader
-
getBaseUrl
Returns the current base URL setting.- Specified by:
getBaseUrl
in interfaceLoader
-
getBasePath
Returns the current base path setting.- Specified by:
getBasePath
in interfaceLoader
-
setFlags
public void setFlags(int flags) This method sets the load flags for the file. The flags should equal 0 by default (which tells the loader to only load geometry). -
getFlags
public int getFlags()Returns the current loading flags setting. -
getObject
getObject() iterates through the objectList checking the given name against the fileName and objectName of each object in turn. For the filename, it carves off the pathname and just checks the final name (e.g., "missile.lwo"). If name has []'s at the end, it will use the number inside those brackets to pick which object out of an ordered set it will send back (objectList is created in the order that objects exist in the file, so this order should correspond to the order specified by the user). If no []'s exist, just pass back the first one encountered that matches. -
debugOutputLn
-
debugOutput
-