sequenceNode.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Filename: sequenceNode.h
  2. // Created by: drose (06Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef SEQUENCENODE_H
  15. #define SEQUENCENODE_H
  16. #include "pandabase.h"
  17. #include "selectiveChildNode.h"
  18. #include "animInterface.h"
  19. #include "clockObject.h"
  20. ////////////////////////////////////////////////////////////////////
  21. // Class : SequenceNode
  22. // Description : A node that automatically cycles through rendering
  23. // each one of its children according to its frame rate.
  24. ////////////////////////////////////////////////////////////////////
  25. class EXPCL_PANDA_PGRAPHNODES SequenceNode : public SelectiveChildNode, public AnimInterface {
  26. PUBLISHED:
  27. INLINE SequenceNode(const string &name);
  28. protected:
  29. SequenceNode(const SequenceNode &copy);
  30. PUBLISHED:
  31. virtual int get_num_frames() const;
  32. INLINE void set_frame_rate(double frame_rate);
  33. public:
  34. virtual PandaNode *make_copy() const;
  35. virtual bool safe_to_combine() const;
  36. virtual bool safe_to_combine_children() const;
  37. virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data);
  38. virtual int get_first_visible_child() const;
  39. virtual bool has_single_child_visibility() const;
  40. virtual int get_visible_child() const;
  41. virtual void output(ostream &out) const;
  42. public:
  43. static void register_with_read_factory();
  44. virtual void write_datagram(BamWriter *manager, Datagram &dg);
  45. protected:
  46. static TypedWritable *make_from_bam(const FactoryParams &params);
  47. void fillin(DatagramIterator &scan, BamReader *manager);
  48. public:
  49. static TypeHandle get_class_type() {
  50. return _type_handle;
  51. }
  52. static void init_type() {
  53. SelectiveChildNode::init_type();
  54. AnimInterface::init_type();
  55. register_type(_type_handle, "SequenceNode",
  56. SelectiveChildNode::get_class_type(),
  57. AnimInterface::get_class_type());
  58. }
  59. virtual TypeHandle get_type() const {
  60. return get_class_type();
  61. }
  62. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  63. private:
  64. static TypeHandle _type_handle;
  65. };
  66. #include "sequenceNode.I"
  67. #endif