Panda3D
animChannelBase.h
1 // Filename: animChannelBase.h
2 // Created by: drose (19Feb99)
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 ANIMCHANNELBASE_H
16 #define ANIMCHANNELBASE_H
17 
18 #include "pandabase.h"
19 
20 #include "animGroup.h"
21 #include "animControl.h"
22 
23 #include "pointerTo.h"
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : AnimChannelBase
27 // Description : Parent class for all animation channels. An
28 // AnimChannel is an arbitrary function that changes
29 // over time (actually, over frames), usually defined by
30 // a table read from an egg file (but possibly computed
31 // or generated in any other way).
32 ////////////////////////////////////////////////////////////////////
33 class EXPCL_PANDA_CHAN AnimChannelBase : public AnimGroup {
34 protected:
35  // The default constructor is protected: don't try to create an
36  // AnimChannel without a parent. To create an AnimChannel hierarchy,
37  // you must first create an AnimBundle, and use that to create any
38  // subsequent children.
39  INLINE AnimChannelBase(const string &name = "");
40  INLINE AnimChannelBase(AnimGroup *parent, const AnimChannelBase &copy);
41 
42 public:
43  INLINE AnimChannelBase(AnimGroup *parent, const string &name);
44 
45  virtual bool has_changed(int last_frame, double last_frac,
46  int this_frame, double this_frac);
47 
48  virtual TypeHandle get_value_type() const=0;
49 
50 protected:
51 
52  int _last_frame;
53 
54 public:
55  virtual void write_datagram(BamWriter* manager, Datagram &me);
56 
57 protected:
58  void fillin(DatagramIterator& scan, BamReader* manager);
59 
60 PUBLISHED:
61  virtual TypeHandle get_type() const {
62  return get_class_type();
63  }
64 
65 public:
66  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
67  static TypeHandle get_class_type() {
68  return _type_handle;
69  }
70  static void init_type() {
71  AnimGroup::init_type();
72  register_type(_type_handle, "AnimChannelBase",
73  AnimGroup::get_class_type());
74  }
75 
76 private:
77  static TypeHandle _type_handle;
78 };
79 
80 #include "animChannelBase.I"
81 
82 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
virtual void write_datagram(BamWriter *manager, Datagram &me)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
Parent class for all animation channels.
virtual TypeHandle get_value_type() const
Returns the TypeHandle associated with the ValueType we are concerned with.
Definition: animGroup.cxx:204
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:36
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