|
NCSA Portfolio | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.j3d.loaders.LoaderBase | +--ncsa.j3d.loaders.ModelLoader
This class is used to load 3D models and return them as a Scene for placement into a scene. In order to write your own object loaders that ModelLoader can recognize, you must do the following:
1. Create an object named by the extension of the type of model you wish to load, with the prefix "Loader_". For example, Wavefront files have the obj extension and VRML files have the wrl extension. Objects created to load those models would be named Loader_OBJ and Loader_WRL, respectively.
2. The object you're creating must implement the BasicLoader interface. ModelLoader uses this interface internally, and uses it to load objects.
3. Currently, the loader must be part of the ncsa.j3d.loaders package. Unless it is, it can not be recognized by ModelLoader. This will probably change in future implementations to make it even easier to add new loaders.
Once you've done this, you should just be able to call ModelLoader as you usually would (see below) and your new Loader will automatically be recognized and called by ModelLoader.
Usage:
ModelLoader loader = new ModelLoader(); Scene model1 = loader.load(new URL("http:/havefun.ncsa.uiuc.edu/~srp/astro.wrl")); Scene model2 = loader.load("cah.obj"); Scene model3 = loader.load("/opt/jw.dxf");
Constructor Summary | |
ModelLoader()
|
Method Summary | |
com.sun.j3d.loaders.Scene |
load(java.io.Reader reader)
This method should not be called directly. |
com.sun.j3d.loaders.Scene |
load(java.io.Reader reader,
java.lang.String ext)
Read the data from the BufferedReader and return it as a Scene. |
com.sun.j3d.loaders.Scene |
load(java.lang.String filename)
Loads a model given its filename |
com.sun.j3d.loaders.Scene |
load(java.net.URL url)
Loads a model given its URL |
Methods inherited from class com.sun.j3d.loaders.LoaderBase |
getBasePath,
getBaseUrl,
getFlags,
setBasePath,
setBaseUrl,
setFlags |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public ModelLoader()
Method Detail |
public com.sun.j3d.loaders.Scene load(java.net.URL url) throws java.io.FileNotFoundException
url
- the URL of the model to loadpublic com.sun.j3d.loaders.Scene load(java.lang.String filename) throws java.io.FileNotFoundException
filename
- the file name of the model to loadpublic com.sun.j3d.loaders.Scene load(java.io.Reader reader, java.lang.String ext) throws java.io.FileNotFoundException
base
- the base name of where this file is being readbr
- the reader connected to the data to be parsedext
- the extension indicating the data typepublic com.sun.j3d.loaders.Scene load(java.io.Reader reader)
|
NCSA Portfolio | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |