Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/lerp/lerp.h

Go to the documentation of this file.
00001 // Filename: lerp.h
00002 // Created by:  frang (18Apr00)
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 __LERP_H__
00020 #define __LERP_H__
00021 
00022 #include <pandabase.h>
00023 
00024 #include "lerpfunctor.h"
00025 #include "lerpblend.h"
00026 
00027 #include <typedReferenceCount.h>
00028 #include <eventHandler.h>
00029 
00030 class EXPCL_PANDA Lerp : public TypedReferenceCount {
00031 private:
00032   PT(LerpBlendType) _blend;
00033   PT(LerpFunctor) _func;
00034   std::string _event;
00035   float _startt;
00036   float _endt;
00037   float _delta;
00038   float _t;
00039 
00040 PUBLISHED:
00041   Lerp(LerpFunctor* func, float endt, LerpBlendType* blend);
00042   Lerp(LerpFunctor* func, float startt, float endt, LerpBlendType* blend);
00043   Lerp(const Lerp&);
00044   virtual ~Lerp(void);
00045   Lerp& operator=(const Lerp&);
00046   void step(void);
00047   void set_step_size(float);
00048   float get_step_size(void) const;
00049   void set_t(float);
00050   float get_t(void) const;
00051   bool is_done(void) const;
00052   LerpFunctor* get_functor(void) const;
00053   void set_end_event(const std::string&);
00054   std::string get_end_event(void) const;
00055 
00056 public:
00057   // now for typehandle stuff
00058   static TypeHandle get_class_type(void) {
00059     return _type_handle;
00060   }
00061   static void init_type(void) {
00062     TypedReferenceCount::init_type();
00063     register_type(_type_handle, "Lerp", TypedReferenceCount::get_class_type());
00064   }
00065   virtual TypeHandle get_type(void) const {
00066     return get_class_type();
00067   }
00068   virtual TypeHandle force_init_type(void) {
00069     init_type();
00070     return get_class_type();
00071   }
00072 private:
00073   static TypeHandle _type_handle;
00074 };
00075 
00076 class EXPCL_PANDA AutonomousLerp : public TypedReferenceCount {
00077 private:
00078   PT(LerpBlendType) _blend;
00079   PT(LerpFunctor) _func;
00080   EventHandler* _handler;
00081   std::string _event;
00082   float _startt;
00083   float _endt;
00084   float _t;
00085 
00086   virtual void step(void);
00087   static void handle_event(CPT(Event), void*);
00088 
00089 PUBLISHED:
00090   AutonomousLerp(LerpFunctor* func, float endt, LerpBlendType* blend,
00091                  EventHandler* handler);
00092   AutonomousLerp(LerpFunctor* func, float startt, float endt,
00093                  LerpBlendType* blend, EventHandler* handler);
00094   AutonomousLerp(const AutonomousLerp&);
00095   virtual ~AutonomousLerp(void);
00096   AutonomousLerp& operator=(const AutonomousLerp&);
00097   void start(void);
00098   void stop(void);
00099   void resume(void);
00100   bool is_done(void) const;
00101   LerpFunctor* get_functor(void) const;
00102   void set_t(float);
00103   float get_t(void) const;
00104   void set_end_event(const std::string&);
00105   std::string get_end_event(void) const;
00106 
00107 public:
00108   // now for typehandle stuff
00109   static TypeHandle get_class_type(void) {
00110     return _type_handle;
00111   }
00112   static void init_type(void) {
00113     TypedReferenceCount::init_type();
00114     register_type(_type_handle, "AutonomousLerp",
00115                   TypedReferenceCount::get_class_type());
00116   }
00117   virtual TypeHandle get_type(void) const {
00118     return get_class_type();
00119   }
00120   virtual TypeHandle force_init_type(void) {
00121     init_type();
00122     return get_class_type();
00123   }
00124 private:
00125   static TypeHandle _type_handle;
00126 };
00127 
00128 #endif /* __LERP_H__ */

Generated on Fri May 2 00:39:52 2003 for Panda by doxygen1.3