Last change
on this file since 5764 was
5755,
checked in by bensch, 19 years ago
|
orxonox/trunk: textures are rebuild on resize of the winodow (on winodws)
|
File size:
1.2 KB
|
Rev | Line | |
---|
[3341] | 1 | /*! |
---|
| 2 | \file texture.h |
---|
| 3 | \brief Contains the texture class, that handles the reading of Images into Texutre-files. |
---|
| 4 | |
---|
[4836] | 5 | @todo procedural textures |
---|
[3341] | 6 | */ |
---|
| 7 | |
---|
| 8 | #ifndef _TEXTURE_H |
---|
| 9 | #define _TEXTURE_H |
---|
| 10 | |
---|
[3548] | 11 | #include "glincl.h" |
---|
[5304] | 12 | #include "base_object.h" |
---|
[3548] | 13 | |
---|
| 14 | #include "debug.h" |
---|
| 15 | |
---|
[5239] | 16 | struct SDL_Surface; |
---|
| 17 | |
---|
[4466] | 18 | //! an enumerator for different procedural texture-types |
---|
| 19 | typedef enum TEXTURE_TYPE { TEXTURE_RADIAL_ALIAS, |
---|
[5239] | 20 | TEXTURE_NOISE }; |
---|
[3341] | 21 | |
---|
| 22 | //! A Class, that reads in Textures from different fileformats. |
---|
[5308] | 23 | class Texture : public BaseObject |
---|
[3341] | 24 | { |
---|
| 25 | public: |
---|
[3905] | 26 | Texture(const char* imageName = NULL); |
---|
[4466] | 27 | // Texture(TEXTURE_TYPE type, int resolution); |
---|
[4746] | 28 | ~Texture(); |
---|
[3905] | 29 | |
---|
[5753] | 30 | bool loadImage(const char* imageName); |
---|
[5755] | 31 | bool rebuild(); |
---|
[5753] | 32 | |
---|
[4836] | 33 | /** @returns The textureID of this texture. */ |
---|
[5239] | 34 | inline GLuint getTexture() const { return this->texture; }; |
---|
[4836] | 35 | /** @returns true if texture has alpha, false otherwise */ |
---|
[4746] | 36 | inline bool hasAlpha() const {return bAlpha;} |
---|
[3341] | 37 | |
---|
[5753] | 38 | private: |
---|
| 39 | SDL_Surface* prepareSurface(SDL_Surface* input); |
---|
| 40 | GLuint loadTexToGL (SDL_Surface* surface) const; |
---|
[4466] | 41 | |
---|
| 42 | private: |
---|
[5753] | 43 | GLuint texture; //!< The Texture-ID of opengl from this Texture. |
---|
| 44 | bool bAlpha; //!< if the texture has an alpha channel. |
---|
| 45 | SDL_Surface* image; |
---|
[3863] | 46 | }; |
---|
[3341] | 47 | |
---|
| 48 | #endif /* _TEXTURE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.