#ifndef NO_PRAGMA_ONCE #pragma once #endif #ifndef __TEXTURE_H #define __TEXTURE_H #include namespace CHCDemoEngine { /// class Texture { public: /** Constructor loading texture from file */ Texture(const std::string &filename); /** Destroys data. */ ~Texture(); /** Returns image data. */ void *GetImage() const; enum { FORMAT_INVALID, FORMAT_RGB, FORMAT_RGBA }; enum { CLAMP, REPEAT }; /** Returns width of texture. */ int GetWidth() const; /** Returns width of texture. */ int GetHeight() const; /** Returns texture format. Currently only RGBA supported. */ int GetFormat() const; /** Returns name of the texture */ std::string GetName() const; int GetRowLength() const; int GetPixelSize() const; inline int GetByteSize() const; /** Bind the texture. */ void Bind() const; void SetBoundaryModeS(int mode) { mBoundaryModeS = mode; } void SetBoundaryModeT(int mode) { mBoundaryModeT = mode; } //void SetUseMipMap(bool useMipMap) { mUseMipMap = useMipMap; } int GetBoundaryModeS() const { return mBoundaryModeS; } int GetBoundaryModeT() const { return mBoundaryModeT; } /** Creates the texture from the image */ void Create(); protected: int mFormat; int mWidth; int mHeight; unsigned int mTexId; int mBoundaryModeS; int mBoundaryModeT; std::string mName; int mByteSize; void *mImage; bool mUseMipMap; }; inline int Texture::GetByteSize() const { return mByteSize; } } #endif // __TEXTURE_H