OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreSkeletonTrack.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 __SkeletonTrack_H__
30 #define __SkeletonTrack_H__
31 
32 #include "OgrePrerequisites.h"
35 
36 namespace Ogre
37 {
38  class KfTransformArrayMemoryManager;
39 
40  struct KeyFrameRig
41  {
43  Real mInvNextFrameDistance; // 1.0f / (KeyFrameRig[1].mFrame - KeyFrameRig[0].mFrame)
44 
45  // SoA variable. Packs posrotscale posrotscale ...
47  };
48 
50 
52 
54  {
55  protected:
59 
61 
78 
80 
81  public:
82  SkeletonTrack( uint32 boneBlockIdx, KfTransformArrayMemoryManager *kfTransformMemoryManager );
83  ~SkeletonTrack();
84 
85  void setNumKeyFrame( size_t numKeyFrames );
86 
87  void addKeyFrame( Real timestamp, Real frameRate );
88  void setKeyFrameTransform( Real frame, uint32 slot, const Vector3 &vPos,
89  const Quaternion &qRot, const Vector3 vScale );
90 
91  uint32 getBoneBlockIdx(void) const { return mBoneBlockIdx; }
92  size_t getUsedSlots(void) const { return mUsedSlots; }
93  void _setMaxUsedSlot( uint32 slot )
94  { mUsedSlots = std::max( slot+1, mUsedSlots ); }
95 
96  const KeyFrameRigVec& getKeyFrames(void) const { return mKeyFrameRigs; }
97  KeyFrameRigVec& _getKeyFrames(void) { return mKeyFrameRigs; }
98 
99  inline void getKeyFrameRigAt( KeyFrameRigVec::const_iterator &inOutPrevFrame,
100  KeyFrameRigVec::const_iterator &outNextFrame,
101  Real frame ) const;
102 
120  void applyKeyFrameRigAt( KeyFrameRigVec::const_iterator &inOutLastKnownKeyFrame, float frame,
121  ArrayReal animWeight, const ArrayReal * RESTRICT_ALIAS perBoneWeights,
122  const TransformArray &KfTransforms ) const;
123 
128  void _bakeUnusedSlots(void);
129  };
130 
132 }
133 
134 #endif
float Real
Software floating point type.
unsigned int uint32
Definition: OgrePlatform.h:420
#define _OgreExport
Definition: OgrePlatform.h:255
const float & max(const float &a, const float &b)
Definition: OgreCommon.h:851
const KeyFrameRigVec & getKeyFrames(void) const
KfTransformArrayMemoryManager * mLocalMemoryManager
Real ArrayReal
KfTransform *RESTRICT_ALIAS mBoneTransform
size_t getUsedSlots(void) const
KeyFrameRigVec & _getKeyFrames(void)
Implementation to create the KfTransform variables needed by SkeletonTrack SkeletonAnimationDef and...
#define RESTRICT_ALIAS
Definition: OgrePlatform.h:448
Implementation of a Quaternion, i.e.
void _setMaxUsedSlot(uint32 slot)
Holds the transform of a KeyFrame (which is part of an animation)
KeyFrameRigVec mKeyFrameRigs
There is one entry per each parent level.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
uint32 getBoneBlockIdx(void) const
vector< KeyFrameRig >::type KeyFrameRigVec
Standard 3-dimensional vector.
Definition: OgreVector3.h:50
vector< SkeletonTrack >::type SkeletonTrackVec
uint32 mUsedSlots
Number of SIMD slots used by all.
FastArray< BoneTransform > TransformArray