#include <workingNodePath.h>
Public Member Functions | |
WorkingNodePath (const NodePath &start) | |
Creates a WorkingNodePath that is the same as the indicated NodePath. | |
WorkingNodePath (const WorkingNodePath ©) | |
WorkingNodePath (const WorkingNodePath &parent, PandaNode *child) | |
Creates a WorkingNodePath that is the same as the indicated WorkingNodePath, plus one node. | |
~WorkingNodePath () | |
void | operator= (const WorkingNodePath ©) |
bool | is_valid () const |
Returns true if the WorkingNodePath object appears to be a valid NodePath reference, false otherwise. | |
NodePath | get_node_path () const |
Constructs and returns an actual NodePath that represents the same path we have just traversed. | |
PandaNode * | node () const |
Returns the node traversed to so far. | |
int | get_num_nodes () const |
Returns the number of nodes in the path from the root to the current node. | |
PandaNode * | get_node (int index) const |
Returns the nth node of the path, where 0 is the referenced (bottom) node and get_num_nodes() - 1 is the top node. | |
void | output (ostream &out) const |
Private Member Functions | |
PointerTo< NodePathComponent > | r_get_node_path () const |
The private, recursive implementation of get_node_path(), this returns the NodePathComponent representing the NodePath. | |
Private Attributes | |
const WorkingNodePath * | _next |
PointerTo< NodePathComponent > | _start |
PandaNode * | _node |
You could just use a regular NodePath to do this, but since the NodePath requires storing NodePathComponents on each node as it is constructed, and then removing them when it destructs, there is considerable overhead in that approach.
The WorkingNodePath eliminates this overhead (but does not guarantee consistency if the scene graph changes while the path is held).
At any given point, you may ask the WorkingNodePath for its actual NodePath, and it will construct and return a new NodePath representing the complete generated chain.
Definition at line 73 of file workingNodePath.h.
|
Creates a WorkingNodePath that is the same as the indicated NodePath. This is generally used to begin the traversal of a scene graph with the root NodePath. Definition at line 38 of file workingNodePath.I. |
|
Definition at line 54 of file workingNodePath.I. |
|
Creates a WorkingNodePath that is the same as the indicated WorkingNodePath, plus one node. This is generally used to continue the traversal to the next node. Definition at line 78 of file workingNodePath.I. References _next, _node, _start, INLINE, nassertv, and NULL. |
|
Definition at line 93 of file workingNodePath.I. References NodePath::_head, NodePath::fail(), INLINE, nassertr, NULL, and r_get_node_path(). |
|
Returns the nth node of the path, where 0 is the referenced (bottom) node and get_num_nodes() - 1 is the top node. This requires iterating through the path. Definition at line 89 of file workingNodePath.cxx. Referenced by get_num_nodes(). |
|
Constructs and returns an actual NodePath that represents the same path we have just traversed.
Definition at line 125 of file workingNodePath.I. Referenced by CollisionLevelState::CollisionLevelState(), FindApproxLevelEntry::consider_node(), get_num_nodes(), ProjectionScreen::recompute_geom(), ProjectionScreen::recompute_if_stale(), and RopeNode::safe_to_transform(). |
|
Returns the number of nodes in the path from the root to the current node. Since a WorkingNodePath always consists of, at minimum, a nonempty parent NodePath and one child node, this method will always return at least 2. Definition at line 66 of file workingNodePath.cxx. References _next, _node, get_node(), NodePath::get_node(), get_node_path(), nassertr, and NULL. |
|
Returns true if the WorkingNodePath object appears to be a valid NodePath reference, false otherwise.
Definition at line 36 of file workingNodePath.cxx. Referenced by FindApproxLevelEntry::FindApproxLevelEntry(), and NodePath::set_billboard_point_eye(). |
|
Returns the node traversed to so far.
Definition at line 141 of file workingNodePath.I. Referenced by PT(), and ProjectionScreen::recompute_if_stale(). |
|
Definition at line 105 of file workingNodePath.I. |
|
Definition at line 111 of file workingNodePath.cxx. |
|
The private, recursive implementation of get_node_path(), this returns the NodePathComponent representing the NodePath.
Definition at line 130 of file workingNodePath.cxx. Referenced by ~WorkingNodePath(). |
|
Definition at line 98 of file workingNodePath.h. Referenced by get_num_nodes(), and WorkingNodePath(). |
|
Definition at line 101 of file workingNodePath.h. Referenced by get_num_nodes(), operator=(), and WorkingNodePath(). |
|
Definition at line 99 of file workingNodePath.h. Referenced by WorkingNodePath(). |