glBindVertexArray(0);
}
-Resource::AsyncLoader *Mesh::load(IO::Seekable &io)
+Resource::AsyncLoader *Mesh::load(IO::Seekable &io, const Resources *)
{
return new AsyncLoader(*this, io);
}
static void unbind();
- virtual Resource::AsyncLoader *load(IO::Seekable &);
+ virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
virtual UInt64 get_data_size() const;
virtual void unload();
};
namespace GL {
class ResourceManager;
+class Resources;
class Resource
{
void set_manager(ResourceManager *);
ResourceManager *get_manager() const { return manager; }
void *get_manager_data() const { return manager_data; }
- virtual AsyncLoader *load(IO::Seekable &) = 0;
+ virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) = 0;
virtual bool is_loaded() const;
virtual UInt64 get_data_size() const = 0;
virtual void unload() = 0;
#include <msp/strings/format.h>
#include <msp/time/utils.h>
#include "resourcemanager.h"
+#include "resources.h"
#include "resourcewatcher.h"
using namespace std;
if(!io)
throw resource_load_error(location.name, "open failed");
- loader = resource->load(*io);
+ const Resources *res = dynamic_cast<Resources *>(location.collection);
+ loader = resource->load(*io, res);
if(!loader)
{
delete io;
unsigned get_level_size(unsigned);
public:
- virtual AsyncLoader *load(IO::Seekable &) { return 0; }
+ virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
virtual UInt64 get_data_size() const;
virtual void unload() { }
};
h = 1;
}
-Resource::AsyncLoader *Texture2D::load(IO::Seekable &io)
+Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *)
{
return new AsyncLoader(*this, io);
}
void get_level_size(unsigned, unsigned &, unsigned &);
public:
- virtual Resource::AsyncLoader *load(IO::Seekable &);
+ virtual Resource::AsyncLoader *load(IO::Seekable &, const Resources * = 0);
virtual UInt64 get_data_size() const;
virtual void unload();
};
void get_level_size(unsigned, unsigned &, unsigned &, unsigned &);
public:
- virtual AsyncLoader *load(IO::Seekable &) { return 0; }
+ virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
virtual UInt64 get_data_size() const;
virtual void unload() { }
};
/** Returns a vector pointing to the center a texel. */
Vector3 get_texel_direction(TextureCubeFace, unsigned, unsigned);
- virtual AsyncLoader *load(IO::Seekable &) { return 0; }
+ virtual AsyncLoader *load(IO::Seekable &, const Resources * = 0) { return 0; }
virtual UInt64 get_data_size() const;
virtual void unload() { }
};