OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreBoneTransform.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 #ifndef _BoneTransform_H_
29 #define _BoneTransform_H_
30 
31 #include "OgreArrayMatrixAf4x3.h"
32 #include "OgreArrayMemoryManager.h"
33 
34 namespace Ogre
35 {
38  {
40  unsigned char mIndex;
41 
44 
47 
50 
53 
56 
59 
62 
65 
69 
73 
75  mIndex( 0 ),
76  mOwner( 0 ),
77  mPosition( 0 ),
78  mOrientation( 0 ),
79  mScale( 0 ),
81  mParentTransform( 0 ),
82  mDerivedTransform( 0 ),
83  mFinalTransform( 0 ),
85  mInheritScale( 0 )
86  {
87  }
88 
101  void copy( const BoneTransform &inCopy )
102  {
103  mOwner[mIndex] = inCopy.mOwner[inCopy.mIndex];
104 
105  Vector3 tmp;
106  Quaternion qTmp;
107 
108  //Position
109  inCopy.mPosition->getAsVector3( tmp, inCopy.mIndex );
111 
112  //Orientation
113  inCopy.mOrientation->getAsQuaternion( qTmp, inCopy.mIndex );
115 
116  //Scale
117  inCopy.mScale->getAsVector3( tmp, inCopy.mIndex );
118  mScale->setFromVector3( tmp, mIndex );
119 
123  mFinalTransform[mIndex] = inCopy.mFinalTransform[inCopy.mIndex];
124 
126  mInheritScale[mIndex] = inCopy.mInheritScale[inCopy.mIndex];
127  }
128 
132  void advancePack()
133  {
135  ++mPosition;
136  ++mOrientation;
137  ++mScale;
144  }
145 
146  void advancePack( size_t numAdvance )
147  {
148  mOwner += ARRAY_PACKED_REALS * numAdvance;
149  mPosition += numAdvance;
150  mOrientation += numAdvance;
151  mScale += numAdvance;
153  mParentTransform += ARRAY_PACKED_REALS * numAdvance;
154  mDerivedTransform += ARRAY_PACKED_REALS * numAdvance;
155  mFinalTransform += ARRAY_PACKED_REALS * numAdvance;
156  mInheritOrientation += ARRAY_PACKED_REALS * numAdvance;
157  mInheritScale += ARRAY_PACKED_REALS * numAdvance;
158  }
159  };
160 }
161 
162 #endif
void advancePack()
Advances all pointers to the next pack, i.e.
bool *RESTRICT_ALIAS mInheritOrientation
Stores whether this node inherits orientation from it's parent.
void copy(const BoneTransform &inCopy)
Copies all the scalar data from the parameter into this.
void getAsQuaternion(Quaternion &out, size_t index) const
bool *RESTRICT_ALIAS mInheritScale
Stores whether this node inherits scale from it's parent.
void setFromQuaternion(const Quaternion &v, size_t index)
unsigned char mIndex
Which of the packed values is ours. Value in range [0; 4) for SSE2.
SimpleMatrixAf4x3 *RESTRICT_ALIAS mDerivedTransform
Caches the full transform into an affine 4x4 matrix. Note it's not Array form! (It's AoS) ...
void getAsVector3(Vector3 &out, size_t index) const
void advancePack(size_t numAdvance)
#define RESTRICT_ALIAS
Definition: OgrePlatform.h:448
Implementation of a Quaternion, i.e.
Bone ** mOwner
The Bone that owns this BoneTransform. Ours is mOwner[mIndex].
SimpleMatrixAf4x3 *RESTRICT_ALIAS mFinalTransform
Caches mDerivedTransform in Bone space, used for rendering. It's not Array form! (It's AoS) ...
SimpleMatrixAf4x3 const **RESTRICT_ALIAS mParentNodeTransform
Points to the Node parent's pointer.
Cache-friendly array of 3-dimensional represented as a SoA array.
void setFromVector3(const Vector3 &v, size_t index)
ArrayVector3 *RESTRICT_ALIAS mScale
Stores the scaling factor applied to a node.
#define ARRAY_PACKED_REALS
Represents the transform of a single object, arranged in SoA (Structure of Arrays) ...
Standard 3-dimensional vector.
Definition: OgreVector3.h:50
SimpleMatrixAf4x3 const **RESTRICT_ALIAS mParentTransform
Points to the parent's pointer.
ArrayQuaternion *RESTRICT_ALIAS mOrientation
Stores the orientation of a node relative to it's parent.
Simple wrap up to load an AoS matrix 4x3 using SSE.
Cache-friendly array of Quaternion represented as a SoA array.
ArrayVector3 *RESTRICT_ALIAS mPosition
Stores the position/translation of a node relative to its parent.
Class representing a Bone in the join hierarchy of a skeleton.
Definition: OgreBone.h:61