Panda3D
 All Classes Functions Variables Enumerations
cLerpAnimEffectInterval.h
00001 // Filename: cLerpAnimEffectInterval.h
00002 // Created by:  drose (27Aug02)
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 CLERPANIMEFFECTINTERVAL_H
00016 #define CLERPANIMEFFECTINTERVAL_H
00017 
00018 #include "directbase.h"
00019 #include "cLerpInterval.h"
00020 #include "animControl.h"
00021 #include "pointerTo.h"
00022 #include "pvector.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : CLerpAnimEffectInterval
00026 // Description : This interval lerps between different amounts of
00027 //               control effects for various AnimControls that might
00028 //               be playing on an actor.  It's used to change the
00029 //               blending amount between multiple animations.
00030 //
00031 //               The idea is to start all the animations playing
00032 //               first, then use a CLerpAnimEffectInterval to adjust
00033 //               the degree to which each animation affects the actor.
00034 ////////////////////////////////////////////////////////////////////
00035 class EXPCL_DIRECT CLerpAnimEffectInterval : public CLerpInterval {
00036 PUBLISHED:
00037   INLINE CLerpAnimEffectInterval(const string &name, double duration, 
00038                                  BlendType blend_type);
00039 
00040   INLINE void add_control(AnimControl *control, const string &name,
00041                           float begin_effect, float end_effect);
00042 
00043   virtual void priv_step(double t);
00044 
00045   virtual void output(ostream &out) const;
00046 
00047 private:
00048   class ControlDef {
00049   public:
00050     INLINE ControlDef(AnimControl *control, const string &name,
00051                       float begin_effect, float end_effect);
00052     PT(AnimControl) _control;
00053     string _name;
00054     float _begin_effect;
00055     float _end_effect;
00056   };
00057     
00058   typedef pvector<ControlDef> Controls;
00059   Controls _controls;
00060   
00061 
00062 public:
00063   static TypeHandle get_class_type() {
00064     return _type_handle;
00065   }
00066   static void init_type() {
00067     CLerpInterval::init_type();
00068     register_type(_type_handle, "CLerpAnimEffectInterval",
00069                   CLerpInterval::get_class_type());
00070   }
00071   virtual TypeHandle get_type() const {
00072     return get_class_type();
00073   }
00074   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00075 
00076 private:
00077   static TypeHandle _type_handle;
00078 };
00079 
00080 #include "cLerpAnimEffectInterval.I"
00081 
00082 #endif
00083 
 All Classes Functions Variables Enumerations