Panda3D
|
00001 // Filename: cLerpInterval.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 CLERPINTERVAL_H 00016 #define CLERPINTERVAL_H 00017 00018 #include "directbase.h" 00019 #include "cInterval.h" 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Class : CLerpInterval 00023 // Description : The base class for a family of intervals that 00024 // linearly interpolate one or more numeric values over 00025 // time. 00026 //////////////////////////////////////////////////////////////////// 00027 class EXPCL_DIRECT CLerpInterval : public CInterval { 00028 PUBLISHED: 00029 enum BlendType { 00030 BT_no_blend, 00031 BT_ease_in, 00032 BT_ease_out, 00033 BT_ease_in_out, 00034 BT_invalid 00035 }; 00036 00037 public: 00038 INLINE CLerpInterval(const string &name, double duration, 00039 BlendType blend_type); 00040 00041 PUBLISHED: 00042 INLINE BlendType get_blend_type() const; 00043 00044 static BlendType string_blend_type(const string &blend_type); 00045 00046 protected: 00047 double compute_delta(double t) const; 00048 00049 private: 00050 BlendType _blend_type; 00051 00052 00053 public: 00054 static TypeHandle get_class_type() { 00055 return _type_handle; 00056 } 00057 static void init_type() { 00058 CInterval::init_type(); 00059 register_type(_type_handle, "CLerpInterval", 00060 CInterval::get_class_type()); 00061 } 00062 virtual TypeHandle get_type() const { 00063 return get_class_type(); 00064 } 00065 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00066 00067 private: 00068 static TypeHandle _type_handle; 00069 }; 00070 00071 #include "cLerpInterval.I" 00072 00073 #endif 00074