Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/graphics/importer/texture.h @ 5968

Last change on this file since 5968 was 5968, checked in by patrick, 18 years ago

network: merged the trunk into the network with the command svn merge -r5824:HEAD ../trunk network, changes changed… bla bla..

File size: 1.9 KB
RevLine 
[3341]1/*!
[5768]2 * @file texture.h
3 * @brief Contains the texture class, that handles the reading of Images into Texutre-files.
4 */
[3341]5
6#ifndef _TEXTURE_H
7#define _TEXTURE_H
8
[5304]9#include "base_object.h"
[3548]10
[5768]11#include "glincl.h"
[3548]12
[5768]13/* Forward Declaration */
[5239]14struct SDL_Surface;
15
[3341]16//! A Class, that reads in Textures from different fileformats.
[5768]17  class Texture : public BaseObject
18  {
19    public:
20      Texture(const char* imageName = NULL);
[4466]21  //  Texture(TEXTURE_TYPE type, int resolution);
[5768]22      ~Texture();
[3905]23
[5768]24      bool loadImage(const char* imageName);
[5968]25      virtual bool rebuild();
[5753]26
[5768]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;}
[5968]31      /** @returns the stored image of this Texture */
32      const SDL_Surface* const getStoredImage() const { return this->image; };
[3341]33
[5968]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 SDL_Surface* prepareSurface(SDL_Surface* input, bool& hasAlpha);
42      static GLuint loadTexToGL (const SDL_Surface* surface);
43
[5768]44    protected:
[5968]45
[5768]46      bool setSurface(SDL_Surface* newSurface);
[5968]47      bool setAlpha(bool hasAlpha) { this->bAlpha = hasAlpha; };
48      bool setTexture(GLuint texture) { this->texture = texture; };
[4466]49
[3341]50
[5768]51    private:
[5968]52      GLuint           texture;            //!< The Texture-ID of opengl from this Texture.
53      bool             bAlpha;             //!< if the texture has an alpha channel.
54      SDL_Surface*     image;              //!< The SDL_Surfce that stores the Texture on it.
55
56      static bool      texturesEnabled;    //!< If the Textures are enabled.
[5768]57  };
58
[3341]59#endif /* _TEXTURE_H */
Note: See TracBrowser for help on using the repository browser.