X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Ftexture.hh;h=f92ad23faf06db7c16c59c2d22d107ec6ad920e7;hb=5e5a883d665b09cc725c9c2baaaa98703c85c30e;hp=6fa4e326c7a51c16d83641e5759ca58853a85723;hpb=79b5f738f2e38acb60cda7e09f54802933a17105;p=chaz%2Fyoink diff --git a/src/texture.hh b/src/texture.hh index 6fa4e32..f92ad23 100644 --- a/src/texture.hh +++ b/src/texture.hh @@ -29,30 +29,50 @@ #ifndef _TEXTURE_HH_ #define _TEXTURE_HH_ +/** + * @file texture.hh + * Image-loading and OpenGL texture loading. + */ + +#include + #include #include "opengl.hh" +#include "resource.hh" namespace dc { -class texture_impl; - -class texture +class texture : public resource { public: - texture(const std::string& filePath, bool keepInMemory = false); - - const std::string& filePath(); + texture(const std::string& name); void bind(); - GLuint object(); + GLuint getObject(); + + unsigned getWidth(); + unsigned getHeight(); - unsigned width(); - unsigned height(); + void setMinFilter(GLuint filter); + void setMaxFilter(GLuint filter); + void setWrapU(GLuint wrap); + void setWrapV(GLuint wrap); + + void applyChanges(); + + static std::string getPathToResource(const std::string& name); + + struct exception : std::runtime_error + { + explicit exception(const std::string& what_arg) : + std::runtime_error(what_arg) {} + }; private: + class texture_impl; boost::shared_ptr impl; }; @@ -61,3 +81,5 @@ private: #endif // _TEXTURE_HH_ +/** vim: set ts=4 sw=4 tw=80: *************************************************/ +