Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8310 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Jun 11, 2006, 12:33:19 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: impooved TextureSequence

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

Legend:

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

    r8309 r8310  
    2929
    3030/**
    31  * Constructor for a Texture
     31 * @brief Constructor for a Texture
    3232 */
    3333TextureSequence::TextureSequence(unsigned int count, ...)
     
    3838  va_start(textureNameList, count);
    3939
     40  for (unsigned int i = 0; i < count; i++)
     41  {
     42    this->addFrame(va_arg(textureNameList, char*));
     43  }
     44  va_end(textureNameList);
     45
    4046  this->loadImageSeries(count, textureNameList);
    4147}
    4248
    43 
    44 /**
    45  * Destructor of a TextureSequence
     49/**
     50 * @brief Creates an ImageSeries out of TextureNames.
     51 * @param textureNames The Names of the Textures
     52 * @param prependFolder Optional you can prepend a Folder of Textures.
     53 */
     54TextureSequence::TextureSequence(const std::vector<std::string>& textureNames, const std::string& prependFolder)
     55{
     56  this->setClassID(CL_TEXTURE_SEQUENCE, "TextureSequence");
     57  this->loadImageSeries(textureNames, prependFolder);
     58}
     59
     60
     61/**
     62 * @brief Destructor of a TextureSequence
    4663 *
    4764 * Frees Data, and deletes the textures from GL
     
    87104      retVal = false;
    88105  }
     106  va_end(textureNameList);
     107  return retVal;
     108}
     109
     110/**
     111 * @brief Load an TextureSeries from TextureNames
     112 * @param textureNames The Names of the Textures.
     113 * @param prependFolder (optional) the Folder to prepend
     114 * @return true on success.
     115 */
     116bool TextureSequence::loadImageSeries(const std::vector<std::string>& textureNames, const std::string& prependFolder)
     117{
     118  bool retVal = true;
     119  for (unsigned int i = 0; i < textureNames.size(); i++)
     120  {
     121    if( !this->addFrame(prependFolder + textureNames[i]))
     122      retVal = false;
     123  }
     124
    89125  return retVal;
    90126}
  • trunk/src/lib/graphics/importer/texture_sequence.h

    r8309 r8310  
    1717  public:
    1818    TextureSequence(unsigned int count = 0, ...);
    19     TextureSequence(const std::vector<std::string>*& textureNames);
     19    TextureSequence(const std::vector<std::string>& textureNames, const std::string& prependFolder = "");
    2020    //  Texture(TEXTURE_TYPE type, int resolution);
    2121    virtual ~TextureSequence();
    2222
    2323    bool loadImageSeries(unsigned int count, ...);
    24     bool loadImageSeries(unsigned int count, std::vector<std::string>& textureNames);
     24    bool loadImageSeries(const std::vector<std::string>& textureNames, const std::string& prependFolder = "");
    2525    bool loadImageSeries(const std::string& imagePrefix, unsigned int from, unsigned int to);
    2626    bool addFrame(const std::string& image);
Note: See TracChangeset for help on using the changeset viewer.