Changeset 5323 in orxonox.OLD for trunk/src/util
- Timestamp:
- Oct 8, 2005, 5:27:22 PM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/resource_manager.cc
r5308 r5323 36 36 #include "ogg_player.h" 37 37 #endif /* NO_AUDIO */ 38 #ifndef NO_SHADERS 39 #include "shader.h" 40 #endif /* NO_SHADERS */ 38 41 39 42 #include "list.h" … … 190 193 #ifndef NO_MODEL 191 194 #define __IF_OK 192 if (!strnc mp(fileName+(strlen(fileName)-4), ".obj", 4))195 if (!strncasecmp(fileName+(strlen(fileName)-4), ".obj", 4)) 193 196 tmpType = OBJ; 194 197 else if (!strncmp(fileName+(strlen(fileName)-4), ".md2", 4)) 195 198 tmpType = MD2; 196 else if (!strc mp(fileName, "cube") ||197 !strc mp(fileName, "sphere") ||198 !strc mp(fileName, "plane") ||199 !strc mp(fileName, "cylinder") ||200 !strc mp(fileName, "cone"))199 else if (!strcasecmp(fileName, "cube") || 200 !strcasecmp(fileName, "sphere") || 201 !strcasecmp(fileName, "plane") || 202 !strcasecmp(fileName, "cylinder") || 203 !strcasecmp(fileName, "cone")) 201 204 tmpType = PRIM; 202 205 #endif /* NO_MODEL */ … … 206 209 #endif 207 210 #define __IF_OK 208 if (!strnc mp(fileName+(strlen(fileName)-4), ".wav", 4))211 if (!strncasecmp(fileName+(strlen(fileName)-4), ".wav", 4)) 209 212 tmpType = WAV; 210 else if (!strnc mp(fileName+(strlen(fileName)-4), ".mp3", 4))213 else if (!strncasecmp(fileName+(strlen(fileName)-4), ".mp3", 4)) 211 214 tmpType = MP3; 212 else if (!strnc mp(fileName+(strlen(fileName)-4), ".ogg", 4))215 else if (!strncasecmp(fileName+(strlen(fileName)-4), ".ogg", 4)) 213 216 tmpType = OGG; 214 217 #endif /* NO_AUDIO */ … … 218 221 #endif 219 222 #define __IF_OK 220 if (!strnc mp(fileName+(strlen(fileName)-4), ".ttf", 4))223 if (!strncasecmp(fileName+(strlen(fileName)-4), ".ttf", 4)) 221 224 tmpType = TTF; 222 225 #endif /* NO_TEXT */ 226 #ifndef NO_SHADERS 227 #ifdef __IF_OK 228 else 229 #endif 230 #define __IF_OK 231 if (!strncasecmp(fileName+(strlen(fileName)-5), ".vert", 5)) 232 tmpType = SHADER; 233 #endif /* NO_SHADERS */ 223 234 #ifndef NO_TEXTURES 224 235 #ifdef __IF_OK … … 308 319 if (param1 != NULL) 309 320 { 310 tmpResource->s kinFileName = new char[strlen((const char*)param1)+1];311 strcpy(tmpResource->s kinFileName, (const char*) param1);321 tmpResource->secFileName = new char[strlen((const char*)param1)+1]; 322 strcpy(tmpResource->secFileName, (const char*) param1); 312 323 } 313 324 else 314 tmpResource->s kinFileName = NULL;315 tmpResource->pointer = new MD2Data(fullName, tmpResource->s kinFileName);325 tmpResource->secFileName = NULL; 326 tmpResource->pointer = new MD2Data(fullName, tmpResource->secFileName); 316 327 } 317 328 break; … … 372 383 break; 373 384 #endif /* NO_TEXTURES */ 385 #ifndef NO_SHADERS 386 case SHADER: 387 if(ResourceManager::isFile(fullName)) 388 { 389 char* secFullName = NULL; 390 if (param1 != NULL) 391 { 392 secFullName = ResourceManager::getFullName((const char*)param1); 393 printf("%s\n", secFullName); 394 if (ResourceManager::isFile(secFullName)) 395 { 396 printf("ok:: %s\n", secFullName); 397 tmpResource->secFileName = new char[strlen((const char*)param1)+1]; 398 strcpy(tmpResource->secFileName, (const char*) param1); 399 } 400 else 401 { 402 delete[] secFullName; 403 secFullName = NULL; 404 tmpResource->secFileName = NULL; 405 } 406 } 407 else 408 tmpResource->secFileName = NULL; 409 printf("%s::%s\n", fullName, secFullName); 410 tmpResource->pointer = new Shader(fullName, secFullName); 411 if (secFullName != NULL) 412 delete[] secFullName; 413 } 414 break; 415 #endif /* NO_SHADERS */ 374 416 default: 375 417 tmpResource->pointer = NULL; … … 458 500 break; 459 501 #endif /* NO_TEXTURES */ 502 #ifndef NO_SHADERS 503 case SHADER: 504 delete (Shader*)resource->pointer; 505 break; 506 #endif /* NO_SHADERS */ 460 507 default: 461 508 PRINTF(2)("NOT YET IMPLEMENTED !!FIX FIX!!\n"); … … 537 584 if (!param1) 538 585 { 539 if (enumRes->s kinFileName == NULL)586 if (enumRes->secFileName == NULL) 540 587 match = true; 541 588 } 542 else if (!strcmp(enumRes->s kinFileName, (const char*)param1))589 else if (!strcmp(enumRes->secFileName, (const char*)param1)) 543 590 match = true; 544 591 break; … … 555 602 break; 556 603 #endif /* NO_TEXT */ 604 #ifndef NO_SHADERS 605 case SHADER: 606 if (!param1) 607 { 608 if (enumRes->secFileName == NULL) 609 match = true; 610 } 611 else if (!strcmp(enumRes->secFileName, (const char*)param1)) 612 match = true; 613 #endif /* NO_SHADERS */ 557 614 default: 558 615 match = true; … … 862 919 break; 863 920 #endif 921 #ifndef NO_SHADERS 922 case SHADER: 923 return "Shader"; 924 break; 925 #endif 864 926 default: 865 927 return "unknown Format"; -
trunk/src/util/resource_manager.h
r5308 r5323 43 43 #endif /* NO_AUDIO */ 44 44 #ifndef NO_TEXTURES 45 IMAGE 45 IMAGE, //!< loading an image 46 46 #endif /* NO_TEXTURES */ 47 #ifndef NO_SHADERS 48 SHADER, //!< openGL-shader program 49 #endif /* NO_SHADERS */ 47 50 }; 48 51 … … 75 78 float modelSize; //!< the size of the model (OBJ/PRIM) 76 79 #ifndef NO_MODEL 77 char* s kinFileName; //!< skinFileName (MD2)80 char* secFileName; //!< a seconf fileName 78 81 #endif /* NO_MODEL */ 79 82 #ifndef NO_TEXT
Note: See TracChangeset
for help on using the changeset viewer.