#include <math.h>
#include <assert.h>
#include "texture.h"
+#include "datamap.h"
#include "image.h"
#include "opengl.h"
#include "imago2.h"
pixels += 4;
}
}
- default_img->save("/tmp/foo.png");
}
switch(type) {
{
}
-Texture *TextureSet::get_texture(const char *name, TextureType type) const
+Texture *TextureSet::get_texture(const char *name, TextureType type, const DataMap *dmap) const
{
- std::map<std::string, Texture*>::const_iterator iter = data.find(name);
+ char *fname;
+ int nsize = dmap ? dmap->path_size(name) : 0;
+ if(nsize) {
+ fname = (char*)alloca(nsize);
+ dmap->lookup(name, fname, nsize);
+ } else {
+ fname = (char*)name;
+ }
+
+ std::map<std::string, Texture*>::const_iterator iter = data.find(fname);
if(iter != data.end()) {
return iter->second;
}
Texture *res = create();
- data[name] = res;
+ data[fname] = res;
res->create_default(type);
- resman_lookup(rman, name, res);
+ resman_lookup(rman, fname, res);
return res;
}