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 virtual Real getTime(void) const; 00057 00058 00059 protected: 00060 Real mTime; 00061 const AnimationTrack* mParentTrack; 00062 }; 00063 00064 00067 class _OgreExport NumericKeyFrame : public KeyFrame 00068 { 00069 public: 00071 NumericKeyFrame(const AnimationTrack* parent, Real time); 00072 ~NumericKeyFrame() {} 00073 00075 virtual const AnyNumeric& getValue(void) const; 00080 virtual void setValue(const AnyNumeric& val); 00081 00082 protected: 00083 AnyNumeric mValue; 00084 }; 00085 00086 00088 class _OgreExport TransformKeyFrame : public KeyFrame 00089 { 00090 public: 00092 TransformKeyFrame(const AnimationTrack* parent, Real time); 00093 ~TransformKeyFrame() {} 00100 virtual void setTranslate(const Vector3& trans); 00101 00103 const Vector3& getTranslate(void) const; 00104 00110 virtual void setScale(const Vector3& scale); 00111 00113 virtual const Vector3& getScale(void) const; 00114 00119 virtual void setRotation(const Quaternion& rot); 00120 00122 virtual const Quaternion& getRotation(void) const; 00123 protected: 00124 Vector3 mTranslate; 00125 Vector3 mScale; 00126 Quaternion mRotate; 00127 00128 00129 }; 00130 00131 00132 00136 class _OgreExport VertexMorphKeyFrame : public KeyFrame 00137 { 00138 public: 00140 VertexMorphKeyFrame(const AnimationTrack* parent, Real time); 00141 ~VertexMorphKeyFrame() {} 00149 void setVertexBuffer(const HardwareVertexBufferSharedPtr& buf); 00150 00152 const HardwareVertexBufferSharedPtr& getVertexBuffer(void) const; 00153 00154 protected: 00155 HardwareVertexBufferSharedPtr mBuffer; 00156 00157 }; 00158 00163 class _OgreExport VertexPoseKeyFrame : public KeyFrame 00164 { 00165 public: 00167 VertexPoseKeyFrame(const AnimationTrack* parent, Real time); 00168 ~VertexPoseKeyFrame() {} 00169 00174 struct PoseRef 00175 { 00183 ushort poseIndex; 00187 Real influence; 00188 00189 PoseRef(ushort p, Real i) : poseIndex(p), influence(i) {} 00190 }; 00191 typedef std::vector<PoseRef> PoseRefList; 00192 00196 void addPoseReference(ushort poseIndex, Real influence); 00200 void updatePoseReference(ushort poseIndex, Real influence); 00204 void removePoseReference(ushort poseIndex); 00206 void removeAllPoseReferences(void); 00207 00208 00210 const PoseRefList& getPoseReferences(void) const; 00211 00212 typedef VectorIterator<PoseRefList> PoseRefIterator; 00213 typedef ConstVectorIterator<PoseRefList> ConstPoseRefIterator; 00214 00216 PoseRefIterator getPoseReferenceIterator(void); 00217 00219 ConstPoseRefIterator getPoseReferenceIterator(void) const; 00220 protected: 00221 PoseRefList mPoseRefs; 00222 00223 }; 00224 00225 } 00226 00227 00228 #endif 00229
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:43 2006