Scene::~Scene()
{
- for(list<Renderable *>::iterator i=owned_data.begin(); i!=owned_data.end(); ++i)
+ for(vector<Renderable *>::iterator i=owned_data.begin(); i!=owned_data.end(); ++i)
delete *i;
}
frustum_edges[0] = Vector4(0, 1/s, y/s, 0);
frustum_edges[1] = Vector4(0, -1/s, y/s, 0);
- float x = y*camera->get_aspect();
+ float x = y*camera->get_aspect_ratio();
s = sqrt(x*x+1);
frustum_edges[2] = Vector4(1/s, 0, x/s, 0);
frustum_edges[3] = Vector4(-1/s, 0, x/s, 0);
Scene::Loader::Loader(Scene &s, Collection &c):
- DataFile::CollectionObjectLoader<Scene>(s, &c)
+ DataFile::CollectionObjectLoader<Scene>(s, &c),
+ content(0)
+{
+ init();
+}
+
+Scene::Loader::Loader(Scene &s, Collection &c, ContentMap &m):
+ DataFile::CollectionObjectLoader<Scene>(s, &c),
+ content(&m)
+{
+ init();
+}
+
+void Scene::Loader::init()
{
add("object", &Loader::object);
+ add("object", &Loader::object_tagged);
}
void Scene::Loader::object(const string &n)
+{
+ object_tagged(n, string());
+}
+
+void Scene::Loader::object_tagged(const string &n, const string &t)
{
RefPtr<AnimatedObject> anob = new AnimatedObject(get_collection().get<GL::Object>(n));
load_sub(*anob);
obj.add(*anob);
+ if(content && !t.empty())
+ (*content)[t] = anob.get();
obj.owned_data.push_back(anob.release());
}