NL3D::CAnimation Class Reference

This class describes animations for several tracks. More...

#include <animation.h>

Inherits NL3D::UAnimation.

List of all members.

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 UTrackgetTrackByName (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 ITrackgetTrack (uint trackId) const
 Get a const track pointer.
ITrackgetTrack (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

Detailed Description

This class describes animations for several tracks.

Each track works with a IAnimatedValue for the IAnimatable objects.

Author:
Cyril 'Hulud' Corvazier
Nevrax France
Date:
2001

Definition at line 57 of file animation.h.


Member Typedef Documentation

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.


Member Enumeration Documentation

anonymous enum
Enumerator:
NotFound 

Definition at line 67 of file animation.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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 (  ) 
TAnimationTime NL3D::CAnimation::getBeginTime (  )  const [virtual]

Get begin time of the animation.

Returns:
the begin time.

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]
uint NL3D::CAnimation::getIdTrackByChannelId ( uint16  channelId  )  const

see applyAnimHeaderCompression()

Returns:
CAnimation::NotFound if the track doesn't exist (or anim header not compressed) else return the id of the track.

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

Parameters:
name is the name of the desired track.
Returns:
CAnimation::NotFound if the track doesn't exist else the id of the 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().

ITrack* NL3D::CAnimation::getTrack ( uint  trackId  )  [inline]

Get a track pointer.

Parameters:
channelId is the id of the desired channel.

Definition at line 105 of file animation.h.

References _TrackVector.

const ITrack* NL3D::CAnimation::getTrack ( uint  trackId  )  const [inline]

Get a const track pointer.

Parameters:
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.

Parameters:
name is the name of the track to get.
Returns:
NULL if the track is not found, else a pointer on the track interface.

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.

Returns:
the count of track in this animation

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.

Parameters:
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  ) 
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().


Member Data Documentation

bool NL3D::CAnimation::_AnimLoop [mutable, private]

Definition at line 190 of file animation.h.

Referenced by allTrackLoop().

Definition at line 193 of file animation.h.

Referenced by addTrack(), and allTrackLoop().

Definition at line 188 of file animation.h.

Referenced by getBeginTime().

Definition at line 191 of file animation.h.

Referenced by addTrack(), and getBeginTime().

Definition at line 189 of file animation.h.

Referenced by getEndTime().

Definition at line 192 of file animation.h.

Referenced by addTrack(), and getEndTime().

std::vector<uint16> NL3D::CAnimation::_IdByChannelId [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().

CTrackSampledQuat header compression.

Definition at line 197 of file animation.h.

Referenced by applyTrackQuatHeaderCompression(), CAnimation(), and ~CAnimation().


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

Generated on Thu Jan 7 08:30:03 2010 for NeL by  doxygen 1.6.1