Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3087 in orxonox.OLD


Ignore:
Timestamp:
Dec 4, 2004, 7:02:56 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/images: check for different File-types

Location:
orxonox/branches/images/importer
Files:
2 edited

Legend:

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

    r3086 r3087  
    157157void Material::setName (char* mtlName)
    158158{
    159   //  if (verbose >= 3)
     159  if (verbose >= 3)
    160160    printf("setting Material Name to %s.\n", mtlName);
    161161  name = new char [strlen(mtlName)];
     
    320320
    321321  //  diffuseTextureSet = loadBMP(dMap, &diffuseTexture);
    322   diffuseTextureSet = loadJPG(dMap, &diffuseTexture);
     322  diffuseTextureSet = loadImage(dMap, &diffuseTexture);
    323323
    324324}
     
    350350void Material::setBump(char* bump)
    351351{
     352
     353}
     354
     355/**
     356   \brief Makes the Programm ready to Read-in a texture-File
     357   1. Checks what type of Image should be imported
     358   2. ToDO: Checks where to find the Image
     359*/
     360bool Material::loadImage(char* imageName, GLuint* texture)
     361{
     362  if (!strncmp(imageName+strlen(imageName)-4, ".bmp", 4))
     363    {
     364      if (verbose >=2)
     365        printf ("Requested bmp-image. Trying to Import.\n");
     366      return loadBMP(imageName, texture);
     367    }
     368
     369  else if (!strncmp(imageName+strlen(imageName)-4, ".jpg", 4) || !strncmp(imageName+strlen(imageName)-5, ".jpg", 5))
     370    {
     371      if (verbose >=2)
     372        printf ("Requested jpeg-image. Trying to Import\n");
     373      return loadJPG(imageName, texture);
     374    }
     375  else
     376    {
     377      if (verbose >=1)
     378        printf ("Requested Image was not recognized in its type. (Maybe a type-Cast-error.)\n FileName: %s", imageName);
     379      return false;
     380    }
    352381
    353382}
  • orxonox/branches/images/importer/material.h

    r3086 r3087  
    8585
    8686  // TEXTURING
     87  bool loadImage(char* imageName, GLuint* texture);
     88
    8789  bool loadBMP (char* bmpName, GLuint* texture);
     90
    8891  bool loadJPG (char* jpgName, GLuint* texture);
    8992  void decodeJPG(jpeg_decompress_struct* cinfo, tImageJPG *pImageData);
Note: See TracChangeset for help on using the changeset viewer.