1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef __KeyFrame_H__
|
---|
27 | #define __KeyFrame_H__
|
---|
28 |
|
---|
29 | #include "OgrePrerequisites.h"
|
---|
30 | #include "OgreVector3.h"
|
---|
31 | #include "OgreQuaternion.h"
|
---|
32 |
|
---|
33 | namespace Ogre
|
---|
34 | {
|
---|
35 |
|
---|
36 | /** A key frame in an animation sequence defined by an AnimationTrack.
|
---|
37 | @remarks
|
---|
38 | This class can be used as a basis for all kinds of key frames.
|
---|
39 | The unifying principle is that multiple KeyFrames define an
|
---|
40 | animation sequence, with the exact state of the animation being an
|
---|
41 | interpolation between these key frames.
|
---|
42 | */
|
---|
43 | class _OgreExport KeyFrame
|
---|
44 | {
|
---|
45 | public:
|
---|
46 |
|
---|
47 | /** Default constructor, you should not call this but use AnimationTrack::createKeyFrame instead. */
|
---|
48 | KeyFrame(const AnimationTrack* parent, Real time);
|
---|
49 |
|
---|
50 | /** Gets the time of this keyframe in the animation sequence. */
|
---|
51 | Real getTime(void) const;
|
---|
52 | /** Sets the translation associated with this keyframe.
|
---|
53 | @remarks
|
---|
54 | The translation factor affects how much the keyframe translates (moves) it's animable
|
---|
55 | object at it's time index.
|
---|
56 | @param trans The vector to translate by
|
---|
57 | */
|
---|
58 | void setTranslate(const Vector3& trans);
|
---|
59 |
|
---|
60 | /** Gets the translation applied by this keyframe. */
|
---|
61 | const Vector3& getTranslate(void) const;
|
---|
62 |
|
---|
63 | /** Sets the scaling factor applied by this keyframe to the animable
|
---|
64 | object at it's time index.
|
---|
65 | @param scale The vector to scale by (beware of supplying zero values for any component of this
|
---|
66 | vector, it will scale the object to zero dimensions)
|
---|
67 | */
|
---|
68 | void setScale(const Vector3& scale);
|
---|
69 |
|
---|
70 | /** Gets the scaling factor applied by this keyframe. */
|
---|
71 | const Vector3& getScale(void) const;
|
---|
72 |
|
---|
73 | /** Sets the rotation applied by this keyframe.
|
---|
74 | @param rot The rotation applied; use Quaternion methods to convert from angle/axis or Matrix3 if
|
---|
75 | you don't like using Quaternions directly.
|
---|
76 | */
|
---|
77 | void setRotation(const Quaternion& rot);
|
---|
78 |
|
---|
79 | /** Gets the rotation applied by this keyframe. */
|
---|
80 | const Quaternion& getRotation(void) const;
|
---|
81 |
|
---|
82 |
|
---|
83 | protected:
|
---|
84 | Real mTime;
|
---|
85 | Vector3 mTranslate;
|
---|
86 | Vector3 mScale;
|
---|
87 | Quaternion mRotate;
|
---|
88 | const AnimationTrack* mParentTrack;
|
---|
89 | };
|
---|
90 |
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|
94 | #endif
|
---|
95 |
|
---|