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

OgreAnimationTrack.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 © 2000-2002 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 __AnimationTrack_H__
00027 #define __AnimationTrack_H__
00028 
00029 #include "OgrePrerequisites.h"
00030 #include "OgreSimpleSpline.h"
00031 #include "OgreRotationalSpline.h"
00032 
00033 namespace Ogre 
00034 {
00054     class _OgreExport AnimationTrack
00055     {
00056     public:
00058         AnimationTrack(Animation* parent);
00060         AnimationTrack(Animation* parent, Node* targetNode);
00061 
00062         virtual ~AnimationTrack();
00063 
00065         unsigned short getNumKeyFrames(void) const;
00066 
00068         KeyFrame* getKeyFrame(unsigned short index) const;
00069 
00091         Real getKeyFramesAtTime(Real timePos, KeyFrame** keyFrame1, KeyFrame** keyFrame2,
00092             unsigned short* firstKeyIndex = 0) const;
00093 
00101         KeyFrame* createKeyFrame(Real timePos);
00102 
00104         void removeKeyFrame(unsigned short index);
00105 
00107         void removeAllKeyFrames(void);
00108 
00109 
00121         KeyFrame getInterpolatedKeyFrame(Real timeIndex) const;
00122 
00131         void apply(Real timePos, Real weight = 1.0, bool accumulate = false);
00132 
00134         Node* getAssociatedNode(void) const;
00135 
00137         void setAssociatedNode(Node* node);
00138 
00140         void applyToNode(Node* node, Real timePos, Real weight = 1.0, bool accumulate = false);
00141         
00143         void setUseShortestRotationPath(bool useShortestPath);
00144         
00146         bool getUseShortestRotationPath() const;
00147 
00148     protected:
00149         typedef std::vector<KeyFrame*> KeyFrameList;
00150         KeyFrameList mKeyFrames;
00151         Real mMaxKeyFrameTime;
00152         Animation* mParent;
00153         Node* mTargetNode;
00154 
00155         // Flag indicating we need to rebuild the splines next time
00156         void buildInterpolationSplines(void) const;
00157 
00158         // Prebuilt splines, must be mutable since lazy-update in const method
00159         mutable bool mSplineBuildNeeded;
00160         mutable SimpleSpline mPositionSpline;
00161         mutable SimpleSpline mScaleSpline;
00162         mutable RotationalSpline mRotationSpline;
00164         mutable bool mUseShortestRotationPath ;
00165       
00166 
00167     };
00168 }
00169 
00170 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:01 2004