My Project
Public Member Functions | List of all members
ParaEngine::MovieKeyFrame< T > Class Template Reference

Generic movie key frame class: T is the data type stored in the key frame. More...

#include <KeyFrame.h>

Public Member Functions

void Clear ()
 
void AppendNewKey (float fTime, const T &key)
 append a new key to the end of the key frame list
 
void InsertNewKey (float fTime, const T &key)
 NOT TESTED: Insert a new key to the key frame list according to the time. More...
 
float GetEndingTime ()
 get the ending time
 
void UpdateKeyFrame (int nIndex, float fTime, const T &key)
 update a key frame value is boundary safe. More...
 
void PopKeyFrame (int nNum)
 pop a specified number of key frames from the end of the key frames More...
 
T & operator[] (int nIndex)
 indexer
 
float time (int nIndex)
 get the time. More...
 
int GetPos ()
 get the current position. More...
 
void SetPos (int nPos)
 set the current position. More...
 
int GetSize ()
 Get the number of key frames. More...
 
T & GetRelative (int nShiftPos=0)
 get the data at current position + nShiftPos. More...
 
int GetKeyIndexByTime (float fTime)
 NOT TESTED: get the index nPos of the key frame, where time[nPos-1]<=fTime<time[nPos] a binary search is used internally. More...
 
int UpdateTime (float &fTimeElapsed)
 update the current time position by a given time in seconds.the current time position may not be the same as the given value in case a rewinding occurs. More...
 
int TrimToTime (float fTimeElapsed)
 trim the key frames to the specified time. More...
 

Detailed Description

template<class T>
class ParaEngine::MovieKeyFrame< T >

Generic movie key frame class: T is the data type stored in the key frame.

Member Function Documentation

§ GetKeyIndexByTime()

template<class T>
int ParaEngine::MovieKeyFrame< T >::GetKeyIndexByTime ( float  fTime)
inline

NOT TESTED: get the index nPos of the key frame, where time[nPos-1]<=fTime<time[nPos] a binary search is used internally.

if there is no key frame found. -1 is returned please note that times.size() may be returned in case the time is larger than all key times in the list

§ GetPos()

template<class T>
int ParaEngine::MovieKeyFrame< T >::GetPos ( )
inline

get the current position.

value is not boundary safe

§ GetRelative()

template<class T>
T& ParaEngine::MovieKeyFrame< T >::GetRelative ( int  nShiftPos = 0)
inline

get the data at current position + nShiftPos.

value is boundary safe. but there should be at least one element.

Parameters
nShiftPosthe shift position. default value is 0. which is the current one

§ GetSize()

template<class T>
int ParaEngine::MovieKeyFrame< T >::GetSize ( )
inline

Get the number of key frames.

§ InsertNewKey()

template<class T>
void ParaEngine::MovieKeyFrame< T >::InsertNewKey ( float  fTime,
const T &  key 
)
inline

NOT TESTED: Insert a new key to the key frame list according to the time.

Parameters
fTimetime at which to insert the key,
keythe key to be inserted.

§ PopKeyFrame()

template<class T>
void ParaEngine::MovieKeyFrame< T >::PopKeyFrame ( int  nNum)
inline

pop a specified number of key frames from the end of the key frames

Parameters
nNumthe number of key frames to remove.

§ SetPos()

template<class T>
void ParaEngine::MovieKeyFrame< T >::SetPos ( int  nPos)
inline

set the current position.

value is not boundary safe

§ time()

template<class T>
float ParaEngine::MovieKeyFrame< T >::time ( int  nIndex)
inline

get the time.

value is boundary safe. but there should be at least one element.

§ TrimToTime()

template<class T>
int ParaEngine::MovieKeyFrame< T >::TrimToTime ( float  fTimeElapsed)
inline

trim the key frames to the specified time.

All key frames after the input time will be removed. This function is safe when the key frames are empty.

Returns
: the number of keys trimmed is returned

§ UpdateKeyFrame()

template<class T>
void ParaEngine::MovieKeyFrame< T >::UpdateKeyFrame ( int  nIndex,
float  fTime,
const T &  key 
)
inline

update a key frame value is boundary safe.

but there should be at least one element.

Parameters
nIndexthe index of the key frame to update
fTimethe time
keythe key

§ UpdateTime()

template<class T>
int ParaEngine::MovieKeyFrame< T >::UpdateTime ( float &  fTimeElapsed)
inline

update the current time position by a given time in seconds.the current time position may not be the same as the given value in case a rewinding occurs.

in such case, the input contains the actual time set. value is not boundary safe.This function is safe when the key frames are empty.

Parameters
fTimeElapsed[in|out] time in seconds. the elapsed time might be reset by this function in case that a rewind occurs.
Returns
: the current position is returned, it is guaranteed that time[nPos-1]<=fTimeElapsed<time[nPos] if the frames are empty, 0 is returned

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