Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8297 in orxonox.OLD for trunk


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

trunk: new ImageLoading algo

Location:
trunk/src/lib
Files:
3 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);
  • trunk/src/lib/gui/gl/glgui_cursor.cc

    r8145 r8297  
    2020#include "glgui_handler.h"
    2121#include "color.h"
     22#include "texture_sequence.h"
    2223
    2324
     
    5051
    5152
     53
    5254  /**
    5355   * @brief initializes the GUI-element
     
    6466    this->setLayer(E2D_LAYER_ABOVE_ALL);
    6567    this->color = 0.0f;
     68
     69    TextureSequence* seq = new TextureSequence();
     70    seq->loadImageSeries("test_###", 0, 222, "png");
    6671
    6772    this->resize();
Note: See TracChangeset for help on using the changeset viewer.