X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FTexture.hh;h=d55f6f7309c71fe05765ac86c02abfbd53599959;hp=e858093e1a44afa06b44d50dcc5eac80503855e7;hb=5fa5f117f28922a7e539a432367960c1a61f837d;hpb=c2321281bf12a7efaedde930422c7ddbc92080d4 diff --git a/src/Moof/Texture.hh b/src/Moof/Texture.hh index e858093..d55f6f7 100644 --- a/src/Moof/Texture.hh +++ b/src/Moof/Texture.hh @@ -38,8 +38,9 @@ #include -#include +#include #include +#include namespace Mf { @@ -50,30 +51,50 @@ class Texture : public Resource public: Texture(const std::string& name); - void bind(); - GLuint getObject(); + void bind() const; + GLuint getObject() const; - unsigned getWidth(); - unsigned getHeight(); + static void resetBind(); - void setMinFilter(GLuint filter); - void setMaxFilter(GLuint filter); - void setWrapU(GLuint wrap); - void setWrapV(GLuint wrap); + unsigned getWidth() const; + unsigned getHeight() const; - void applyChanges(); + void setMinFilter(GLuint filter); + void setMagFilter(GLuint filter); + void setWrapS(GLuint wrap); + void setWrapT(GLuint wrap); - static std::string getPathToResource(const std::string& name); + static std::string getPath(const std::string& name); - struct Exception : std::runtime_error + struct Exception : public Mf::Exception { - explicit Exception(const std::string& what_arg) : - std::runtime_error(what_arg) {} + enum + { + BAD_IMAGE_FORMAT = 1024 + }; + + explicit Exception(unsigned error) : + Mf::Exception(error) {} + + void raise() + { + throw *this; + } + + const char* what() const throw() + { + switch (code) + { + case BAD_IMAGE_FORMAT: + return "inappropriate image format"; + } + return Mf::Exception::what(); + } }; private: - class TextureImpl; - boost::shared_ptr impl_; + class Impl; + boost::shared_ptr impl_; };