diff --git a/panda/src/gui/guiItem.I b/panda/src/gui/guiItem.I index 712a94d475..e34c06e527 100644 --- a/panda/src/gui/guiItem.I +++ b/panda/src/gui/guiItem.I @@ -4,7 +4,24 @@ //////////////////////////////////////////////////////////////////// INLINE GuiItem::GuiItem(void) : Namable("fubar"), _left(-1.), _right(1.), - _bottom(-1.), _top(1.) {} + _bottom(-1.), _top(1.), _pri(P_Normal) {} + +INLINE void GuiItem::set_priority(const GuiItem::Priority p) { + _pri = p; + float r = _pos.dot(LVector3f::rfu(1., 0., 0.)); + float u = _pos.dot(LVector3f::rfu(0., 0., 1.)); + switch (_pri) { + case P_Low: + this->set_pos(LVector3f::rfu(r, 0.5, u)); + break; + case P_Normal: + this->set_pos(LVector3f::rfu(r, 0., u)); + break; + case P_High: + this->set_pos(LVector3f::rfu(r, -0.5, u)); + break; + } +} INLINE float GuiItem::get_scale(void) const { return _scale; @@ -34,6 +51,10 @@ INLINE LVector4f GuiItem::get_frame(void) const { return LVector4f(_left, _right, _bottom, _top); } +INLINE GuiItem::Priority GuiItem::get_priority(void) const { + return _pri; +} + INLINE void GuiItem::recompute(void) { this->recompute_frame(); } diff --git a/panda/src/gui/guiItem.cxx b/panda/src/gui/guiItem.cxx index e4489d9703..7db6bd1eac 100644 --- a/panda/src/gui/guiItem.cxx +++ b/panda/src/gui/guiItem.cxx @@ -15,7 +15,7 @@ GuiItem::GuiItem(const string& name) : Namable(name), _added_hooks(false), _scale(1.), _left(-1.), _right(1.), _bottom(-1.), _top(1.), _pos(0., 0., 0.), - _mgr((GuiManager*)0L) { + _mgr((GuiManager*)0L), _pri(P_Normal) { } GuiItem::~GuiItem(void) { diff --git a/panda/src/gui/guiItem.h b/panda/src/gui/guiItem.h index d0a51a38fc..9a5585d817 100644 --- a/panda/src/gui/guiItem.h +++ b/panda/src/gui/guiItem.h @@ -11,11 +11,15 @@ #include class EXPCL_PANDA GuiItem : public TypedReferenceCount, public Namable { +PUBLISHED: + enum Priority { P_Low, P_Normal, P_High }; + protected: bool _added_hooks; float _scale, _left, _right, _bottom, _top; LVector3f _pos; GuiManager* _mgr; + Priority _pri; INLINE GuiItem(void); virtual void recompute_frame(void) = 0; @@ -29,6 +33,7 @@ PUBLISHED: virtual void set_scale(float) = 0; virtual void set_pos(const LVector3f&) = 0; + INLINE void set_priority(const Priority); INLINE float get_scale(void) const; INLINE LVector3f get_pos(void) const; @@ -37,6 +42,7 @@ PUBLISHED: INLINE float get_bottom(void) const; INLINE float get_top(void) const; INLINE LVector4f get_frame(void) const; + INLINE Priority get_priority(void) const; INLINE void recompute(void); diff --git a/panda/src/testbed/deadrec_rec.cxx b/panda/src/testbed/deadrec_rec.cxx index 8429265de4..992c97db40 100644 --- a/panda/src/testbed/deadrec_rec.cxx +++ b/panda/src/testbed/deadrec_rec.cxx @@ -443,14 +443,14 @@ inline static void predict_linear(void) { B_time = telemetry_time; V = B - A; V *= 1. / (B_time - A_time); - // time = 0.; + time = 0.; } else { // is between our two samples A = telemetry_pos; A_time = telemetry_time; V = B - A; V *= 1. / (B_time - A_time); - // time = 0.; + time = 0.; } } if (time <= 0.) {