OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreSkeletonInstance.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 _SkeletonInstance2_H__
30 #define _SkeletonInstance2_H__
31 
32 #include "OgreSkeletonAnimation.h"
33 #include "Animation/OgreBone.h"
34 
35 namespace Ogre
36 {
37  class SkeletonDef;
40 
72  {
73  public:
75 
76  protected:
79 
81 
83 
86 
88 
93 
96 
97  public:
98  SkeletonInstance( const SkeletonDef *skeletonDef, BoneMemoryManager *boneMemoryManager );
100 
101  const SkeletonDef* getDefinition(void) const { return mDefinition; }
102 
103  void update(void);
104 
106  void resetToPose(void);
107 
122  void setManualBone( Bone *bone, bool isManual );
123 
128  bool isManualBone( Bone *bone );
129 
132  {
133  return mBones[index]._getFullTransform();
134  }
135 
137  Bone* getBone( IdString boneName );
138 
139  bool hasAnimation( IdString name ) const;
141  SkeletonAnimation* getAnimation( IdString name );
142 
144  void _enableAnimation( SkeletonAnimation *animation );
145 
147  void _disableAnimation( SkeletonAnimation *animation );
148 
152  void setParentNode( Node *parentNode );
153 
155  Node* getParentNode(void) const { return mParentNode; }
156 
157  void getTransforms( SimpleMatrixAf4x3 * RESTRICT_ALIAS outTransform,
158  const FastArray<unsigned short> &usedBones ) const;
159 
163  void _updateBoneStartTransforms(void);
164 
165  const TransformArray& _getTransformArray() const { return mBoneStartTransforms; }
166 
167  const void* _getMemoryBlock(void) const;
168  const void* _getMemoryUniqueOffset(void) const;
169  };
170 
172  const SkeletonInstance *_right )
173  {
174  return _left->_getMemoryUniqueOffset() < _right->_getMemoryUniqueOffset();
175  }
176 
179 }
180 
181 #endif
Wrap-around class that contains multiple ArrayMemoryManager, one per hierarchy depth.
SkeletonDef const * mDefinition
#define _OgreExport
Definition: OgrePlatform.h:255
bool OrderSkeletonInstanceByMemory(const SkeletonInstance *_left, const SkeletonInstance *_right)
vector< SkeletonAnimation * >::type ActiveAnimationsVec
FORCEINLINE const SimpleMatrixAf4x3 & _getBoneFullTransform(size_t index) const
Gets full transform of a bone by its index.
RawSimdUniquePtr< ArrayReal, MEMCATEGORY_ANIMATION > mManualBones
The start of Transform at each depth level.
const SkeletonDef * getDefinition(void) const
const TransformArray & _getTransformArray() const
Represents the instance of a Skeletal animation based on its definition.
TransformArray mBoneStartTransforms
#define RESTRICT_ALIAS
Definition: OgrePlatform.h:448
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Hashed string.
Definition: OgreIdString.h:94
const void * _getMemoryUniqueOffset(void) const
vector< Bone >::type BoneVec
FastArray< size_t > mSlotStarts
SkeletonAnimationVec mAnimations
ActiveAnimationsVec mActiveAnimations
Simple wrap up to load an AoS matrix 4x3 using SSE.
#define FORCEINLINE
Definition: OgrePlatform.h:104
vector< SkeletonAnimation >::type SkeletonAnimationVec
Node * getParentNode(void) const
Returns our parent node. May be null.
BoneVec mUnusedNodes
Unused slots for each parent depth level that had more bones than >= ARRAY_PACKED_REALS /2 but less t...
Class representing a general-purpose node an articulated scene graph.
Definition: OgreNode.h:58
Class representing a Bone in the join hierarchy of a skeleton.
Definition: OgreBone.h:61
Instance of a Skeleton, main external interface for retrieving bone positions and applying animations...
Node * mParentNode
Node this SkeletonInstance is attached to (so we can work in world space)