switchNode.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Filename: switchNode.h
  2. // Created by: drose (15May01)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, 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://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef SWITCHNODE_H
  19. #define SWITCHNODE_H
  20. #include <pandabase.h>
  21. #include <namedNode.h>
  22. class RenderTraverser;
  23. ////////////////////////////////////////////////////////////////////
  24. // Class : SwitchNode
  25. // Description : A base class for nodes that may choose to render only
  26. // some subset of their children, based on some internal
  27. // criteria.
  28. //
  29. // This is an abstract base class, and is only
  30. // interface; it is defined in this directory so that
  31. // FrustumCullTraverser can access it. All of the
  32. // implementations of this class are defined in the
  33. // switchnode directory.
  34. ////////////////////////////////////////////////////////////////////
  35. class EXPCL_PANDA SwitchNode : public NamedNode {
  36. PUBLISHED:
  37. INLINE SwitchNode(const string &name = "");
  38. INLINE SwitchNode(const SwitchNode &copy);
  39. INLINE void operator = (const SwitchNode &copy);
  40. public:
  41. virtual void compute_switch(RenderTraverser *trav)=0;
  42. virtual bool is_child_visible(TypeHandle type, int index)=0;
  43. public:
  44. static TypeHandle get_class_type() {
  45. return _type_handle;
  46. }
  47. static void init_type() {
  48. NamedNode::init_type();
  49. register_type( _type_handle, "SwitchNode",
  50. NamedNode::get_class_type() );
  51. }
  52. virtual TypeHandle get_type() const {
  53. return get_class_type();
  54. }
  55. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  56. private:
  57. static TypeHandle _type_handle;
  58. };
  59. #include "switchNode.I"
  60. #endif