exhibits
[laserbrain_demo] / src / exman.cc
index d93c2ff..28f3700 100644 (file)
@@ -12,6 +12,11 @@ ExhibitManager::ExhibitManager()
 
 ExhibitManager::~ExhibitManager()
 {
+       clear();
+}
+
+void ExhibitManager::clear()
+{
        int num = (int)items.size();
        for(int i=0; i<num; i++) {
                delete items[i];
@@ -56,7 +61,8 @@ bool ExhibitManager::load(MetaScene *mscn, const char *fname)
 
                        const char *amatch = ts_get_attr_str(node, "match_node");
                        if(!amatch || !(snode = mscn->match_node(amatch))) {
-                               error_log("regexp \"%s\" didn't match any nodes\n", amatch ? amatch : "");
+                               error_log("ExhibitManager::load: regexp \"%s\" didn't match any nodes\n",
+                                               amatch ? amatch : "");
                                continue;
                        }
 
@@ -76,6 +82,16 @@ bool ExhibitManager::load(MetaScene *mscn, const char *fname)
        return true;
 }
 
+ExSelection ExhibitManager::select(const Ray &ray) const
+{
+       return ExSelection();   // TODO
+}
+
+ExSelection ExhibitManager::select(const Sphere &sph) const
+{
+       return ExSelection();   // TODO
+}
+
 void ExhibitManager::update(float dt)
 {
        int num = items.size();
@@ -84,11 +100,23 @@ void ExhibitManager::update(float dt)
        }
 }
 
+void ExhibitManager::draw() const
+{
+       int num = items.size();
+       for(int i=0; i<num; i++) {
+               items[i]->pre_draw();
+               items[i]->draw();
+               items[i]->post_draw();
+       }
+}
+
 static Exhibit *create_exhibit(const char *type)
 {
        if(strcmp(type, "static") == 0) {
+               debug_log("creating static exhibit\n");
                return new Exhibit;
        } else if(strcmp(type, "blobs") == 0) {
+               debug_log("creating blobs exhibit\n");
                return new BlobExhibit;
        }
        error_log("unknown exhibit type: %s\n", type);