Panda3D
|
This is a class designed to support low-overhead traversals of the complete scene graph, with a memory of the complete path through the graph at any given point. More...
#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. | |
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. | |
NodePath | get_node_path () const |
Constructs and returns an actual NodePath that represents the same path we have just traversed. | |
int | get_num_nodes () const |
Returns the number of nodes in the path from the root to the current node. | |
bool | is_valid () const |
Returns true if the WorkingNodePath object appears to be a valid NodePath reference, false otherwise. | |
PandaNode * | node () const |
Returns the node traversed to so far. | |
void | operator= (const WorkingNodePath ©) |
void | output (ostream &out) const |
This is a class designed to support low-overhead traversals of the complete scene graph, with a memory of the complete path through the graph at any given point.
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 45 of file workingNodePath.h.
WorkingNodePath::WorkingNodePath | ( | const NodePath & | start | ) | [inline] |
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 25 of file workingNodePath.I.
References NodePath::is_empty(), and NodePath::node().
WorkingNodePath::WorkingNodePath | ( | const WorkingNodePath & | parent, |
PandaNode * | child | ||
) | [inline] |
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 56 of file workingNodePath.I.
PandaNode * WorkingNodePath::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.
This requires iterating through the path.
Definition at line 67 of file workingNodePath.cxx.
References get_node(), NodePath::get_node(), and get_node_path().
Referenced by get_node().
NodePath WorkingNodePath::get_node_path | ( | ) | const [inline] |
Constructs and returns an actual NodePath that represents the same path we have just traversed.
Definition at line 94 of file workingNodePath.I.
References NodePath::fail().
Referenced by FindApproxLevelEntry::consider_node(), FadeLODNode::cull_callback(), PortalNode::cull_callback(), SheetNode::cull_callback(), RopeNode::cull_callback(), ProjectionScreen::cull_callback(), CollisionNode::cull_callback(), get_node(), and CollisionLevelStateBase::get_node_path().
int WorkingNodePath::get_num_nodes | ( | ) | const |
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 48 of file workingNodePath.cxx.
References Thread::get_current_thread(), get_num_nodes(), and Thread::get_pipeline_stage().
Referenced by get_num_nodes().
bool WorkingNodePath::is_valid | ( | ) | const |
Returns true if the WorkingNodePath object appears to be a valid NodePath reference, false otherwise.
Definition at line 25 of file workingNodePath.cxx.
References is_valid().
Referenced by FindApproxLevelEntry::FindApproxLevelEntry(), and is_valid().
PandaNode * WorkingNodePath::node | ( | ) | const [inline] |
Returns the node traversed to so far.
Definition at line 107 of file workingNodePath.I.
Referenced by FindApproxLevelEntry::consider_next_step(), FindApproxLevelEntry::consider_node(), CullTraverserData::node(), and CollisionLevelStateBase::node().