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-2013 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 #include "OgreHeaderPrefix.h" 00039 00040 namespace Ogre 00041 { 00042 00056 class _OgreExport KeyFrame : public AnimationAlloc 00057 { 00058 public: 00059 00061 KeyFrame(const AnimationTrack* parent, Real time); 00062 00063 virtual ~KeyFrame() {} 00064 00066 Real getTime(void) const { return mTime; } 00067 00069 virtual KeyFrame* _clone(AnimationTrack* newParent) const; 00070 00071 00072 protected: 00073 Real mTime; 00074 const AnimationTrack* mParentTrack; 00075 }; 00076 00077 00080 class _OgreExport NumericKeyFrame : public KeyFrame 00081 { 00082 public: 00084 NumericKeyFrame(const AnimationTrack* parent, Real time); 00085 ~NumericKeyFrame() {} 00086 00088 virtual const AnyNumeric& getValue(void) const; 00093 virtual void setValue(const AnyNumeric& val); 00094 00096 KeyFrame* _clone(AnimationTrack* newParent) const; 00097 protected: 00098 AnyNumeric mValue; 00099 }; 00100 00101 00103 class _OgreExport TransformKeyFrame : public KeyFrame 00104 { 00105 public: 00107 TransformKeyFrame(const AnimationTrack* parent, Real time); 00108 ~TransformKeyFrame() {} 00115 virtual void setTranslate(const Vector3& trans); 00116 00118 const Vector3& getTranslate(void) const; 00119 00125 virtual void setScale(const Vector3& scale); 00126 00128 virtual const Vector3& getScale(void) const; 00129 00134 virtual void setRotation(const Quaternion& rot); 00135 00137 virtual const Quaternion& getRotation(void) const; 00138 00140 KeyFrame* _clone(AnimationTrack* newParent) const; 00141 protected: 00142 Vector3 mTranslate; 00143 Vector3 mScale; 00144 Quaternion mRotate; 00145 00146 00147 }; 00148 00149 00150 00154 class _OgreExport VertexMorphKeyFrame : public KeyFrame 00155 { 00156 public: 00158 VertexMorphKeyFrame(const AnimationTrack* parent, Real time); 00159 ~VertexMorphKeyFrame() {} 00167 void setVertexBuffer(const HardwareVertexBufferSharedPtr& buf); 00168 00170 const HardwareVertexBufferSharedPtr& getVertexBuffer(void) const; 00171 00173 KeyFrame* _clone(AnimationTrack* newParent) const; 00174 00175 protected: 00176 HardwareVertexBufferSharedPtr mBuffer; 00177 00178 }; 00179 00184 class _OgreExport VertexPoseKeyFrame : public KeyFrame 00185 { 00186 public: 00188 VertexPoseKeyFrame(const AnimationTrack* parent, Real time); 00189 ~VertexPoseKeyFrame() {} 00190 00195 struct PoseRef 00196 { 00204 ushort poseIndex; 00208 Real influence; 00209 00210 PoseRef(ushort p, Real i) : poseIndex(p), influence(i) {} 00211 }; 00212 typedef vector<PoseRef>::type PoseRefList; 00213 00217 void addPoseReference(ushort poseIndex, Real influence); 00221 void updatePoseReference(ushort poseIndex, Real influence); 00225 void removePoseReference(ushort poseIndex); 00227 void removeAllPoseReferences(void); 00228 00229 00231 const PoseRefList& getPoseReferences(void) const; 00232 00233 typedef VectorIterator<PoseRefList> PoseRefIterator; 00234 typedef ConstVectorIterator<PoseRefList> ConstPoseRefIterator; 00235 00237 PoseRefIterator getPoseReferenceIterator(void); 00238 00240 ConstPoseRefIterator getPoseReferenceIterator(void) const; 00241 00243 KeyFrame* _clone(AnimationTrack* newParent) const; 00244 00245 void _applyBaseKeyFrame(const VertexPoseKeyFrame* base); 00246 00247 protected: 00248 PoseRefList mPoseRefs; 00249 00250 }; 00254 } 00255 00256 #include "OgreHeaderSuffix.h" 00257 00258 #endif 00259
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:43