00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://ogre.sourceforge.net/ 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 { 00050 class _OgreExport AnimationTrack 00051 { 00052 public: 00054 AnimationTrack(Animation* parent); 00056 AnimationTrack(Animation* parent, Node* targetNode); 00057 00058 virtual ~AnimationTrack(); 00059 00061 unsigned short getNumKeyFrames(void) const; 00062 00064 KeyFrame* getKeyFrame(unsigned short index) const; 00065 00087 Real getKeyFramesAtTime(Real timePos, KeyFrame** keyFrame1, KeyFrame** keyFrame2, 00088 unsigned short* firstKeyIndex = 0) const; 00089 00097 KeyFrame* createKeyFrame(Real timePos); 00098 00100 void removeKeyFrame(unsigned short index); 00101 00103 void removeAllKeyFrames(void); 00104 00105 00117 KeyFrame getInterpolatedKeyFrame(Real timeIndex) const; 00118 00127 void apply(Real timePos, Real weight = 1.0, bool accumulate = false); 00128 00130 Node* getAssociatedNode(void) const; 00131 00133 void setAssociatedNode(Node* node); 00134 00136 void applyToNode(Node* node, Real timePos, Real weight = 1.0, bool accumulate = false); 00137 00138 00139 protected: 00140 typedef std::vector<KeyFrame*> KeyFrameList; 00141 KeyFrameList mKeyFrames; 00142 Real mMaxKeyFrameTime; 00143 Animation* mParent; 00144 Node* mTargetNode; 00145 00146 // Flag indicating we need to rebuild the splines next time 00147 void buildInterpolationSplines(void) const; 00148 00149 // Prebuilt splines, must be mutable since lazy-update in const method 00150 mutable bool mSplineBuildNeeded; 00151 mutable SimpleSpline mPositionSpline; 00152 mutable SimpleSpline mScaleSpline; 00153 mutable RotationalSpline mRotationSpline; 00154 00155 00156 }; 00157 } 00158 00159 #endif
Copyright © 2002 by The OGRE Team