00001 /* MAINTAINER: Petko */ 00002 #ifndef _COMONENTITY_H 00003 #define _COMONENTITY_H 00004 00005 #include "GLVector.h" 00006 #include "GLQuaternion.h" 00007 00008 #include "colmodel.h" 00009 /*@{ */ 00011 00015 enum ClassType 00016 { 00017 cInvalid, 00018 cProjectile, 00019 cTank, 00020 cBonusBox 00021 }; 00022 00029 class CommonEntity 00030 { 00031 public: 00032 CommonEntity(); 00033 virtual ~CommonEntity() = 0; 00034 00035 void setID(int ID); 00036 int getID(); 00037 00044 void basicInit( int ID, GLVector3d position, GLQuaterniond orientation ); 00045 00056 virtual bool init(); 00057 00065 virtual void destroy(); 00066 00067 // Maybe this routine could do the rendering and then the others 00068 // doesn't have to override it. Except tank probably. 00069 virtual void render(); 00070 00076 ClassType getClassType(); 00077 00081 CollisionModel mColModel; 00082 00086 void tranformColModel() 00087 { 00088 mColModel.resetTransformations(); 00089 mColModel.setRotation( mOrientation ); 00090 mColModel.setTranslation( mPosition ); 00091 mColModel.finishTransformations(); 00092 } 00093 00098 GLVector3d getPosition() 00099 { 00100 return mPosition; 00101 } 00102 00107 void setPosition( GLVector3d pos ) 00108 { 00109 mPosition = pos; 00110 } 00111 00116 GLQuaterniond getOrientation() 00117 { 00118 return mOrientation; 00119 } 00120 00125 void setOrientation( GLQuaterniond orient ) 00126 { 00127 mOrientation = orient; 00128 } 00129 00130 protected: 00132 GLVector3d mPosition; 00133 00135 GLQuaterniond mOrientation; 00136 00138 int mID; 00139 00141 ClassType mType; 00142 00144 int mSubType; 00145 00146 private: 00148 CommonEntity( const CommonEntity & ); 00149 }; 00150 00152 #endif // _COMONENTITY_H
1.4.5