com.model.md5.importer
Class MD5Importer

java.lang.Object
  extended by com.model.md5.importer.MD5Importer

public class MD5Importer
extends java.lang.Object

MD5Importer is a singleton utility class that provides a mechanism to load models and animations of MD5 format.

MD5Importer allows separate Mesh and IMD5Animation loading process. However, it also provides convenient methods for loading both MD5 resources at once.

MD5Importer should be cleaned up after the loading process is completed.

For details on MD5 format, please go to official MD5 wiki at http://www.modwiki.net/wiki/MD5_(file_format).


Constructor Summary
MD5Importer()
          Constructor of MD5Importer.
 
Method Summary
 void cleanup()
          Cleanup the importer.
 IMD5Animation getAnimation()
          Retrieve the MD5 animation instance.
 int getAnisotropic()
          Retrieve the anisotropic level.
static MD5Importer getInstance()
          Retrieve the singleton importer instance.
 com.jme.image.Texture.MagnificationFilter getMagFilter()
          Retrieve the magnification (FM) texture filter.
 IMD5Node getMD5Node()
          Retrieve the MD5 node instance.
 com.jme.image.Texture.MinificationFilter getMiniFilter()
          Retrieve the minification (MM) texture filter.
 boolean isOriented()
          Check if oriented bounding should be used.
 void load(java.net.URL md5mesh, java.lang.String modelName, java.net.URL md5anim, java.lang.String animName, int repeatType)
          Load the given md5mesh and md5anim files and assign the loaded JointAnimation to the Mesh.
 void loadAnim(java.net.URL md5anim, java.lang.String name)
          Load the given md5anim file.
 void loadMesh(java.net.URL md5mesh, java.lang.String name)
          Load the given md5mesh file.
 void setAnisotropic(int aniso)
          Set the texture anisotropic level.
 void setMagFilter(com.jme.image.Texture.MagnificationFilter filter)
          Set the magnification (FM) Texture filter.
 void setMiniFilter(com.jme.image.Texture.MinificationFilter filter)
          Set the minification (MM) Texture filter.
 void setOrientedBounding(boolean orientedBounding)
          Set if oriented bounding should be used for the meshes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MD5Importer

public MD5Importer()
Constructor of MD5Importer.

Method Detail

getInstance

public static MD5Importer getInstance()
Retrieve the singleton importer instance.

Returns:
The MD5Importer instance.

load

public void load(java.net.URL md5mesh,
                 java.lang.String modelName,
                 java.net.URL md5anim,
                 java.lang.String animName,
                 int repeatType)
          throws java.io.IOException
Load the given md5mesh and md5anim files and assign the loaded JointAnimation to the Mesh.

Parameters:
md5mesh - The URL of the md5mesh file.
modelName - The String name of the loaded model.
md5anim - The URL points to the md5anim file.
animName - The String name of the loaded animation.
repeatType - The Integer repeat type.
Throws:
java.io.IOException - Thrown when errors occurred during file reading.

loadMesh

public void loadMesh(java.net.URL md5mesh,
                     java.lang.String name)
              throws java.io.IOException
Load the given md5mesh file.

Parameters:
md5mesh - The URL points to the md5mesh file.
name - The String name of the loaded model.
Throws:
java.io.IOException - Thrown when errors occurred during file reading.

loadAnim

public void loadAnim(java.net.URL md5anim,
                     java.lang.String name)
              throws java.io.IOException
Load the given md5anim file.

Parameters:
md5anim - The URL points to the md5anim file.
name - The String name of the loaded animation.
Throws:
java.io.IOException - Thrown when errors occurred during file reading.

setMiniFilter

public void setMiniFilter(com.jme.image.Texture.MinificationFilter filter)
Set the minification (MM) Texture filter.

Parameters:
filter - The minification (MM) Texture filter.

setMagFilter

public void setMagFilter(com.jme.image.Texture.MagnificationFilter filter)
Set the magnification (FM) Texture filter.

Parameters:
filter - The magnification (FM) Texture filter.

setAnisotropic

public void setAnisotropic(int aniso)
Set the texture anisotropic level.

Parameters:
value - The Integer anisotropic level value.

setOrientedBounding

public void setOrientedBounding(boolean orientedBounding)
Set if oriented bounding should be used for the meshes.

Parameters:
orientedBounding - True if oriented bounding should be used. False otherwise.

getMiniFilter

public com.jme.image.Texture.MinificationFilter getMiniFilter()
Retrieve the minification (MM) texture filter.

Returns:
The MinificationFilter enumeration.

getMagFilter

public com.jme.image.Texture.MagnificationFilter getMagFilter()
Retrieve the magnification (FM) texture filter.

Returns:
The MagnificationFilter enumeration.

getAnisotropic

public int getAnisotropic()
Retrieve the anisotropic level.

Returns:
The Integer anisotropic level.

getMD5Node

public IMD5Node getMD5Node()
Retrieve the MD5 node instance.

Returns:
The IMD5Node instance.

getAnimation

public IMD5Animation getAnimation()
Retrieve the MD5 animation instance.

Returns:
The IMD5Animation instance.

isOriented

public boolean isOriented()
Check if oriented bounding should be used.

Returns:
True if oriented bounding should be used. False otherwise.

cleanup

public void cleanup()
Cleanup the importer.