Go to the documentation of this file.00001 #ifndef __TRANFORMATION_HISTORY_H
00002 #define __TRANFORMATION_HISTORY_H
00003
00004 #include "RakNetTypes.h"
00005 #include "OgreVector3.h"
00006 #include "OgreQuaternion.h"
00007 #include "DS_Queue.h"
00008 #include "RakMemoryOverride.h"
00009
00010 struct TransformationHistoryCell
00011 {
00012 TransformationHistoryCell();
00013 TransformationHistoryCell(RakNetTime t, const Ogre::Vector3& pos, const Ogre::Vector3& vel, const Ogre::Quaternion& quat );
00014
00015 RakNetTime time;
00016 Ogre::Vector3 position;
00017 Ogre::Quaternion orientation;
00018 Ogre::Vector3 velocity;
00019 };
00020
00021 class TransformationHistory
00022 {
00023 public:
00024 void Init(RakNetTime maxWriteInterval, RakNetTime maxHistoryTime);
00025 void Write(const Ogre::Vector3 &position, const Ogre::Vector3 &velocity, const Ogre::Quaternion &orientation, RakNetTime curTimeMS);
00026 void Overwrite(const Ogre::Vector3 &position, const Ogre::Vector3 &velocity, const Ogre::Quaternion &orientation, RakNetTime when);
00027 enum ReadResult
00028 {
00029
00030 READ_OLDEST,
00031
00032 VALUES_UNCHANGED,
00033
00034 INTERPOLATED
00035 };
00036
00037 ReadResult Read(Ogre::Vector3 *position, Ogre::Vector3 *velocity, Ogre::Quaternion *orientation,
00038 RakNetTime when, RakNetTime curTime);
00039 void Clear(void);
00040 protected:
00041 DataStructures::Queue<TransformationHistoryCell> history;
00042 unsigned maxHistoryLength;
00043 RakNetTime writeInterval;
00044 };
00045
00046 #endif