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