00001 // Filename: animChannelScalarTable.h 00002 // Created by: drose (22Feb99) 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 ANIMCHANNELSCALARTABLE_H 00020 #define ANIMCHANNELSCALARTABLE_H 00021 00022 #include <pandabase.h> 00023 00024 #include "animChannel.h" 00025 00026 #include <pointerToArray.h> 00027 #include <pta_float.h> 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Class : AnimChannelScalarTable 00031 // Description : An animation channel that issues a scalar each frame, 00032 // read from a table such as might have been read from 00033 // an egg file. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA AnimChannelScalarTable : public AnimChannelScalar { 00036 public: 00037 AnimChannelScalarTable(AnimGroup *parent, const string &name); 00038 00039 virtual bool has_changed(int last_frame, int this_frame); 00040 virtual void get_value(int frame, float &value); 00041 00042 void set_table(const CPTA_float &table); 00043 INLINE bool has_table() const; 00044 INLINE void clear_table(); 00045 00046 virtual void write(ostream &out, int indent_level) const; 00047 00048 protected: 00049 AnimChannelScalarTable(void); 00050 CPTA_float _table; 00051 00052 public: 00053 static void register_with_read_factory(void); 00054 virtual void write_datagram(BamWriter* manager, Datagram &me); 00055 00056 static TypedWritable *make_AnimChannelScalarTable(const FactoryParams ¶ms); 00057 00058 protected: 00059 void fillin(DatagramIterator& scan, BamReader* manager); 00060 00061 public: 00062 virtual TypeHandle get_type() const { 00063 return get_class_type(); 00064 } 00065 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00066 static TypeHandle get_class_type() { 00067 return _type_handle; 00068 } 00069 static void init_type() { 00070 AnimChannelScalar::init_type(); 00071 register_type(_type_handle, "AnimChannelScalarTable", 00072 AnimChannelScalar::get_class_type()); 00073 } 00074 00075 private: 00076 static TypeHandle _type_handle; 00077 }; 00078 00079 #include "animChannelScalarTable.I" 00080 00081 #endif