- Cal3D 0.9 API Reference -

Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

# CalCoreModel Class Reference

The core model class. More...

`#include <coremodel.h>`

List of all members.

## Public Member Functions

| CalCoreModel ()
| Constructs the core model instance.
virtual | ~CalCoreModel ()
| Destructs the core model instance.
int | addCoreAnimation (CalCoreAnimation *pCoreAnimation)
| Adds a core animation.
int | addCoreMorphAnimation (CalCoreMorphAnimation *pCoreMorphAnimation)
| Adds a core morph animation.
int | addCoreMaterial (CalCoreMaterial *pCoreMaterial)
| Adds a core material.
int | addCoreMesh (CalCoreMesh *pCoreMesh)
| Adds a core mesh.
bool | create (const std::string &strName)
| Creates the core model instance.
bool | createCoreMaterialThread (int coreMaterialThreadId)
| Creates a core material thread.
void | destroy ()
| Destroys the core model instance.
CalCoreAnimation * | getCoreAnimation (int coreAnimationId)
| Provides access to a core animation.
CalCoreMorphAnimation * | getCoreMorphAnimation (int coreMorphAnimationId)
| Provides access to a core morph animation.
int | getCoreAnimationCount ()
| Returns the number of core animations.
int | getCoreMorphAnimationCount ()
| Returns the number of core morph animations.
CalCoreMaterial * | getCoreMaterial (int coreMaterialId)
| Provides access to a core material.
int | getCoreMaterialCount ()
| Returns the number of core materials.
int | getCoreMaterialId (int coreMaterialThreadId, int coreMaterialSetId)
| Returns a specified core material ID.
CalCoreMesh * | getCoreMesh (int coreMeshId)
| Provides access to a core mesh.
int | getCoreMeshCount ()
| Returns the number of core meshes.
CalCoreSkeleton * | getCoreSkeleton ()
| Provides access to the core skeleton.
Cal::UserData | getUserData ()
| Provides access to the user data.
int | loadCoreAnimation (const std::string &strFilename)
| Loads a core animation.
int | loadCoreMaterial (const std::string &strFilename)
| Loads a core material.
int | loadCoreMesh (const std::string &strFilename)
| Loads a core mesh.
bool | loadCoreSkeleton (const std::string &strFilename)
| Loads the core skeleton.
bool | saveCoreAnimation (const std::string &strFilename, int coreAnimtionId)
| Saves a core animation.
bool | saveCoreMaterial (const std::string &strFilename, int coreMaterialId)
| Saves a core material.
bool | saveCoreMesh (const std::string &strFilename, int coreMeshId)
| Saves a core mesh.
bool | saveCoreSkeleton (const std::string &strFilename)
| Saves the core skeleton.
bool | setCoreMaterialId (int coreMaterialThreadId, int coreMaterialSetId, int coreMaterialId)
| Sets a core material ID.
void | setCoreSkeleton (CalCoreSkeleton *pCoreSkeleton)
| Sets the core skeleton.
void | setUserData (Cal::UserData userData)
| Stores user data.
void | addBoneHelper (const std::string &strBoneName, int boneId)
| Creates or overwrites a string-to-boneId mapping.
void | addAnimHelper (const std::string &strAnimName, int animId)
| Creates or overwrites a string-to-animation ID mapping.
int | getBoneId (const std::string &strBoneName)
| Retrieves the ID of the bone referenced by a string.
int | getAnimId (const std::string &strAnimName)
| Retrieves the ID of the animation referenced by a string.

## Protected Attributes

std::string | m_strName
CalCoreSkeleton * | m_pCoreSkeleton
std::vector< CalCoreAnimation * > | m_vectorCoreAnimation
std::vector< CalCoreMorphAnimation * > | m_vectorCoreMorphAnimation
std::vector< CalCoreMesh * > | m_vectorCoreMesh
std::vector< CalCoreMaterial * > | m_vectorCoreMaterial
std::map< int, std::map< int, int > > | m_mapmapCoreMaterialThread
Cal::UserData | m_userData
std::map< std::string, int > | m_animationHelper

## Detailed Description

The core model class.

## Constructor & Destructor Documentation

CalCoreModel::CalCoreModel | ( |  | ) |

| Constructs the core model instance. This function is the default constructor of the core model instance.

CalCoreModel::~CalCoreModel | ( |  | ) | `[virtual]`

| Destructs the core model instance. This function is the destructor of the core model instance.

## Member Function Documentation

void CalCoreModel::addAnimHelper | ( | const std::string & | strAnimName,
|  | int | animId
| ) |

