[3341] | 1 | /*! |
---|
[7194] | 2 | * @file texture_sequence.h |
---|
| 3 | * @brief Contains the texture_sequence class, that handles the reading of Image-files into multiple Texutres. |
---|
[5768] | 4 | */ |
---|
[3341] | 5 | |
---|
[5861] | 6 | #ifndef _TEXTURE_SEQUENCE_H |
---|
| 7 | #define _TEXTURE_SEQUENCE_H |
---|
[3341] | 8 | |
---|
[5858] | 9 | #include "texture.h" |
---|
[3548] | 10 | |
---|
[5858] | 11 | #include <vector> |
---|
[3548] | 12 | |
---|
[5239] | 13 | |
---|
[3341] | 14 | //! A Class, that reads in Textures from different fileformats. |
---|
[5861] | 15 | class TextureSequence : public Texture |
---|
[5860] | 16 | { |
---|
| 17 | public: |
---|
[5861] | 18 | TextureSequence(unsigned int count = 0, ...); |
---|
[8310] | 19 | TextureSequence(const std::vector<std::string>& textureNames, const std::string& prependFolder = ""); |
---|
[8309] | 20 | // Texture(TEXTURE_TYPE type, int resolution); |
---|
[6981] | 21 | virtual ~TextureSequence(); |
---|
[3905] | 22 | |
---|
[5860] | 23 | bool loadImageSeries(unsigned int count, ...); |
---|
[8310] | 24 | bool loadImageSeries(const std::vector<std::string>& textureNames, const std::string& prependFolder = ""); |
---|
[8324] | 25 | bool loadImageSeries(const std::string& imageNameSubstitue, unsigned int from, unsigned int to); |
---|
[7221] | 26 | bool addFrame(const std::string& image); |
---|
[5860] | 27 | bool addFrame(SDL_Surface* surface); |
---|
[6532] | 28 | bool addFrame(GLuint texture); |
---|
[5753] | 29 | |
---|
[6532] | 30 | void clearLists(); |
---|
| 31 | |
---|
[5860] | 32 | virtual bool rebuild(); |
---|
[3341] | 33 | |
---|
[5865] | 34 | /** @returns the count of frames in this sequence */ |
---|
| 35 | inline unsigned int getFrameCount() const { return this->textures.size(); }; |
---|
[8324] | 36 | /** @returns true if no Textures are stored inside of this TextureSequence */ |
---|
| 37 | inline bool empty() const { return textures.empty(); }; |
---|
[5865] | 38 | |
---|
[6532] | 39 | //void gotoFrame(unsigned int frameNumber); |
---|
[5860] | 40 | /** @returns The textureID of the Frame @param frameNumber the n-th frame this texture-series. */ |
---|
[5865] | 41 | inline GLuint getFrameTexture(unsigned int frameNumber) const { return (this->textures.size()>frameNumber)?this->textures[frameNumber]:0; }; |
---|
[5860] | 42 | /** @returns The SDL_Surface of the image at Frame @param frameNumber the n-th frame of this image-seriers */ |
---|
[5865] | 43 | const SDL_Surface* const getFrameImage(unsigned int frameNumber) const { return (this->images.size()>frameNumber)?this->images[frameNumber]:NULL; }; |
---|
[5856] | 44 | |
---|
[5860] | 45 | private: |
---|
| 46 | std::vector<GLuint> textures; //!< The Texture-ID of opengl from this Texture. |
---|
| 47 | std::vector<SDL_Surface*> images; //!< The SDL_Surfce that stores the Texture on it. |
---|
| 48 | }; |
---|
[5768] | 49 | |
---|
[5861] | 50 | #endif /* _TEXTURE_SEQUENCE_H */ |
---|