| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iSpriteCal3DFactoryState Struct Reference
[Mesh plugins]

This interface describes the API for the 3D sprite factory mesh object. More...

`#include <imesh/spritecal3d.h>`

Inheritance diagram for iSpriteCal3DFactoryState:

[legend]
List of all members.

## Public Member Functions
virtual bool | AddCoreMaterial (iMaterialWrapper *mat)=0
| This jams a CS material into a cal3d material struct.
virtual int | AddMorphAnimation (const char *name)=0
| This adds a new morph animation.
virtual bool | AddMorphTarget (int morphanimation_index, const char *mesh_name, const char *morphtarget_name)=0
| This adds a mesh and one of its morph target to the given morph animation.
virtual iSpriteCal3DSocket * | AddSocket ()=0
| Create and add a new socket to the sprite.
virtual void | BindMaterials ()=0
| Cal3d requires extra initialization once all materials are loaded.
virtual void | CalculateAllBoneBoundingBoxes ()=0
| Does internal cal3d prep work for doing fast bbox calcs later.
virtual bool | Create (const char *name)=0
| Initialize internal Cal3d data structures.
virtual int | FindMeshName (const char *meshName)=0
| Returns the index of the specified mesh name, or -1 if not found.
virtual int | FindMorphAnimationName (const char *meshName)=0
| Returns the index of the specified morph animation name, or -1 if not found.
virtual iSpriteCal3DSocket * | FindSocket (iMeshWrapper *mesh) const =0
| find a socked based on the sprite attached to it.
virtual iSpriteCal3DSocket * | FindSocket (const char *name) const =0
| find a named socket into the sprite.
virtual CalCoreModel * | GetCal3DCoreModel ()=0
| This gives you access to the internal Cal3d Core Model class which sprcal3dfact wraps.
virtual const char * | GetDefaultMaterial (const char *meshName)=0
| Returns the name of the default material that should go on this mesh.
virtual int | GetMeshCount ()=0
| Returns the count of all the meshes available for attachment to the core model.
virtual const char * | GetMeshName (int idx)=0
| Returns the xml name of the mesh at a certain index in the array.
virtual int | GetMorphAnimationCount ()=0
| Returns the count of all Morph animations of this core model.
virtual const char * | GetMorphAnimationName (int idx)=0
| Returns the xml name of the morph animation at a certain index in the array.
virtual int | GetMorphTargetCount (int mesh_id)=0
| Returns the number of morph targets of a mesh.
virtual iSpriteCal3DSocket * | GetSocket (int f) const =0
| Query the socket number f.
virtual int | GetSocketCount () const =0
| Query the number of sockets.
virtual bool | IsMeshDefault (int idx)=0
| Returns whether the mesh is a default mesh or not.
virtual int | LoadCoreAnimation (iVFS *vfs, const char *filename, const char *name, int type, float base_velocity, float min_velocity, float max_velocity, int min_interval, int max_interval, int idle_pct, bool lock)=0
| This loads the supplied file as one animation action for the sprite.
virtual int | LoadCoreMesh (iVFS *vfs, const char *filename, const char *name, bool attach, iMaterialWrapper *defmat)=0
| This loads a submesh which will attach to this skeleton.
virtual int | LoadCoreMorphTarget (iVFS *vfs, int mesh_index, const char *filename, const char *name)=0
| This adds a mesh as a morph target of another mesh.
virtual bool | LoadCoreSkeleton (iVFS *vfs, const char *filename)=0
| This loads the supplied file as the skeleton data for the sprite.
virtual bool | RegisterAnimCallback (const char *anim, CalAnimationCallback *callback, float min_interval)=0
| This function will attach a callback to the Core Anim, to be called whenever the min_interval passes and this animation is active.
virtual bool | RemoveAnimCallback (const char *anim, CalAnimationCallback *callback)=0
| This function should be called to remove callbacks when the meshfact is destroyed.
virtual void | ReportLastError ()=0
| This prints the message if any cal3d function is unsuccessful.
virtual void | RescaleFactory (float factor)=0
| This function resizes all instances of this factory permanently.
virtual void | SetBasePath (const char *path)=0
| This sets the path to which other filenames will be appended before loading.
virtual void | SetLoadFlags (int flags)=0
| This function sets the flags, which the factory sets in CalLoader when loading new models.

## Detailed Description

This interface describes the API for the 3D sprite factory mesh object.

Definition at line 97 of file spritecal3d.h.

## Member Function Documentation

virtual bool iSpriteCal3DFactoryState::AddCoreMaterial | ( | iMaterialWrapper * | mat | ) | `[pure virtual]`

This jams a CS material into a cal3d material struct.

Don't try this at home!

virtual int iSpriteCal3DFactoryState::AddMorphAnimation | ( | const char * | name | ) | `[pure virtual]`

This adds a new morph animation.

Parameters:

  | name | The name of morph animation.

Returns:
  The index of the morph animation.

virtual bool iSpriteCal3DFactoryState::AddMorphTarget | ( | int | morphanimation_index,
|  | const char * | mesh_name,
|  | const char * | morphtarget_name |
| ) |  |  | `[pure virtual]`

This adds a mesh and one of its morph target to the given morph animation.

Parameters:

  | morphanimation_index | The index of the morph animation.
  | mesh_name | The name of the mesh.
  | morphtarget_name | The name of the morph target of the mesh.

Returns:
  True if successfull.

virtual iSpriteCal3DSocket* iSpriteCal3DFactoryState::AddSocket | ( |  | ) | `[pure virtual]`

Create and add a new socket to the sprite.

virtual void iSpriteCal3DFactoryState::BindMaterials | ( |  | ) | `[pure virtual]`

Cal3d requires extra initialization once all materials are loaded.

The loader calls this at the appropriate time automatically.

virtual void iSpriteCal3DFactoryState::CalculateAllBoneBoundingBoxes | ( |  | ) | `[pure virtual]`

Does internal cal3d prep work for doing fast bbox calcs later.

virtual bool iSpriteCal3DFactoryState::Create | ( | const char * | name | ) | `[pure virtual]`

Initialize internal Cal3d data structures.

virtual int iSpriteCal3DFactoryState::FindMeshName | ( | const char * | meshName | ) | `[pure virtual]`

Returns the index of the specified mesh name, or -1 if not found.

virtual int iSpriteCal3DFactoryState::FindMorphAnimationName | ( | const char * | meshName | ) | `[pure virtual]`

Returns the index of the specified morph animation name, or -1 if not found.

virtual iSpriteCal3DSocket* iSpriteCal3DFactoryState::FindSocket | ( | iMeshWrapper * | mesh | ) | const`[pure virtual]`

find a socked based on the sprite attached to it.

virtual iSpriteCal3DSocket* iSpriteCal3DFactoryState::FindSocket | ( | const char * | name | ) | const`[pure virtual]`

find a named socket into the sprite.

virtual CalCoreModel* iSpriteCal3DFactoryState::GetCal3DCoreModel | ( |  | ) | `[pure virtual]`

This gives you access to the internal Cal3d Core Model class which sprcal3dfact wraps.

If you use it directly, you run the risk of making sprcal3dfact and CalCoreModel get out of sync. Use carefully!

virtual const char* iSpriteCal3DFactoryState::GetDefaultMaterial | ( | const char * | meshName | ) | `[pure virtual]`

Returns the name of the default material that should go on this mesh.

virtual int iSpriteCal3DFactoryState::GetMeshCount | ( |  | ) | `[pure virtual]`

Returns the count of all the meshes available for attachment to the core model.

virtual const char* iSpriteCal3DFactoryState::GetMeshName | ( | int | idx | ) | `[pure virtual]`

Returns the xml name of the mesh at a certain index in the array.

virtual int iSpriteCal3DFactoryState::GetMorphAnimationCount | ( |  | ) | `[pure virtual]`

Returns the count of all Morph animations of this core model.

virtual const char* iSpriteCal3DFactoryState::GetMorphAnimationName | ( | int | idx | ) | `[pure virtual]`

Returns the xml name of the morph animation at a certain index in the array.

virtual int iSpriteCal3DFactoryState::GetMorphTargetCount | ( | int | mesh_id | ) | `[pure virtual]`

Returns the number of morph targets of a mesh.

Parameters:

  | mesh_id | The id of the mesh.

Returns:
  The number of morph targets of a mesh. -1 if something went wrong.

virtual iSpriteCal3DSocket* iSpriteCal3DFactoryState::GetSocket | ( | int | f | ) | const`[pure virtual]`

Query the socket number f.

virtual int iSpriteCal3DFactoryState::GetSocketCount | ( |  | ) | const`[pure virtual]`

Query the number of sockets.

virtual bool iSpriteCal3DFactoryState::IsMeshDefault | ( | int | idx | ) | `[pure virtual]`

Returns whether the mesh is a default mesh or not.

