md3.md3model
Class MD3ModelFactory

java.lang.Object
  |
  +--md3.md3model.MD3ModelFactory
Direct Known Subclasses:
MD3GLModelFactory

public class MD3ModelFactory
extends java.lang.Object

This is a factory class that follows the Abstract Factory pattern. The MD3 model related classes in the package cannot be instantiated directely. Use the factory methods provided here to obtain the necessary instances of those classes.

Subclass this class if you want the MD3 model construction process to create and use instances of your own subclasses. The default implementations provided here return instances of the default MD3 model classes provided in the md3.md3model package.

The factory methods that return empty objects can be used when creating your own models.

Author:
Erwin Vervaet (erwin@cs.kuleuven.ac.be)

Constructor Summary
MD3ModelFactory()
           
 
Method Summary
static MD3ModelFactory getFactory()
          Return the currently used factory, null if none.
 AnimationCfg makeAnimationCfg()
          Creates an empty AnimationCfg resource object.
 AnimationCfg makeAnimationCfg(java.io.InputStream in)
          Load animation.cfg data from the given input stream into the internal data stuctures of an AnimationCfg object.
 AnimationCfg makeAnimationCfg(java.lang.String filename)
          Load an animation.cfg file into the internal data stuctures of an AnimationCfg object.
 MD3Animation makeMD3Animation()
          Creates an empty, uninitialized MD3Animation object.
 MD3Animation makeMD3Animation(java.lang.String line)
          Factory method that creates a new MD3Animation object and initialize it with the data in the specified string.
 MD3BoneFrame makeMD3BoneFrame(int tagNum)
          Create an empty bone frame with the specified amount of tag positions.
 MD3BoneFrame makeMD3BoneFrame(int tagNum, java.io.DataInput din)
          Read a bone frame object with the specified amount of tag positions from the given input stream.
 MD3Mesh makeMD3Mesh()
          Creates an empty, uninitialized MD3Mesh object.
 MD3Mesh makeMD3Mesh(java.io.DataInput din)
          Create a new MD3Mesh object and initialize it with data read from the specified input stream.
 MD3Model makeMD3Model()
          Create a new, uninitialized MD3Model object.
 MD3Model makeMD3Model(java.lang.String filename)
          Factory method that loads an MD3 model from a file and sets up an MD3Model object with the read information.
 MD3Model makeMD3Model(java.lang.String name, java.io.InputStream in)
          Factory method that loads an MD3 model from a specified input stream and sets up an MD3Model object with the read information.
 MD3Skin makeMD3Skin()
          Creates an empty MD3Skin resource object.
 MD3Skin makeMD3Skin(java.io.InputStream in)
          Load data from the specified input stream and put it in an MD3Skin resource object.
 MD3Skin makeMD3Skin(java.lang.String filename)
          Load data from the specified skin file and put it in an MD3Skin resource object.
 MD3Tag makeMD3Tag()
          Create a new, uninitialized MD3Tag object.
 MD3Tag makeMD3Tag(java.io.DataInput din)
          Read a MD3Tag object from the specified input stream.
 MD3Texture makeMD3Texture()
          Creates an empty, uninitialized MD3Texture object.
 MD3Texture makeMD3Texture(java.lang.String name, java.lang.String loadFilename)
          Factory method that loads a texture from a file.
 MD3Texture makeMD3Texture(java.lang.String name, java.lang.String loadFilename, java.io.InputStream in)
          Factory method that loads a texture from an input stream.
static void setFactory(MD3ModelFactory factory)
          Set the factory that will be used during the MD3Model object creation process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MD3ModelFactory

public MD3ModelFactory()
Method Detail

setFactory

public static void setFactory(MD3ModelFactory factory)

Set the factory that will be used during the MD3Model object creation process.


getFactory

public static MD3ModelFactory getFactory()

Return the currently used factory, null if none.


makeMD3Model

public MD3Model makeMD3Model(java.lang.String filename)
                      throws java.io.IOException

Factory method that loads an MD3 model from a file and sets up an MD3Model object with the read information.

