# 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:

NL3D::CAnimatedLightmap NL3D::CAnimatedMaterial NL3D::CAnimatedMorph NL3D::ITransformable NL3D::CBone NL3D::CTransform NL3D::CCamera NL3D::CCluster NL3D::CCoarseMeshManager NL3D::CLandscapeModel NL3D::CPointLightModel NL3D::CTransformShape NL3D::CVegetableBlendLayerModel NL3D::CFlareModel NL3D::CMeshBaseInstance NL3D::CParticleSystemModel NL3D::CSegRemanence NL3D::CSkeletonModel NL3D::CWaterModel NL3D::CWaveMakerModel NL3D::CMeshInstance NL3D::CMeshMRMInstance NL3D::CMeshMultiLodInstance List of all members.

Interface

enum  TAnimValues { AnimValueLast = 0 }
 The enum of animated values. 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...


Public Types


Public Methods

 IAnimatable ()
 Default Constructor. More...

virtual ~IAnimatable ()
Touch flags management
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

sint 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:
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::CAnimatedLightmap.

Definition at line 96 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.

References _Father.

Referenced by propagateTouch, and setFather.

virtual NL3D::IAnimatable::~IAnimatable   [inline, virtual]
 

Definition at line 88 of file animatable.h.


Member Function Documentation

sint 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.

Returns:
-1 if the track was not found in the animationSet, else it return the channelId as if returned by CAnimationSet::getChannelIdByName(channelName).

Definition at line 37 of file animatable.cpp.

References getDefaultTrack, getValue, getValueName, and nlassert.

Referenced by NL3D::CTransform::registerToChannelMixer, NL3D::CParticleSystemModel::registerToChannelMixer, NL3D::CCamera::registerToChannelMixer, NL3D::CBone::registerToChannelMixer, NL3D::CAnimatedMorph::registerToChannelMixer, NL3D::CAnimatedMaterial::registerToChannelMixer, and NL3D::CAnimatedLightmap::registerToChannelMixer.

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

This method clear a bit in the bitset.

Definition at line 231 of file animatable.h.

References NLMISC::CBitSet::clear.

Referenced by NL3D::CAnimatedMaterial::update.

virtual 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.

Implemented in NL3D::CAnimatedLightmap.

Referenced by addValue.

virtual 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.

Implemented in NL3D::CAnimatedLightmap.

Referenced by addValue.

virtual 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.

Implemented in NL3D::CAnimatedLightmap.

Referenced by addValue.

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 182 of file animatable.h.

References bitSet.

Referenced by NL3D::ITransformable::needCompute, and NL3D::CAnimatedMaterial::update.

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

Definition at line 210 of file animatable.h.

References _FatherOwnerBit, and IAnimatable.

Referenced by setFather, and touch.

virtual 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

Implemented in NL3D::CAnimatedLightmap.

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

Change value count.

Parameters:
count  is the new value count.

Definition at line 193 of file animatable.h.

References bitSet, and NLMISC::CBitSet::resizeNoReset.

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 151 of file animatable.h.

References _Father, _FatherOwnerBit, IAnimatable, and propagateTouch.

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 166 of file animatable.h.

References bitSet, propagateTouch, and NLMISC::CBitSet::set.

Referenced by NL3D::CParticleSystemModel::reallocRsc, NL3D::ITransformable::setPivot, NL3D::ITransformable::setPos, NL3D::ITransformable::setRotEuler, NL3D::ITransformable::setRotQuat, NL3D::ITransformable::setScale, and NL3D::ITransformable::setTransformMode.


Friends And Related Function Documentation

friend class IAnimatedValue [friend]
 

Definition at line 75 of file animatable.h.


Member Data Documentation

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

Definition at line 206 of file animatable.h.

Referenced by IAnimatable, and setFather.

uint NL3D::IAnimatable::_FatherOwnerBit [private]
 

Definition at line 208 of file animatable.h.

Referenced by propagateTouch, and setFather.

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

Definition at line 204 of file animatable.h.

Referenced by isTouched, resize, and touch.


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