org.jagatoo.loaders.models.cal3d.core
Class CalCoreModel

java.lang.Object
  extended by org.jagatoo.loaders.models.cal3d.core.CalCoreModel

public class CalCoreModel
extends java.lang.Object

The core model or prototype for animated character models.


Field Summary
protected  CalCoreSkeleton coreSkeleton
           
protected  java.util.Map<java.lang.String,CalCoreAnimation> mapCoreAnimation
           
protected  java.util.Map<java.lang.String,CalCoreMaterial> mapCoreMaterial
           
protected  java.util.Vector<java.util.Map<java.lang.String,CalCoreMaterial>> mapCoreMaterialThread
           
protected  java.util.Map<java.lang.String,CalCoreMesh> mapCoreMesh
           
protected  java.util.Map<java.lang.String,CalCoreMorphAnimation> mapCoreMorphAnimation
           
protected  java.lang.String name
           
protected  java.util.Properties properties
           
protected  java.lang.Object userData
           
 
Constructor Summary
CalCoreModel(java.lang.String name)
          Constructs the core model instance.
CalCoreModel(java.lang.String name, CalCoreSkeleton skeleton)
          Constructs a core model with the supplied skeleton.
 
Method Summary
 void addCoreAnimation(java.lang.String tag, CalCoreAnimation coreAnimation)
          /** Adds a core animation.
 void addCoreMaterial(java.lang.String tag, CalCoreMaterial coreMaterial)
          /** Adds a core material.
 void addCoreMesh(java.lang.String tag, CalCoreMesh coreMesh)
          /** Adds a core mesh.
 void addCoreMorphAnimation(java.lang.String tag, CalCoreMorphAnimation coreAnimation)
          /** Adds a core morph animation.
 int countMaterialThreadsNeeded()
          Counts the number of core materials needed for this model.
 CalCoreAnimation getCoreAnimation(java.lang.String coreAnimationId)
          /** Gets the core animation for a specified id tag.
 int getCoreAnimationCount()
          /** The number of core animations.
 java.util.Collection<java.lang.String> getCoreAnimationIds()
           
 java.util.Map<java.lang.String,CalCoreAnimation> getCoreAnimations()
           
 CalCoreMaterial getCoreMaterial(int coreMaterialThreadId, java.lang.String coreMaterialSetId)
          Returns a specified core material ID.
 CalCoreMaterial getCoreMaterial(java.lang.String coreMaterialId)
          /** Provides access to a core material.
 int getCoreMaterialCount()
          This function returns the number of core materials in the core model instance.
 java.util.Collection<java.lang.String> getCoreMaterialIds()
           
 java.util.Map<java.lang.String,CalCoreMaterial> getCoreMaterials()
           
 java.util.Vector<java.util.Map<java.lang.String,CalCoreMaterial>> getCoreMaterialThreadMaps()
          Gets the vector of maps from core material set to core material indexed by thread.
 CalCoreMesh getCoreMesh(java.lang.String coreMeshId)
          Provides access to a core mesh.
 int getCoreMeshCount()
          Returns the number of core meshes.
 java.util.Map<java.lang.String,CalCoreMesh> getCoreMeshes()
          Gets all the core meshes in a single map
 java.util.Collection<java.lang.String> getCoreMeshIds()
           
 CalCoreMorphAnimation getCoreMorphAnimation(java.lang.String coreAnimationId)
          /** Gets the morph core animation for a specified id tag.
 int getCoreMorphAnimationCount()
          /** The number of core animations.
 java.util.Map<java.lang.String,CalCoreMorphAnimation> getCoreMorphAnimations()
           
 CalCoreSkeleton getCoreSkeleton()
          Provides access to the core skeleton.
 java.lang.String getName()
           
 int getNumCoreMaterialThreads()
          Gets the number of core material threads.
 java.util.Properties getProperties()
          Gets the properties (as key/value pairs) for this model supplied when it was loaded.
 java.lang.String getProperty(java.lang.String property)
           
 java.lang.Object getUserData()
          Provides access to the user data.
 void removeCoreAnimation(java.lang.String tag)
          Removes a core animation from the core model.
 void removeCoreMorphAnimation(java.lang.String tag)
          Removes a core morph animation from the core model.
 void setCoreMaterial(int coreMaterialThreadId, java.lang.String coreMaterialSetId, java.lang.String coreMaterialId)
          Sets a core material ID.
 void setCoreSkeleton(CalCoreSkeleton coreSkeleton)
          Sets the core skeleton.
 void setProperties(java.util.Properties properties)
          Sets the properties for this model - usually when it is loaded.
 void setUserData(java.lang.Object userData)
          Stores user data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

coreSkeleton

protected CalCoreSkeleton coreSkeleton

mapCoreAnimation

protected java.util.Map<java.lang.String,CalCoreAnimation> mapCoreAnimation

mapCoreMorphAnimation

protected java.util.Map<java.lang.String,CalCoreMorphAnimation> mapCoreMorphAnimation

mapCoreMesh

protected java.util.Map<java.lang.String,CalCoreMesh> mapCoreMesh

mapCoreMaterial

protected java.util.Map<java.lang.String,CalCoreMaterial> mapCoreMaterial

mapCoreMaterialThread

protected java.util.Vector<java.util.Map<java.lang.String,CalCoreMaterial>> mapCoreMaterialThread

userData

protected java.lang.Object userData

properties

protected java.util.Properties properties
Constructor Detail

CalCoreModel

public CalCoreModel(java.lang.String name)
Constructs the core model instance. This function is the default constructor of the core model instance.


CalCoreModel

public CalCoreModel(java.lang.String name,
                    CalCoreSkeleton skeleton)
Constructs a core model with the supplied skeleton.

Method Detail

addCoreMesh

public void addCoreMesh(java.lang.String tag,
                        CalCoreMesh coreMesh)
/** Adds a core mesh. This function adds a core mesh to the core model instance.

Parameters:
tag - A name to refer to this subsequently
coreMesh - A pointer to the core mesh that should be added.

getCoreMeshes

public java.util.Map<java.lang.String,CalCoreMesh> getCoreMeshes()
Gets all the core meshes in a single map


getCoreMeshIds

public java.util.Collection<java.lang.String> getCoreMeshIds()

addCoreAnimation

public void addCoreAnimation(java.lang.String tag,
                             CalCoreAnimation coreAnimation)
/** Adds a core animation. This function adds a core animation to the core model instance.

Parameters:
tag - A name to refer to this subsequently
coreAnimation - the core animation that should be added.

removeCoreAnimation

public void removeCoreAnimation(java.lang.String tag)
Removes a core animation from the core model.

Parameters:
tag - The name of the animation to remove.

getCoreAnimations

public java.util.Map<java.lang.String,CalCoreAnimation> getCoreAnimations()

getCoreAnimationIds

public java.util.Collection<java.lang.String> getCoreAnimationIds()

addCoreMorphAnimation

public void addCoreMorphAnimation(java.lang.String tag,
                                  CalCoreMorphAnimation coreAnimation)
/** Adds a core morph animation. This function adds a core morph animation to the core model instance.

Parameters:
tag - A name to refer to this subsequently
coreAnimation - the core morph animation that should be added.

removeCoreMorphAnimation

public void removeCoreMorphAnimation(java.lang.String tag)
Removes a core morph animation from the core model.

Parameters:
tag - The name of the animation to remove.

addCoreMaterial

public void addCoreMaterial(java.lang.String tag,
                            CalCoreMaterial coreMaterial)
/** Adds a core material. This function adds a core material to the core model instance.

Parameters:
tag - A name to refer to this subsequently
coreMaterial - A pointer to the core material that should be added.

getCoreMaterialIds

public java.util.Collection<java.lang.String> getCoreMaterialIds()

getCoreAnimation

public CalCoreAnimation getCoreAnimation(java.lang.String coreAnimationId)
/** Gets the core animation for a specified id tag.

Parameters:
coreAnimationId - The ID of the core animation that should be returned.
Returns:
the core animation or null if not found

getCoreAnimationCount

public int getCoreAnimationCount()
/** The number of core animations.

Returns:
The number of core animations.

getCoreMorphAnimation

public CalCoreMorphAnimation getCoreMorphAnimation(java.lang.String coreAnimationId)
/** Gets the morph core animation for a specified id tag.

Parameters:
coreAnimationId - The ID of the core animation that should be returned.
Returns:
the core animation or null if not found

getCoreMorphAnimations

public java.util.Map<java.lang.String,CalCoreMorphAnimation> getCoreMorphAnimations()

getCoreMorphAnimationCount

public int getCoreMorphAnimationCount()
/** The number of core animations.

Returns:
The number of core animations.

getCoreMaterial

public CalCoreMaterial getCoreMaterial(java.lang.String coreMaterialId)
/** Provides access to a core material. This function returns the core material with the given ID.

Parameters:
coreMaterialId - The ID of the core material that should be returned.
Returns:
One of the following values: \li a pointer to the core material \li \b 0 if an error happend

getCoreMaterials

public java.util.Map<java.lang.String,CalCoreMaterial> getCoreMaterials()

getCoreMaterialCount

public int getCoreMaterialCount()
This function returns the number of core materials in the core model instance.

Returns:
The number of core materials.

countMaterialThreadsNeeded

public int countMaterialThreadsNeeded()
Counts the number of core materials needed for this model. This is not the same as getting the count from the material set mapping. It does not deal with sparse numbering of threads though and simply reports the highest thread Id encountered (plus one).


getCoreMaterial

public CalCoreMaterial getCoreMaterial(int coreMaterialThreadId,
                                       java.lang.String coreMaterialSetId)
Returns a specified core material ID. This function returns the core material ID for a specified core material thread / core material set pair.

Parameters:
coreMaterialThreadId - The ID of the core material thread.
coreMaterialSetId - The ID of the core material set.
Returns:
One of the following values: \li the \b ID of the core material \li throws an IllegalArgumentException if an error happend

getCoreMesh

public CalCoreMesh getCoreMesh(java.lang.String coreMeshId)
Provides access to a core mesh. This function returns the core mesh with the given ID.

Parameters:
coreMeshId - The ID of the core mesh that should be returned.
Returns:
One of the following values: \li a pointer to the core mesh \li \b 0 if an error happend

getCoreMeshCount

public int getCoreMeshCount()
Returns the number of core meshes. This function returns the number of core meshes in the core model instance.

Returns:
The number of core meshes.

getCoreSkeleton

public CalCoreSkeleton getCoreSkeleton()
Provides access to the core skeleton. This function returns the core skeleton.

Returns:
One of the following values: \li a pointer to the core skeleton \li \b 0 if an error happend

getUserData

public java.lang.Object getUserData()
Provides access to the user data. This function returns the user data stored in the core model instance.

Returns:
The user data stored in the core model instance.

setCoreMaterial

public void setCoreMaterial(int coreMaterialThreadId,
                            java.lang.String coreMaterialSetId,
                            java.lang.String coreMaterialId)
Sets a core material ID. This function sets a core material ID for a core material thread / core material set pair.

Parameters:
coreMaterialThreadId - The ID of the core material thread.
coreMaterialSetId - The ID of the core maetrial set.
coreMaterialId - The ID of the core maetrial.

getNumCoreMaterialThreads

public int getNumCoreMaterialThreads()
Gets the number of core material threads.


getCoreMaterialThreadMaps

public java.util.Vector<java.util.Map<java.lang.String,CalCoreMaterial>> getCoreMaterialThreadMaps()
Gets the vector of maps from core material set to core material indexed by thread.


setCoreSkeleton

public void setCoreSkeleton(CalCoreSkeleton coreSkeleton)
Sets the core skeleton. This function sets the core skeleton of the core model instance..

Parameters:
coreSkeleton - The core skeleton that should be set.

setUserData

public void setUserData(java.lang.Object userData)
Stores user data. This function stores user data in the core model instance.

Parameters:
userData - The user data that should be stored.

getProperties

public java.util.Properties getProperties()
Gets the properties (as key/value pairs) for this model supplied when it was loaded. These properties may include further details about how the model was generated, or how it should be used.


getProperty

public java.lang.String getProperty(java.lang.String property)

setProperties

public void setProperties(java.util.Properties properties)
Sets the properties for this model - usually when it is loaded. These properties may include further details about how the model was generated, or how it should be used. The properties will also usually include the source file names for the various components which form the model.


getName

public java.lang.String getName()