mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
whee fun
This commit is contained in:
parent
83aaafe343
commit
189894e7a1
@ -129,6 +129,12 @@ void GuiBackground::set_priority(GuiItem* it, const GuiItem::Priority p) {
|
|||||||
GuiItem::set_priority(it, p);
|
GuiItem::set_priority(it, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiBackground::set_draw_order(int v) {
|
||||||
|
int o = _bg->set_draw_order(v);
|
||||||
|
o = _item->set_draw_order(o);
|
||||||
|
return GuiItem::set_draw_order(o);
|
||||||
|
}
|
||||||
|
|
||||||
void GuiBackground::output(ostream& os) const {
|
void GuiBackground::output(ostream& os) const {
|
||||||
GuiItem::output(os);
|
GuiItem::output(os);
|
||||||
os << " Background data:" << endl;
|
os << " Background data:" << endl;
|
||||||
|
@ -39,6 +39,8 @@ PUBLISHED:
|
|||||||
INLINE void set_color(const Colorf&);
|
INLINE void set_color(const Colorf&);
|
||||||
INLINE Colorf get_color(void) const;
|
INLINE Colorf get_color(void) const;
|
||||||
|
|
||||||
|
virtual int set_draw_order(int);
|
||||||
|
|
||||||
virtual void output(ostream&) const;
|
virtual void output(ostream&) const;
|
||||||
|
|
||||||
INLINE void reassert(void);
|
INLINE void reassert(void);
|
||||||
|
@ -277,47 +277,29 @@ void GuiButton::recompute_frame(void) {
|
|||||||
_down_rollover->recompute();
|
_down_rollover->recompute();
|
||||||
if (_inactive != (GuiLabel*)0L)
|
if (_inactive != (GuiLabel*)0L)
|
||||||
_inactive->recompute();
|
_inactive->recompute();
|
||||||
GetExtents(_up, _down, _up_rollover, _down_rollover, _inactive, _left,
|
this->adjust_region();
|
||||||
_right, _bottom, _top);
|
|
||||||
if (_alt_root.is_null()) {
|
|
||||||
// adjust for graph transform
|
|
||||||
LVector3f sc = this->get_graph_scale();
|
|
||||||
LPoint3f p = this->get_graph_pos();
|
|
||||||
float x = sc.dot(LVector3f::rfu(1., 0., 0.));
|
|
||||||
_left *= x;
|
|
||||||
_right *= x;
|
|
||||||
float y = sc.dot(LVector3f::rfu(0., 0., 1.));
|
|
||||||
_bottom *= y;
|
|
||||||
_top *= y;
|
|
||||||
x = p.dot(LVector3f::rfu(1., 0., 0.));
|
|
||||||
_left += x;
|
|
||||||
_right += y;
|
|
||||||
y = p.dot(LVector3f::rfu(0., 0., 1.));
|
|
||||||
_bottom += y;
|
|
||||||
_top += y;
|
|
||||||
}
|
|
||||||
_rgn->set_region(_left, _right, _bottom, _top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiButton::adjust_region(void) {
|
void GuiButton::adjust_region(void) {
|
||||||
GetExtents(_up, _down, _up_rollover, _down_rollover, _inactive, _left,
|
GetExtents(_up, _down, _up_rollover, _down_rollover, _inactive, _left,
|
||||||
_right, _bottom, _top);
|
_right, _bottom, _top);
|
||||||
|
gui_cat->debug() << "in adjust_region, base values (" << _left << ", "
|
||||||
|
<< _right << ", " << _bottom << ", " << _top << ")" << endl;
|
||||||
if (_alt_root.is_null()) {
|
if (_alt_root.is_null()) {
|
||||||
// adjust for graph transform
|
// adjust for graph transform
|
||||||
LVector3f sc = this->get_graph_scale();
|
LMatrix4f m;
|
||||||
LPoint3f p = this->get_graph_pos();
|
this->get_graph_mat(m);
|
||||||
float x = sc.dot(LVector3f::rfu(1., 0., 0.));
|
LVector3f ul = LVector3f::rfu(_left, 0., _top);
|
||||||
_left *= x;
|
LVector3f lr = LVector3f::rfu(_right, 0., _bottom);
|
||||||
_right *= x;
|
ul = m * ul;
|
||||||
float y = sc.dot(LVector3f::rfu(0., 0., 1.));
|
lr = m * lr;
|
||||||
_bottom *= y;
|
_left = ul.dot(LVector3f::rfu(1., 0., 0.));
|
||||||
_top *= y;
|
_top = ul.dot(LVector3f::rfu(0., 0., 1.));
|
||||||
x = p.dot(LVector3f::rfu(1., 0., 0.));
|
_right = lr.dot(LVector3f::rfu(1., 0., 0.));
|
||||||
_left += x;
|
_bottom = lr.dot(LVector3f::rfu(0., 0., 1.));
|
||||||
_right += y;
|
gui_cat->debug() << "childed to non-default node, current values ("
|
||||||
y = p.dot(LVector3f::rfu(0., 0., 1.));
|
<< _left << ", " << _right << ", " << _bottom << ", "
|
||||||
_bottom += y;
|
<< _top << ")" << endl;
|
||||||
_top += y;
|
|
||||||
}
|
}
|
||||||
_rgn->set_region(_left, _right, _bottom, _top);
|
_rgn->set_region(_left, _right, _bottom, _top);
|
||||||
}
|
}
|
||||||
@ -645,6 +627,18 @@ void GuiButton::set_priority(GuiItem* i, const GuiItem::Priority p) {
|
|||||||
GuiBehavior::set_priority(i, p);
|
GuiBehavior::set_priority(i, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiButton::set_draw_order(int v) {
|
||||||
|
int o = _up->set_draw_order(v);
|
||||||
|
o = _down->set_draw_order(o);
|
||||||
|
if (_up_rollover != (GuiLabel*)0L)
|
||||||
|
o = _up_rollover->set_draw_order(o);
|
||||||
|
if (_down_rollover != (GuiLabel*)0L)
|
||||||
|
o = _down_rollover->set_draw_order(o);
|
||||||
|
if (_inactive != (GuiLabel*)0L)
|
||||||
|
o = _inactive->set_draw_order(o);
|
||||||
|
return GuiBehavior::set_draw_order(o);
|
||||||
|
}
|
||||||
|
|
||||||
void GuiButton::output(ostream& os) const {
|
void GuiButton::output(ostream& os) const {
|
||||||
GuiBehavior::output(os);
|
GuiBehavior::output(os);
|
||||||
os << " Button data:" << endl;
|
os << " Button data:" << endl;
|
||||||
|
@ -101,6 +101,8 @@ PUBLISHED:
|
|||||||
virtual void stop_behavior(void);
|
virtual void stop_behavior(void);
|
||||||
virtual void reset_behavior(void);
|
virtual void reset_behavior(void);
|
||||||
|
|
||||||
|
virtual int set_draw_order(int);
|
||||||
|
|
||||||
virtual void output(ostream&) const;
|
virtual void output(ostream&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -316,6 +316,14 @@ void GuiChooser::set_priority(GuiItem* it, const GuiItem::Priority p) {
|
|||||||
_next_button->set_priority(it, p);
|
_next_button->set_priority(it, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiChooser::set_draw_order(int v) {
|
||||||
|
int o = _prev_button->set_draw_order(v);
|
||||||
|
o = _next_button->set_draw_order(o);
|
||||||
|
for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i)
|
||||||
|
o = (*i)->set_draw_order(o);
|
||||||
|
return GuiBehavior::set_draw_order(o);
|
||||||
|
}
|
||||||
|
|
||||||
void GuiChooser::output(ostream& os) const {
|
void GuiChooser::output(ostream& os) const {
|
||||||
GuiBehavior::output(os);
|
GuiBehavior::output(os);
|
||||||
os << " Chooser data:" << endl;
|
os << " Chooser data:" << endl;
|
||||||
|
@ -68,6 +68,8 @@ PUBLISHED:
|
|||||||
virtual void stop_behavior(void);
|
virtual void stop_behavior(void);
|
||||||
virtual void reset_behavior(void);
|
virtual void reset_behavior(void);
|
||||||
|
|
||||||
|
virtual int set_draw_order(int);
|
||||||
|
|
||||||
virtual void output(ostream&) const;
|
virtual void output(ostream&) const;
|
||||||
|
|
||||||
INLINE void set_loop(bool);
|
INLINE void set_loop(bool);
|
||||||
|
@ -131,6 +131,18 @@ void GuiCollection::set_priority(GuiItem* it, const GuiItem::Priority p) {
|
|||||||
(*i)->set_priority(it, p);
|
(*i)->set_priority(it, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiCollection::set_draw_order(int v) {
|
||||||
|
bool first = true;
|
||||||
|
int o;
|
||||||
|
for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
o = (*i)->set_draw_order(v);
|
||||||
|
} else
|
||||||
|
o = (*i)->set_draw_order(o);
|
||||||
|
return GuiItem::set_draw_order(o);
|
||||||
|
}
|
||||||
|
|
||||||
void GuiCollection::output(ostream& os) const {
|
void GuiCollection::output(ostream& os) const {
|
||||||
GuiItem::output(os);
|
GuiItem::output(os);
|
||||||
os << " Collection data:" << endl;
|
os << " Collection data:" << endl;
|
||||||
|
@ -38,6 +38,8 @@ PUBLISHED:
|
|||||||
virtual void set_priority(GuiLabel*, const Priority);
|
virtual void set_priority(GuiLabel*, const Priority);
|
||||||
virtual void set_priority(GuiItem*, const Priority);
|
virtual void set_priority(GuiItem*, const Priority);
|
||||||
|
|
||||||
|
virtual int set_draw_order(int);
|
||||||
|
|
||||||
virtual void output(ostream&) const;
|
virtual void output(ostream&) const;
|
||||||
public:
|
public:
|
||||||
// type interface
|
// type interface
|
||||||
|
@ -382,6 +382,18 @@ void GuiFrame::set_priority(GuiItem* it, const GuiItem::Priority p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiFrame::set_draw_order(int v) {
|
||||||
|
int o;
|
||||||
|
bool first = true;
|
||||||
|
for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
o = (*i).get_item()->set_draw_order(v);
|
||||||
|
} else
|
||||||
|
o = (*i).get_item()->set_draw_order(o);
|
||||||
|
return GuiItem::set_draw_order(o);
|
||||||
|
}
|
||||||
|
|
||||||
void GuiFrame::output(ostream& os) const {
|
void GuiFrame::output(ostream& os) const {
|
||||||
GuiItem::output(os);
|
GuiItem::output(os);
|
||||||
os << " Frame data:" << endl;
|
os << " Frame data:" << endl;
|
||||||
|
@ -124,6 +124,8 @@ PUBLISHED:
|
|||||||
virtual void set_priority(GuiLabel*, const Priority);
|
virtual void set_priority(GuiLabel*, const Priority);
|
||||||
virtual void set_priority(GuiItem*, const Priority);
|
virtual void set_priority(GuiItem*, const Priority);
|
||||||
|
|
||||||
|
virtual int set_draw_order(int);
|
||||||
|
|
||||||
virtual void output(ostream&) const;
|
virtual void output(ostream&) const;
|
||||||
public:
|
public:
|
||||||
// type interface
|
// type interface
|
||||||
|
@ -10,18 +10,13 @@ INLINE GuiItem::GuiItem(void) : Namable("fubar"), _scale(1.), _scale_x(1.),
|
|||||||
|
|
||||||
#include <get_rel_pos.h>
|
#include <get_rel_pos.h>
|
||||||
|
|
||||||
INLINE LVector3f GuiItem::get_graph_scale(void) {
|
INLINE void GuiItem::get_graph_mat(LMatrix4f& m) {
|
||||||
if (_alt_root.is_null())
|
if (_alt_root.is_null()) {
|
||||||
return LVector3f(1., 1., 1.);
|
m = LMatrix4f::ident_mat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// pass NULL for the 'to' to go to root
|
// pass NULL for the 'to' to go to root
|
||||||
return get_rel_scale(_alt_root, (Node*)0L);
|
get_rel_mat(_alt_root, (Node*)0L, m);
|
||||||
}
|
|
||||||
|
|
||||||
INLINE LPoint3f GuiItem::get_graph_pos(void) {
|
|
||||||
if (_alt_root.is_null())
|
|
||||||
return LPoint3f(0., 0., 0.);
|
|
||||||
// pass NULL for the 'to' to go to root
|
|
||||||
return get_rel_pos(_alt_root, (Node*)0L);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE float GuiItem::get_scale(void) const {
|
INLINE float GuiItem::get_scale(void) const {
|
||||||
|
@ -78,6 +78,10 @@ void GuiItem::set_priority(GuiItem* i, const GuiItem::Priority p) {
|
|||||||
_mgr->recompute_priorities();
|
_mgr->recompute_priorities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiItem::set_draw_order(int v) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
void GuiItem::output(ostream& os) const {
|
void GuiItem::output(ostream& os) const {
|
||||||
os << "GuiItem (0x" << (void*)this << ")" << endl;
|
os << "GuiItem (0x" << (void*)this << ")" << endl;
|
||||||
os << " name - '" << get_name() << "'" << endl;
|
os << " name - '" << get_name() << "'" << endl;
|
||||||
|
@ -26,8 +26,7 @@ protected:
|
|||||||
virtual void recompute_frame(void) = 0;
|
virtual void recompute_frame(void) = 0;
|
||||||
virtual void adjust_region(void);
|
virtual void adjust_region(void);
|
||||||
|
|
||||||
INLINE LVector3f get_graph_scale(void);
|
INLINE void get_graph_mat(LMatrix4f&);
|
||||||
INLINE LPoint3f get_graph_pos(void);
|
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
GuiItem(const string&);
|
GuiItem(const string&);
|
||||||
@ -62,6 +61,8 @@ PUBLISHED:
|
|||||||
|
|
||||||
INLINE void recompute(void);
|
INLINE void recompute(void);
|
||||||
|
|
||||||
|
virtual int set_draw_order(int) = 0;
|
||||||
|
|
||||||
virtual void output(ostream&) const = 0;
|
virtual void output(ostream&) const = 0;
|
||||||
public:
|
public:
|
||||||
// type interface
|
// type interface
|
||||||
|
@ -18,7 +18,7 @@ INLINE GuiLabel::GuiLabel(void) : _type(GuiLabel::NONE),
|
|||||||
_have_height(false), _height(0.),
|
_have_height(false), _height(0.),
|
||||||
_mirror_x(false), _mirror_y(false),
|
_mirror_x(false), _mirror_y(false),
|
||||||
_hard_pri(0), _highest_pri(false),
|
_hard_pri(0), _highest_pri(false),
|
||||||
_lowest_pri(false) {
|
_lowest_pri(false), _has_hard_pri(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE Node* GuiLabel::get_geometry(void) const {
|
INLINE Node* GuiLabel::get_geometry(void) const {
|
||||||
@ -39,7 +39,7 @@ INLINE void GuiLabel::set_width(float f) {
|
|||||||
_width = 0.;
|
_width = 0.;
|
||||||
} else {
|
} else {
|
||||||
if (_type == MODEL)
|
if (_type == MODEL)
|
||||||
_width = f / this->get_width();
|
_width = f / this->_model_width;
|
||||||
else
|
else
|
||||||
_width = f;
|
_width = f;
|
||||||
_have_width = true;
|
_have_width = true;
|
||||||
@ -53,7 +53,7 @@ INLINE void GuiLabel::set_height(float f) {
|
|||||||
_height = 0.;
|
_height = 0.;
|
||||||
} else {
|
} else {
|
||||||
if (_type == MODEL)
|
if (_type == MODEL)
|
||||||
_height = f / this->get_height();
|
_height = f / this->_model_height;
|
||||||
else
|
else
|
||||||
_height = f;
|
_height = f;
|
||||||
_have_height = true;
|
_have_height = true;
|
||||||
@ -140,3 +140,7 @@ INLINE void GuiLabel::set_priority(GuiLabel* l, const PriorityType t) {
|
|||||||
else
|
else
|
||||||
this->_priorities[l] = t;
|
this->_priorities[l] = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE bool GuiLabel::has_hard_draw_order(void) const {
|
||||||
|
return _has_hard_pri;
|
||||||
|
}
|
||||||
|
@ -625,6 +625,35 @@ bool GuiLabel::operator<(const GuiLabel& c) const {
|
|||||||
int GuiLabel::set_draw_order(int order) {
|
int GuiLabel::set_draw_order(int order) {
|
||||||
int ret = order+1;
|
int ret = order+1;
|
||||||
this->freeze();
|
this->freeze();
|
||||||
|
_has_hard_pri = true;
|
||||||
|
_hard_pri = order;
|
||||||
|
switch (_type) {
|
||||||
|
case SIMPLE_TEXT:
|
||||||
|
{
|
||||||
|
TextNode* n = DCAST(TextNode, _geom);
|
||||||
|
n->set_bin("fixed");
|
||||||
|
n->set_draw_order(order);
|
||||||
|
ret += 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SIMPLE_TEXTURE:
|
||||||
|
case SIMPLE_CARD:
|
||||||
|
case L_NULL:
|
||||||
|
case MODEL:
|
||||||
|
_arc->set_transition(new GeomBinTransition("fixed", order));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gui_cat->warning() << "trying to set draw order on an unknown label type ("
|
||||||
|
<< (int)_type << ")" << endl;
|
||||||
|
}
|
||||||
|
this->thaw();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GuiLabel::soft_set_draw_order(int order) {
|
||||||
|
int ret = order+1;
|
||||||
|
this->freeze();
|
||||||
|
_has_hard_pri = false;
|
||||||
_hard_pri = order;
|
_hard_pri = order;
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case SIMPLE_TEXT:
|
case SIMPLE_TEXT:
|
||||||
|
@ -52,6 +52,7 @@ private:
|
|||||||
int _hard_pri;
|
int _hard_pri;
|
||||||
bool _highest_pri;
|
bool _highest_pri;
|
||||||
bool _lowest_pri;
|
bool _lowest_pri;
|
||||||
|
bool _has_hard_pri;
|
||||||
|
|
||||||
INLINE Node* get_geometry(void) const;
|
INLINE Node* get_geometry(void) const;
|
||||||
INLINE void set_arc(RenderRelation*);
|
INLINE void set_arc(RenderRelation*);
|
||||||
@ -114,7 +115,9 @@ PUBLISHED:
|
|||||||
// used for the priority system
|
// used for the priority system
|
||||||
bool operator<(const GuiLabel&) const;
|
bool operator<(const GuiLabel&) const;
|
||||||
INLINE void set_priority(GuiLabel*, const PriorityType);
|
INLINE void set_priority(GuiLabel*, const PriorityType);
|
||||||
|
int soft_set_draw_order(int);
|
||||||
int set_draw_order(int);
|
int set_draw_order(int);
|
||||||
|
INLINE bool has_hard_draw_order(void) const;
|
||||||
|
|
||||||
void write(ostream&) const;
|
void write(ostream&) const;
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
INLINE GuiManager::GuiManager(MouseWatcher* w, Node* n) : _next_draw_order(0),
|
INLINE GuiManager::GuiManager(MouseWatcher* w, Node* n) : _start_draw_order(0),
|
||||||
|
_next_draw_order(0),
|
||||||
_root(n),
|
_root(n),
|
||||||
_watcher(w) {
|
_watcher(w) {
|
||||||
}
|
}
|
||||||
@ -21,3 +22,11 @@ INLINE void GuiManager::set_next_draw_order(int v) {
|
|||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
this->_next_draw_order = v;
|
this->_next_draw_order = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INLINE int GuiManager::get_start_draw_order(void) const {
|
||||||
|
return _start_draw_order;
|
||||||
|
}
|
||||||
|
|
||||||
|
INLINE void GuiManager::set_start_draw_order(int v) {
|
||||||
|
this->_start_draw_order = v;
|
||||||
|
}
|
||||||
|
@ -194,9 +194,10 @@ void GuiManager::recompute_priorities(void) {
|
|||||||
_sorts.clear();
|
_sorts.clear();
|
||||||
for (LabelSet::iterator i=_labels.begin(); i!=_labels.end(); ++i)
|
for (LabelSet::iterator i=_labels.begin(); i!=_labels.end(); ++i)
|
||||||
_sorts.insert(*i);
|
_sorts.insert(*i);
|
||||||
int p=0;
|
int p=this->_start_draw_order;
|
||||||
for (SortSet::iterator j=_sorts.begin(); j!=_sorts.end(); ++j) {
|
for (SortSet::iterator j=_sorts.begin(); j!=_sorts.end(); ++j) {
|
||||||
p = (*j)->set_draw_order(p);
|
if (!((*j)->has_hard_draw_order()))
|
||||||
|
p = (*j)->soft_set_draw_order(p);
|
||||||
}
|
}
|
||||||
_next_draw_order = p;
|
_next_draw_order = p;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ private:
|
|||||||
typedef set<GuiLabel*, SortComp> SortSet;
|
typedef set<GuiLabel*, SortComp> SortSet;
|
||||||
SortSet _sorts;
|
SortSet _sorts;
|
||||||
|
|
||||||
|
int _start_draw_order;
|
||||||
int _next_draw_order;
|
int _next_draw_order;
|
||||||
|
|
||||||
Node* _root;
|
Node* _root;
|
||||||
@ -54,6 +55,8 @@ PUBLISHED:
|
|||||||
|
|
||||||
INLINE int get_next_draw_order(void) const;
|
INLINE int get_next_draw_order(void) const;
|
||||||
INLINE void set_next_draw_order(int);
|
INLINE void set_next_draw_order(int);
|
||||||
|
INLINE int get_start_draw_order(void) const;
|
||||||
|
INLINE void set_start_draw_order(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "guiManager.I"
|
#include "guiManager.I"
|
||||||
|
@ -63,45 +63,28 @@ void GuiRollover::recompute_frame(void) {
|
|||||||
GuiItem::recompute_frame();
|
GuiItem::recompute_frame();
|
||||||
_off->recompute();
|
_off->recompute();
|
||||||
_on->recompute();
|
_on->recompute();
|
||||||
GetExtents(_off, _on, _left, _right, _bottom, _top);
|
this->adjust_region();
|
||||||
if (_alt_root.is_null()) {
|
|
||||||
// adjust for graph transform
|
|
||||||
LVector3f sc = this->get_graph_scale();
|
|
||||||
LPoint3f p = this->get_graph_pos();
|
|
||||||
float x = sc.dot(LVector3f::rfu(1., 0., 0.));
|
|
||||||
_left *= x;
|
|
||||||
_right *= x;
|
|
||||||
float y = sc.dot(LVector3f::rfu(0., 0., 1.));
|
|
||||||
_bottom *= y;
|
|
||||||
_top *= y;
|
|
||||||
x = p.dot(LVector3f::rfu(1., 0., 0.));
|
|
||||||
_left += x;
|
|
||||||
_right += y;
|
|
||||||
y = p.dot(LVector3f::rfu(0., 0., 1.));
|
|
||||||
_bottom += y;
|
|
||||||
_top += y;
|
|
||||||
}
|
|
||||||
_rgn->set_region(_left, _right, _bottom, _top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiRollover::adjust_region(void) {
|
void GuiRollover::adjust_region(void) {
|
||||||
GetExtents(_off, _on, _left, _right, _bottom, _top);
|
GetExtents(_off, _on, _left, _right, _bottom, _top);
|
||||||
|
gui_cat->debug() << "in adjust_region, base values (" << _left << ", "
|
||||||
|
<< _right << ", " << _bottom << ", " << _top << ")" << endl;
|
||||||
if (_alt_root.is_null()) {
|
if (_alt_root.is_null()) {
|
||||||
// adjust for graph transform
|
// adjust for graph transform
|
||||||
LVector3f sc = this->get_graph_scale();
|
LMatrix4f m;
|
||||||
LPoint3f p = this->get_graph_pos();
|
this->get_graph_mat(m);
|
||||||
float x = sc.dot(LVector3f::rfu(1., 0., 0.));
|
LVector3f ul = LVector3f::rfu(_left, 0., _top);
|
||||||
_left *= x;
|
LVector3f lr = LVector3f::rfu(_right, 0., _bottom);
|
||||||
_right *= x;
|
ul = m * ul;
|
||||||
float y = sc.dot(LVector3f::rfu(0., 0., 1.));
|
lr = m * lr;
|
||||||
_bottom *= y;
|
_left = ul.dot(LVector3f::rfu(1., 0., 0.));
|
||||||
_top *= y;
|
_top = ul.dot(LVector3f::rfu(0., 0., 1.));
|
||||||
x = p.dot(LVector3f::rfu(1., 0., 0.));
|
_right = lr.dot(LVector3f::rfu(1., 0., 0.));
|
||||||
_left += x;
|
_bottom = lr.dot(LVector3f::rfu(0., 0., 1.));
|
||||||
_right += y;
|
gui_cat->debug() << "childed to non-default node, current values ("
|
||||||
y = p.dot(LVector3f::rfu(0., 0., 1.));
|
<< _left << ", " << _right << ", " << _bottom << ", "
|
||||||
_bottom += y;
|
<< _top << ")" << endl;
|
||||||
_top += y;
|
|
||||||
}
|
}
|
||||||
_rgn->set_region(_left, _right, _bottom, _top);
|
_rgn->set_region(_left, _right, _bottom, _top);
|
||||||
}
|
}
|
||||||
@ -220,6 +203,12 @@ void GuiRollover::set_priority(GuiItem* i, const GuiItem::Priority p) {
|
|||||||
GuiItem::set_priority(i, p);
|
GuiItem::set_priority(i, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiRollover::set_draw_order(int v) {
|
||||||
|
int o = _off->set_draw_order(v);
|
||||||
|
o = _on->set_draw_order(o);
|
||||||
|
return GuiItem::set_draw_order(o);
|
||||||
|
}
|
||||||
|
|
||||||
void GuiRollover::output(ostream& os) const {
|
void GuiRollover::output(ostream& os) const {
|
||||||
GuiItem::output(os);
|
GuiItem::output(os);
|
||||||
os << " Rollover data:" << endl;
|
os << " Rollover data:" << endl;
|
||||||
|
@ -48,6 +48,8 @@ PUBLISHED:
|
|||||||
virtual void set_priority(GuiLabel*, const Priority);
|
virtual void set_priority(GuiLabel*, const Priority);
|
||||||
virtual void set_priority(GuiItem*, const Priority);
|
virtual void set_priority(GuiItem*, const Priority);
|
||||||
|
|
||||||
|
virtual int set_draw_order(int);
|
||||||
|
|
||||||
virtual void output(ostream&) const;
|
virtual void output(ostream&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -94,6 +94,11 @@ void GuiSign::set_priority(GuiItem* i, const GuiItem::Priority p) {
|
|||||||
GuiItem::set_priority(i, p);
|
GuiItem::set_priority(i, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GuiSign::set_draw_order(int v) {
|
||||||
|
int o = _sign->set_draw_order(v);
|
||||||
|
return GuiItem::set_draw_order(o);
|
||||||
|
}
|
||||||
|
|
||||||
void GuiSign::output(ostream& os) const {
|
void GuiSign::output(ostream& os) const {
|
||||||
GuiItem::output(os);
|
GuiItem::output(os);
|
||||||
os << " Sign data:" << endl;
|
os << " Sign data:" << endl;
|
||||||
|
@ -35,6 +35,8 @@ PUBLISHED:
|
|||||||
virtual void set_priority(GuiLabel*, const Priority);
|
virtual void set_priority(GuiLabel*, const Priority);
|
||||||
virtual void set_priority(GuiItem*, const Priority);
|
virtual void set_priority(GuiItem*, const Priority);
|
||||||
|
|
||||||
|
virtual int set_draw_order(int);
|
||||||
|
|
||||||
virtual void output(ostream&) const;
|
virtual void output(ostream&) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user