ExhibitSlots and exhibit placement (initial)
[laserbrain_demo] / src / exman.h
index 5c627e6..bbd72fd 100644 (file)
@@ -5,18 +5,59 @@
 #include "exhibit.h"
 #include "metascene.h"
 
+//! argument to ExhibitSlot::attach
+enum ExSlotAttachMode {
+       EXSLOT_ATTACH_PERMANENT,
+       EXSLOT_ATTACH_TRANSIENT
+};
+
+//! slot which can hold a single exhibit
+class ExhibitSlot {
+private:
+       Exhibit *ex;
+
+public:
+       SceneNode node;
+
+       ExhibitSlot(Exhibit *ex = 0);
+       ~ExhibitSlot();
+
+       void init(Exhibit *ex);
+
+       bool empty() const;
+       Exhibit *get_exhibit() const;
+
+       bool attach_exhibit(Exhibit *ex, ExSlotAttachMode mode = EXSLOT_ATTACH_PERMANENT);
+       bool detach_exhibit();
+};
+
+
 class ExhibitManager {
 private:
-       std::vector<Exhibit*> items;
+       std::vector<Exhibit*> items, stashed;
+       std::vector<ExhibitSlot*> exslots;
+       // TODO kdtree of slots for quick nearest queries
 
 public:
        ExhibitManager();
        ~ExhibitManager();
 
-       bool load(const MetaScene *mscn, const char *fname);
+       void clear();
+
+       void add(Exhibit *ex);
+       bool remove(Exhibit *ex);
+
+       bool load(MetaScene *mscn, const char *fname);
 
        ExSelection select(const Ray &ray) const;
        ExSelection select(const Sphere &sph) const;
+
+       ExhibitSlot *nearest_empty_slot(const Vec3 &pos, float max_dist = 10) const;
+
+       void stash_exhibit(Exhibit *ex);
+
+       void update(float dt = 0.0f);
+       void draw() const;
 };
 
 #endif // EXMAN_H_