Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: introducing multiframe-texture

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//! A Class, that reads in Textures from different fileformats.
17  class Texture : public BaseObject
18  {
19    public:
20      Texture(const char* imageName = NULL);
21  //  Texture(TEXTURE_TYPE type, int resolution);
22      ~Texture();
23
24      bool loadImage(const char* imageName);
25      virtual bool rebuild();
26
27      /** @returns The textureID of this texture.  */
28      inline GLuint getTexture() const { return this->texture; };
29      /** @returns true if texture has alpha, false otherwise */
30      inline bool hasAlpha() const {return bAlpha;}
31      /** @returns the stored image of this Texture */
32      const SDL_Surface* const getStoredImage() const { return this->image; };
33
34
35
36      static void setTextureEnableState(bool texturesEnabled);
37      /** @returns true if Textures are enabled */
38      inline static bool getTextureEnableState() { return Texture::texturesEnabled; };
39
40      // Utility functionality:
41      static GLuint loadTexToGL (const SDL_Surface* surface);
42
43    protected:
44      bool prepareSurface(SDL_Surface* input);
45      bool setSurface(SDL_Surface* newSurface);
46      bool setTexture(GLuint texture) { this->texture = texture; };
47
48
49    private:
50      GLuint           texture;            //!< The Texture-ID of opengl from this Texture.
51      bool             bAlpha;             //!< if the texture has an alpha channel.
52      SDL_Surface*     image;              //!< The SDL_Surfce that stores the Texture on it.
53
54      static bool      texturesEnabled;    //!< If the Textures are enabled.
55  };
56
57#endif /* _TEXTURE_H */
Note: See TracBrowser for help on using the repository browser.