added delayed init call after scenegraph/meshes are done loading
[laserbrain_demo] / src / exman.cc
index e5cdd9f..00f7e39 100644 (file)
@@ -153,6 +153,8 @@ bool ExhibitManager::remove(Exhibit *ex)
 
 bool ExhibitManager::load(MetaScene *mscn, const char *fname)
 {
+       info_log("ExhibitManager::load(%s)\n", fname);
+
        struct ts_node *root = ts_load(fname);
        if(!root || strcmp(root->name, "exhibits") != 0) {
                ts_free_tree(root);
@@ -243,6 +245,7 @@ bool ExhibitManager::load(MetaScene *mscn, const char *fname)
                        const char *voice = ts_get_attr_str(node, "voiceover");
                        if(desc || voice) {
                                ExData exd;
+                               exd.type = EXDATA_INFO;
 
                                if(desc) {
                                        char *fixed_desc = new char[strlen(desc) + 1];
@@ -285,13 +288,14 @@ ExSelection ExhibitManager::select(const Ray &ray) const
 
 ExSelection ExhibitManager::select(const Sphere &sph) const
 {
-       ExSelection sel;
-       if(!items.empty()) {
-               sel.ex = items[0];
-               sel.selsphere = sph;
-               sel.validmask = EXSEL_SPHERE;
+       int nitems = items.size();
+       for(int i=0; i<nitems; i++) {
+               ExSelection sel = items[i]->select(sph);
+               if(sel) {
+                       return sel;
+               }
        }
-       return sel;     // TODO
+       return ExSelection();
 }
 
 // TODO optimize