| Creates or overwrites a string-to-animation ID mapping. This function makes an animation ID reference-able by a string name. Note that we don't verify that the ID is valid because the animation may be added later. Also, if there is already a helper with this name, it will be overwritten without warning.

Parameters:

  strAnimName | The string that will be associated with the ID.
  animId | The ID number of the animation to be referenced by the string.

void CalCoreModel::addBoneHelper | ( | const std::string & | strBoneName,
|  | int | boneId
| ) |

| Creates or overwrites a string-to-boneId mapping. This function makes a bone ID reference-able by a string name.

Parameters:

  strBoneName | The string that will be associated with the ID.
  boneId | The ID number of the bone that will be referenced by the string.

int CalCoreModel::addCoreAnimation | ( | CalCoreAnimation * | pCoreAnimation | ) |

| Adds a core animation. This function adds a core animation to the core model instance.

Parameters:

  pCoreAnimation | A pointer to the core animation that should be added.

Returns:
  One of the following values:
  - the assigned animation ID of the added core animation
  - -1 if an error happend

int CalCoreModel::addCoreMaterial | ( | CalCoreMaterial * | pCoreMaterial | ) |

| Adds a core material. This function adds a core material to the core model instance.

Parameters:

  pCoreMaterial | A pointer to the core material that should be added.

Returns:
  One of the following values:
  - the assigned material ID of the added core material
  - -1 if an error happend

int CalCoreModel::addCoreMesh | ( | CalCoreMesh * | pCoreMesh | ) |

| Adds a core mesh. This function adds a core mesh to the core model instance.

Parameters:

  pCoreMesh | A pointer to the core mesh that should be added.

Returns:
  One of the following values:
  - the assigned mesh ID of the added core material
  - -1 if an error happend

int CalCoreModel::addCoreMorphAnimation | ( | CalCoreMorphAnimation * | pCoreMorphAnimation | ) |

| Adds a core morph animation. This function adds a core morph animation to the core model instance.

Parameters:

  pCoreMorphAnimation | A pointer to the core morph animation that should be added.

Returns:
  One of the following values:
  - the assigned morph animation ID of the added core morph animation
  - -1 if an error happend

bool CalCoreModel::create | ( | const std::string & | strName | ) |

| Creates the core model instance. This function creates the core model instance.

Parameters:

  strName | A string that should be used as the name of the core model instance.

Returns:
  One of the following values:
  - true if successful
  - false if an error happend

bool CalCoreModel::createCoreMaterialThread | ( | int | coreMaterialThreadId | ) |

| Creates a core material thread. This function creates a new core material thread with the given ID.

Parameters:

  coreMaterialThreadId | The ID of the core material thread that should be created.

Returns:
  One of the following values:
  - true if successful
  - false if an error happend

void CalCoreModel::destroy | ( |  | ) |

| Destroys the core model instance. This function destroys all data stored in the core model instance and frees all allocated memory.

int CalCoreModel::getAnimId | ( | const std::string & | strAnimName | ) |

| Retrieves the ID of the animation referenced by a string. This function returns an animation ID

Parameters:

  strAnimName | A string that is associated with an anim ID number.

Returns:
  Returns:
  - -1 if there is no anim ID associated with the input string
  - the ID number of the anim asssociated with the input string

int CalCoreModel::getBoneId | ( | const std::string & | strBoneName | ) |

| Retrieves the ID of the bone referenced by a string. This function returns a bone ID

Parameters:

  strBoneName | A string that is associated with a bone ID number.

Returns:
  Returns:
  - -1 if there is no bone ID associated with the input string
  - the ID number of the bone asssociated with the input string

CalCoreAnimation * CalCoreModel::getCoreAnimation | ( | int | coreAnimationId | ) |

| Provides access to a core animation. This function returns the core animation with the given ID.

Parameters:

  coreAnimationId | The ID of the core animation that should be returned.

Returns:
  One of the following values:
  - a pointer to the core animation
  - 0 if an error happend

int CalCoreModel::getCoreAnimationCount | ( |  | ) |

| Returns the number of core animations. This function returns the number of core animations in the core model instance.

Returns:
  The number of core animations.

