projects
/
laserbrain_demo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stash/unstash clunky as fuck
[laserbrain_demo]
/
src
/
exman.cc
diff --git
a/src/exman.cc
b/src/exman.cc
index
e5cdd9f
..
4fff917
100644
(file)
--- a/
src/exman.cc
+++ b/
src/exman.cc
@@
-153,6
+153,8
@@
bool ExhibitManager::remove(Exhibit *ex)
bool ExhibitManager::load(MetaScene *mscn, const char *fname)
{
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);
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;
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];
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 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
}
// TODO optimize
@@
-330,6
+334,17
@@
void ExhibitManager::stash_exhibit(Exhibit *ex)
}
}
}
}
+Exhibit *ExhibitManager::unstash_exhibit()
+{
+ if(stashed.empty()) {
+ return 0;
+ }
+
+ Exhibit *ex = stashed[0];
+ stashed.erase(stashed.begin());
+ return ex;
+}
+
void ExhibitManager::update(float dt)
{
int num = items.size();
void ExhibitManager::update(float dt)
{
int num = items.size();