KeosAnimatedMeshKF.h

Go to the documentation of this file.
00001 /*
00002  * This source file is part of KEOS (Free 3D Engine)
00003  * For the latest info, see http://www.keosengine.org/
00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License as published by the Free Software
00008  * Foundation; either version 2 of the License, or (at your option) any later
00009  * version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00018  * http://www.gnu.org/copyleft/lesser.txt.
00019  *
00020  */
00021 #ifndef KEOS_ANIMATEDMESHKF_H
00022 #define KEOS_ANIMATEDMESHKF_H
00023 
00024 #include "KeosPrerequisites.h"
00025 #include "KeosMesh.h"
00026 
00027 namespace Keos
00028 {
00029   //-----------------------------------------------------------------------
00032   class CAnimationInfoKF
00033   {
00034   public:
00035     int Begin;
00036     int End;
00037     int Fps;
00038 
00039     CAnimationInfoKF()
00040     {
00041       Begin = 0;
00042       End = 0;
00043       Fps = 0;
00044     }
00045 
00046     CAnimationInfoKF(int nBegin, int nEnd, int nFps)
00047     {
00048       Begin = nBegin;
00049       End = nEnd;
00050       Fps = nFps;
00051     }
00052   };
00053 
00054   //-----------------------------------------------------------------------
00057   class KEOS_EXPORT CAnimatedMeshKF : public CMesh
00058   {
00059   public :
00060 
00064     CAnimatedMeshKF(std::vector<CMeshGeom::TVertex> Frames);
00065 
00068     ~CAnimatedMeshKF();
00069 
00073     void Animate(float fPercent);
00074 
00078     void SetAnimation(uint nAnimIndex) ;
00079 
00082     uint GetAnimation()
00083     {
00084       return m_nCurrentAnimation;
00085     }
00086 
00090     void AddAnimation(const CAnimationInfoKF& AnimationInfo);
00091 
00094     size_t GetNumberOfAnimations()
00095     {
00096       return m_AnimationVector.size();
00097     }
00098 
00099   private :
00100 
00102     void LinearInterpolation();
00103 
00105     std::vector<CMeshGeom::TVertex> m_Frames;
00106 
00108     int m_nCurrFrame;
00109     int m_nNextFrame;
00110     float m_fInterp;
00111     float m_fPercent;
00112 
00114     std::vector<CAnimationInfoKF> m_AnimationVector;
00115 
00117     int m_nCurrentAnimation;
00118 
00119   };
00120 
00122   typedef CSmartPtr<CAnimatedMeshKF, CRefCount> TAnimatedMeshKFPtr;
00123 
00124 } // namespace Keos
00125 
00126 
00127 #endif // KEOS_ANIMATEDMESHKF_H

Generated on Fri Mar 9 14:29:01 2007 for Keos by  doxygen 1.5.1-p1