# 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
    00122         void apply(Real timePos, Real weight = 1.0, bool accumulate = false,
    00123             Real scale = 1.0f);
    00124
    00135         void apply(Skeleton* skeleton, Real timePos, Real weight = 1.0,
    00136             bool accumulate = false, Real scale = 1.0f);
    00137
    00150         void setInterpolationMode(InterpolationMode im);
    00151
    00156         InterpolationMode getInterpolationMode(void) const;
    00167         void setRotationInterpolationMode(RotationInterpolationMode im);
    00168
    00173         RotationInterpolationMode getRotationInterpolationMode(void) const;
    00174
    00175         // Methods for setting the defaults
    00182         static void setDefaultInterpolationMode(InterpolationMode im);
    00183
    00185         static InterpolationMode getDefaultInterpolationMode(void);
    00186
    00193         static void setDefaultRotationInterpolationMode(RotationInterpolationMode im);
    00194
    00196         static RotationInterpolationMode getDefaultRotationInterpolationMode(void);
    00197
    00198         typedef std::map<unsigned short, AnimationTrack*> TrackList;
    00199         typedef ConstMapIterator<TrackList> TrackIterator;
    00200
    00202         const TrackList& _getTrackList(void) const;
    00203
    00205         TrackIterator getTrackIterator(void) const
    00206         { return TrackIterator(mTrackList.begin(), mTrackList.end()); }
    00207
    00217         void optimise(void);
    00218
    00219
    00220
    00221     protected:
    00223         TrackList mTrackList;
    00224         String mName;
    00225
    00226         Real mLength;
    00227
    00228         InterpolationMode mInterpolationMode;
    00229         RotationInterpolationMode mRotationInterpolationMode;
    00230
    00231         static InterpolationMode msDefaultInterpolationMode;
    00232         static RotationInterpolationMode msDefaultRotationInterpolationMode;
    00233
    00234
    00235     };
    00236
    00237
    00238
    00239 }
    00240
    00241
    00242 #endif
    00243

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:41 2006