Panda3D
 All Classes Functions Variables Enumerations
animChannelBase.h
00001 // Filename: animChannelBase.h
00002 // Created by:  drose (19Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef ANIMCHANNELBASE_H
00016 #define ANIMCHANNELBASE_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "animGroup.h"
00021 #include "animControl.h"
00022 
00023 #include "pointerTo.h"
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //       Class : AnimChannelBase
00027 // Description : Parent class for all animation channels.  An
00028 //               AnimChannel is an arbitrary function that changes
00029 //               over time (actually, over frames), usually defined by
00030 //               a table read from an egg file (but possibly computed
00031 //               or generated in any other way).
00032 ////////////////////////////////////////////////////////////////////
00033 class EXPCL_PANDA_CHAN AnimChannelBase : public AnimGroup {
00034 protected:
00035   // The default constructor is protected: don't try to create an
00036   // AnimChannel without a parent.  To create an AnimChannel hierarchy,
00037   // you must first create an AnimBundle, and use that to create any
00038   // subsequent children.
00039   INLINE AnimChannelBase(const string &name = "");
00040   INLINE AnimChannelBase(AnimGroup *parent, const AnimChannelBase &copy);
00041 
00042 public:
00043   INLINE AnimChannelBase(AnimGroup *parent, const string &name);
00044 
00045   virtual bool has_changed(int last_frame, double last_frac, 
00046                            int this_frame, double this_frac);
00047 
00048   virtual TypeHandle get_value_type() const=0;
00049 
00050 protected:
00051 
00052   int _last_frame;
00053 
00054 public:
00055   virtual void write_datagram(BamWriter* manager, Datagram &me);
00056 
00057 protected:
00058   void fillin(DatagramIterator& scan, BamReader* manager);
00059 
00060 PUBLISHED:
00061   virtual TypeHandle get_type() const {
00062     return get_class_type();
00063   }
00064 
00065 public:
00066   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00067   static TypeHandle get_class_type() {
00068     return _type_handle;
00069   }
00070   static void init_type() {
00071     AnimGroup::init_type();
00072     register_type(_type_handle, "AnimChannelBase",
00073                   AnimGroup::get_class_type());
00074   }
00075 
00076 private:
00077   static TypeHandle _type_handle;
00078 };
00079 
00080 #include "animChannelBase.I"
00081 
00082 #endif
 All Classes Functions Variables Enumerations