X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fexman.h;h=13d9bcc0818e9a8c9bfbd1c20bae547875f665ee;hp=d91e3744cbd47f059748121262f03281b65f6078;hb=5c69b226e45df981db338dd859ef1d95e9be8f96;hpb=35c329e4b66fc60622080be1b9ff30148a7e74e4 diff --git a/src/exman.h b/src/exman.h index d91e374..13d9bcc 100644 --- a/src/exman.h +++ b/src/exman.h @@ -5,14 +5,49 @@ #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: + Quat rotation, grab_rot; + 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 items; + std::vector items, stashed; + int cur_stashed; + std::vector exslots; + // TODO kdtree of slots for quick nearest queries + + Scene *own_scn; // scene to manage all exhibits not taken from an existing scene public: ExhibitManager(); ~ExhibitManager(); + void clear(); + void add(Exhibit *ex); bool remove(Exhibit *ex); @@ -21,7 +56,13 @@ public: 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); + Exhibit *unstash_exhibit(); + void update(float dt = 0.0f); + void draw() const; }; #endif // EXMAN_H_