# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::IAnimatable Class Reference

An animatable object. More...

#include <animatable.h>

Inheritance diagram for NL3D::IAnimatable

Inheritance graph
[legend]
Collaboration diagram for NL3D::IAnimatable:

Collaboration graph
[legend]
List of all members.

Public Types

enum  TAnimValues {
  AnimValueLast = 0
}
 The enum of animated values. More...


Public Methods

 IAnimatable ()
 Default Constructor. More...

virtual IAnimatedValuegetValue (uint valueId) = 0
 Get a value pointer. More...

virtual const char* getValueName (uint valueId) const = 0
 Get animated value name. More...

virtual ITrackgetDefaultTrack (uint valueId) = 0
 Get default track pointer. More...

virtual void registerToChannelMixer (CChannelMixer *chanMixer, const std::string &prefix=std::string()) = 0
 register the Aniamtable to a channelMixer (using CChannelMixer::addChannel()). More...

void setFather (IAnimatable *father, uint fatherOwnerBit)
 Say which (if any) IAnimatable owns this one. More...

void touch (uint valueId, uint ownerValueId)
 Touch a value because it has been modified. More...

bool isTouched (uint valueId) const
 Return true if the value as been touched else false. More...

void resize (uint count)
 Change value count. More...


Protected Methods

void addValue (CChannelMixer *chanMixer, uint valueId, uint ownerValueId, const std::string &prefix, bool detail)
 This is a tool function which add a given value to a channel. More...

void clearFlag (uint valueId)
 This method clear a bit in the bitset. More...


Private Methods

void propagateTouch ()

Private Attributes

NLMISC::CBitSet bitSet
IAnimatable* _Father
uint _FatherOwnerBit

Friends

class  IAnimatedValue

Detailed Description

An animatable object.

This object can have a set of animated values. Animated values are animated by a CChannelMixer object. Each value have a name and a default track.

An IAnimatable may have IAnimatable sons (list of bones, list of materails etc...). The value count and valueId of the IAnimatable DO NOT count those sons, but register() should register his sons too. A father propagated touch system (setFather()) is implemented. When a son is touched, he touchs his fathers, his grandfather and so on.

When a class derives from IAnimatable, it must implement all the interface's methods:

extend TAnimValues enum, beginning to BaseClass::AnimValueLast, and add a bit OwnerBit. ctor(): just type "IAnimatable::resize() (AnimValueLast);" virtual IAnimatedValue* getValue (uint valueId); virtual const char *getValueName (uint valueId) const; virtual ITrack* getDefaultTrack (uint valueId);

virtual register(CChannelMixer *, const string &prefix);

Watch NL3D::ITransformable and NL3D::CTransform for a good example.

Author(s):
Cyril 'Hulud' Corvazier , Nevrax France
Date:
2001

Definition at line 73 of file animatable.h.


Member Enumeration Documentation

enum NL3D::IAnimatable::TAnimValues
 

The enum of animated values.

(same system in CMOT). Deriver should extend this enum, beginning with OwnerBit= BaseClass::AnimValueLast. "OwnerBit" system: each deriver of IAnimatable should had an entry "OwnerBit" in this TAnimValues. This bit will be set when an IAnimatedValue of this deriver part is touched, or if one of his IAnimatable sons is touched (see setFather()).

Enumeration values:
AnimValueLast  

Reimplemented in NL3D::CAnimatedMaterial, NL3D::CCamera, NL3D::CMeshInstance, NL3D::CSkeletonModel, and NL3D::ITransformable.

Definition at line 95 of file animatable.h.


Constructor & Destructor Documentation

NL3D::IAnimatable::IAnimatable ( ) [inline]
 

Default Constructor.

Set number of value to 0. Deriver: should just write: IAnimatable::resize() (getValueCount());

Definition at line 83 of file animatable.h.


Member Function Documentation

void NL3D::IAnimatable::addValue ( CChannelMixer * chanMixer,
uint valueId,
uint ownerValueId,
const std::string & prefix,
bool detail ) [protected]
 

This is a tool function which add a given value to a channel.

Definition at line 34 of file animatable.cpp.

void NL3D::IAnimatable::clearFlag ( uint valueId ) [inline, protected]
 

