00001 #ifndef OBJECT_H 00002 #define OBJECT_H 00003 00004 #include "lugre_smartptr.h" 00005 #include "location.h" 00006 #include "objectcontroller.h" 00007 #include <list> 00008 00009 #define kResyncMessageLen (4+2+4+3*3+2*4) 00010 00011 #include <OgreVector3.h> 00012 #include <OgreQuaternion.h> 00013 using Ogre::Vector3; 00014 using Ogre::Quaternion; 00015 using namespace Lugre; 00016 00017 class lua_State; 00018 class cLocation; 00019 class cObjectController; 00020 00021 namespace Lugre { 00022 class cFIFO; 00023 class cGfx3D; 00024 class cOdeObject; 00025 }; 00026 00032 class cObject : public cSmartPointable { public : 00033 cOdeObject* mpPhysicForm; 00034 cObjectController* mpController; 00035 int miLastChangeTime; 00036 int miResyncCounterHigh; 00037 uint32 miResyncCounterLow; 00038 float mfMaxSpeed; 00039 float mfBoundingRad; 00040 float mfDistToLocationCenter; 00041 bool mbResynced; 00042 Vector3 mvPos,mvVel,mvAccel; 00043 Quaternion mqRot,mqTurn; 00044 cGfx3D* mpGfx3D; 00045 00046 cObject(); 00047 virtual ~cObject(); 00048 00049 void Step (const int iCurTime,const float fPhysStepTime,const bool bIncResyncCounterLow=false); 00050 00051 void SaveResyncData (cFIFO& pFIFO); 00052 void LoadResyncData (cFIFO& pFIFO); 00053 static void SkipResyncData (cFIFO& pFIFO); 00054 00055 void SetController (cObjectController* pObjectController); 00056 00057 void SetParentLocation (cLocation* pParentLocation); 00058 inline cLocation* GetParentLocation () { return mpParentLocation; } 00059 00061 inline void _HackForgetParentLocation () { mpParentLocation = 0; } 00062 00063 inline int GetID () { return miID; } 00064 void SetID (const int iID); 00065 00066 // lua binding 00067 static void LuaRegister (lua_State *L); 00068 00069 private: 00070 // keeping insert position iterors enables constant time removal later 00071 cLocation* mpParentLocation; 00072 std::list<cObject*>::iterator _mLocationInsertPos; 00073 int miID; 00074 }; 00075 00076 #endif
1.5.6