Panda3D
Loading...
Searching...
No Matches
findApproxLevelEntry.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file findApproxLevelEntry.I
10 * @author drose
11 * @date 2002-03-13
12 */
13
14/**
15 *
16 */
17INLINE FindApproxLevelEntry::
18FindApproxLevelEntry(const WorkingNodePath &node_path, FindApproxPath &approx_path) :
19 _node_path(node_path),
20 _approx_path(approx_path)
21{
22 _i = 0;
23 _next = nullptr;
24 nassertv(_node_path.is_valid());
25}
26
27/**
28 * This constructor is used to construct the next entry based on a child node
29 * of the previous entry's node.
30 */
31INLINE FindApproxLevelEntry::
32FindApproxLevelEntry(const FindApproxLevelEntry &parent,
33 PandaNode *child_node, int i,
35 _node_path(parent._node_path, child_node),
36 _i(i),
37 _approx_path(parent._approx_path),
38 _next(next)
39{
40 nassertv(validate_ptr(this) && validate_ptr(&parent));
41 nassertv(_node_path.is_valid());
42}
43
44/**
45 *
46 */
47INLINE FindApproxLevelEntry::
48FindApproxLevelEntry(const FindApproxLevelEntry &copy) :
49 _node_path(copy._node_path),
50 _i(copy._i),
51 _approx_path(copy._approx_path)
52{
53 _next = nullptr;
54 nassertv(_node_path.is_valid());
55}
56
57/**
58 *
59 */
60INLINE void FindApproxLevelEntry::
61operator = (const FindApproxLevelEntry &copy) {
62 _node_path = copy._node_path;
63 _i = copy._i;
64 nassertv(&_approx_path == &copy._approx_path);
65 nassertv(_node_path.is_valid());
66}
67
68
69/**
70 * Returns true if the next node matched by this entry must be a stashed node,
71 * false otherwise.
72 */
74next_is_stashed(int increment) const {
75 return _approx_path.matches_stashed(_i + increment);
76}
77
78/**
79 * Returns true if this entry represents a solution to the search; i.e. all
80 * the components of the path have been successfully matched.
81 */
83is_solution(int increment) const {
84 return (_i + increment >= _approx_path.get_num_components());
85}
This class is local to this package only; it doesn't get exported.
bool next_is_stashed(int increment) const
Returns true if the next node matched by this entry must be a stashed node, false otherwise.
bool is_solution(int increment) const
Returns true if this entry represents a solution to the search; i.e.
This class is local to this package only; it doesn't get exported.
bool matches_stashed(int index) const
Returns true if the nth component of the path matches a stashed node only, false otherwise.
int get_num_components() const
Returns the number of components in the path.
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
This is a class designed to support low-overhead traversals of the complete scene graph,...
is_valid
Returns true if the WorkingNodePath object appears to be a valid NodePath reference,...