Panda3D

selectiveChildNode.h

00001 // Filename: selectiveChildNode.h
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 #ifndef SELECTIVECHILDNODE_H
00016 #define SELECTIVECHILDNODE_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "pandaNode.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : SelectiveChildNode
00024 // Description : A base class for nodes like LODNode and SequenceNode
00025 //               that select only one visible child at a time.
00026 ////////////////////////////////////////////////////////////////////
00027 class EXPCL_PANDA_PGRAPHNODES SelectiveChildNode : public PandaNode {
00028 PUBLISHED:
00029   INLINE SelectiveChildNode(const string &name);
00030 
00031 protected:
00032   INLINE SelectiveChildNode(const SelectiveChildNode &copy);
00033 
00034 public:
00035   virtual bool has_selective_visibility() const;
00036   virtual int get_first_visible_child() const;
00037   virtual int get_next_visible_child(int n) const;
00038 
00039 protected:
00040   INLINE void select_child(int n);
00041 
00042 private:
00043   // Not sure if this should be cycled or not.  It's not exactly
00044   // thread-safe not to cycle it, but it doesn't really need the full
00045   // pipeline control.  It's probably a problem in the non-thread-safe
00046   // design; need to rethink the design a bit.
00047   int _selected_child;
00048 
00049 public:
00050   static TypeHandle get_class_type() {
00051     return _type_handle;
00052   }
00053   static void init_type() {
00054     PandaNode::init_type();
00055     register_type(_type_handle, "SelectiveChildNode",
00056                   PandaNode::get_class_type());
00057   }
00058   virtual TypeHandle get_type() const {
00059     return get_class_type();
00060   }
00061   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00062 
00063 private:
00064   static TypeHandle _type_handle;
00065 };
00066 
00067 #include "selectiveChildNode.I"
00068 
00069 #endif
 All Classes Functions Variables Enumerations