00001 /* 00002 Autor: $Author: kunkel $ State: $State: Exp $ 00003 Datum: $Date: 2005/05/30 12:35:25 $ 00004 Version: $Revision: 1.1 $ 00005 */ 00006 00011 #ifndef OBJECT_H 00012 #define OBJECT_H 00013 00014 #include "config.h" 00015 #include "Vector.h" 00016 #include <GL/glut.h> 00017 #include "glui/glui.h" 00018 00026 class Object { 00027 protected: 00031 enum button {CANCEL,TEXTURE}; 00032 00036 class classWindowEditAttributes { 00037 public: 00038 00042 GLUI * attributeWindow; 00043 00047 GLUI_Listbox * textureSelector; 00048 00056 Object * my; 00057 00061 string objectType; 00062 00066 char name[SIZEOFGLUISTRING]; 00067 00077 void * additionalInformation; 00078 }; 00079 00084 static classWindowEditAttributes * editAttributes; 00085 00093 virtual void loadAttributes(); 00094 00100 virtual void saveAttributes(); 00101 00110 virtual void deleteAdditionalInformation(void * additionalInformation); 00111 00117 void drawBegin(); 00118 00125 void drawEnd(); 00126 00132 GLuint getOpenglTextureNumber(); 00133 private: 00137 unsigned short textureNum; 00138 00142 char texture[MAX_TEXTURE_LENGTH+1]; 00143 00147 char name[MAX_NAME_LENGTH+1]; 00148 00153 static void AttributeMenuCallback(int i); 00154 00159 void FillTextureSelector(); 00160 public: 00161 00165 Vector pos; 00166 00170 Vector v; 00171 00175 double mass; 00176 00180 double radius; 00181 00188 Vector getScaledPos(); 00189 00195 Vector getScaledV(); 00196 00202 double getScaledRadius(); 00203 00204 00208 Object(); 00209 00213 virtual ~Object() { 00214 closeAttributeWindow(); 00215 } 00216 00221 char *getName() { 00222 return name; 00223 } 00224 00229 void setName(const string & name); 00230 00235 virtual char * getType()=0; 00236 00241 char *getTexture() { 00242 return texture; 00243 } 00244 00248 void refreshAttributes() { 00249 if(editAttributes == 0 ) 00250 return; 00251 loadAttributes(); 00252 editAttributes->attributeWindow->sync_live(); 00253 } 00254 00259 void setTexture(const string & texture); 00260 00264 virtual void draw()=0; 00271 virtual void createAttributeWindow(); 00280 virtual int getDrawPriority() { 00281 return 0; 00282 } 00283 00288 virtual void load(istream & FILE); 00289 00294 virtual void save(ostream & FILE); 00295 00302 static double getRadiusModified(double r); 00303 00310 static Vector getDistanceModified(Vector pos); 00311 00315 static void closeAttributeWindow(); 00316 00321 static bool attributeWindowShown() { 00322 return editAttributes != 0; 00323 } 00324 }; 00325 00326 #endif