Panda3D
 All Classes Functions Variables Enumerations
animChannelMatrixDynamic.h
1 // Filename: animChannelMatrixDynamic.h
2 // Created by: drose (20Oct03)
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 
15 #ifndef ANIMCHANNELMATRIXDYNAMIC_H
16 #define ANIMCHANNELMATRIXDYNAMIC_H
17 
18 #include "pandabase.h"
19 
20 #include "animChannel.h"
21 #include "transformState.h"
22 #include "pandaNode.h"
23 #include "pointerTo.h"
24 
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_CHAN AnimChannelMatrixDynamic : public AnimChannelMatrix {
38 protected:
41 
42 public:
43  AnimChannelMatrixDynamic(const string &name);
44 
45  virtual bool has_changed(int last_frame, double last_frac,
46  int this_frame, double this_frac);
47  virtual void get_value(int frame, LMatrix4 &mat);
48 
49  virtual void get_value_no_scale_shear(int frame, LMatrix4 &value);
50  virtual void get_scale(int frame, LVecBase3 &scale);
51  virtual void get_hpr(int frame, LVecBase3 &hpr);
52  virtual void get_quat(int frame, LQuaternion &quat);
53  virtual void get_pos(int frame, LVecBase3 &pos);
54  virtual void get_shear(int frame, LVecBase3 &shear);
55 
56 PUBLISHED:
57  void set_value(const LMatrix4 &value);
58  void set_value(const TransformState *value);
59  void set_value_node(PandaNode *node);
60 
61  INLINE const TransformState *get_value_transform() const;
62  INLINE PandaNode *get_value_node() const;
63 
64 protected:
65  virtual AnimGroup *make_copy(AnimGroup *parent) const;
66 
67 
68 private:
69  // This is filled in only if we are using the set_value_node()
70  // interface to get an implicit value from the transform on the
71  // indicated node each frame.
72  PT(PandaNode) _value_node;
73 
74  CPT(TransformState) _value;
75  CPT(TransformState) _last_value;
76 
77 public:
78  static void register_with_read_factory();
79  virtual void write_datagram(BamWriter *manager, Datagram &dg);
80  virtual int complete_pointers(TypedWritable **plist, BamReader *manager);
81  void fillin(DatagramIterator &scan, BamReader *manager);
82 
83  static TypedWritable *make_AnimChannelMatrixDynamic(const FactoryParams &params);
84 
85 public:
86  virtual TypeHandle get_type() const {
87  return get_class_type();
88  }
89  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
90  static TypeHandle get_class_type() {
91  return _type_handle;
92  }
93  static void init_type() {
94  AnimChannelMatrix::init_type();
95  register_type(_type_handle, "AnimChannelMatrixDynamic",
96  AnimChannelMatrix::get_class_type());
97  }
98 
99 private:
100  static TypeHandle _type_handle;
101 };
102 
103 #include "animChannelMatrixDynamic.I"
104 
105 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
virtual void get_pos(int frame, LVecBase3 &pos)
Returns the x, y, and z translation components associated with the current frame. ...
Definition: animChannel.I:158
virtual void get_quat(int frame, LQuaternion &quat)
Returns the rotation component associated with the current frame, expressed as a quaternion.
Definition: animChannel.I:145
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Takes in a vector of pointes to TypedWritable objects that correspond to all the requests for pointer...
Definition: animGroup.cxx:327
virtual void get_scale(int frame, LVecBase3 &scale)
Returns the x, y, and z scale components associated with the current frame.
Definition: animChannel.I:119
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
static void register_with_read_factory()
Factory method to generate a AnimGroup object.
Definition: animGroup.cxx:362
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
virtual void get_hpr(int frame, LVecBase3 &hpr)
Returns the h, p, and r components associated with the current frame.
Definition: animChannel.I:132
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This is our own Panda specialization on the default STL list.
Definition: plist.h:38
This template class is the parent class for all kinds of AnimChannels that return different values...
Definition: animChannel.h:30
virtual bool has_changed(int last_frame, double last_frac, int this_frame, double this_frac)
Returns true if the value has changed since the last call to has_changed().
An animation channel that accepts a matrix each frame from some dynamic input provided by code...
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:36
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
virtual void get_value_no_scale_shear(int frame, ValueType &value)
Returns the value associated with the current frame, with no scale or share components.
Definition: animChannel.I:106
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:40
virtual void write_datagram(BamWriter *manager, Datagram &me)
Function to write the important information in the particular object to a Datagram.
This is the base quaternion class.
Definition: lquaternion.h:96
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
virtual void get_shear(int frame, LVecBase3 &shear)
Returns the a, b, and c shear components associated with the current frame.
Definition: animChannel.I:171