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