- Timestamp:
- Jun 7, 2005, 9:49:57 AM (19 years ago)
- Location:
- orxonox/trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/resource_manager.cc
r4519 r4534 19 19 20 20 // different resource Types 21 #ifndef NO_MODEL 21 22 #include "objModel.h" 22 23 #include "primitive_model.h" 23 24 #include "md2Model.h" 25 #endif /* NO_MODEL */ 26 #ifndef NO_TEXTURES 24 27 #include "texture.h" 28 #endif /* NO_TEXTURES */ 29 #ifndef NO_TEXT 25 30 #include "text_engine.h" 31 #endif /* NO_TEXT */ 32 #ifndef NO_AUDIO 26 33 #include "sound_engine.h" 34 #endif /* NO_AUDIO */ 27 35 28 36 #include "list.h" … … 117 125 } 118 126 127 #ifndef NO_TEXTURE 119 128 /** 120 129 \brief adds a new Path for Images … … 155 164 } 156 165 } 166 #endif /* NO_TEXTURES */ 157 167 158 168 /** … … 168 178 { 169 179 ResourceType tmpType; 170 180 #ifndef NO_MODEL 171 181 if (!strncmp(fileName+(strlen(fileName)-4), ".obj", 4)) 172 182 tmpType = OBJ; 173 if (!strncmp(fileName+(strlen(fileName)-4), ".md2", 4))183 else if (!strncmp(fileName+(strlen(fileName)-4), ".md2", 4)) 174 184 tmpType = MD2; 185 else if (!strcmp(fileName, "cube") || 186 !strcmp(fileName, "sphere") || 187 !strcmp(fileName, "plane") || 188 !strcmp(fileName, "cylinder") || 189 !strcmp(fileName, "cone")) 190 tmpType = PRIM; 191 #endif /* NO_MODEL */ 192 #ifndef NO_AUDIO 175 193 else if (!strncmp(fileName+(strlen(fileName)-4), ".wav", 4)) 176 194 tmpType = WAV; … … 179 197 else if (!strncmp(fileName+(strlen(fileName)-4), ".ogg", 4)) 180 198 tmpType = OGG; 181 else if (!strcmp(fileName, "cube") || 182 !strcmp(fileName, "sphere") || 183 !strcmp(fileName, "plane") || 184 !strcmp(fileName, "cylinder") || 185 !strcmp(fileName, "cone")) 186 tmpType = PRIM; 199 #endif /* NO_AUDIO */ 200 #ifndef NO_TEXT 187 201 else if (!strncmp(fileName+(strlen(fileName)-4), ".ttf", 4)) 188 202 tmpType = TTF; 203 #endif /* NO_TEXT */ 204 #ifndef NO_TEXTURES 189 205 else 190 206 tmpType = IMAGE; 207 #endif /* NO_TEXTURES */ 191 208 192 209 return this->load(fileName, tmpType, prio, param1, param2, param3); … … 232 249 switch(type) 233 250 { 251 #ifndef NO_MODEL 234 252 case OBJ: 235 253 if (param1) … … 276 294 } 277 295 break; 296 #endif /* NO_MODEL */ 297 #ifndef NO_TEXT 278 298 case TTF: 279 299 if (param1) … … 304 324 PRINTF(2)("Sorry, %s does not exist. Not loading Font\n", fullName); 305 325 break; 326 #endif /* NO_TEXT */ 327 #ifndef NO_AUDIO 306 328 case WAV: 307 329 if(isFile(fullName)) 308 330 tmpResource->pointer = new SoundBuffer(fullName); 309 331 break; 332 #endif /* NO_AUDIO */ 333 #ifndef NO_TEXTURES 310 334 case IMAGE: 311 335 if(isFile(fullName)) … … 338 362 PRINTF(2)("!!Image %s not Found!!\n", fileName); 339 363 break; 364 #endif /* NO_TEXTURES */ 340 365 default: 341 366 tmpResource->pointer = NULL; … … 392 417 switch(resource->type) 393 418 { 419 #ifndef NO_MODEL 394 420 case OBJ: 395 421 case PRIM: … … 399 425 delete (MD2Data*)resource->pointer; 400 426 break; 427 #endif /* NO_MODEL */ 428 #ifndef NO_AUDIO 429 case WAV: 430 delete (SoundBuffer*)resource->pointer; 431 break; 432 #endif /* NO_AUDIO */ 433 #ifndef NO_TEXT 434 case TTF: 435 delete (Font*)resource->pointer; 436 break; 437 #endif /* NO_TEXT */ 438 #ifndef NO_TEXTURES 401 439 case IMAGE: 402 440 delete (Texture*)resource->pointer; 403 441 break; 404 case WAV: 405 delete (SoundBuffer*)resource->pointer; 406 break; 407 case TTF: 408 delete (Font*)resource->pointer; 409 break; 442 #endif /* NO_TEXTURES */ 410 443 default: 411 444 PRINTF(1)("NOT YET IMPLEMENTED !!FIX FIX!!\n"); … … 473 506 switch (type) 474 507 { 508 #ifndef NO_MODEL 475 509 case PRIM: 476 510 case OBJ: … … 492 526 match = true; 493 527 break; 528 #endif /* NO_MODEL */ 529 #ifndef NO_TEXT 494 530 case TTF: 495 531 if (!param1) … … 515 551 match = true; 516 552 } 517 518 break; 553 break; 554 #endif /* NO_TEXT */ 519 555 default: 520 556 match = true; -
orxonox/trunk/src/util/resource_manager.h
r4519 r4534 7 7 Otherwise it will instruct the coresponding resource-loader to load, 8 8 and receive a pointer to it. 9 10 it is possible to compile the resource Manager without some modules by 11 just adding the compile flag -D.... 12 (NO_MODEL) 13 (NO_AUDIO) 14 (NO_TEXT) 15 (NO_TEXTURES) 9 16 */ 10 17 … … 20 27 21 28 //! An eumerator for different fileTypes the resourceManager supports 22 typedef enum ResourceType { OBJ, //!< loading .obj file 23 PRIM, //!< loading primitive model 24 MD2, //!< loading md2-file 25 WAV, //!< loading wav 26 MP3, //!< loading mp3 27 OGG, //!< loading ogg 28 TTF, //!< loading a TrueTypeFont 29 IMAGE }; //!< loading an image 29 typedef enum ResourceType { 30 #ifndef NO_MODEL 31 OBJ, //!< loading .obj file 32 PRIM, //!< loading primitive model 33 MD2, //!< loading md2-file 34 #endif /* NO_MODEL */ 35 #ifndef NO_AUDIO 36 WAV, //!< loading wav 37 MP3, //!< loading mp3 38 OGG, //!< loading ogg 39 #endif /* NO_AUDIO */ 40 #ifndef NO_TEXT 41 TTF, //!< loading a TrueTypeFont 42 #endif /* NO_TEXT */ 43 #ifndef NO_TEXTURES 44 IMAGE //!< loading an image 45 #endif /* NO_TEXTURES */ 46 }; 30 47 31 48 //! An enumerator for different UNLOAD-types. … … 52 69 53 70 // more specific 71 #ifndef NO_MODEL 54 72 float modelSize; //!< the size of the model (OBJ/PRIM) 73 char* skinFileName; //!< skinFileName (MD2) 74 #endif /* NO_MODEL */ 75 #ifndef NO_TEXT 55 76 unsigned int ttfSize; //!< the size of the ttf-font (TTF) 56 77 unsigned char ttfColorR; //!< red Color (TTF) 57 78 unsigned char ttfColorG; //!< green Color (TTF) 58 79 unsigned char ttfColorB; //!< blue Color (TTF) 59 char* skinFileName; //!< skinFileName (MD2) 80 #endif /* NO_TEXT */ 60 81 }; 61 82
Note: See TracChangeset
for help on using the changeset viewer.