00001 #ifndef movable_H
00002 #define movable_H
00003
00004 #include <string>
00005
00006
00007
00008
00009
00010
00011
00012 #include "misc.hpp"
00013
00014
00015
00016 #define ROTATE_SLOWNESS 8
00017 #define MOVE_INC 0.2f
00018
00019 using namespace std;
00020
00022
00029 class movable
00030 {
00031 public:
00032
00033 movable();
00034 movable(string name);
00035 virtual ~movable();
00036
00037 void init();
00038
00039 movable& operator= (const movable& other);
00040
00041 virtual void draw();
00042 virtual void update();
00043
00044 void move(int pitch, int turn, int roll, float x, float y, float z);
00045
00046 void setName(string name);
00047
00048
00050
00051
00052 float mass;
00054 matrix9f Ibody;
00056 matrix9f IbodyInv;
00057
00059 matrix16f location,
00060 newLocation;
00061
00063 vector3f P,newP,
00065 L,newL;
00066
00067
00068
00069 matrix9f Iinv;
00071 vector3f velocity,
00073 omega;
00074
00076 vector3f force,
00078 torque;
00079
00080
00081 bool normalize;
00082
00083 float step;
00084
00085
00086 string name;
00087
00088
00089
00090 virtual void getBoundingBox();
00091 void getAABB();
00092 void drawAABB();
00093 void drawBoundingBox();
00094
00095 bool drawBB;
00096
00097
00098 bool BBtested;
00099
00100 bool BBcollided;
00101
00102 vector3f centerBB;
00103 vector3f edgesBB;
00104 vector3f boundingBox[8];
00105
00106 vector3f oldCenterAABB;
00107 vector3f centerAABB;
00108 vector3f edgesAABB;
00109 vector3f AABB[8];
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 bool physical;
00121
00122 private:
00123
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 };
00137
00138 #endif // movable_H