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 __KeyFrame_H__ 00027 #define __KeyFrame_H__ 00028 00029 #include "OgrePrerequisites.h" 00030 #include "OgreVector3.h" 00031 #include "OgreQuaternion.h" 00032 #include "OgreAny.h" 00033 #include "OgreHardwareVertexBuffer.h" 00034 #include "OgreIteratorWrappers.h" 00035 00036 namespace Ogre 00037 { 00038 00046 class _OgreExport KeyFrame 00047 { 00048 public: 00049 00051 KeyFrame(const AnimationTrack* parent, Real time); 00052 00053 virtual ~KeyFrame() {} 00054 00056 Real getTime(void) const { return mTime; } 00057 00059 virtual KeyFrame* _clone(AnimationTrack* newParent) const; 00060 00061 00062 protected: 00063 Real mTime; 00064 const AnimationTrack* mParentTrack; 00065 }; 00066 00067 00070 class _OgreExport NumericKeyFrame : public KeyFrame 00071 { 00072 public: 00074 NumericKeyFrame(const AnimationTrack* parent, Real time); 00075 ~NumericKeyFrame() {} 00076 00078 virtual const AnyNumeric& getValue(void) const; 00083 virtual void setValue(const AnyNumeric& val); 00084 00086 KeyFrame* _clone(AnimationTrack* newParent) const; 00087 protected: 00088 AnyNumeric mValue; 00089 }; 00090 00091 00093 class _OgreExport TransformKeyFrame : public KeyFrame 00094 { 00095 public: 00097 TransformKeyFrame(const AnimationTrack* parent, Real time); 00098 ~TransformKeyFrame() {} 00105 virtual void setTranslate(const Vector3& trans); 00106 00108 const Vector3& getTranslate(void) const; 00109 00115 virtual void setScale(const Vector3& scale); 00116 00118 virtual const Vector3& getScale(void) const; 00119 00124 virtual void setRotation(const Quaternion& rot); 00125 00127 virtual const Quaternion& getRotation(void) const; 00128 00130 KeyFrame* _clone(AnimationTrack* newParent) const; 00131 protected: 00132 Vector3 mTranslate; 00133 Vector3 mScale; 00134 Quaternion mRotate; 00135 00136 00137 }; 00138 00139 00140 00144 class _OgreExport VertexMorphKeyFrame : public KeyFrame 00145 { 00146 public: 00148 VertexMorphKeyFrame(const AnimationTrack* parent, Real time); 00149 ~VertexMorphKeyFrame() {} 00157 void setVertexBuffer(const HardwareVertexBufferSharedPtr& buf); 00158 00160 const HardwareVertexBufferSharedPtr& getVertexBuffer(void) const; 00161 00163 KeyFrame* _clone(AnimationTrack* newParent) const; 00164 00165 protected: 00166 HardwareVertexBufferSharedPtr mBuffer; 00167 00168 }; 00169 00174 class _OgreExport VertexPoseKeyFrame : public KeyFrame 00175 { 00176 public: 00178 VertexPoseKeyFrame(const AnimationTrack* parent, Real time); 00179 ~VertexPoseKeyFrame() {} 00180 00185 struct PoseRef 00186 { 00194 ushort poseIndex; 00198 Real influence; 00199 00200 PoseRef(ushort p, Real i) : poseIndex(p), influence(i) {} 00201 }; 00202 typedef std::vector<PoseRef> PoseRefList; 00203 00207 void addPoseReference(ushort poseIndex, Real influence); 00211 void updatePoseReference(ushort poseIndex, Real influence); 00215 void removePoseReference(ushort poseIndex); 00217 void removeAllPoseReferences(void); 00218 00219 00221 const PoseRefList& getPoseReferences(void) const; 00222 00223 typedef VectorIterator<PoseRefList> PoseRefIterator; 00224 typedef ConstVectorIterator<PoseRefList> ConstPoseRefIterator; 00225 00227 PoseRefIterator getPoseReferenceIterator(void); 00228 00230 ConstPoseRefIterator getPoseReferenceIterator(void) const; 00231 00233 KeyFrame* _clone(AnimationTrack* newParent) const; 00234 00235 protected: 00236 PoseRefList mPoseRefs; 00237 00238 }; 00239 00240 } 00241 00242 00243 #endif 00244
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jan 21 10:01:37 2007