Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Dec 1, 2005, 11:00:49 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: sequence test

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

Legend:

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

    r5863 r5865  
    2929/**
    3030 *  Constructor for a Texture
    31 */
     31 */
    3232TextureSequence::TextureSequence(unsigned int count, ...)
    3333{
     
    4141
    4242/**
    43  *  Destructor of a TextureSequence
    44 
    45    Frees Data, and deletes the textures from GL
    46 */
     43 * Destructor of a TextureSequence
     44 *
     45 * Frees Data, and deletes the textures from GL
     46 */
    4747TextureSequence::~TextureSequence()
    4848{
     
    5454  }
    5555
     56  this->setTexture(0);
    5657  // delete all textures.
    5758  while(!this->textures.empty())
     
    6566
    6667/**
    67  * rebuilds all the textures from the Images stored in this FrameSequence
     68 * @brief rebuilds all the textures from the Images stored in this FrameSequence
    6869 */
    6970bool TextureSequence::rebuild()
     
    8586
    8687/**
    87  * loads an image Series
     88 * @brief loads an image Sequence
    8889 * @param count how many images to load to the TextureSequence
    8990 * @param ... the names of the Images to load
     
    99100
    100101/**
    101  * loads an image Series
     102 * @brief loads an image Sequence
    102103 * @param count how many images to load to the TextureSequence
    103104 * @param textures the names of the Images to load
     
    115116}
    116117
    117 
     118/**
     119 * @brief adds a new Frame to this Sequence (at the end)
     120 * @param imageName the Name of the Image to add
     121 * @returns true on success
     122 */
    118123bool TextureSequence::addFrame(const char* imageName)
    119124{
     
    129134
    130135/**
    131  * adds a new Frame at the end of the Sequence.
     136 * @brief adds a new Frame at the end of the Sequence.
    132137 * @param surface the Surface to add at the end of the Sequence.
    133138 */
     
    144149  }
    145150  this->setAlpha(hasAlpha);
     151  return true;
    146152}
     153
     154
     155
     156/**
     157 * moves to the n'th texture which can then be retrieved via the Texture function: this->getTexture()
     158 * @param frameNumber the n-th frame
     159 */
     160void TextureSequence::gotoFrame(unsigned int frameNumber)
     161{
     162  if (this->textures.size() > frameNumber)
     163    this->setTexture(this->textures[frameNumber]);
     164}
  • trunk/src/lib/graphics/importer/texture_sequence.h

    r5861 r5865  
    3232    virtual bool rebuild();
    3333
     34    /** @returns the count of frames in this sequence */
     35    inline unsigned int getFrameCount() const { return this->textures.size(); };
     36
     37    void gotoFrame(unsigned int frameNumber);
    3438    /** @returns The textureID of the Frame @param frameNumber the n-th frame this texture-series.  */
    35     inline GLuint getFrameTexture(unsigned int frameNumber) const { return this->textures[frameNumber]; };
     39    inline GLuint getFrameTexture(unsigned int frameNumber) const { return (this->textures.size()>frameNumber)?this->textures[frameNumber]:0; };
    3640    /** @returns The SDL_Surface of the image at Frame @param frameNumber the n-th frame of this image-seriers */
    37     const SDL_Surface* const getFrameImage(unsigned int frameNumber) const { return this->images[frameNumber]; };
     41    const SDL_Surface* const getFrameImage(unsigned int frameNumber) const { return (this->images.size()>frameNumber)?this->images[frameNumber]:NULL; };
    3842
    3943  private:
Note: See TracChangeset for help on using the changeset viewer.