open_toontown_panda3d/panda/src/pgraph/workingNodePath.cxx

57 lines
1.9 KiB
C++

// Filename: workingNodePath.cxx
// 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
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#include "workingNodePath.h"
////////////////////////////////////////////////////////////////////
// Function: WorkingNodePath::get_num_nodes
// Access: Public
// Description: Returns the number of nodes in the path from the root
// to the current node.
////////////////////////////////////////////////////////////////////
int WorkingNodePath::
get_num_nodes() const {
if (_next == (WorkingNodePath *)NULL) {
return _start->get_length();
}
return _next->get_num_nodes() + 1;
}
////////////////////////////////////////////////////////////////////
// Function: WorkingNodePath::r_get_node_path
// Access: Private
// Description: The private, recursive implementation of
// get_node_path(), this returns the NodePathComponent
// representing the NodePath.
////////////////////////////////////////////////////////////////////
PT(qpNodePathComponent) WorkingNodePath::
r_get_node_path() const {
if (_next == (WorkingNodePath *)NULL) {
return _start;
}
nassertr(_start == (qpNodePathComponent *)NULL, NULL);
nassertr(_node != (PandaNode *)NULL, NULL);
PT(qpNodePathComponent) comp = _next->r_get_node_path();
nassertr(comp != (qpNodePathComponent *)NULL, NULL);
return PandaNode::get_component(comp, _node);
}