fix render order for wait bars

This commit is contained in:
David Rose 2005-10-06 23:12:53 +00:00
parent 1a5ef405a3
commit 7683032977
3 changed files with 10 additions and 5 deletions

View File

@ -153,13 +153,14 @@ xform(const LMatrix4f &mat) {
// Access: Public
// Description: Generates geometry representing a frame of the
// indicated size, and parents it to the indicated node,
// with a scene graph sort order of -1.
// with the indicated scene graph sort order.
//
// The return value is the generated NodePath, if any,
// or an empty NodePath if nothing is generated.
////////////////////////////////////////////////////////////////////
NodePath PGFrameStyle::
generate_into(const NodePath &parent, const LVecBase4f &frame) {
generate_into(const NodePath &parent, const LVecBase4f &frame,
int sort) {
PT(PandaNode) new_node;
LPoint2f center((frame[0] + frame[1]) / 2.0f,
@ -204,7 +205,7 @@ generate_into(const NodePath &parent, const LVecBase4f &frame) {
}
// Adding the node to the parent keeps the reference count.
return parent.attach_new_node(new_node);
return parent.attach_new_node(new_node, sort);
}
////////////////////////////////////////////////////////////////////

View File

@ -75,7 +75,8 @@ PUBLISHED:
public:
bool xform(const LMatrix4f &mat);
NodePath generate_into(const NodePath &parent, const LVecBase4f &frame);
NodePath generate_into(const NodePath &parent, const LVecBase4f &frame,
int sort = 0);
private:
PT(PandaNode) generate_flat_geom(const LVecBase4f &frame);

View File

@ -177,7 +177,10 @@ update() {
frac = max(min(frac, 1.0f), 0.0f);
bar_frame[1] = bar_frame[0] + frac * (bar_frame[1] - bar_frame[0]);
_bar = _bar_style.generate_into(root, bar_frame);
_bar = _bar_style.generate_into(root, bar_frame, 1);
// Make sure the bar is rendered after the frame.
_bar.set_bin("fixed", 1);
}
// Indicate that the bar is current for this state.