virtual int iSpriteCal3DFactoryState::LoadCoreAnimation | ( | iVFS * | vfs,
|  | const char * | filename,
|  | const char * | name,
|  | int | type,
|  | float | base_velocity,
|  | float | min_velocity,
|  | float | max_velocity,
|  | int | min_interval,
|  | int | max_interval,
|  | int | idle_pct,
|  | bool | lock |
| ) |  |  | `[pure virtual]`

This loads the supplied file as one animation action for the sprite.

Parameters:

  | vfs | The ref to the vfs plugin used when loading the anim file
  | filename | The VFS path to the anim file.
  | name | The animation's name.
  | type | The type of anim this file represents.
  | base_velocity | On movement type anims, this represents the native traversal speed of the model implied by this animation. For example, a "walk" anim might specify 2m/sec.
  | min_velocity | On movement type anims, this represents the minimum velocity for which this animation should be considered or used. The anim will be blended with other anims to achieve the desired exact velocity.
  | max_velocity | Same thing for max velocity for this anim to be blended in.
  | min_interval | When the anim of type "idle" is playing, the model will randomly choose override actions to play every so often to enhance the realism of the idle. (Thus a "standing" creature might shift his feet or scratch his nose every 30 seconds or so.) This param is the minimum time between these overrides.
  | max_interval | Max interval between these override idle actions. The model will randomly choose a time between min and max.
  | idle_pct | For anims of type action, if the model is idling it will randomly choose among these based on the idle_pct weights specified here. This param should total 100 across all anims for the model if used.
  | lock | This specifies whether the animation is to be locked on last frame or not. If not locked, the action will return to the base keyframe when complete. If locked, the action will stay in the final keyframe position until cleared. (This is usually for anims like "death".)

virtual int iSpriteCal3DFactoryState::LoadCoreMesh | ( | iVFS * | vfs,
|  | const char * | filename,
|  | const char * | name,
|  | bool | attach,
|  | iMaterialWrapper * | defmat |
| ) |  |  | `[pure virtual]`

This loads a submesh which will attach to this skeleton.

filename is the native system filename of the mesh file. name is the logical name which will be used by the mesh object to attach and detach this mesh. attach should be true if this mesh should be part of the mesh object after it is first created, or false if it will be optionally added later. defmat is the material which should be used when the object is created, if any.

virtual int iSpriteCal3DFactoryState::LoadCoreMorphTarget | ( | iVFS * | vfs,
|  | int | mesh_index,
|  | const char * | filename,
|  | const char * | name |
| ) |  |  | `[pure virtual]`

This adds a mesh as a morph target of another mesh.

Parameters:

  | vfs | The VFS object where `filename' resides.
  | mesh_index | The index of the mesh we are going to add a morph target to.
  | filename | The name of the file of the mesh of the morph tarrget.
  | name | The name of the morph target.

Returns:
  The index of the morph target.

virtual bool iSpriteCal3DFactoryState::LoadCoreSkeleton | ( | iVFS * | vfs,
|  | const char * | filename |
| ) |  |  | `[pure virtual]`

This loads the supplied file as the skeleton data for the sprite.

virtual bool iSpriteCal3DFactoryState::RegisterAnimCallback | ( | const char * | anim,
|  | CalAnimationCallback * | callback,
|  | float | min_interval |
| ) |  |  | `[pure virtual]`

This function will attach a callback to the Core Anim, to be called whenever the min_interval passes and this animation is active.

virtual bool iSpriteCal3DFactoryState::RemoveAnimCallback | ( | const char * | anim,
|  | CalAnimationCallback * | callback |
| ) |  |  | `[pure virtual]`

This function should be called to remove callbacks when the meshfact is destroyed.

virtual void iSpriteCal3DFactoryState::ReportLastError | ( |  | ) | `[pure virtual]`

This prints the message if any cal3d function is unsuccessful.

There is no way I can see to retrieve the string and use cs report with it.

virtual void iSpriteCal3DFactoryState::RescaleFactory | ( | float | factor | ) | `[pure virtual]`

This function resizes all instances of this factory permanently.

Factor=1 means no change.

virtual void iSpriteCal3DFactoryState::SetBasePath | ( | const char * | path | ) | `[pure virtual]`

This sets the path to which other filenames will be appended before loading.

virtual void iSpriteCal3DFactoryState::SetLoadFlags | ( | int | flags | ) | `[pure virtual]`

This function sets the flags, which the factory sets in CalLoader when loading new models.

The documentation for this struct was generated from the following file:

- imesh/spritecal3d.h