00001 #include "ext_stl.h" 00003 class Texture { 00004 00005 private: 00007 Texture(const Texture &) {} 00009 Texture & operator = (const Texture &){return *this;} 00010 int handle; 00011 00012 static int last_handle; 00013 public: 00015 Texture (const std::string & file); 00016 ~Texture(); 00018 void Bind(); 00020 bool operator < (const Texture &oth)const { 00021 return handle<oth.handle; 00022 } 00024 bool operator == (const Texture &oth)const { 00025 return (handle==oth.handle); 00026 } 00027 }; 00028 00030 class Model { 00032 float radius; 00034 int vertexList; 00036 void calcbb (); 00038 Vector min,max; 00039 public: 00040 typedef TSub<Texture,std::string> SubTexture; 00042 typedef RefClass <Texture,std::string,SubTexture> RefTexture; 00043 private: 00044 RefTexture tex; 00045 00046 public: 00048 float getRadius ()const {return radius;} 00050 const Vector &getMin ()const { 00051 return min; 00052 } 00054 const Vector &getMax () const{ 00055 return max; 00056 } 00058 Model (const Model & m); 00060 Model (const std::string &filename); 00061 ~Model (); 00062 Model & operator = (const Model & m); 00063 bool operator == (const Model & m)const { 00064 return this==&m; 00065 } 00066 bool operator < (const Model & m) const { 00067 if (tex< m.tex) { 00068 return true; 00069 }else if (tex == m.tex) { 00070 return this < &m; 00071 } 00072 return false; 00073 } 00074 void draw (const Matrix &mat); 00075 };