00001 #ifndef NODE_INTERP_H 00002 #define NODE_INTERP_H 00003 00004 /* 00005 00006 GLT OpenGL C++ Toolkit (LGPL) 00007 Copyright (C) 2000-2002 Nigel Stewart 00008 00009 Email: nigels.com@gmail.com 00010 WWW: http://www.nigels.com/glt/ 00011 00012 This library is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU Lesser General Public 00014 License as published by the Free Software Foundation; either 00015 version 2.1 of the License, or (at your option) any later version. 00016 00017 This library is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 Lesser General Public License for more details. 00021 00022 You should have received a copy of the GNU Lesser General Public 00023 License along with this library; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 00026 */ 00027 00033 #include <glt/colmap.h> 00034 00035 #include <node/shape.h> 00036 #include <misc/timer.h> 00037 00038 class GltColor; 00039 class Matrix; 00040 00046 class GltInterpolator : public GltShape 00047 { 00048 public: 00049 GltInterpolator(); 00050 virtual ~GltInterpolator(); 00051 00053 void start(const double duration,const bool loop = false); 00054 00056 void start(const bool loop = false); 00057 00059 void stop(); 00060 00062 void restart(void); 00063 00064 // 00065 // Get/Set 00066 // 00067 00068 const bool &active() const; 00069 const bool &loop() const; 00070 const bool &realTime() const; 00071 const double &duration() const; 00072 const int &frame() const; 00073 00074 bool &active(); 00075 bool &loop(); 00076 bool &realTime(); 00077 double &duration(); 00078 int &frame(); 00079 00080 protected: 00081 bool _active; 00082 bool _loop; 00083 bool _realTime; 00084 Timer _timer; 00085 double _duration; 00086 int _frame; 00087 }; 00088 00095 class GltInterpolatorColor : public GltInterpolator 00096 { 00097 public: 00098 GltInterpolatorColor(GltColor &color); 00099 ~GltInterpolatorColor(); 00100 00101 virtual void draw() const; 00102 00103 GltColorMap &colorMap(); 00104 const GltColorMap &colorMap() const; 00105 00106 private: 00107 GltColor &_color; 00108 GltColorMap _colorMap; 00109 }; 00110 00117 class GltInterpolatorRotation : public GltInterpolator 00118 { 00119 public: 00120 GltInterpolatorRotation(Matrix &matrix); 00121 ~GltInterpolatorRotation(); 00122 00123 virtual void draw() const; 00124 00125 Vector &axis(); 00126 const Vector &axis() const; 00127 00128 Vector ¢er(); 00129 const Vector ¢er() const; 00130 00131 private: 00132 Matrix &_matrix; 00133 Vector _axis; 00134 Vector _center; 00135 }; 00136 00137 #endif