X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fobject.cpp;h=f2d1f8bf74a9781c64d829e2f7950513296dbae1;hb=927a1aa0a3a27e463ec0efc08bd08e7c4e969909;hp=d5d5231bab47dbdd9358a489ea975841298c4a87;hpb=e759062876ee7fc81d1c2f40818d5bf97898d53d;p=libs%2Fgl.git diff --git a/source/object.cpp b/source/object.cpp index d5d5231b..f2d1f8bf 100644 --- a/source/object.cpp +++ b/source/object.cpp @@ -5,6 +5,7 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ +#include #include #include "except.h" #include "material.h" @@ -124,8 +125,7 @@ void Object::render_instance(const ObjectInstance &inst, const Tag &tag) const Object::Loader::Loader(Object &o, Collection &c): - obj(o), - coll(c) + DataFile::CollectionObjectLoader(o, &c) { add("lod_mesh", &Loader::lod_mesh); add("material", &Object::material); @@ -154,20 +154,20 @@ void Object::Loader::finish() void Object::Loader::lod_mesh(unsigned l, const string &n) { obj.meshes.resize(l+1, 0); - obj.meshes[l]=coll.get(n); + obj.meshes[l]=coll->get(n); } void Object::Loader::material_inline() { RefPtr mat=new Material; load_sub(*mat); - coll.add(format("_%p", mat.get()), mat.get()); + coll->add(format("_%p", mat.get()), mat.get()); obj.material=mat.release(); } void Object::Loader::mesh(const string &n) { - obj.meshes[0]=coll.get(n); + obj.meshes[0]=coll->get(n); } void Object::Loader::shader_texture(const string &n) @@ -179,12 +179,12 @@ void Object::Loader::shader_texture(const string &n) if(eqsign==string::npos) throw InvalidParameterValue("Must specify texture slot name"); - obj.textures[obj.technique->get_texture_index(n.substr(0, eqsign))]=coll.get(n.substr(eqsign+1)); + obj.textures[obj.technique->get_texture_index(n.substr(0, eqsign))]=coll->get(n.substr(eqsign+1)); } void Object::Loader::technique(const string &n) { - obj.technique=coll.get(n); + obj.technique=coll->get(n); obj.textures.resize(obj.technique->get_n_textures()); obj.material=obj.technique->get_material(); } @@ -194,7 +194,7 @@ void Object::Loader::texture(const string &n) if(obj.main_texture) throw Exception("Only one main texture may be specified"); - Texture *tex=coll.get(n); + Texture *tex=coll->get(n); if(obj.technique) obj.textures[obj.technique->get_texture_index("texture")]=tex; obj.main_texture=tex;