10 enum TextureType { TEX_2D, TEX_CUBE };
19 static Image *default_img;
21 Texture(const Texture &tex) {}
22 Texture &operator =(const Texture &tex) { return *this; }
24 void set_image_2d(const Image &img);
25 bool set_image_cube(const Image &img, int idx);
26 bool set_image_cube(const Image &img);
28 bool load_cube(const char *fname);
30 /* for loading multiple cubemap faces from a single image */
31 bool set_cube_multi(const Image &img, const float *xoffsets, const float *yoffsets, float sz,
32 unsigned int rotmask = 0);
38 void set_wrapping(unsigned int wrap);
39 void set_filtering(unsigned int filt);
40 void set_filtering(unsigned int min_filt, unsigned int mag_filt);
42 unsigned int get_format() const;
44 int get_size(int dim) const;
46 void create(int xsz, int ysz, TextureType type = TEX_2D, unsigned int ifmt = GL_RGBA);
47 void create_default(TextureType type = TEX_2D);
48 void set_image(const Image &img, int idx = -1);
50 bool load(const char *fname);
52 unsigned int get_id() const;
53 TextureType get_type() const;
55 void bind(int tex_unit = 0) const;
57 friend class TextureSet;
60 void bind_texture(Texture *tex, int tunit = 0);
62 class TextureSet : public DataSet<Texture*> {
64 static Texture *create_tex();
65 static bool load_tex(Texture *tex, const char *fname);
66 static bool done_tex(Texture *tex);
67 static void free_tex(Texture *tex);
72 Texture *get_texture(const char *name, TextureType type = TEX_2D, const DataMap *dmap = 0) const;