Package com.sun.j3d.loaders.lw3d
Class Lw3dLoader
- java.lang.Object
-
- com.sun.j3d.loaders.lw3d.Lw3dLoader
-
- All Implemented Interfaces:
Loader
public class Lw3dLoader extends java.lang.Object implements 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
Fields Modifier and Type Field Description protected com.sun.j3d.loaders.lw3d.DebugOutput
debugPrinter
-
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
Constructors Constructor Description Lw3dLoader()
Default 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
debugOutput(int outputType, java.lang.String theOutput)
protected void
debugOutputLn(int outputType, java.lang.String theOutput)
java.lang.String
getBasePath()
Returns the current base path setting.java.net.URL
getBaseUrl()
Returns the current base URL setting.int
getFlags()
Returns the current loading flags setting.TransformGroup
getObject(java.lang.String name)
getObject() iterates through the objectList checking the given name against the fileName and objectName of each object in turn.Scene
load(java.io.Reader reader)
This method loads the Reader and returns the Scene containing the scene.Scene
load(java.lang.String fileName)
This method loads the named file and returns the Scene containing the scene.Scene
load(java.net.URL url)
This method loads the named file and returns the Scene containing the scene.void
setBasePath(java.lang.String pathName)
This method sets the base path to be used when searching for all data files within a Lightwave scene.void
setBaseUrl(java.net.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.
-
-
-
Constructor Detail
-
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 Detail
-
load
public Scene load(java.net.URL url) throws java.io.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:
java.io.FileNotFoundException
IncorrectFormatException
ParsingErrorException
-
load
public Scene load(java.lang.String fileName) throws java.io.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:
java.io.FileNotFoundException
IncorrectFormatException
ParsingErrorException
-
load
public Scene load(java.io.Reader reader) throws java.io.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:
java.io.FileNotFoundException
IncorrectFormatException
ParsingErrorException
-
setBaseUrl
public void setBaseUrl(java.net.URL url)
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
public void setBasePath(java.lang.String pathName)
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
public java.net.URL getBaseUrl()
Returns the current base URL setting.- Specified by:
getBaseUrl
in interfaceLoader
-
getBasePath
public java.lang.String 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
public TransformGroup getObject(java.lang.String name)
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
protected void debugOutputLn(int outputType, java.lang.String theOutput)
-
debugOutput
protected void debugOutput(int outputType, java.lang.String theOutput)
-
-