moving the first exhibit, no picking yet
[laserbrain_demo] / src / exman.cc
index 28f3700..900d860 100644 (file)
@@ -84,18 +84,35 @@ bool ExhibitManager::load(MetaScene *mscn, const char *fname)
 
 ExSelection ExhibitManager::select(const Ray &ray) const
 {
-       return ExSelection();   // TODO
+       ExSelection sel;
+       if(!items.empty()) {
+               sel.ex = items[0];
+               sel.selray = ray;
+               sel.validmask = EXSEL_RAY;
+       }
+       return sel;     // TODO
 }
 
 ExSelection ExhibitManager::select(const Sphere &sph) const
 {
-       return ExSelection();   // TODO
+       ExSelection sel;
+       if(!items.empty()) {
+               sel.ex = items[0];
+               sel.selsphere = sph;
+               sel.validmask = EXSEL_SPHERE;
+       }
+       return sel;     // TODO
 }
 
 void ExhibitManager::update(float dt)
 {
        int num = items.size();
        for(int i=0; i<num; i++) {
+               // if the exhibit is not part of a scene graph, first call its
+               // node's update function (otherwise it'll have been called recursively earlier)
+               if(!items[i]->node->get_parent()) {
+                       items[i]->node->update(dt);
+               }
                items[i]->update(dt);
        }
 }