00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OpenSpace3D 00004 For the latest info, see http://www.openspace3d.com 00005 00006 Copyright (c) 2010 I-maginer 00007 00008 This program is free software; you can redistribute it and/or modify it under 00009 the terms of the GNU Lesser General Public License as published by the Free Software 00010 Foundation; either version 2 of the License, or (at your option) any later 00011 version. 00012 00013 This program is distributed in the hope that it will be useful, but WITHOUT 00014 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00015 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License along with 00018 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00019 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00020 http://www.gnu.org/copyleft/lesser.txt 00021 00022 You may alternatively use this source under the terms of a specific version of 00023 the OpenSpace3D Unrestricted License provided you have obtained such a license from 00024 I-maginer. 00025 ----------------------------------------------------------------------------- 00026 */ 00027 00035 #ifndef __SO3SKELETON_H__ 00036 #define __SO3SKELETON_H__ 00037 00038 #include "../SCOLBasic/SO3Std.h" 00039 #include "../SO3SceneGraph/SO3NodeScol.h" 00040 00041 namespace SO3 00042 { 00043 00044 class SSkeleton : public SNode 00045 { 00046 public: 00047 enum SkeletonAnimationMode 00048 { 00049 SO3_ANIMBLEND_AVERAGE, //<! Animations are applied by calculating a weighted average of all animations 00050 SO3_ANIMBLEND_CUMULATIVE //<! Animations are applied by calculating a weighted cumulative total 00051 }; 00052 protected: 00053 SEntity* linkedEntity; 00054 Ogre::Entity* ogreLinkedEntity; 00055 Ogre::SkeletonInstance* O3SkeletonInstance; 00056 SBoneMap boneList; 00057 SBoneIndexMap boneListByIndex; 00058 SBone* rootBone; 00059 private: 00060 00061 public: 00064 SSkeleton(SScene* parent, std::string skeletonName, SEntity* parentEntity); 00065 00068 ~SSkeleton(); 00069 00072 void Initialise(); 00073 00076 void SetBindingPose(); 00077 00080 SkeletonAnimationMode GetBlendMode(); 00081 00084 void SetBlendMode(SkeletonAnimationMode newBlendMode); 00085 00088 unsigned short GetNumBones(); 00089 00092 SBone* GetBone(std::string boneName); 00093 00096 SBone* GetBone(unsigned short boneIndex); 00097 00100 SBoneMap GetBones() const; 00101 00104 Ogre::SkeletonInstance* GetOgreSkeletonPointer(); 00105 00108 SEntity* GetParentEntity(); 00109 00112 SBone* GetRootBone(); 00113 00117 void _OnBoneDeletion(SBone* boneInstance); 00118 00122 virtual Ogre::Vector3 GetGlobalPosition(); 00123 00127 virtual Ogre::Quaternion GetGlobalOrientation(); 00128 00132 virtual Ogre::Vector3 GetGlobalScale(); 00133 00137 virtual void SetGlobalPosition(Ogre::Vector3 pos); 00138 00142 virtual void SetGlobalOrientation(Ogre::Quaternion quat); 00143 protected: 00147 void AddBone(SBone* existingBone); 00148 00152 void RemoveBone(SBone* existingBone); 00153 00157 void RemoveBone(std::string boneName); 00158 private: 00162 SSkeleton(); 00163 }; 00164 00165 } 00166 00167 #endif
1.6.3