00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 #ifndef ABSOBJ_H
00021 #define ABSOBJ_H
00022 
00026 
00027 
00028 #include "obj.h"
00029 #include "tritype.h"
00030 #include <vector>
00031 
00032 using namespace std;
00033 
00038 class AbsObj : public Obj
00039 {
00040 public:
00041     AbsObj();
00044     Vec4 col;
00046     Vec4 vrot;
00048     Vec4 l;
00050     Vec4 vl;
00052     Vec4 vr;
00056     bool gotGrav;
00058     bool gotMove;
00060     enum objtype {UnSet = 0, Static, MainObj, Debris, NonContact, Projectile};
00061     enum objtype ourType;
00063     float LastColl;
00064     
00066     Matrix4x4 affine;
00068     Matrix4x4 invaff;
00069 
00071     float life;
00073     float mass;
00075     Matrix4x4 invtensor;    
00077     Vec4 forces;
00079     Vec4 torques;
00081     vector<Vec4> vertlist;
00083     vector<tritype> trilist;
00085     vector<Vec4> normlist;
00086 
00087     void genericupdate(float time);
00089     void pos(float px, float py, float pz) {Obj::pos(px, py, pz); getAffine();};
00090 
00094     void setTransp(float t) { col(3) = t;};
00096     void setColour(float rin, float gin, float bin)
00097         {col(0) = rin; col(1) = gin; col(2) = bin;};
00099     void setRotation(float xin, float yin, float zin);
00101     void setVel(float xin, float yin, float zin)
00102     {vl(0) = xin; vl(1) = yin, vl(2) = zin;getAffine();} ;
00104     void setRotVel(float xin, float yin, float zin)
00105     {vr(0) = xin; vr(1) = yin, vr(2) = zin;};
00107     void addRotVel(float xin, float yin, float zin)
00108     {vr(0) += xin; vr(1) += yin, vr(2) += zin;};
00109     void calcTorque(Vec4 pos, Vec4 force);
00110     void getAffine(void);
00114     void genericrender(void);
00115     bool collide(const AbsObj &incoming, Vec4 *collpt = NULL, Vec4 *colln = NULL, Vec4 *collintr = NULL);
00116     bool collidept(const AbsObj &incoming, Vec4 *colln = NULL);
00117     
00121     virtual void update(float time) = 0;
00125     virtual void render(void) = 0;
00126 };
00127 
00128 int collideResponse(float time, AbsObj &bill, AbsObj &ben, Vec4 &pt, Vec4 &n, Vec4 &intr, float sticky = 0.8);
00129 
00130 #endif
00131 
00132 
00133 
00134 
00135 
00136 
00137