Panda3D
selectiveChildNode.cxx
1 // Filename: selectiveChildNode.cxx
2 // Created by: drose (06Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "selectiveChildNode.h"
16 
17 TypeHandle SelectiveChildNode::_type_handle;
18 
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: SelectiveChildNode::has_selective_visibility
22 // Access: Public, Virtual
23 // Description: Should be overridden by derived classes to return
24 // true if this kind of node has some restrictions on
25 // the set of children that should be rendered. Node
26 // with this property include LODNodes, SwitchNodes, and
27 // SequenceNodes.
28 //
29 // If this function returns true,
30 // get_first_visible_child() and
31 // get_next_visible_child() will be called to walk
32 // through the list of children during cull, instead of
33 // iterating through the entire list. This method is
34 // called after cull_callback(), so cull_callback() may
35 // be responsible for the decisions as to which children
36 // are visible at the moment.
37 ////////////////////////////////////////////////////////////////////
40  return true;
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: SelectiveChildNode::get_first_visible_child
45 // Access: Public, Virtual
46 // Description: Returns the index number of the first visible child
47 // of this node, or a number >= get_num_children() if
48 // there are no visible children of this node. This is
49 // called during the cull traversal, but only if
50 // has_selective_visibility() has already returned true.
51 // See has_selective_visibility().
52 ////////////////////////////////////////////////////////////////////
55  return _selected_child;
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function: SelectiveChildNode::get_next_visible_child
60 // Access: Public, Virtual
61 // Description: Returns the index number of the next visible child
62 // of this node following the indicated child, or a
63 // number >= get_num_children() if there are no more
64 // visible children of this node. See
65 // has_selective_visibility() and
66 // get_first_visible_child().
67 ////////////////////////////////////////////////////////////////////
69 get_next_visible_child(int n) const {
70  return get_num_children();
71 }
int get_num_children(Thread *current_thread=Thread::get_current_thread()) const
Returns the number of child nodes this node has.
Definition: pandaNode.I:68
virtual int get_first_visible_child() const
Returns the index number of the first visible child of this node, or a number >= get_num_children() i...
virtual bool has_selective_visibility() const
Should be overridden by derived classes to return true if this kind of node has some restrictions on ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual int get_next_visible_child(int n) const
Returns the index number of the next visible child of this node following the indicated child...