/*! * @file texture.h * @brief Contains the texture class, that handles the reading of Images into Texutre-files. */ #ifndef _TEXTURE_H #define _TEXTURE_H #include "base_object.h" #include "glincl.h" /* Forward Declaration */ struct SDL_Surface; //! an enumerator for different procedural texture-types typedef enum TEXTURE_TYPE { TEXTURE_RADIAL_ALIAS, TEXTURE_NOISE }; //! A Class, that reads in Textures from different fileformats. class Texture : public BaseObject { public: Texture(const char* imageName = NULL); // Texture(TEXTURE_TYPE type, int resolution); ~Texture(); bool loadImage(const char* imageName); bool rebuild(); /** @returns The textureID of this texture. */ inline GLuint getTexture() const { return this->texture; }; /** @returns true if texture has alpha, false otherwise */ inline bool hasAlpha() const {return bAlpha;} static GLuint loadTexToGL (const SDL_Surface* surface); const SDL_Surface* const getStoredImage() { return this->image; }; static void setTextureEnableState(bool texturesEnabled); /** @returns true if Textures are enabled */ inline static bool getTextureEnableState() { return Texture::texturesEnabled; }; protected: bool prepareSurface(SDL_Surface* input); bool setSurface(SDL_Surface* newSurface); bool setTexture(GLuint texture) { this->texture = texture; }; private: GLuint texture; //!< The Texture-ID of opengl from this Texture. bool bAlpha; //!< if the texture has an alpha channel. SDL_Surface* image; //!< The SDL_Surfce that stores the Texture on it. static bool texturesEnabled; //!< If the Textures are enabled. }; #endif /* _TEXTURE_H */