00001 #ifndef _COLLIDABLE_H_ 00002 #define _COLLIDABLE_H_ 00003 00004 #include "model.h" 00005 00007 00010 class Collidable { 00011 public: 00012 std::string name; 00013 typedef RefClass <Model,std::string> ModelRef; 00015 ModelRef model; 00017 Matrix pos;// ********* FIXME: MUST SET THE POSITION IN THE COLIDETABEL! MAKE PRIVAET ********* // 00019 Collidable () {} 00021 Collidable(std::string filename, const Matrix &pos); 00022 void collide (Collidable *oth); 00023 float getRadius ()const {return model->getRadius();} 00024 class VectorHash getVectorHash()const; 00025 const QVector& getPosition()const {return pos.pos();} 00026 QVector getMin ()const { 00027 return Transform(pos,model->getMin()); 00028 } 00029 QVector getMax ()const { 00030 return Transform(pos,model->getMax()); 00031 } 00032 00033 }; 00034 00035 class IdCollidable : public Collidable { 00036 int id; 00037 public: 00039 IdCollidable () : id(-1), Collidable () {} 00041 IdCollidable(std::string filename, const Matrix &mat, int newId = -1) 00042 : Collidable (filename, mat) , id (newId) { 00043 } 00044 void setId (int newId) { 00045 id=newId; 00046 } 00047 int getId () const { 00048 return id; 00049 } 00050 }; 00051 #endif