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
    00150         void _keyFrameDataChanged(void) const;
    00151
    00152     protected:
    00153         typedef std::vector<KeyFrame*> KeyFrameList;
    00154         KeyFrameList mKeyFrames;
    00155         Real mMaxKeyFrameTime;
    00156         Animation* mParent;
    00157         Node* mTargetNode;
    00158
    00159         // Flag indicating we need to rebuild the splines next time
    00160         void buildInterpolationSplines(void) const;
    00161
    00162         // Prebuilt splines, must be mutable since lazy-update in const method
    00163         mutable bool mSplineBuildNeeded;
    00164         mutable SimpleSpline mPositionSpline;
    00165         mutable SimpleSpline mScaleSpline;
    00166         mutable RotationalSpline mRotationSpline;
    00168         mutable bool mUseShortestRotationPath ;
    00169
    00170
    00171     };
    00172 }
    00173
    00174 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:14 2004