This method clear a bit in the bitset.

Definition at line 227 of file animatable.h.

ITrack * NL3D::IAnimatable::getDefaultTrack ( uint valueId ) [pure virtual]
 

Get default track pointer.

Parameters:
valueId   is the animated value ID in the object we want the default track. IGNORING IANIMATABLE SONS (eg: bones, materials...).
Returns:
The pointer on the default track of the value.

Reimplemented in NL3D::CAnimatedMaterial, NL3D::CBone, NL3D::CCamera, NL3D::CMeshInstance, NL3D::CTransform, and NL3D::ITransformable.

IAnimatedValue * NL3D::IAnimatable::getValue ( uint valueId ) [pure virtual]
 

Get a value pointer.

Parameters:
valueId   is the animated value ID in the object. IGNORING IANIMATABLE SONS (eg: bones, materials...).
Returns:
The pointer on the animated value.

Reimplemented in NL3D::CAnimatedMaterial, NL3D::CCamera, and NL3D::ITransformable.

const char * NL3D::IAnimatable::getValueName ( uint valueId ) const [pure virtual]
 

Get animated value name.

Parameters:
valueId   is the animated value ID in the object we want the name. IGNORING IANIMATABLE SONS (eg: bones, materials...).
Returns:
the name of the animated value.

Reimplemented in NL3D::CAnimatedMaterial, NL3D::CCamera, and NL3D::ITransformable.

bool NL3D::IAnimatable::isTouched ( uint valueId ) const [inline]
 

Return true if the value as been touched else false.

Parameters:
valueId   is the animated value ID in the object we want to test the touch flag. or it may be an OwnerBit.

Definition at line 181 of file animatable.h.

void NL3D::IAnimatable::propagateTouch ( ) [inline, private]
 

Definition at line 209 of file animatable.h.

void NL3D::IAnimatable::registerToChannelMixer ( CChannelMixer * chanMixer,
const std::string & prefix = std::string() ) [pure virtual]
 

register the Aniamtable to a channelMixer (using CChannelMixer::addChannel()).

You MUST use this method to register Animatable. This method should:

  • call is BaseClass method.
  • register local AnimatableValues, with channel name: prefix+getValueName().
  • register local sons!!. eg: matlist[0]->registerToChannelMixer(chanMixer, prefix+"mat0.").
Parameters:
chanMixer   is the channel mixer. Should not be NULL. for anim detail purpose , the IAnimatable may store a RefPtr on this channel mixer.
prefix   prefix to be append to valueNames

Reimplemented in NL3D::CAnimatedMaterial, NL3D::CBone, NL3D::CCamera, NL3D::CMeshInstance, NL3D::CSkeletonModel, NL3D::CTransform, and NL3D::ITransformable.

void NL3D::IAnimatable::resize ( uint count ) [inline]
 

Change value count.

Parameters:
count   is the new value count.

Definition at line 192 of file animatable.h.

void NL3D::IAnimatable::setFather ( IAnimatable * father,
uint fatherOwnerBit ) [inline]
 

Say which (if any) IAnimatable owns this one.

This is important for Touch propagation. By this system, Fathers and ancestors know if they must check their sons (isTouched() return true).

Parameters:
father   the father we must inform of our update.
fatherOwnerBit   What bit of father we must set when we are updated

Definition at line 150 of file animatable.h.

void NL3D::IAnimatable::touch ( uint valueId,
uint ownerValueId ) [inline]
 

Touch a value because it has been modified.

Parameters:
valueId   is the animated value ID in the object we want to touch.
ownerValueId   is the bit of the IAnimatable part which owns this animated value.

Definition at line 165 of file animatable.h.


Friends And Related Function Documentation

class IAnimatedValue [friend]
 

Definition at line 75 of file animatable.h.


Member Data Documentation

IAnimatable * NL3D::IAnimatable::_Father [private]
 

Definition at line 205 of file animatable.h.

uint NL3D::IAnimatable::_FatherOwnerBit [private]
 

Definition at line 207 of file animatable.h.

NLMISC::CBitSet NL3D::IAnimatable::bitSet [private]
 

Definition at line 203 of file animatable.h.


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