rapture
This commit is contained in:
parent
3dbb4bd24a
commit
5ad35d82e7
|
|
@ -16,6 +16,7 @@ void GuiBackground::recompute_frame(void) {
|
|||
(_item->get_bottom() + _item->get_top())*0.5));
|
||||
_bg->recompute();
|
||||
GuiItem::recompute_frame();
|
||||
this->adjust_region();
|
||||
}
|
||||
|
||||
void GuiBackground::set_priority(GuiLabel* l, const GuiItem::Priority p) {
|
||||
|
|
|
|||
|
|
@ -283,24 +283,7 @@ void GuiButton::recompute_frame(void) {
|
|||
void GuiButton::adjust_region(void) {
|
||||
GetExtents(_up, _down, _up_rollover, _down_rollover, _inactive, _left,
|
||||
_right, _bottom, _top);
|
||||
gui_cat->debug() << "in adjust_region, base values (" << _left << ", "
|
||||
<< _right << ", " << _bottom << ", " << _top << ")" << endl;
|
||||
if (!(_alt_root.is_null())) {
|
||||
// adjust for graph transform
|
||||
LMatrix4f m;
|
||||
this->get_graph_mat(m);
|
||||
LPoint3f ul = LVector3f::rfu(_left, 0., _top);
|
||||
LPoint3f lr = LVector3f::rfu(_right, 0., _bottom);
|
||||
ul = m * ul;
|
||||
lr = m * lr;
|
||||
_left = ul.dot(LVector3f::rfu(1., 0., 0.));
|
||||
_top = ul.dot(LVector3f::rfu(0., 0., 1.));
|
||||
_right = lr.dot(LVector3f::rfu(1., 0., 0.));
|
||||
_bottom = lr.dot(LVector3f::rfu(0., 0., 1.));
|
||||
gui_cat->debug() << "childed to non-default node, current values ("
|
||||
<< _left << ", " << _right << ", " << _bottom << ", "
|
||||
<< _top << ")" << endl;
|
||||
}
|
||||
GuiBehavior::adjust_region();
|
||||
_rgn->set_region(_left, _right, _bottom, _top);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ void GuiChooser::recompute_frame(void) {
|
|||
_top = t;
|
||||
|
||||
GuiBehavior::recompute_frame();
|
||||
this->adjust_region();
|
||||
}
|
||||
|
||||
void GuiChooser::set_priority(GuiLabel* l, GuiItem::Priority p) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ void GuiCollection::recompute_frame(void) {
|
|||
for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
|
||||
(*i)->recompute();
|
||||
|
||||
this->adjust_region();
|
||||
thaw();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -207,6 +207,7 @@ void GuiFrame::recompute_frame(void) {
|
|||
_top = (_top<tmp)?tmp:_top;
|
||||
}
|
||||
|
||||
this->adjust_region();
|
||||
thaw();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,24 @@ void GuiItem::recompute_frame(void) {
|
|||
|
||||
void GuiItem::adjust_region(void) {
|
||||
test_ref_count_integrity();
|
||||
gui_cat->debug() << "in adjust_region, base values (" << _left << ", "
|
||||
<< _right << ", " << _bottom << ", " << _top << ")" << endl;
|
||||
if (!(_alt_root.is_null())) {
|
||||
// adjust for graph transform
|
||||
LMatrix4f m;
|
||||
this->get_graph_mat(m);
|
||||
LPoint3f ul = LVector3f::rfu(_left, 0., _top);
|
||||
LPoint3f lr = LVector3f::rfu(_right, 0., _bottom);
|
||||
ul = m * ul;
|
||||
lr = m * lr;
|
||||
_left = ul.dot(LVector3f::rfu(1., 0., 0.));
|
||||
_top = ul.dot(LVector3f::rfu(0., 0., 1.));
|
||||
_right = lr.dot(LVector3f::rfu(1., 0., 0.));
|
||||
_bottom = lr.dot(LVector3f::rfu(0., 0., 1.));
|
||||
gui_cat->debug() << "childed to non-default node, current values ("
|
||||
<< _left << ", " << _right << ", " << _bottom << ", "
|
||||
<< _top << ")" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void GuiItem::set_priority(GuiLabel*, const GuiItem::Priority) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ INLINE GuiLabel::GuiLabel(void) : _type(GuiLabel::NONE),
|
|||
_model_height(1.), _scale(1.),
|
||||
_scale_x(1.), _scale_y(1.), _scale_z(1.),
|
||||
_pos(0., 0., 0.),
|
||||
_model_pos(0., 0., 0.),
|
||||
_have_foreground(false),
|
||||
_foreground(1., 1., 1., 1.),
|
||||
_have_background(false),
|
||||
_background(0., 0., 0., 0.),
|
||||
|
|
@ -108,6 +110,7 @@ INLINE LVector3f GuiLabel::get_pos(void) const {
|
|||
|
||||
INLINE void GuiLabel::set_foreground_color(float r, float g, float b,
|
||||
float a) {
|
||||
this->_have_foreground = true;
|
||||
this->set_foreground_color(Colorf(r, g, b, a));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void GuiLabel::recompute_transform(void) {
|
|||
LMatrix4f::scale_mat(LVector3f::rfu(w, 1., h)) *
|
||||
LMatrix4f::scale_mat(LVector3f::rfu((_mirror_x?-1.:1.), 1.,
|
||||
(_mirror_y?-1.:1.))) *
|
||||
LMatrix4f::translate_mat(_pos);
|
||||
LMatrix4f::translate_mat(_pos + _model_pos);
|
||||
_internal->set_transition(new TransformTransition(mat));
|
||||
}
|
||||
break;
|
||||
|
|
@ -63,7 +63,8 @@ void GuiLabel::set_properties(void) {
|
|||
case SIMPLE_TEXT:
|
||||
{
|
||||
TextNode* n = DCAST(TextNode, _geom);
|
||||
n->set_text_color(_foreground);
|
||||
if (_have_foreground)
|
||||
n->set_text_color(_foreground);
|
||||
n->clear_card();
|
||||
if ((_have_background) || (_tex == (Texture*)0L)) {
|
||||
if (_have_background)
|
||||
|
|
@ -108,10 +109,19 @@ void GuiLabel::set_properties(void) {
|
|||
case SIMPLE_TEXTURE:
|
||||
case MODEL:
|
||||
case L_NULL:
|
||||
_internal->set_transition(new ColorTransition(_foreground));
|
||||
if (_have_foreground)
|
||||
_internal->set_transition(new ColorTransition(_foreground));
|
||||
break;
|
||||
case SIMPLE_CARD:
|
||||
_internal->set_transition(new ColorTransition(_foreground));
|
||||
if (_have_foreground) {
|
||||
_internal->set_transition(new ColorTransition(_foreground));
|
||||
TransparencyProperty::Mode mode;
|
||||
if (_foreground[3] != 1.)
|
||||
mode = TransparencyProperty::M_alpha;
|
||||
else
|
||||
mode = TransparencyProperty::M_none;
|
||||
_internal->set_transition(new TransparencyTransition(mode));
|
||||
}
|
||||
{
|
||||
float w, h;
|
||||
w = _have_width?(_width * 0.5):0.5;
|
||||
|
|
@ -258,8 +268,23 @@ GuiLabel* GuiLabel::make_model_label(Node* geom, float w, float h) {
|
|||
ret->_model_width = w;
|
||||
ret->_model_height = h;
|
||||
ret->_internal = new RenderRelation(ret->_geom, geom);
|
||||
ret->_internal->set_transition(
|
||||
new ColorTransition(Colorf(ret->_foreground)));
|
||||
gui_cat->debug() << "created model label 0x" << (void*)ret
|
||||
<< " from node 0x" << (void*)geom
|
||||
<< ", set _type(" << (int)(ret->_type) << ") to MODEL("
|
||||
<< (int)MODEL << ")" << endl;
|
||||
return ret;
|
||||
}
|
||||
|
||||
GuiLabel* GuiLabel::make_model_label(Node* geom, float left, float right,
|
||||
float bottom, float top) {
|
||||
GuiLabel* ret = new GuiLabel();
|
||||
ret->_type = MODEL;
|
||||
ret->_geom = new NamedNode("GUI label");
|
||||
ret->_model_pos = LVector3f::rfu((left - right) * 0.5, 0.,
|
||||
(bottom - top) * 0.5);
|
||||
ret->_model_width = right - left;
|
||||
ret->_model_height = top - bottom;
|
||||
ret->_internal = new RenderRelation(ret->_geom, geom);
|
||||
gui_cat->debug() << "created model label 0x" << (void*)ret
|
||||
<< " from node 0x" << (void*)geom
|
||||
<< ", set _type(" << (int)(ret->_type) << ") to MODEL("
|
||||
|
|
@ -640,7 +665,7 @@ int GuiLabel::set_draw_order(int order) {
|
|||
case SIMPLE_CARD:
|
||||
case L_NULL:
|
||||
case MODEL:
|
||||
_arc->set_transition(new GeomBinTransition("fixed", order));
|
||||
_internal->set_transition(new GeomBinTransition("fixed", order));
|
||||
break;
|
||||
default:
|
||||
gui_cat->warning() << "trying to set draw order on an unknown label type ("
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ private:
|
|||
float _scale;
|
||||
float _scale_x, _scale_y, _scale_z;
|
||||
LVector3f _pos;
|
||||
LVector3f _model_pos;
|
||||
bool _have_foreground;
|
||||
Colorf _foreground;
|
||||
bool _have_background;
|
||||
Colorf _background;
|
||||
|
|
@ -73,6 +75,7 @@ PUBLISHED:
|
|||
static GuiLabel* make_simple_card_label(void);
|
||||
static GuiLabel* make_null_label(void);
|
||||
static GuiLabel* make_model_label(Node*, float, float);
|
||||
static GuiLabel* make_model_label(Node*, float, float, float, float);
|
||||
|
||||
int freeze();
|
||||
int thaw();
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ void GuiListBox::recompute_frame(void) {
|
|||
_right = rgt;
|
||||
_top = tp;
|
||||
_bottom = btm;
|
||||
this->adjust_region();
|
||||
this->thaw();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,24 +68,7 @@ void GuiRollover::recompute_frame(void) {
|
|||
|
||||
void GuiRollover::adjust_region(void) {
|
||||
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())) {
|
||||
// adjust for graph transform
|
||||
LMatrix4f m;
|
||||
this->get_graph_mat(m);
|
||||
LPoint3f ul = LVector3f::rfu(_left, 0., _top);
|
||||
LPoint3f lr = LVector3f::rfu(_right, 0., _bottom);
|
||||
ul = m * ul;
|
||||
lr = m * lr;
|
||||
_left = ul.dot(LVector3f::rfu(1., 0., 0.));
|
||||
_top = ul.dot(LVector3f::rfu(0., 0., 1.));
|
||||
_right = lr.dot(LVector3f::rfu(1., 0., 0.));
|
||||
_bottom = lr.dot(LVector3f::rfu(0., 0., 1.));
|
||||
gui_cat->debug() << "childed to non-default node, current values ("
|
||||
<< _left << ", " << _right << ", " << _bottom << ", "
|
||||
<< _top << ")" << endl;
|
||||
}
|
||||
GuiItem::adjust_region();
|
||||
_rgn->set_region(_left, _right, _bottom, _top);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ void GuiSign::recompute_frame(void) {
|
|||
GuiItem::recompute_frame();
|
||||
_sign->recompute();
|
||||
_sign->get_extents(_left, _right, _bottom, _top);
|
||||
this->adjust_region();
|
||||
}
|
||||
|
||||
void GuiSign::set_priority(GuiLabel* l, const GuiItem::Priority p) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue