animChannelMatrixDynamic.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Filename: animChannelMatrixDynamic.h
  2. // Created by: drose (20Oct03)
  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 ANIMCHANNELMATRIXDYNAMIC_H
  19. #define ANIMCHANNELMATRIXDYNAMIC_H
  20. #include "pandabase.h"
  21. #include "animChannel.h"
  22. #include "transformState.h"
  23. #include "pandaNode.h"
  24. #include "pointerTo.h"
  25. ////////////////////////////////////////////////////////////////////
  26. // Class : AnimChannelMatrixDynamic
  27. // Description : An animation channel that accepts a matrix each frame
  28. // from some dynamic input provided by code.
  29. //
  30. // This object operates in two modes: in explicit mode,
  31. // the programmer should call set_value() each frame to
  32. // indicate the new value; in implicit mode, the
  33. // programmer should call set_value_node() to indicate
  34. // the node whose transform will be copied to the joint
  35. // each frame.
  36. ////////////////////////////////////////////////////////////////////
  37. class EXPCL_PANDA AnimChannelMatrixDynamic : public AnimChannelMatrix {
  38. public:
  39. AnimChannelMatrixDynamic(AnimGroup *parent, const string &name);
  40. protected:
  41. AnimChannelMatrixDynamic();
  42. public:
  43. virtual bool has_changed(int last_frame, int this_frame);
  44. virtual void get_value(int frame, LMatrix4f &mat);
  45. virtual void get_value_no_scale(int frame, LMatrix4f &value);
  46. virtual void get_scale(int frame, float scale[3]);
  47. PUBLISHED:
  48. void set_value(const LMatrix4f &value);
  49. void set_value(const TransformState *value);
  50. void set_value_node(PandaNode *node);
  51. private:
  52. // This is filled in only if we are using the set_value_node()
  53. // interface to get an implicit value from the transform on the
  54. // indicated node each frame.
  55. PT(PandaNode) _value_node;
  56. CPT(TransformState) _value;
  57. CPT(TransformState) _last_value;
  58. public:
  59. static void register_with_read_factory();
  60. virtual void write_datagram(BamWriter *manager, Datagram &dg);
  61. virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
  62. void fillin(DatagramIterator &scan, BamReader *manager);
  63. static TypedWritable *make_AnimChannelMatrixDynamic(const FactoryParams &params);
  64. public:
  65. virtual TypeHandle get_type() const {
  66. return get_class_type();
  67. }
  68. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  69. static TypeHandle get_class_type() {
  70. return _type_handle;
  71. }
  72. static void init_type() {
  73. AnimChannelMatrix::init_type();
  74. register_type(_type_handle, "AnimChannelMatrixDynamic",
  75. AnimChannelMatrix::get_class_type());
  76. }
  77. private:
  78. static TypeHandle _type_handle;
  79. };
  80. #include "animChannelMatrixDynamic.I"
  81. #endif