Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreAnimation.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2005 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 
00026 #ifndef __Animation_H__
00027 #define __Animation_H__
00028 
00029 #include "OgrePrerequisites.h"
00030 #include "OgreString.h"
00031 #include "OgreIteratorWrappers.h"
00032 
00033 namespace Ogre {
00034 
00045     class _OgreExport Animation
00046     {
00047 
00048     public:
00050         enum InterpolationMode
00051         {
00053             IM_LINEAR,
00055             IM_SPLINE
00056         };
00057 
00059         enum RotationInterpolationMode
00060         {
00064             RIM_LINEAR,
00068             RIM_SPHERICAL
00069         };
00074         Animation(const String& name, Real length);
00075         virtual ~Animation();
00076 
00078         const String& getName(void) const;
00079 
00081         Real getLength(void) const;
00082 
00087         AnimationTrack* createTrack(unsigned short handle);
00088 
00097         AnimationTrack* createTrack(unsigned short handle, Node* node);
00098 
00100         unsigned short getNumTracks(void) const;
00101 
00103         AnimationTrack* getTrack(unsigned short handle) const;
00104 
00105 
00107         void destroyTrack(unsigned short handle);
00108 
00110         void destroyAllTracks(void);
00111 
00120         void apply(Real timePos, Real weight = 1.0, bool accumulate = false);
00121 
00130         void apply(Skeleton* skeleton, Real timePos, Real weight = 1.0, bool accumulate = false);
00131 
00144         void setInterpolationMode(InterpolationMode im);
00145 
00150         InterpolationMode getInterpolationMode(void) const;
00161         void setRotationInterpolationMode(RotationInterpolationMode im);
00162 
00167         RotationInterpolationMode getRotationInterpolationMode(void) const;
00168 
00169         // Methods for setting the defaults
00176         static void setDefaultInterpolationMode(InterpolationMode im);
00177 
00179         static InterpolationMode getDefaultInterpolationMode(void);
00180 
00187         static void setDefaultRotationInterpolationMode(RotationInterpolationMode im);
00188 
00190         static RotationInterpolationMode getDefaultRotationInterpolationMode(void);
00191 
00192         typedef std::map<unsigned short, AnimationTrack*> TrackList;
00193         typedef ConstMapIterator<TrackList> TrackIterator;
00194 
00196         const TrackList& _getTrackList(void) const;
00197 
00199         TrackIterator getTrackIterator(void) const
00200         { return TrackIterator(mTrackList.begin(), mTrackList.end()); }
00201         
00202 
00203 
00204 
00205     protected:
00207         TrackList mTrackList;
00208         String mName;
00209 
00210         Real mLength;
00211 
00212         InterpolationMode mInterpolationMode;
00213         RotationInterpolationMode mRotationInterpolationMode;
00214 
00215         static InterpolationMode msDefaultInterpolationMode;
00216         static RotationInterpolationMode msDefaultRotationInterpolationMode;
00217 
00218         
00219     };
00220 
00221 
00222 
00223 }
00224 
00225 
00226 #endif
00227 

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Apr 10 23:21:11 2005