This class describes animations for several tracks. More...
#include <animation.h>
Inherits NL3D::UAnimation.
Public Member Functions | |
| CAnimation () | |
| ctor | |
| virtual | ~CAnimation () |
| Destructor. | |
| void | addSSSShape (const std::string &shape) |
| For SkeletonSpawnScript (SSS) animation. | |
| const std::vector< std::string > & | getSSSShapes () const |
From UAnimation | |
| virtual UTrack * | getTrackByName (const char *name) |
| Get an animation track with its name. | |
| virtual void | releaseTrack (UTrack *track) |
| Relase a track interface. | |
| virtual TAnimationTime | getBeginTime () const |
| Get begin time of the animation. | |
| virtual TAnimationTime | getEndTime () const |
| Get end time of the animation. | |
| virtual bool | allTrackLoop () const |
| Say if all track of this animation loop. | |
CAnimationSet private | |
| void | applySampleDivisor (uint sampleDivisor) |
| For each track that support it (CTrackSampled for instance), divide its number of sampled keys, to lower the memory lod. | |
| void | applyTrackQuatHeaderCompression () |
| For CTrackSampledQuat only, compress header. | |
| void | applyAnimHeaderCompression (CAnimationSet *animationSetOwner, const std::map< std::string, uint32 > &channelMap) |
| Used by CAnimationSet to lower the memory Size. | |
Private Attributes | |
| class CTrackSamplePack * | _TrackSamplePack |
| CTrackSampledQuat header compression. | |
| std::vector< uint16 > | _IdByChannelId |
| class CAnimationSet * | _AnimationSetOwner |
| std::vector< std::string > | _SSSShapes |
Anim time caching | |
| TAnimationTime | _BeginTime |
| TAnimationTime | _EndTime |
| bool | _AnimLoop |
| bool | _BeginTimeTouched |
| bool | _EndTimeTouched |
| bool | _AnimLoopTouched |
Public interface. | |
|
| |
| enum | { NotFound = 0xffffffff } |
| uint | getIdTrackByName (const std::string &name) const |
| Get track with its name. | |
| void | getTrackNames (std::set< std::string > &setString) const |
| Fill the set of string with the name of the channels. | |
| uint | getIdTrackByChannelId (uint16 channelId) const |
| see applyAnimHeaderCompression() | |
| const ITrack * | getTrack (uint trackId) const |
| Get a const track pointer. | |
| ITrack * | getTrack (uint trackId) |
| Get a track pointer. | |
| void | addTrack (const std::string &name, ITrack *pChannel) |
| Add a track at the end of the track list. | |
| void | serial (NLMISC::IStream &f) |
| Serial the template. | |
| void | setMinEndTime (TAnimationTime minEndTime) |
| Set animation min end time. | |
Members | |
|
| |
| typedef std::map< std::string, uint32 > | TMapStringUInt |
| typedef std::vector< ITrack * > | TVectAPtrTrack |
| std::string | _Name |
| TMapStringUInt | _IdByName |
| TVectAPtrTrack | _TrackVector |
| TAnimationTime | _MinEndTime |
This class describes animations for several tracks.
Each track works with a IAnimatedValue for the IAnimatable objects.
Definition at line 57 of file animation.h.
typedef std::map<std::string, uint32> NL3D::CAnimation::TMapStringUInt [private] |
Definition at line 171 of file animation.h.
typedef std::vector<ITrack* > NL3D::CAnimation::TVectAPtrTrack [private] |
Definition at line 172 of file animation.h.
| anonymous enum |
Definition at line 67 of file animation.h.
| NL3D::CAnimation::CAnimation | ( | ) |
ctor
Definition at line 51 of file animation.cpp.
References _AnimationSetOwner, _MinEndTime, and _TrackSamplePack.
| NL3D::CAnimation::~CAnimation | ( | ) | [virtual] |
Destructor.
Definition at line 60 of file animation.cpp.
References _TrackSamplePack, and _TrackVector.
| void NL3D::CAnimation::addSSSShape | ( | const std::string & | shape | ) |
For SkeletonSpawnScript (SSS) animation.
Add manualy the shapes that can be spawned by the channel "spawn_script" in this animation This add into a vector (avoid duplicates)
Then CAnimationSet::preloadSSSShapes() can be used after CAnimationSet::build() to force loading into the ShapeBank/Texture of thoses shapes, so there is no problem of shape loading during animation
Definition at line 515 of file animation.cpp.
References _SSSShapes.
Referenced by NL3D::CAnimationOptimizer::optimize().
| void NL3D::CAnimation::addTrack | ( | const std::string & | name, | |
| ITrack * | pChannel | |||
| ) |
Add a track at the end of the track list.
This method is used to insert tracks in the animation. Tracks must be allocated with new. The pointer is then handeled by the CAnimation.
Definition at line 75 of file animation.cpp.
References _AnimLoopTouched, _BeginTimeTouched, _EndTimeTouched, _IdByChannelId, _IdByName, _TrackVector, and nlassert.
Referenced by NL3D::CAnimationOptimizer::optimize().
| bool NL3D::CAnimation::allTrackLoop | ( | ) | const [virtual] |
Say if all track of this animation loop.
NB: If no tracks in the animation, return true
Implements NL3D::UAnimation.
Definition at line 257 of file animation.cpp.
References _AnimLoop, _AnimLoopTouched, _TrackVector, and NL3D_HAUTO_UI_ANIMATION.
| void NL3D::CAnimation::applyAnimHeaderCompression | ( | CAnimationSet * | animationSetOwner, | |
| const std::map< std::string, uint32 > & | channelMap | |||
| ) |
Used by CAnimationSet to lower the memory Size.
After this, you can (and should for better performances) use getIdTrackByChannelId() Does not support more than 65536 channels (nlassert)
Definition at line 451 of file animation.cpp.
References _AnimationSetOwner, _IdByChannelId, _IdByName, _TrackVector, NLMISC::contReset(), and nlassert.
| void NL3D::CAnimation::applySampleDivisor | ( | uint | sampleDivisor | ) |
For each track that support it (CTrackSampled for instance), divide its number of sampled keys, to lower the memory lod.
Used typically by CAnimationSet
Definition at line 358 of file animation.cpp.
References _TrackVector, NL3D::ITrack::applySampleDivisor(), and NL3D_HAUTO_UI_ANIMATION.
Referenced by NL3D::CAnimationSet::addAnimation().
| void NL3D::CAnimation::applyTrackQuatHeaderCompression | ( | ) |
For CTrackSampledQuat only, compress header.
Used typically by CAnimationSet NB: Animation cannot be serialized after this operation (unserialisable tracks)
Definition at line 372 of file animation.cpp.
References _TrackSamplePack, _TrackVector, NL3D::ITrack::applyTrackQuatHeaderCompressionPass0(), NL3D::ITrack::applyTrackQuatHeaderCompressionPass1(), NL3D::CTrackSamplePack::Keys, NL3D_HAUTO_UI_ANIMATION, nlassert, NL3D::CTrackSampleCounter::NumKeys, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), NL3D::CTrackSamplePack::Times, NL3D::CTrackSampleCounter::TrackHeaders, and NL3D::CTrackSamplePack::TrackHeaders.
Referenced by NL3D::CAnimationSet::addAnimation().
| TAnimationTime NL3D::CAnimation::getBeginTime | ( | ) | const [virtual] |
Get begin time of the animation.
Implements NL3D::UAnimation.
Definition at line 192 of file animation.cpp.
References _BeginTime, _BeginTimeTouched, _TrackVector, and NL3D_HAUTO_UI_ANIMATION.
Referenced by NL3D::CAnimationPlaylist::getLocalTime(), and NL3D::CMeshBaseInstance::traverseHrc().
| TAnimationTime NL3D::CAnimation::getEndTime | ( | ) | const [virtual] |
Get end time of the animation.
Implements NL3D::UAnimation.
Definition at line 223 of file animation.cpp.
References _EndTime, _EndTimeTouched, _MinEndTime, _TrackVector, and NL3D_HAUTO_UI_ANIMATION.
Referenced by NL3D::CLodCharacterBuilder::addAnim(), NL3D::CAnimationPlaylist::getLocalTime(), NL3D::CAnimationOptimizer::optimize(), NL3D::CAnimationPlaylist::setupMixer(), and NL3D::CMeshBaseInstance::traverseHrc().
see applyAnimHeaderCompression()
Definition at line 497 of file animation.cpp.
References _IdByChannelId, NotFound, and NLMISC::searchLowerBound().
Referenced by getIdTrackByName().
| uint NL3D::CAnimation::getIdTrackByName | ( | const std::string & | name | ) | const |
Get track with its name.
WARNING: slower if applyAnimHeaderCompression() has been called. try use getIdTrackByChannelId() instead
| name | is the name of the desired track. |
Definition at line 132 of file animation.cpp.
References _AnimationSetOwner, _IdByChannelId, _IdByName, NL3D::CAnimationSet::getChannelIdByName(), getIdTrackByChannelId(), nlassert, NL3D::CAnimationSet::NotFound, and NotFound.
Referenced by getTrackByName(), NL3D::CAnimationOptimizer::optimize(), and NL3D::CChannelMixer::refreshList().
| const std::vector<std::string>& NL3D::CAnimation::getSSSShapes | ( | ) | const [inline] |
Definition at line 145 of file animation.h.
References _SSSShapes.
Referenced by NL3D::CAnimationOptimizer::optimize().
Get a track pointer.
| channelId | is the id of the desired channel. |
Definition at line 105 of file animation.h.
References _TrackVector.
Get a const track pointer.
| channelId | is the id of the desired channel. |
Definition at line 95 of file animation.h.
References _TrackVector.
Referenced by getTrackByName(), NL3D::CAnimationOptimizer::optimize(), and NL3D::CChannelMixer::refreshList().
| UTrack * NL3D::CAnimation::getTrackByName | ( | const char * | name | ) | [virtual] |
Get an animation track with its name.
The track interface should be released with releaseTrack.
| name | is the name of the track to get. |
Implements NL3D::UAnimation.
Definition at line 286 of file animation.cpp.
References getIdTrackByName(), getTrack(), NL3D_HAUTO_UI_ANIMATION, and NotFound.
| void NL3D::CAnimation::getTrackNames | ( | std::set< std::string > & | setString | ) | const |
Fill the set of string with the name of the channels.
Definition at line 162 of file animation.cpp.
References _AnimationSetOwner, _IdByChannelId, _IdByName, NL3D::CAnimationSet::getChannelName(), and nlassert.
Referenced by NL3D::CAnimationSet::build(), NL3D::CAnimationOptimizer::optimize(), and NL3D::CScene::setAutomaticAnimationSet().
| void NL3D::CAnimation::releaseTrack | ( | UTrack * | track | ) | [virtual] |
Relase a track interface.
| track | is a pointer on the track interface to release. |
Implements NL3D::UAnimation.
Definition at line 304 of file animation.cpp.
References NL3D_HAUTO_UI_ANIMATION.
| void NL3D::CAnimation::serial | ( | NLMISC::IStream & | f | ) |
Serial the template.
Definition at line 93 of file animation.cpp.
References _IdByChannelId, _IdByName, _MinEndTime, _Name, _SSSShapes, _TrackVector, nlassert, NLMISC::IStream::serial(), NLMISC::IStream::serialCheck(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialContPolyPtr(), and NLMISC::IStream::serialVersion().
| void NL3D::CAnimation::setMinEndTime | ( | TAnimationTime | minEndTime | ) |
Set animation min end time.
Definition at line 313 of file animation.cpp.
References _MinEndTime.
Referenced by NL3D::CAnimationOptimizer::optimize().
class CAnimationSet* NL3D::CAnimation::_AnimationSetOwner [private] |
Definition at line 202 of file animation.h.
Referenced by applyAnimHeaderCompression(), CAnimation(), getIdTrackByName(), and getTrackNames().
bool NL3D::CAnimation::_AnimLoop [mutable, private] |
Definition at line 190 of file animation.h.
Referenced by allTrackLoop().
bool NL3D::CAnimation::_AnimLoopTouched [mutable, private] |
Definition at line 193 of file animation.h.
Referenced by addTrack(), and allTrackLoop().
TAnimationTime NL3D::CAnimation::_BeginTime [mutable, private] |
Definition at line 188 of file animation.h.
Referenced by getBeginTime().
bool NL3D::CAnimation::_BeginTimeTouched [mutable, private] |
Definition at line 191 of file animation.h.
Referenced by addTrack(), and getBeginTime().
TAnimationTime NL3D::CAnimation::_EndTime [mutable, private] |
Definition at line 189 of file animation.h.
Referenced by getEndTime().
bool NL3D::CAnimation::_EndTimeTouched [mutable, private] |
Definition at line 192 of file animation.h.
Referenced by addTrack(), and getEndTime().
std::vector<uint16> NL3D::CAnimation::_IdByChannelId [private] |
Definition at line 200 of file animation.h.
Referenced by addTrack(), applyAnimHeaderCompression(), getIdTrackByChannelId(), getIdTrackByName(), getTrackNames(), and serial().
TMapStringUInt NL3D::CAnimation::_IdByName [private] |
Definition at line 178 of file animation.h.
Referenced by addTrack(), applyAnimHeaderCompression(), getIdTrackByName(), getTrackNames(), and serial().
TAnimationTime NL3D::CAnimation::_MinEndTime [private] |
Definition at line 184 of file animation.h.
Referenced by CAnimation(), getEndTime(), serial(), and setMinEndTime().
std::string NL3D::CAnimation::_Name [private] |
Definition at line 175 of file animation.h.
Referenced by serial().
std::vector<std::string> NL3D::CAnimation::_SSSShapes [private] |
Definition at line 205 of file animation.h.
Referenced by addSSSShape(), getSSSShapes(), and serial().
class CTrackSamplePack* NL3D::CAnimation::_TrackSamplePack [private] |
CTrackSampledQuat header compression.
Definition at line 197 of file animation.h.
Referenced by applyTrackQuatHeaderCompression(), CAnimation(), and ~CAnimation().
TVectAPtrTrack NL3D::CAnimation::_TrackVector [private] |
Definition at line 181 of file animation.h.
Referenced by addTrack(), allTrackLoop(), applyAnimHeaderCompression(), applySampleDivisor(), applyTrackQuatHeaderCompression(), getBeginTime(), getEndTime(), getTrack(), serial(), and ~CAnimation().
1.6.1