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-2012 Torus Knot Software Ltd
00008 
00009 Permission is hereby granted, free of charge, to any person obtaining a copy
00010 of this software and associated documentation files (the "Software"), to deal
00011 in the Software without restriction, including without limitation the rights
00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00013 copies of the Software, and to permit persons to whom the Software is
00014 furnished to do so, subject to the following conditions:
00015 
00016 The above copyright notice and this permission notice shall be included in
00017 all copies or substantial portions of the Software.
00018 
00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00025 THE SOFTWARE.
00026 -----------------------------------------------------------------------------
00027 */
00028 
00029 #ifndef __KeyFrame_H__
00030 #define __KeyFrame_H__
00031 
00032 #include "OgrePrerequisites.h"
00033 #include "OgreVector3.h"
00034 #include "OgreQuaternion.h"
00035 #include "OgreAny.h"
00036 #include "OgreHardwareVertexBuffer.h"
00037 #include "OgreIteratorWrappers.h"
00038 
00039 namespace Ogre 
00040 {
00041 
00055     class _OgreExport KeyFrame : public AnimationAlloc
00056     {
00057     public:
00058 
00060         KeyFrame(const AnimationTrack* parent, Real time);
00061 
00062         virtual ~KeyFrame() {}
00063 
00065         Real getTime(void) const { return mTime; }
00066 
00068         virtual KeyFrame* _clone(AnimationTrack* newParent) const;
00069 
00070 
00071     protected:
00072         Real mTime;
00073         const AnimationTrack* mParentTrack;
00074     };
00075 
00076 
00079     class _OgreExport NumericKeyFrame : public KeyFrame
00080     {
00081     public:
00083         NumericKeyFrame(const AnimationTrack* parent, Real time);
00084         ~NumericKeyFrame() {}
00085 
00087         virtual const AnyNumeric& getValue(void) const;
00092         virtual void setValue(const AnyNumeric& val);
00093 
00095         KeyFrame* _clone(AnimationTrack* newParent) const;
00096     protected:
00097         AnyNumeric mValue;
00098     };
00099 
00100 
00102     class _OgreExport TransformKeyFrame : public KeyFrame
00103     {
00104     public:
00106         TransformKeyFrame(const AnimationTrack* parent, Real time);
00107         ~TransformKeyFrame() {}
00114         virtual void setTranslate(const Vector3& trans);
00115 
00117         const Vector3& getTranslate(void) const;
00118 
00124         virtual void setScale(const Vector3& scale);
00125 
00127         virtual const Vector3& getScale(void) const;
00128 
00133         virtual void setRotation(const Quaternion& rot);
00134 
00136         virtual const Quaternion& getRotation(void) const;
00137 
00139         KeyFrame* _clone(AnimationTrack* newParent) const;
00140     protected:
00141         Vector3 mTranslate;
00142         Vector3 mScale;
00143         Quaternion mRotate;
00144 
00145 
00146     };
00147 
00148 
00149 
00153     class _OgreExport VertexMorphKeyFrame : public KeyFrame
00154     {
00155     public:
00157         VertexMorphKeyFrame(const AnimationTrack* parent, Real time);
00158         ~VertexMorphKeyFrame() {}
00166         void setVertexBuffer(const HardwareVertexBufferSharedPtr& buf);
00167 
00169         const HardwareVertexBufferSharedPtr& getVertexBuffer(void) const;
00170 
00172         KeyFrame* _clone(AnimationTrack* newParent) const;      
00173 
00174     protected:
00175         HardwareVertexBufferSharedPtr mBuffer;
00176 
00177     };
00178 
00183     class _OgreExport VertexPoseKeyFrame : public KeyFrame
00184     {
00185     public:
00187         VertexPoseKeyFrame(const AnimationTrack* parent, Real time);
00188         ~VertexPoseKeyFrame() {}
00189 
00194         struct PoseRef
00195         {
00203             ushort poseIndex;
00207             Real influence;
00208 
00209             PoseRef(ushort p, Real i) : poseIndex(p), influence(i) {}
00210         };
00211         typedef vector<PoseRef>::type PoseRefList;
00212 
00216         void addPoseReference(ushort poseIndex, Real influence);
00220         void updatePoseReference(ushort poseIndex, Real influence);
00224         void removePoseReference(ushort poseIndex);
00226         void removeAllPoseReferences(void);
00227 
00228 
00230         const PoseRefList& getPoseReferences(void) const;
00231 
00232         typedef VectorIterator<PoseRefList> PoseRefIterator;
00233         typedef ConstVectorIterator<PoseRefList> ConstPoseRefIterator;
00234 
00236         PoseRefIterator getPoseReferenceIterator(void);
00237 
00239         ConstPoseRefIterator getPoseReferenceIterator(void) const;
00240 
00242         KeyFrame* _clone(AnimationTrack* newParent) const;
00243         
00244         void _applyBaseKeyFrame(const VertexPoseKeyFrame* base);
00245         
00246     protected:
00247         PoseRefList mPoseRefs;
00248 
00249     };
00253 }
00254 
00255 
00256 #endif
00257 

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:24 2012