Parameters:
filename - Name of file to load.
Returns:
An MD3Model object containing the read information.

makeMD3Model

public MD3Model makeMD3Model(java.lang.String name,
                             java.io.InputStream in)
                      throws java.io.IOException

Factory method that loads an MD3 model from a specified input stream and sets up an MD3Model object with the read information. The given name will be stored as the model's loadFilename.

Parameters:
name - Name of the model.
in - Stream to read data from.
Returns:
An MD3Model object containing the read information.

makeMD3Model

public MD3Model makeMD3Model()

Create a new, uninitialized MD3Model object.


makeMD3BoneFrame

public MD3BoneFrame makeMD3BoneFrame(int tagNum,
                                     java.io.DataInput din)
                              throws java.io.IOException

Read a bone frame object with the specified amount of tag positions from the given input stream. Note that the tag information itself will NOT be initialized. This has to be done separately!


makeMD3BoneFrame

public MD3BoneFrame makeMD3BoneFrame(int tagNum)

Create an empty bone frame with the specified amount of tag positions.


makeMD3Tag

public MD3Tag makeMD3Tag(java.io.DataInput din)
                  throws java.io.IOException

Read a MD3Tag object from the specified input stream.


makeMD3Tag

public MD3Tag makeMD3Tag()

Create a new, uninitialized MD3Tag object.


makeMD3Mesh

public MD3Mesh makeMD3Mesh(java.io.DataInput din)
                    throws java.io.IOException

Create a new MD3Mesh object and initialize it with data read from the specified input stream.


makeMD3Mesh

public MD3Mesh makeMD3Mesh()

Creates an empty, uninitialized MD3Mesh object.


makeMD3Texture

public MD3Texture makeMD3Texture(java.lang.String name,
                                 java.lang.String loadFilename)
                          throws java.io.IOException

Factory method that loads a texture from a file.

Parameters:
name - Name of the texture as specified in .md3 or .skin file.
loadFilename - Full name of file from which texture data will be loaded.
Returns:
The loaded MD3Texture object;

makeMD3Texture

public MD3Texture makeMD3Texture(java.lang.String name,
                                 java.lang.String loadFilename,
                                 java.io.InputStream in)
                          throws java.io.IOException

Factory method that loads a texture from an input stream.

Parameters:
name - Name of the texture as specified in .md3 or .skin file.
loadFilename - Full name of file from which texture is (supposedly) loaded.
in - Stream to load texture data from.
Returns:
The loaded MD3Texture object;

makeMD3Texture

public MD3Texture makeMD3Texture()

Creates an empty, uninitialized MD3Texture object.


makeMD3Animation

public MD3Animation makeMD3Animation(java.lang.String line)
                              throws java.io.IOException

Factory method that creates a new MD3Animation object and initialize it with the data in the specified string. Note that the name and type of the animation are NOT initialized! This has to be done separately!


makeMD3Animation

public MD3Animation makeMD3Animation()

Creates an empty, uninitialized MD3Animation object.


makeAnimationCfg

public AnimationCfg makeAnimationCfg(java.lang.String filename)
                              throws java.io.IOException

Load an animation.cfg file into the internal data stuctures of an AnimationCfg object.

Parameters:
filename - Name of the file to open.

makeAnimationCfg

public AnimationCfg makeAnimationCfg(java.io.InputStream in)
                              throws java.io.IOException

Load animation.cfg data from the given input stream into the internal data stuctures of an AnimationCfg object.

Parameters:
in - Stream to load data from.

makeAnimationCfg

public AnimationCfg makeAnimationCfg()

Creates an empty AnimationCfg resource object.


makeMD3Skin

public MD3Skin makeMD3Skin(java.lang.String filename)
                    throws java.io.IOException

Load data from the specified skin file and put it in an MD3Skin resource object.


makeMD3Skin

public MD3Skin makeMD3Skin(java.io.InputStream in)
                    throws java.io.IOException

Load data from the specified input stream and put it in an MD3Skin resource object.


makeMD3Skin

public MD3Skin makeMD3Skin()

Creates an empty MD3Skin resource object.