X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FTexture.hh;h=4e311ea53a05f75689b0e7b2c31dfedf4b573135;hp=d55f6f7309c71fe05765ac86c02abfbd53599959;hb=3f6e44698c38b74bb622ad81ea9d2daa636981d2;hpb=5fa5f117f28922a7e539a432367960c1a61f837d diff --git a/src/Moof/Texture.hh b/src/Moof/Texture.hh index d55f6f7..4e311ea 100644 --- a/src/Moof/Texture.hh +++ b/src/Moof/Texture.hh @@ -34,11 +34,8 @@ * Image-loading and OpenGL texture loading. */ -#include - #include -#include #include #include @@ -46,10 +43,20 @@ namespace Mf { +class Texture; +typedef boost::shared_ptr TextureP; + + class Texture : public Resource { public: - Texture(const std::string& name); + + static TextureP alloc(const std::string& name) + { + return TextureP(new Texture(name)); + } + + explicit Texture(const std::string& name); void bind() const; GLuint getObject() const; @@ -66,35 +73,10 @@ public: static std::string getPath(const std::string& name); - struct Exception : public Mf::Exception - { - 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 Impl; - boost::shared_ptr impl_; + boost::shared_ptr mImpl; };