Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8297 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Jun 9, 2006, 2:56:50 AM (19 years ago)
Author:
bensch
Message:

trunk: new ImageLoading algo

Location:
trunk/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/texture_sequence.cc

    r7221 r8297  
    8686      this->textures[i] = loadTexToGL(this->images[i]);
    8787  }
     88  return true;
    8889}
    8990
     
    117118  }
    118119  return retVal;
     120}
     121
     122bool TextureSequence::loadImageSeries(const std::string& imagePrefix, unsigned int from, unsigned int to, const std::string& extension)
     123{
     124  unsigned int index = 0;
     125  unsigned int frameSize = 0;
     126  // search for the special character # in the LoadParam
     127  if ((index = imagePrefix.find("_#")) != std::string::npos)
     128  {
     129    std::string _imagePrefix = imagePrefix;
     130    index++; // start at #
     131    while(imagePrefix[index+frameSize] == '#')
     132    {
     133      _imagePrefix[index+frameSize] = '0';
     134      frameSize++;
     135    }
     136
     137    PRINTF(4)("Found %d '#'s in %s... searching for LOD's\n", frameSize, imagePrefix.c_str());
     138    char tmpString[32];
     139    for (unsigned int i = from; i < to; i++)
     140    {
     141      sprintf(tmpString, "%d", i);
     142      _imagePrefix.replace(index+frameSize -strlen(tmpString), index+frameSize, tmpString);
     143      printf("TEST STRING %s\n", _imagePrefix.c_str());
     144    }
     145    return true;
     146  }
     147  return false;
    119148}
    120149
  • trunk/src/lib/graphics/importer/texture_sequence.h

    r7221 r8297  
    2323    bool loadImageSeries(unsigned int count, ...);
    2424    bool loadImageSeries(unsigned int count, va_list textureNames);
     25    bool loadImageSeries(const std::string& imagePrefix, unsigned int from, unsigned int to, const std::string& extension = "png");
    2526    bool addFrame(const std::string& image);
    2627    bool addFrame(SDL_Surface* surface);
Note: See TracChangeset for help on using the changeset viewer.