Panda3D
|
00001 // Filename: selectiveChildNode.cxx 00002 // Created by: drose (06Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "selectiveChildNode.h" 00016 00017 TypeHandle SelectiveChildNode::_type_handle; 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: SelectiveChildNode::has_selective_visibility 00022 // Access: Public, Virtual 00023 // Description: Should be overridden by derived classes to return 00024 // true if this kind of node has some restrictions on 00025 // the set of children that should be rendered. Node 00026 // with this property include LODNodes, SwitchNodes, and 00027 // SequenceNodes. 00028 // 00029 // If this function returns true, 00030 // get_first_visible_child() and 00031 // get_next_visible_child() will be called to walk 00032 // through the list of children during cull, instead of 00033 // iterating through the entire list. This method is 00034 // called after cull_callback(), so cull_callback() may 00035 // be responsible for the decisions as to which children 00036 // are visible at the moment. 00037 //////////////////////////////////////////////////////////////////// 00038 bool SelectiveChildNode:: 00039 has_selective_visibility() const { 00040 return true; 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: SelectiveChildNode::get_first_visible_child 00045 // Access: Public, Virtual 00046 // Description: Returns the index number of the first visible child 00047 // of this node, or a number >= get_num_children() if 00048 // there are no visible children of this node. This is 00049 // called during the cull traversal, but only if 00050 // has_selective_visibility() has already returned true. 00051 // See has_selective_visibility(). 00052 //////////////////////////////////////////////////////////////////// 00053 int SelectiveChildNode:: 00054 get_first_visible_child() const { 00055 return _selected_child; 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function: SelectiveChildNode::get_next_visible_child 00060 // Access: Public, Virtual 00061 // Description: Returns the index number of the next visible child 00062 // of this node following the indicated child, or a 00063 // number >= get_num_children() if there are no more 00064 // visible children of this node. See 00065 // has_selective_visibility() and 00066 // get_first_visible_child(). 00067 //////////////////////////////////////////////////////////////////// 00068 int SelectiveChildNode:: 00069 get_next_visible_child(int n) const { 00070 return get_num_children(); 00071 }