#include <msp/datafile/objectloader.h>
#include "gl.h"
#include "predicate.h"
+#include "resource.h"
namespace Msp {
namespace GL {
If texture coordinates fall outside of the principal range of the texture,
wrapping is applied. The default for all directions is REPEAT.
*/
-class Texture
+class Texture: public Resource
{
protected:
- class Loader: public DataFile::ObjectLoader<Texture>
+ class Loader: public DataFile::CollectionObjectLoader<Texture>
{
+ protected:
+ bool srgb;
+
public:
Loader(Texture &);
+ Loader(Texture &, Collection &);
private:
+ void init();
+
void filter(TextureFilter);
void generate_mipmap(bool);
void mag_filter(TextureFilter);
Predicate cmp_func;
mutable int dirty_params;
- Texture(GLenum);
+ Texture(GLenum, ResourceManager * = 0);
Texture(const Texture &);
Texture &operator=(const Texture &);
public:
GLenum get_target() const { return target; }
unsigned get_id() const { return id; }
- void bind() const;
+ void bind() const { bind_to(0); }
void bind_to(unsigned) const;
- static const Texture *current();
- static void unbind();
+ static const Texture *current(unsigned = 0);
+ static void unbind() { unbind_from(0); }
static void unbind_from(unsigned);
};