#include <animatable.h>
Inheritance diagram for NL3D::IAnimatable:
This object can have a set of animated values. At Max 32 animated values can be set (because of bit and touch mgt) 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.
Nevrax France
Definition at line 73 of file animatable.h.
Interface | |
enum | TAnimValues { AnimValueLast = 0 } |
virtual ITrack * | getDefaultTrack (uint valueId)=0 |
virtual IAnimatedValue * | getValue (uint valueId)=0 |
virtual const char * | getValueName (uint valueId) const=0 |
virtual void | registerToChannelMixer (CChannelMixer *chanMixer, const std::string &prefix=std::string())=0 |
Public Types | |
Public Member Functions | |
IAnimatable () | |
virtual | ~IAnimatable () |
Protected Member Functions | |
sint | addValue (CChannelMixer *chanMixer, uint valueId, uint ownerValueId, const std::string &prefix, bool detail) |
void | clearFlag (uint valueId) |
This method clear a bit in the bitset. | |
void | setFlag (uint valueId) |
This method set a bit in the bitset. | |
Private Member Functions | |
void | propagateTouch () |
Private Attributes | |
uint32 | _BitSet |
IAnimatable * | _Father |
uint | _FatherOwnerBit |
Friends | |
class | IAnimatedValue |
|
The enum of animated values. (same system in CMOT). Deriver should extend this enum, beginning with OwnerBit= BaseClass::AnimValueLast. The number of values MUST NOT EXCEED 32, for fast touch() system. "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()). Reimplemented in NL3D::CAnimatedLightmap, NL3D::CAnimatedMaterial, NL3D::CAnimatedMorph, NL3D::CCamera, NL3D::CMeshBaseInstance, NL3D::CParticleSystemModel, NL3D::CSegRemanence, NL3D::CSkeletonModel, and NL3D::ITransformable. Definition at line 98 of file animatable.h.
00099 { 00100 AnimValueLast=0, 00101 }; |
|
Default Constructor. Set number of value to 0. Deriver: should just write: IAnimatable::resize (getValueCount()); Definition at line 83 of file animatable.h. References _BitSet, and _Father.
|
|
Definition at line 89 of file animatable.h.
00089 {} |
|
This is a tool function which add a given value to a channel.
Definition at line 37 of file animatable.cpp. References NL3D::CChannelMixer::addChannel(), getDefaultTrack(), getValue(), getValueName(), nlassert, sint, and uint. Referenced by NL3D::CTransform::registerToChannelMixer(), NL3D::CParticleSystemModel::registerToChannelMixer(), NL3D::CCamera::registerToChannelMixer(), NL3D::CBone::registerToChannelMixer(), NL3D::CAnimatedMorph::registerToChannelMixer(), NL3D::CAnimatedMaterial::registerToChannelMixer(), and NL3D::CAnimatedLightmap::registerToChannelMixer().
00038 { 00039 nlassert(chanMixer); 00040 return chanMixer->addChannel(prefix+getValueName(valueId), this, getValue(valueId), getDefaultTrack(valueId), valueId, ownerValueId, detail); 00041 } |
|
This method clear a bit in the bitset.
Definition at line 233 of file animatable.h. Referenced by NL3D::ITransformable::clearTransformFlags(), NL3D::CParticleSystemModel::doAnimate(), and NL3D::CAnimatedMaterial::update().
00234 { 00235 _BitSet&= ~(1<<valueId); 00236 } |
|
Get default track pointer.
Implemented in NL3D::CAnimatedLightmap, NL3D::CAnimatedMaterial, NL3D::CAnimatedMorph, NL3D::CBone, NL3D::CCamera, NL3D::CMeshBaseInstance, NL3D::CParticleSystemModel, NL3D::CSegRemanence, NL3D::CTransform, NL3D::ITransformable, NL3D::CWaterModel, and NL3D::CWaveMakerModel. Referenced by addValue(). |
|
Get a value pointer.
Implemented in NL3D::CAnimatedLightmap, NL3D::CAnimatedMaterial, NL3D::CAnimatedMorph, NL3D::CCamera, NL3D::CParticleSystemModel, and NL3D::ITransformable. Referenced by addValue(). |
|
Get animated value name.
Implemented in NL3D::CAnimatedLightmap, NL3D::CAnimatedMaterial, NL3D::CAnimatedMorph, NL3D::CCamera, NL3D::CParticleSystemModel, and NL3D::ITransformable. Referenced by addValue(). |
|
Return non 0 int if the value as been touched else 0.
Definition at line 184 of file animatable.h. References _BitSet, uint, and uint32. Referenced by NL3D::CParticleSystemModel::doAnimate(), NL3D::ITransformable::needCompute(), propagateTouch(), and NL3D::CAnimatedMaterial::update().
00185 { 00186 return _BitSet&(1<<valueId); 00187 } |
|
Definition at line 212 of file animatable.h. References _Father, _FatherOwnerBit, isTouched(), and setFlag(). Referenced by setFather(), and touch().
00213 { 00214 IAnimatable *pCur= this; 00215 // Stop when no father, or when father is already touched (and so the grandfather...!!!). 00216 while(pCur->_Father && !pCur->_Father->isTouched(_FatherOwnerBit)) 00217 { 00218 // The Owner bit is the "something is touched" flag. touch it. 00219 pCur->_Father->setFlag(pCur->_FatherOwnerBit); 00220 pCur= pCur->_Father; 00221 } 00222 } |
|
register the Aniamtable to a channelMixer (using CChannelMixer::addChannel()). You MUST use this method to register Animatable. This method should:
Implemented in NL3D::CAnimatedLightmap, NL3D::CAnimatedMaterial, NL3D::CAnimatedMorph, NL3D::CBone, NL3D::CCamera, NL3D::CMeshBaseInstance, NL3D::CParticleSystemModel, NL3D::CSegRemanence, NL3D::CSkeletonModel, NL3D::CTransform, and NL3D::ITransformable. |
|
Change value count, bit are set to 0
Definition at line 195 of file animatable.h. References count, nlassert, and uint.
00196 { 00197 // with the "uint32 _BitSet" implementation, juste check the size is correct 00198 nlassert(count<=32); 00199 } |
|
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).
Definition at line 153 of file animatable.h. References _Father, _FatherOwnerBit, propagateTouch(), and uint. Referenced by NL3D::CMeshBase::instanciateMeshBase(), and NL3D::CSegRemanence::setAnimatedMaterial().
00154 { 00155 _Father= father; _FatherOwnerBit= fatherOwnerBit; 00156 00157 // propagate the touch to the fathers. 00158 propagateTouch(); 00159 } |
|
This method set a bit in the bitset.
Definition at line 239 of file animatable.h. Referenced by propagateTouch(), and touch().
00240 { 00241 _BitSet|= (1<<valueId); 00242 } |
|
|
Definition at line 75 of file animatable.h. |
|
Definition at line 206 of file animatable.h. Referenced by clearFlag(), IAnimatable(), isTouched(), and setFlag(). |
|
Definition at line 208 of file animatable.h. Referenced by IAnimatable(), propagateTouch(), and setFather(). |
|
Definition at line 210 of file animatable.h. Referenced by propagateTouch(), and setFather(). |