selectiveChildNode.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Filename: selectiveChildNode.h
  2. // Created by: drose (06Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef SELECTIVECHILDNODE_H
  19. #define SELECTIVECHILDNODE_H
  20. #include "pandabase.h"
  21. #include "pandaNode.h"
  22. ////////////////////////////////////////////////////////////////////
  23. // Class : SelectiveChildNode
  24. // Description : A base class for nodes like LODNode and SequenceNode
  25. // that select only one visible child at a time.
  26. ////////////////////////////////////////////////////////////////////
  27. class EXPCL_PANDA SelectiveChildNode : public PandaNode {
  28. PUBLISHED:
  29. INLINE SelectiveChildNode(const string &name);
  30. protected:
  31. INLINE SelectiveChildNode(const SelectiveChildNode &copy);
  32. public:
  33. virtual bool has_selective_visibility() const;
  34. virtual int get_first_visible_child() const;
  35. virtual int get_next_visible_child(int n) const;
  36. protected:
  37. INLINE void select_child(int n);
  38. private:
  39. // Not sure if this should be cycled or not. It's not exactly
  40. // thread-safe not to cycle it, but it doesn't really need the full
  41. // pipeline control. It's probably a problem in the non-thread-safe
  42. // design; need to rethink the design a bit.
  43. int _selected_child;
  44. public:
  45. static TypeHandle get_class_type() {
  46. return _type_handle;
  47. }
  48. static void init_type() {
  49. PandaNode::init_type();
  50. register_type(_type_handle, "SelectiveChildNode",
  51. PandaNode::get_class_type());
  52. }
  53. virtual TypeHandle get_type() const {
  54. return get_class_type();
  55. }
  56. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  57. private:
  58. static TypeHandle _type_handle;
  59. };
  60. #include "selectiveChildNode.I"
  61. #endif