CalCoreMaterial * CalCoreModel::getCoreMaterial | ( | int | 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:
  - a pointer to the core material
  - 0 if an error happend

int CalCoreModel::getCoreMaterialCount | ( |  | ) |

| Returns the number of core materials. This function returns the number of core materials in the core model instance.

Returns:
  The number of core materials.

int CalCoreModel::getCoreMaterialId | ( | int | coreMaterialThreadId,
|  | int | 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:
  - the ID of the core material
  - -1 if an error happend

CalCoreMesh * CalCoreModel::getCoreMesh | ( | int | 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:
  - a pointer to the core mesh
  - 0 if an error happend

int CalCoreModel::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.

CalCoreMorphAnimation * CalCoreModel::getCoreMorphAnimation | ( | int | coreMorphAnimationId | ) |

| Provides access to a core morph animation. This function returns the core morph animation with the given ID.

Parameters:

  coreMorphAnimationId | The ID of the core morph animation that should be returned.

Returns:
  One of the following values:
  - a pointer to the core morph animation
  - 0 if an error happend

int CalCoreModel::getCoreMorphAnimationCount | ( |  | ) |

| Returns the number of core morph animations. This function returns the number of core morph animations in the core model instance.

Returns:
  The number of core morph animations.

CalCoreSkeleton * CalCoreModel::getCoreSkeleton | ( |  | ) |

| Provides access to the core skeleton. This function returns the core skeleton.

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

Cal::UserData CalCoreModel::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.

int CalCoreModel::loadCoreAnimation | ( | const std::string & | strFilename | ) |

| Loads a core animation. This function loads a core animation from a file.

Parameters:

  strFilename | The file from which the core animation should be loaded from.

Returns:
  One of the following values:
  - the assigned ID of the loaded core animation
  - -1 if an error happend

int CalCoreModel::loadCoreMaterial | ( | const std::string & | strFilename | ) |

| Loads a core material. This function loads a core material from a file.

Parameters:

  strFilename | The file from which the core material should be loaded from.

Returns:
  One of the following values:
  - the assigned ID of the loaded core material
  - -1 if an error happend

int CalCoreModel::loadCoreMesh | ( | const std::string & | strFilename | ) |

| Loads a core mesh. This function loads a core mesh from a file.

Parameters:

  strFilename | The file from which the core mesh should be loaded from.

Returns:
  One of the following values:
  - the assigned ID of the loaded core mesh
  - -1 if an error happend

bool CalCoreModel::loadCoreSkeleton | ( | const std::string & | strFilename | ) |

| Loads the core skeleton. This function loads the core skeleton from a file.

Parameters:

  strFilename | The file from which the core skeleton should be loaded from.

Returns:
  One of the following values:
  - true if successful
  - false if an error happend

bool CalCoreModel::saveCoreAnimation | ( | const std::string & | strFilename,
|  | int | coreAnimationId
| ) |

| Saves a core animation. This function saves a core animation to a file.

Parameters:

  strFilename | The file to which the core animation should be saved to.
  coreAnimationId | The ID of the core animation that should be saved.

Returns:
  One of the following values:
  - true if successful
  - false if an error happend

bool CalCoreModel::saveCoreMaterial | ( | const std::string & | strFilename,
|  | int | coreMaterialId
| ) |

| Saves a core material. This function saves a core material to a file.

Parameters:

  strFilename | The file to which the core material should be saved to.
  coreMaterialId | The ID of the core material that should be saved.

Returns:
  One of the following values:
  - true if successful
  - false if an error happend

bool CalCoreModel::saveCoreMesh | ( | const std::string & | strFilename,
|  | int | coreMeshId
| ) |

| Saves a core mesh. This function saves a core mesh to a file.

Parameters:

  strFilename | The file to which the core mesh should be saved to.
  coreMeshId | The ID of the core mesh that should be saved.

Returns:
  One of the following values:
  - true if successful
  - false if an error happend

bool CalCoreModel::saveCoreSkeleton | ( | const std::string & | strFilename | ) |

| Saves the core skeleton. This function saves the core skeleton to a file.

Parameters:

  strFilename | The file to which the core skeleton should be saved to.

Returns:
  One of the following values:
  - true if successful
  - false if an error happend

bool CalCoreModel::setCoreMaterialId | ( | int | coreMaterialThreadId,
|  | int | coreMaterialSetId,
|  | int | 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.

Returns:
  One of the following values:
  - true if successful
  - false if an error happend

void CalCoreModel::setCoreSkeleton | ( | CalCoreSkeleton * | pCoreSkeleton | ) |

| Sets the core skeleton. This function sets the core skeleton of the core model instance..

Parameters:

  pCoreSkeleton | The core skeleton that should be set.

void CalCoreModel::setUserData | ( | Cal::UserData | userData | ) |

| Stores user data. This function stores user data in the core model instance.

Parameters:

  userData | The user data that should be stored.

The documentation for this class was generated from the following files:

- coremodel.h
- coremodel.cpp

Generated at Wed Apr 7 16:57:17 2004 by The Cal3D Team with 1.3.6 © 1997-2001 Dimitri van Heesch