#include "exhibit.h"
#include "snode.h"
#include "scene.h"
-#include "geomdraw.h"
-#include "app.h"
ExSelection ExSelection::null;
{
}
-void Exhibit::pre_draw() const
-{
- if(node) {
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glMultMatrixf(node->get_matrix()[0]);
- }
-}
-
-void Exhibit::draw() const
-{
-}
-
-void Exhibit::post_draw() const
-{
- if(node) {
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
-
- if(exsel_hover.ex == this) {
- const AABox &bvol = get_aabox();
- draw_geom_object(&bvol);
- }
- }
-}
-
-
const AABox &Exhibit::get_aabox() const
{
aabb = node->get_bounds();
#include "exhibit.h"
#include "blob_exhibit.h"
#include "treestore.h"
+#include "app.h"
+#include "geomdraw.h"
static Exhibit *create_exhibit(const char *type);
void ExhibitManager::clear()
{
- int num = (int)items.size();
- for(int i=0; i<num; i++) {
- delete items[i];
- }
+ // not deleting exhibit objects, as they will be deleted the own_scn destructor
items.clear();
- num = (int)exslots.size();
+ int num = (int)exslots.size();
for(int i=0; i<num; i++) {
delete exslots[i];
}
std::vector<Exhibit*>::iterator it = std::find(items.begin(), items.end(), ex);
if(it == items.end()) {
items.push_back(ex);
+ own_scn->add_object(ex);
+ if(ex->node) own_scn->add_node(ex->node);
}
}
std::vector<Exhibit*>::iterator it = std::find(items.begin(), items.end(), ex);
if(it != items.end()) {
items.erase(it);
+ own_scn->remove_object(ex);
+ if(ex->node) own_scn->remove_node(ex->node);
return true;
}
return false;
return false;
}
- // create our own scene to manage all exhibits not already in an existing scene
- // and add it to the metascene
+ /* create our own scene to manage all exhibits not already in an existing scene
+ * and add it to the metascene.
+ * Also exhibit drawing happens due to the renderer drawing the metascene
+ */
if(!own_scn) {
own_scn = new Scene;
own_scn->name = "ad-hoc exhibits";
}
}
+ // add everything to our data structures
+ // equivalent to add_exhibit(ex), but without all the searching
+ own_scn->add_object(ex);
if(!snode) {
snode = new SceneNode;
snode->set_name(ex->get_name());
own_scn->add_node(snode);
}
ex->set_node(snode);
-
items.push_back(ex);
float *apos = ts_get_attr_vec(node, "pos");
{
int num = items.size();
for(int i=0; i<num; i++) {
- items[i]->pre_draw();
- items[i]->draw();
- items[i]->post_draw();
+ if(exsel_hover.ex == items[i]) {
+ const AABox &bvol = items[i]->get_aabox();
+ draw_geom_object(&bvol);
+ }
}
}