| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- // Filename: workingNodePath.I
- // Created by: drose (16Mar02)
- //
- ////////////////////////////////////////////////////////////////////
- //
- // PANDA 3D SOFTWARE
- // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
- //
- // All use of this software is subject to the terms of the Panda 3d
- // Software license. You should have received a copy of this license
- // along with this source code; you will also find a current copy of
- // the license at http://www.panda3d.org/license.txt .
- //
- // To contact the maintainers of this program write to
- // [email protected] .
- //
- ////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////
- // Function: WorkingNodePath::Constructor
- // Access: Public
- // Description: 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.
- ////////////////////////////////////////////////////////////////////
- INLINE WorkingNodePath::
- WorkingNodePath(const NodePath &start) {
- nassertv(!start.is_empty());
- _next = (WorkingNodePath *)NULL;
- _start = start._head;
- _node = start.node();
- }
- ////////////////////////////////////////////////////////////////////
- // Function: WorkingNodePath::Copy Constructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE WorkingNodePath::
- WorkingNodePath(const WorkingNodePath ©) :
- _next(copy._next),
- _start(copy._start),
- _node(copy._node)
- {
- nassertv(_next != (WorkingNodePath *)NULL ||
- _start != (NodePathComponent *)NULL);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: WorkingNodePath::Constructor
- // Access: Public
- // Description: 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.
- ////////////////////////////////////////////////////////////////////
- INLINE WorkingNodePath::
- WorkingNodePath(const WorkingNodePath &parent, PandaNode *child) {
- _next = &parent;
- _start = (NodePathComponent *)NULL;
- _node = child;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: WorkingNodePath::Destructor
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE WorkingNodePath::
- ~WorkingNodePath() {
- }
- ////////////////////////////////////////////////////////////////////
- // Function: WorkingNodePath::Copy Assignment Operator
- // Access: Public
- // Description:
- ////////////////////////////////////////////////////////////////////
- INLINE void WorkingNodePath::
- operator = (const WorkingNodePath ©) {
- _next = copy._next;
- _start = copy._start;
- _node = copy._node;
- nassertv(_next != (WorkingNodePath *)NULL ||
- _start != (NodePathComponent *)NULL);
- }
- ////////////////////////////////////////////////////////////////////
- // Function: WorkingNodePath::get_node_path
- // Access: Public
- // Description: Constructs and returns an actual NodePath that
- // represents the same path we have just traversed.
- ////////////////////////////////////////////////////////////////////
- INLINE NodePath WorkingNodePath::
- get_node_path() const {
- NodePath result;
- result._head = r_get_node_path();
- nassertr(result._head != (NodePathComponent *)NULL, NodePath::fail());
- return result;
- }
- ////////////////////////////////////////////////////////////////////
- // Function: WorkingNodePath::node
- // Access: Public
- // Description: Returns the node traversed to so far.
- ////////////////////////////////////////////////////////////////////
- INLINE PandaNode *WorkingNodePath::
- node() const {
- return _node;
- }
- INLINE ostream &
- operator << (ostream &out, const WorkingNodePath &node_path) {
- node_path.output(out);
- return out;
- }
|