# OgreKeyFrame.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-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029
    00030 #ifndef __KeyFrame_H__
    00031 #define __KeyFrame_H__
    00032
    00033 #include "OgrePrerequisites.h"
    00034 #include "OgreVector3.h"
    00035 #include "OgreQuaternion.h"
    00036 #include "OgreAny.h"
    00037 #include "OgreHardwareVertexBuffer.h"
    00038 #include "OgreIteratorWrappers.h"
    00039
    00040 namespace Ogre
    00041 {
    00042
    00050     class _OgreExport KeyFrame : public AnimationAlloc
    00051     {
    00052     public:
    00053
    00055         KeyFrame(const AnimationTrack* parent, Real time);
    00056
    00057         virtual ~KeyFrame() {}
    00058
    00060         Real getTime(void) const { return mTime; }
    00061
    00063         virtual KeyFrame* _clone(AnimationTrack* newParent) const;
    00064
    00065
    00066     protected:
    00067         Real mTime;
    00068         const AnimationTrack* mParentTrack;
    00069     };
    00070
    00071
    00074     class _OgreExport NumericKeyFrame : public KeyFrame
    00075     {
    00076     public:
    00078         NumericKeyFrame(const AnimationTrack* parent, Real time);
    00079         ~NumericKeyFrame() {}
    00080
    00082         virtual const AnyNumeric& getValue(void) const;
    00087         virtual void setValue(const AnyNumeric& val);
    00088
    00090         KeyFrame* _clone(AnimationTrack* newParent) const;
    00091     protected:
    00092         AnyNumeric mValue;
    00093     };
    00094
    00095
    00097     class _OgreExport TransformKeyFrame : public KeyFrame
    00098     {
    00099     public:
    00101         TransformKeyFrame(const AnimationTrack* parent, Real time);
    00102         ~TransformKeyFrame() {}
    00109         virtual void setTranslate(const Vector3& trans);
    00110
    00112         const Vector3& getTranslate(void) const;
    00113
    00119         virtual void setScale(const Vector3& scale);
    00120
    00122         virtual const Vector3& getScale(void) const;
    00123
    00128         virtual void setRotation(const Quaternion& rot);
    00129
    00131         virtual const Quaternion& getRotation(void) const;
    00132
    00134         KeyFrame* _clone(AnimationTrack* newParent) const;
    00135     protected:
    00136         Vector3 mTranslate;
    00137         Vector3 mScale;
    00138         Quaternion mRotate;
    00139
    00140
    00141     };
    00142
    00143
    00144
    00148     class _OgreExport VertexMorphKeyFrame : public KeyFrame
    00149     {
    00150     public:
    00152         VertexMorphKeyFrame(const AnimationTrack* parent, Real time);
    00153         ~VertexMorphKeyFrame() {}
    00161         void setVertexBuffer(const HardwareVertexBufferSharedPtr& buf);
    00162
    00164         const HardwareVertexBufferSharedPtr& getVertexBuffer(void) const;
    00165
    00167         KeyFrame* _clone(AnimationTrack* newParent) const;
    00168
    00169     protected:
    00170         HardwareVertexBufferSharedPtr mBuffer;
    00171
    00172     };
    00173
    00178     class _OgreExport VertexPoseKeyFrame : public KeyFrame
    00179     {
    00180     public:
    00182         VertexPoseKeyFrame(const AnimationTrack* parent, Real time);
    00183         ~VertexPoseKeyFrame() {}
    00184
    00189         struct PoseRef
    00190         {
    00198             ushort poseIndex;
    00202             Real influence;
    00203
    00204             PoseRef(ushort p, Real i) : poseIndex(p), influence(i) {}
    00205         };
    00206         typedef std::vector<PoseRef> PoseRefList;
    00207
    00211         void addPoseReference(ushort poseIndex, Real influence);
    00215         void updatePoseReference(ushort poseIndex, Real influence);
    00219         void removePoseReference(ushort poseIndex);
    00221         void removeAllPoseReferences(void);
    00222
    00223
    00225         const PoseRefList& getPoseReferences(void) const;
    00226
    00227         typedef VectorIterator<PoseRefList> PoseRefIterator;
    00228         typedef ConstVectorIterator<PoseRefList> ConstPoseRefIterator;
    00229
    00231         PoseRefIterator getPoseReferenceIterator(void);
    00232
    00234         ConstPoseRefIterator getPoseReferenceIterator(void) const;
    00235
    00237         KeyFrame* _clone(AnimationTrack* newParent) const;
    00238
    00239     protected:
    00240         PoseRefList mPoseRefs;
    00241
    00242     };
    00243
    00244 }
    00245
    00246
    00247 #endif
    00248

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Dec 27 17:31:05 2009