*** empty log message ***

This commit is contained in:
David Rose 2001-02-13 02:00:38 +00:00
parent d2767605e3
commit faa5570026
2 changed files with 58 additions and 2 deletions

View File

@ -353,6 +353,41 @@ find_all_matches(const string &path) const {
return col;
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::find_singular_transform
// Access: Public
// Description: Scans the subgraph beginning at the bottom node of
// the scene graph, looking for a node with a singular
// matrix transform above it. Returns the first such
// node encountered, or an empty NodePath if no singular
// transforms exist in the scene graph.
//
// This is a handy function for tracking down mysterious
// "tried in invert a singular matrix" errors, which are
// almost always caused by zero-scale transform matrices
// in the scene graph.
////////////////////////////////////////////////////////////////////
NodePath NodePath::
find_singular_transform() const {
if (has_mat()) {
LMatrix4f mat;
if (!mat.invert_from(get_mat())) {
// Here's a singular matrix!
return *this;
}
}
int num_children = get_num_children();
for (int i = 0; i < num_children; i++) {
NodePath result = get_child(i).find_singular_transform();
if (!result.is_empty()) {
return result;
}
}
return NodePath();
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::get_node
// Access: Public
@ -1800,6 +1835,26 @@ set_color(const Colorf &color, int priority) {
_head->_arc->set_transition(col_trans, priority);
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::set_color_off
// Access: Public
// Description: Sets the geometry at this level and below to render
// using the geometry color. This is normally the
// default, but it may be useful to use this to
// contradict set_color() at a higher node level (or,
// with a priority, to override a set_color() at a lower
// level).
////////////////////////////////////////////////////////////////////
void NodePath::
set_color_off(int priority) {
nassertv(has_arcs());
nassertv(_head != (ArcComponent *)NULL);
ColorTransition *col_trans =
new ColorTransition(ColorTransition::off());
_head->_arc->set_transition(col_trans, priority);
}
////////////////////////////////////////////////////////////////////
// Function: NodePath::get_color
// Access: Public

View File

@ -175,6 +175,8 @@ PUBLISHED:
NodePathCollection
find_all_matches(const string &path) const;
NodePath find_singular_transform() const;
// Methods that actually move nodes around in the scene graph. The
// optional "sort" parameter can be used to force a particular
@ -374,6 +376,7 @@ PUBLISHED:
INLINE void set_color(float r, float g, float b, float a = 1.0,
int priority = 0);
void set_color(const Colorf &color, int priority = 0);
void set_color_off(int priority = 0);
INLINE void clear_color();
INLINE bool has_color() const;
Colorf get_color() const;
@ -462,8 +465,6 @@ private:
const FindApproxLevel &level,
int max_matches, int num_levels_remaining) const;
void r_prepare_scene(Node *node);
void r_list_descendants(ostream &out, int indent_level) const;
void r_list_transitions(ostream &out, int indent_level) const;