Changeset 3133 in orxonox.OLD for orxonox/branches/images/importer
- Timestamp:
- Dec 8, 2004, 4:26:05 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/images/importer/material.cc
r3130 r3133 15 15 TGA-code: borrowed from nehe-Tutorials 16 16 17 ToDo: free SDL-surface when deleting Material. 17 ToDo: 18 - free SDL-surface when deleting Material. 19 - delete imgNameWithPath after use creation. 18 20 */ 19 21 … … 485 487 bool Material::loadImage(char* imageName, GLuint* texture) 486 488 { 487 char* imgNameWithPath = searchTextureInPaths(imageName);489 char* imgNameWithPath = searchTextureInPaths(imageName); 488 490 if (imgNameWithPath) 489 491 { … … 510 512 else 511 513 { 512 if (verbose >=2) 513 printf ("Image not Found: %s\n", imageName); 514 return false; 515 } 516 } 517 #else 514 if (verbose >=1) 515 printf ("Image not Found: %s\n", imgNameWithPath); 516 return false; 517 } 518 } 519 520 521 #else /* HAVE_SDL_SDL_IMAGE_H */ 518 522 /** 519 523 \brief Makes the Programm ready to Read-in a texture-File … … 523 527 bool Material::loadImage(char* imageName, GLuint* texture) 524 528 { 525 if (!strncmp(imageName+strlen(imageName)-4, ".bmp", 4)) 526 { 527 if (verbose >=2) 528 printf ("Requested bmp-image. Trying to Import.\n"); 529 return loadBMP(imageName, texture); 530 } 531 532 else if (!strncmp(imageName+strlen(imageName)-4, ".jpg", 4) || !strncmp(imageName+strlen(imageName)-5, ".jpg", 5)) 533 { 534 if (verbose >=2) 535 printf ("Requested jpeg-image. Trying to Import\n"); 536 return loadJPG(imageName, texture); 537 } 538 else if (!strncmp(imageName+strlen(imageName)-4, ".tga", 4)) 539 { 540 if (verbose >=2) 541 printf ("Requested tga-image. Trying to Import\n"); 542 return loadTGA(imageName, texture); 543 } 544 else if (!strncmp(imageName+strlen(imageName)-4, ".png", 4)) 545 { 546 if (verbose >=2) 547 printf ("Requested png-image. Trying to Import\n"); 548 return loadPNG(imageName, texture); 529 char* imgNameWithPath = searchTextureInPaths(imageName); 530 if (imgNameWithPath) 531 { 532 if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".bmp", 4)) 533 { 534 if (verbose >=2) 535 printf ("Requested bmp-image. Trying to Import.\n"); 536 return loadBMP(imgNameWithPath, texture); 537 } 538 539 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".jpg", 4) || !strncmp(imgNameWithPath+strlen(imgNameWithPath)-5, ".jpg", 5)) 540 { 541 if (verbose >=2) 542 printf ("Requested jpeg-image. Trying to Import\n"); 543 return loadJPG(imgNameWithPath, texture); 544 } 545 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".tga", 4)) 546 { 547 if (verbose >=2) 548 printf ("Requested tga-image. Trying to Import\n"); 549 return loadTGA(imgNameWithPath, texture); 550 } 551 else if (!strncmp(imgNameWithPath+strlen(imgNameWithPath)-4, ".png", 4)) 552 { 553 if (verbose >=2) 554 printf ("Requested png-image. Trying to Import\n"); 555 return loadPNG(imgNameWithPath, texture); 556 } 557 else 558 { 559 if (verbose >=1) 560 printf ("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imgNameWithPath); 561 return false; 562 } 549 563 } 550 564 else 551 565 { 552 566 if (verbose >=1) 553 printf ("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imageName); 554 return false; 555 } 556 567 printf ("Image not Found: %s\n", imgNameWithPath); 568 return false; 569 } 557 570 } 558 571
Note: See TracChangeset
for help on using the changeset viewer.