projects
/
laserbrain_demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
exhibits
[laserbrain_demo]
/
src
/
exman.cc
diff --git
a/src/exman.cc
b/src/exman.cc
index
d93c2ff
..
28f3700
100644
(file)
--- a/
src/exman.cc
+++ b/
src/exman.cc
@@
-12,6
+12,11
@@
ExhibitManager::ExhibitManager()
ExhibitManager::~ExhibitManager()
{
ExhibitManager::~ExhibitManager()
{
+ clear();
+}
+
+void ExhibitManager::clear()
+{
int num = (int)items.size();
for(int i=0; i<num; i++) {
delete items[i];
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))) {
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;
}
continue;
}
@@
-76,6
+82,16
@@
bool ExhibitManager::load(MetaScene *mscn, const char *fname)
return true;
}
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();
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) {
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) {
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);
return new BlobExhibit;
}
error_log("unknown exhibit type: %s\n", type);