com.microcrowd.loader.java3d.max3ds
Class Loader3DS

java.lang.Object
  extended by LoaderBase
      extended by com.microcrowd.loader.java3d.max3ds.Loader3DS

public class Loader3DS
extends LoaderBase

Used to load a 3ds studio max file. This will sequentially read a 3ds file, load or skip chunks and subchunks and initialize the data for the chunks. A ChunkChopper is a singleton flyweight factory responsible for chopping the data up and sending it to the corresponding chunks(which are flyweights ala the flyweight pattern) for processing.

Features not supported; unknown chunks are skipped.


Constructor Summary
Loader3DS()
           
 
Method Summary
static void addDefaultLights(Group group)
          Adds defaultlights to the group provided similar to the ones 3ds max adds when there are none in the scene.
 boolean fromUrl()
          Returns true if this loader is loading files from a url.
 java.awt.Image getTextureImage(java.lang.String imageName)
          gets an image with the specified name.
 Scene load(java.io.Reader reader)
          This is not supported
 Scene load(java.lang.String modelPath)
          Loads the model by parsing the file, modelPath and creating a 3D Scene.
 Scene load(java.net.URL url)
          throws UnsupportedOperationException
protected  Scene parseChunks(java.io.InputStream inputStream, int modelSize)
          Gets a chunk chopper to do all the dirty work.
 void setBasePath(java.lang.String pathName)
          Set the path where files associated with this .obj file are located.
 void setTextureImageLoader(TextureImageLoader loader)
          Sets the TextureImageLoader to be used when texture images are needed.
 void turnOnDebug()
          Turn on debug mode for all 3ds xml.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Loader3DS

public Loader3DS()
Method Detail

load

public Scene load(java.io.Reader reader)
           throws java.io.FileNotFoundException
This is not supported

Parameters:
reader - loads a model from a reader
Returns:
nothing, this isn't implemented.
Throws:
java.io.FileNotFoundException
java.lang.UnsupportedOperationException

load

public Scene load(java.lang.String modelPath)
           throws java.io.FileNotFoundException
Loads the model by parsing the file, modelPath and creating a 3D Scene.

Parameters:
modelPath - the path of the 3ds file.
Returns:
a loaded scene
Throws:
java.io.FileNotFoundException - if the file can't be located.

setBasePath

public void setBasePath(java.lang.String pathName)
Set the path where files associated with this .obj file are located. Only needs to be called to set it to a different directory from that containing the .obj file.


fromUrl

public boolean fromUrl()
Returns true if this loader is loading files from a url.


getTextureImage

public java.awt.Image getTextureImage(java.lang.String imageName)
gets an image with the specified name. This uses a DefaultTextureImageLoader to load the image if one hasn't been set for this loader.

Parameters:
imageName - name of image to load.
Returns:
image corresponding to imageName

setTextureImageLoader

public void setTextureImageLoader(TextureImageLoader loader)
Sets the TextureImageLoader to be used when texture images are needed.

Parameters:
loader - the TextureImageLoader that will be used to load images.

parseChunks

protected Scene parseChunks(java.io.InputStream inputStream,
                            int modelSize)
Gets a chunk chopper to do all the dirty work.

Parameters:
inputStream - the stream containing the model.
modelSize - size of the model file.
Returns:
a java3d scene built from input.

addDefaultLights

public static void addDefaultLights(Group group)
Adds defaultlights to the group provided similar to the ones 3ds max adds when there are none in the scene.

Parameters:
group - to add the lighting to.

load

public Scene load(java.net.URL url)
           throws java.io.FileNotFoundException
throws UnsupportedOperationException

Parameters:
url - url of model to be loaded.
Returns:
a java3d scene represented in url
Throws:
java.io.FileNotFoundException - if file couldn't be found.

turnOnDebug

public void turnOnDebug()
Turn on debug mode for all 3ds xml.



Copyright © 2000-2011 Microcrowd. All Rights Reserved.