void Font::Loader::texture_ref(const string &name)
{
- obj.texture = get_collection().get<Texture2D>(name);
+ obj.texture = &get_collection().get<Texture2D>(name);
obj.texture.keep();
}
void Object::Loader::init()
{
- allow_pointer_reload = false;
-
add("mesh", &Loader::mesh_inline);
add("mesh", &Loader::mesh_inline_lod);
add("mesh", &Loader::mesh);
void Object::Loader::mesh(const std::string &n)
{
- obj.set_mesh(get_collection().get<Mesh>(n));
+ obj.set_mesh(&get_collection().get<Mesh>(n));
}
void Object::Loader::mesh_lod(unsigned l, const string &n)
{
- obj.set_mesh(l, get_collection().get<Mesh>(n));
+ obj.set_mesh(l, &get_collection().get<Mesh>(n));
}
void Object::Loader::technique_inline()
void Object::Loader::technique(const std::string &n)
{
- obj.set_technique(get_collection().get<Technique>(n));
+ obj.set_technique(&get_collection().get<Technique>(n));
}
} // namespace GL
-#include <msp/core/refptr.h>
#include <msp/datafile/collection.h>
#include <msp/strings/format.h>
#include "error.h"
void RenderPass::Loader::init()
{
- allow_pointer_reload = false;
-
add("shader", &RenderPass::shprog);
add("material", &Loader::material_inline);
add("material", &Loader::material);
void RenderPass::Loader::material(const string &name)
{
- obj.material = get_collection().get<Material>(name);
+ obj.material = &get_collection().get<Material>(name);
obj.material.keep();
}
void RenderPass::TextureLoader::texture(const string &name)
{
- tex = get_collection().get<Texture>(name);
+ tex = &get_collection().get<Texture>(name);
tex.keep();
}
void Technique::Loader::inherit(const string &n)
{
- obj.passes = get_collection().get<Technique>(n)->get_passes();
+ obj.passes = get_collection().get<Technique>(n).get_passes();
InheritLoader ldr(obj, get_collection());
load_sub_with(ldr);
}
void Technique::InheritLoader::texture(const std::string &slot, const string &name)
{
- Texture *tex = get_collection().get<Texture>(name);
+ Texture &tex = get_collection().get<Texture>(name);
for(PassMap::iterator i=obj.passes.begin(); i!=obj.passes.end(); ++i)
{
int index = i->second.get_texture_index(slot);
if(index<0)
continue;
- i->second.set_texture(index, tex);
+ i->second.set_texture(index, &tex);
}
}