00001 // Filename: animChannelFixed.h 00002 // Created by: drose (24Feb99) 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 ANIMCHANNELFIXED_H 00020 #define ANIMCHANNELFIXED_H 00021 00022 #include <pandabase.h> 00023 00024 #include "animChannel.h" 00025 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : AnimChannelFixed 00029 // Description : This template class is a special kind of AnimChannel 00030 // that always returns just one fixed value. It is a 00031 // special channel, in that it need not be assigned 00032 // within a hierarchy. It may stand alone, so that it 00033 // may be created on-the-fly for parts that need default 00034 // anims to bind against. 00035 //////////////////////////////////////////////////////////////////// 00036 template<class SwitchType> 00037 class AnimChannelFixed : public AnimChannel<SwitchType> { 00038 public: 00039 typedef TYPENAME AnimChannel<SwitchType>::ValueType ValueType; 00040 00041 INLINE AnimChannelFixed(AnimGroup *parent, const string &name, const ValueType &value); 00042 INLINE AnimChannelFixed(const string &name, const ValueType &value); 00043 00044 virtual bool has_changed(int last_frame, int this_frame); 00045 virtual void get_value(int frame, ValueType &value); 00046 00047 virtual void output(ostream &out) const; 00048 00049 ValueType _value; 00050 00051 public: 00052 virtual TypeHandle get_type() const { 00053 return get_class_type(); 00054 } 00055 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00056 static TypeHandle get_class_type() { 00057 return _type_handle; 00058 } 00059 static void init_type() { 00060 AnimChannel<SwitchType>::init_type(); 00061 register_type(_type_handle, SwitchType::get_fixed_channel_type_name(), 00062 AnimChannel<SwitchType>::get_class_type()); 00063 } 00064 00065 private: 00066 static TypeHandle _type_handle; 00067 }; 00068 00069 00070 #include "animChannelFixed.I" 00071 00072 #endif