# 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 (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 __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
    00133         void apply(Real timePos, Real weight = 1.0, bool accumulate = false,
    00134             Real scale = 1.0f);
    00135
    00137         Node* getAssociatedNode(void) const;
    00138
    00140         void setAssociatedNode(Node* node);
    00141
    00143         void applyToNode(Node* node, Real timePos, Real weight = 1.0,
    00144             bool accumulate = false, Real scale = 1.0f);
    00145
    00147         void setUseShortestRotationPath(bool useShortestPath);
    00148
    00150         bool getUseShortestRotationPath() const;
    00151
    00154         void _keyFrameDataChanged(void) const;
    00155
    00160         bool hasNonZeroKeyFrames(void) const;
    00161
    00163         void optimise(void);
    00164     protected:
    00165         typedef std::vector<KeyFrame*> KeyFrameList;
    00166         KeyFrameList mKeyFrames;
    00167         Real mMaxKeyFrameTime;
    00168         Animation* mParent;
    00169         Node* mTargetNode;
    00170
    00171         // Flag indicating we need to rebuild the splines next time
    00172         void buildInterpolationSplines(void) const;
    00173
    00174         // Prebuilt splines, must be mutable since lazy-update in const method
    00175         mutable bool mSplineBuildNeeded;
    00176         mutable SimpleSpline mPositionSpline;
    00177         mutable SimpleSpline mScaleSpline;
    00178         mutable RotationalSpline mRotationSpline;
    00180         mutable bool mUseShortestRotationPath ;
    00181
    00182
    00183     };
    00184 }
    00185
    00186 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:35:56 2005