Project

General

Profile

SO3Engine
SO3Skeleton.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
32#ifndef __SO3SKELETON_H__
33#define __SO3SKELETON_H__
34
37
38namespace SO3
39{
40
41class SSkeleton : public SNode
42{
43public:
45 {
46 SO3_ANIMBLEND_AVERAGE, //<! Animations are applied by calculating a weighted average of all animations
47 SO3_ANIMBLEND_CUMULATIVE //<! Animations are applied by calculating a weighted cumulative total
48 };
49protected:
51 Ogre::Entity* ogreLinkedEntity;
55private:
56
57public:
60 SSkeleton(SScene* parent, const std::string& skeletonName, SEntity* parentEntity);
61
64 ~SSkeleton();
65
68 void Initialise();
69
72 void SetBindingPose();
73
77
80 void SetBlendMode(const SkeletonAnimationMode& newBlendMode);
81
84 unsigned short GetNumBones();
85
88 SBone* GetBone(const std::string& boneName);
89
92 SBone* GetBone(const unsigned short& boneIndex);
93
96 SBoneMap GetBones() const;
97
100 Ogre::SkeletonInstance* GetOgreSkeletonPointer();
101
105
109
113 void _OnBoneDeletion(SBone* boneInstance);
114
118 virtual Ogre::Vector3 GetGlobalPosition();
119
123 virtual Ogre::Quaternion GetGlobalOrientation();
124
128 virtual Ogre::Vector3 GetGlobalScale();
129
133 virtual void SetGlobalPosition(const Ogre::Vector3& pos, bool updateBody = true);
134
138 virtual void SetGlobalOrientation(const Ogre::Quaternion& quat, bool updateBody = true);
139protected:
143 void AddBone(SBone* existingBone);
144
148 void RemoveBone(SBone* existingBone);
149
153 void RemoveBone(const std::string& boneName);
154private:
158 SSkeleton();
159};
160
161}
162
163#endif
librairies include
SBoneMap rootBonesList
Definition SO3Skeleton.h:53
void RemoveBone(SBone *existingBone)
Ogre::SkeletonInstance * GetOgreSkeletonPointer()
SkeletonAnimationMode GetBlendMode()
void AddBone(SBone *existingBone)
SBoneMap GetBones() const
virtual void SetGlobalPosition(const Ogre::Vector3 &pos, bool updateBody=true)
Ogre::Entity * ogreLinkedEntity
Definition SO3Skeleton.h:51
SEntity * linkedEntity
Definition SO3Skeleton.h:50
SEntity * GetParentEntity()
SBone * GetBone(const std::string &boneName)
SBoneIndexMap boneListByIndex
Definition SO3Skeleton.h:54
virtual Ogre::Quaternion GetGlobalOrientation()
virtual void SetGlobalOrientation(const Ogre::Quaternion &quat, bool updateBody=true)
void SetBlendMode(const SkeletonAnimationMode &newBlendMode)
SBoneMap boneList
Definition SO3Skeleton.h:52
void _OnBoneDeletion(SBone *boneInstance)
virtual Ogre::Vector3 GetGlobalPosition()
virtual Ogre::Vector3 GetGlobalScale()
unsigned short GetNumBones()
SBoneMap GetRootBones()
std::unordered_map< unsigned short, SBone * > SBoneIndexMap
std::unordered_map< std::string, SBone * > SBoneMap