Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/graphics/importer/texture.h @ 5857

Last change on this file since 5857 was 5857, checked in by bensch, 18 years ago

orxonox/trunk: enableTexture now a property of Texture and not GraphicsEngine → Texture is a Leaf now

@patrick: as you said so long ago, this is the better idea

File size: 1.8 KB
Line 
1/*!
2 * @file texture.h
3 * @brief Contains the texture class, that handles the reading of Images into Texutre-files.
4 */
5
6#ifndef _TEXTURE_H
7#define _TEXTURE_H
8
9#include "base_object.h"
10
11#include "glincl.h"
12
13/* Forward Declaration */
14struct SDL_Surface;
15
16//! an enumerator for different procedural texture-types
17typedef enum TEXTURE_TYPE { TEXTURE_RADIAL_ALIAS,
18  TEXTURE_NOISE };
19
20//! A Class, that reads in Textures from different fileformats.
21  class Texture : public BaseObject
22  {
23    public:
24      Texture(const char* imageName = NULL);
25  //  Texture(TEXTURE_TYPE type, int resolution);
26      ~Texture();
27
28      bool loadImage(const char* imageName);
29      bool rebuild();
30
31      /** @returns The textureID of this texture.  */
32      inline GLuint getTexture() const { return this->texture; };
33      /** @returns true if texture has alpha, false otherwise */
34      inline bool hasAlpha() const {return bAlpha;}
35
36      static GLuint loadTexToGL (const SDL_Surface* surface);
37
38      const SDL_Surface* const getStoredImage() { return this->image; };
39
40      static void setTextureEnableState(bool texturesEnabled);
41      /** @returns true if Textures are enabled */
42      inline static bool getTextureEnableState() { return Texture::texturesEnabled; };
43
44    protected:
45      bool prepareSurface(SDL_Surface* input);
46      bool setSurface(SDL_Surface* newSurface);
47      bool setTexture(GLuint texture) { this->texture = texture; };
48
49
50    private:
51      GLuint           texture;            //!< The Texture-ID of opengl from this Texture.
52      bool             bAlpha;             //!< if the texture has an alpha channel.
53      SDL_Surface*     image;              //!< The SDL_Surfce that stores the Texture on it.
54
55      static bool      texturesEnabled;    //!< If the Textures are enabled.
56  };
57
58#endif /* _TEXTURE_H */
Note: See TracBrowser for help on using the repository browser.