X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fexman.h;h=df3d8bd9e4cfae057fbcb18129b38085c0d0791d;hp=4a72993ee8ef8c6f1a81bd0eac824091087d2695;hb=332f9dce52862e39afabd50bdce9691de7986921;hpb=b75b6703809abf0dc02f2e557ba73e9efbefa4d1 diff --git a/src/exman.h b/src/exman.h index 4a72993..df3d8bd 100644 --- a/src/exman.h +++ b/src/exman.h @@ -5,9 +5,40 @@ #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 items; + std::vector items, 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(); @@ -23,6 +54,10 @@ 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); + void update(float dt = 0.0f); void draw() const; };