cameraAnimation.h

00001 
00002 /* Copyright (c) 2009, Maxim Makhinya
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #ifndef EQ_PLY_CAMERAANIMATION_H
00019 #define EQ_PLY_CAMERAANIMATION_H
00020 #include <eq/eq.h>
00021 #include <eq/base/base.h>
00022 #include <math.h>
00023 #include <string>
00024 
00025 namespace eqPly
00026 {
00027 
00032     class CameraAnimation
00033     {
00034     public:
00035         struct Step;
00036 
00037         CameraAnimation() : _curStep( 0 ), _curFrame( 0 ) {}
00038 
00039         bool loadAnimation( const std::string& fileName );
00040 
00041         bool isValid() const { return !_steps.empty(); }
00042 
00043         Step getNextStep();
00044 
00045         const eq::Vector3f& getModelRotation() const { return _modelRotation;}
00046 
00047         struct Step
00048         {
00049             Step()
00050                 : frame( 0 )
00051                 , translation( eq::Vector3f( .0f, .0f, -1.0f ))
00052                 , rotation(    eq::Vector3f( .0f, .0f,   .0f )){}
00053 
00054             Step( int frame_, const eq::Vector3f& translation_,
00055                               const eq::Vector3f& rotation_  )
00056                 : frame( frame_ )
00057                 , translation( translation_ ),
00058                   rotation( rotation_ ){}
00059 
00060             int frame;
00061             eq::Vector3f translation;
00062             eq::Vector3f rotation;
00063         };
00064 
00065     private:
00066         eq::Vector3f        _modelRotation;
00067         std::vector< Step > _steps;
00068         uint32_t            _curStep;
00069         int32_t             _curFrame;
00070     };
00071 
00072 }
00073 
00074 #endif // EQ_PLY_CAMERAANIMATION_H
00075 
Generated on Sat Feb 6 12:59:42 2010 for Equalizer 0.9.1 by  doxygen 1.6.1