Rev | Line | |
---|
[3341] | 1 | /*! |
---|
[8751] | 2 | * @file texture_data.h |
---|
[5768] | 3 | * @brief Contains the texture class, that handles the reading of Images into Texutre-files. |
---|
| 4 | */ |
---|
[3341] | 5 | |
---|
[8363] | 6 | #ifndef _TEXTURE_DATA_H |
---|
| 7 | #define _TEXTURE_DATA_H |
---|
[3341] | 8 | |
---|
[5304] | 9 | #include "base_object.h" |
---|
[3548] | 10 | |
---|
[5768] | 11 | #include "glincl.h" |
---|
[7785] | 12 | #include "count_pointer.h" |
---|
[3548] | 13 | |
---|
[5768] | 14 | /* Forward Declaration */ |
---|
[5239] | 15 | struct SDL_Surface; |
---|
| 16 | |
---|
[7785] | 17 | |
---|
| 18 | class TextureData |
---|
| 19 | { |
---|
| 20 | public: |
---|
| 21 | TextureData(); |
---|
| 22 | ~TextureData(); |
---|
| 23 | |
---|
| 24 | inline GLuint getTexture() const { return this->texture; }; |
---|
| 25 | /** @returns true if texture has alpha, false otherwise */ |
---|
| 26 | inline bool hasAlpha() const {return this->bAlpha; } |
---|
| 27 | /** @returns the stored image of this Texture */ |
---|
| 28 | const SDL_Surface* const getStoredImage() const { return this->image; }; |
---|
| 29 | |
---|
| 30 | bool loadSurface(SDL_Surface* surface, GLenum target = GL_TEXTURE_2D); |
---|
| 31 | |
---|
| 32 | bool rebuild(); |
---|
| 33 | |
---|
| 34 | bool setSurface(SDL_Surface* newSurface); |
---|
[7788] | 35 | /** @returns true if the Surface has an Alpha Value. */ |
---|
[8145] | 36 | bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; return this->bAlpha; }; |
---|
[7785] | 37 | bool setTexture(GLuint texture); |
---|
| 38 | |
---|
| 39 | private: |
---|
| 40 | GLuint texture; //!< The Texture-ID of opengl from this Texture. |
---|
| 41 | bool bAlpha; //!< if the texture has an alpha channel. |
---|
| 42 | SDL_Surface* image; //!< The SDL_Surfce that stores the Texture on it. |
---|
| 43 | }; |
---|
| 44 | |
---|
[8761] | 45 | typedef CountPointer<TextureData> TextureDataPointer; |
---|
| 46 | |
---|
[8363] | 47 | #endif /* _TEXTURE_DATA_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.