Panda3D
 All Classes Functions Variables Enumerations
animChannelFixed.h
00001 // Filename: animChannelFixed.h
00002 // Created by:  drose (24Feb99)
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 ANIMCHANNELFIXED_H
00016 #define ANIMCHANNELFIXED_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "animChannel.h"
00021 
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : AnimChannelFixed
00025 // Description : This template class is a special kind of AnimChannel
00026 //               that always returns just one fixed value.  It is a
00027 //               special channel, in that it need not be assigned
00028 //               within a hierarchy.  It may stand alone, so that it
00029 //               may be created on-the-fly for parts that need default
00030 //               anims to bind against.
00031 ////////////////////////////////////////////////////////////////////
00032 template<class SwitchType>
00033 class AnimChannelFixed : public AnimChannel<SwitchType> {
00034 public:
00035   typedef TYPENAME AnimChannel<SwitchType>::ValueType ValueType;
00036 
00037 protected:
00038   INLINE AnimChannelFixed(AnimGroup *parent, const AnimChannelFixed<SwitchType> &copy);
00039 
00040 public:
00041   INLINE AnimChannelFixed(const string &name, const ValueType &value);
00042 
00043   virtual bool has_changed(int last_frame, double last_frac, 
00044                            int this_frame, double this_frac);
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
 All Classes Functions Variables Enumerations