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