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