Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3133 in orxonox.OLD


Ignore:
Timestamp:
Dec 8, 2004, 4:26:05 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/images: now PathTexture-stuff also works for the non-sdl-image-compiling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/images/importer/material.cc

    r3130 r3133  
    1515   TGA-code: borrowed from nehe-Tutorials
    1616
    17    ToDo: free SDL-surface when deleting Material.
     17   ToDo:
     18   - free SDL-surface when deleting Material.
     19   - delete imgNameWithPath after use creation.
    1820*/
    1921
     
    485487bool Material::loadImage(char* imageName, GLuint* texture)
    486488{
    487   char* imgNameWithPath= searchTextureInPaths(imageName);
     489  char* imgNameWithPath = searchTextureInPaths(imageName);
    488490  if (imgNameWithPath)
    489491    {
     
    510512  else
    511513    {
    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 */
    518522/**
    519523   \brief Makes the Programm ready to Read-in a texture-File
     
    523527bool Material::loadImage(char* imageName, GLuint* texture)
    524528{
    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        }
    549563    }
    550564  else
    551565    {
    552566      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    }
    557570}
    558571
Note: See TracChangeset for help on using the changeset viewer.