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