OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreSkeletonAnimation.h
Go to the documentation of this file.
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-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __SkeletonAnimation_H__
30 #define __SkeletonAnimation_H__
31 
32 #include "OgreSkeletonTrack.h"
33 #include "OgreIdString.h"
34 
35 #include "OgreRawPtr.h"
36 
37 #include "OgreHeaderPrefix.h"
38 
39 namespace Ogre
40 {
41  class SkeletonAnimationDef;
43 
45 
55  {
57  protected:
60  public:
61  Real mFrameRate; // Playback framerate
63  FastArray<size_t> const *mSlotStarts; // One per parent depth level
64  bool mLoop;
65  bool mEnabled;
67  protected:
69 
72 
73  public:
74  SkeletonAnimation( const SkeletonAnimationDef *definition, const FastArray<size_t> *slotStarts,
75  SkeletonInstance *owner );
76 
78  void initialize(void);
79 
84  void addTime( Real time ) { addFrame( time * mFrameRate ); }
85 
90  void addFrame( Real frames );
91 
93  Real getCurrentTime( Real time ) const { return mCurrentFrame / mFrameRate; }
94 
96  Real getCurrentFrame( Real time ) const { return mCurrentFrame; }
97 
98  IdString getName(void) const { return mName; }
99 
105  void setLoop( bool bLoop ) { mLoop = bLoop; }
106 
109  bool getLoop(void) const { return mLoop; }
110 
123  void setBoneWeight( IdString boneName, Real weight );
124 
132  Real getBoneWeight( IdString boneName ) const;
133 
146  Real* getBoneWeightPtr( IdString boneName );
147 
149  void setEnabled( bool bEnable );
150  bool getEnabled(void) const { return mEnabled; }
151 
152  void _applyAnimation( const TransformArray &boneTransforms );
153  };
154 
157 }
158 
159 #include "OgreHeaderSuffix.h"
160 
161 #endif
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:255
KnownKeyFramesVec mLastKnownKeyFrames
One per track.
FastArray< size_t > const * mSlotStarts
void setLoop(bool bLoop)
Loop setting.
IdString getName(void) const
Represents the instance of a Skeletal animation based on its definition.
bool getLoop(void) const
Returns current loop setting.
void addTime(Real time)
Plays the animation forward (or backwards if negative)
vector< KeyFrameRigVec::const_iterator >::type KnownKeyFramesVec
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Hashed string.
Definition: OgreIdString.h:94
RawSimdUniquePtr< ArrayReal, MEMCATEGORY_ANIMATION > mBoneWeights
Real getCurrentTime(Real time) const
Gets the current animation time, in seconds. Prefer using getCurrentFrame.
SkeletonAnimationDef const * mDefinition
Instance of a Skeleton, main external interface for retrieving bone positions and applying animations...
Real getCurrentFrame(Real time) const
Gets the current animation frame, in frames.