Panda3D
animChannelBase.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file animChannelBase.h
10  * @author drose
11  * @date 1999-02-19
12  */
13 
14 #ifndef ANIMCHANNELBASE_H
15 #define ANIMCHANNELBASE_H
16 
17 #include "pandabase.h"
18 
19 #include "animGroup.h"
20 #include "animControl.h"
21 
22 #include "pointerTo.h"
23 
24 /**
25  * Parent class for all animation channels. An AnimChannel is an arbitrary
26  * function that changes over time (actually, over frames), usually defined by
27  * a table read from an egg file (but possibly computed or generated in any
28  * other way).
29  */
30 class EXPCL_PANDA_CHAN AnimChannelBase : public AnimGroup {
31 protected:
32  // The default constructor is protected: don't try to create an AnimChannel
33  // without a parent. To create an AnimChannel hierarchy, you must first
34  // create an AnimBundle, and use that to create any subsequent children.
35  INLINE AnimChannelBase(const std::string &name = "");
36  INLINE AnimChannelBase(AnimGroup *parent, const AnimChannelBase &copy);
37 
38 public:
39  INLINE AnimChannelBase(AnimGroup *parent, const std::string &name);
40 
41  virtual bool has_changed(int last_frame, double last_frac,
42  int this_frame, double this_frac);
43 
44  virtual TypeHandle get_value_type() const=0;
45 
46 protected:
47 
48  int _last_frame;
49 
50 public:
51  virtual void write_datagram(BamWriter* manager, Datagram &me);
52 
53 protected:
54  void fillin(DatagramIterator& scan, BamReader* manager);
55 
56 PUBLISHED:
57  virtual TypeHandle get_type() const {
58  return get_class_type();
59  }
60 
61 public:
62  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
63  static TypeHandle get_class_type() {
64  return _type_handle;
65  }
66  static void init_type() {
67  AnimGroup::init_type();
68  register_type(_type_handle, "AnimChannelBase",
69  AnimGroup::get_class_type());
70  }
71 
72 private:
73  static TypeHandle _type_handle;
74 };
75 
76 #include "animChannelBase.I"
77 
78 #endif
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:63
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:176
This is the base class for AnimChannel and AnimBundle.
Definition: animGroup.h:33
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38