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 __SO3BONE_H__ 00036 #define __SO3BONE_H__ 00037 00038 #include "../SCOLBasic/SO3Std.h" 00039 #include "../SO3SceneGraph/SO3NodeScol.h" 00040 00041 namespace SO3 00042 { 00043 00044 class SBone : public SNode 00045 { 00046 friend class SNode; 00047 public: 00048 protected: 00049 SSkeleton* parentSkeleton; 00050 Ogre::Bone* O3Bone; 00051 Ogre::Entity* ogreLinkedEntity; 00052 unsigned short boneIndex; 00053 private: 00054 00055 public: 00058 SBone(SScene* parent, std::string boneName, SSkeleton* skeleton, unsigned short id); 00059 00062 ~SBone(); 00063 00066 Ogre::Bone* GetOgreBonePointer(); 00067 00071 virtual void Rotate(Ogre::Vector3 axis, float radianAngle, SNode::NodeTransformSpace relativeTo=SNode::SO3_LOCAL_TS); 00072 00076 virtual void SetOrientation(Ogre::Quaternion quat); 00077 00081 virtual void AddOrientation(Ogre::Quaternion quat); 00082 00086 virtual void ResetToInitialOrientation(); 00087 00091 virtual void SetPosition(Ogre::Vector3 pos); 00092 00096 virtual void Translate(Ogre::Vector3 d, SNode::NodeTransformSpace relativeTo=SNode::SO3_PARENT_TS); 00097 00101 virtual void SetScale(Ogre::Vector3 scale); 00102 00106 virtual Ogre::Vector3 GetPosition(); 00107 00111 virtual Ogre::Quaternion GetOrientation(); 00112 00116 virtual Ogre::Vector3 GetScale(); 00117 00121 virtual Ogre::Vector3 GetInitialPosition(); 00122 00126 virtual Ogre::Quaternion GetInitialOrientation(); 00127 00131 virtual Ogre::Vector3 GetInitialScale(); 00132 00136 virtual Ogre::Vector3 GetGlobalPosition(); 00137 00141 virtual Ogre::Quaternion GetGlobalOrientation(); 00142 00146 virtual Ogre::Vector3 GetGlobalScale(); 00147 00151 virtual void SetGlobalPosition(Ogre::Vector3 pos); 00152 00156 virtual void SetGlobalOrientation(Ogre::Quaternion quat); 00157 00161 virtual void SetGlobalScale(Ogre::Vector3 pos); 00162 00166 virtual Ogre::Matrix4 GetTransformationMatrix(); 00167 00171 virtual void Pitch(float radianAngle, SNode::NodeTransformSpace relativeTo=SNode::SO3_LOCAL_TS); 00172 00176 virtual void Yaw(float radianAngle, SNode::NodeTransformSpace relativeTo=SNode::SO3_LOCAL_TS); 00177 00181 virtual void Roll(float radianAngle, SNode::NodeTransformSpace relativeTo=SNode::SO3_LOCAL_TS); 00182 00186 virtual int GetNumChildren(); 00187 00191 virtual void StoreInitialPRS(); 00192 00196 virtual void ResetToInitialPRS(); 00197 00200 unsigned short GetIndex(); 00201 00204 Ogre::Quaternion ConvertWorldToLocalOrientation(Ogre::Quaternion quat); 00205 00208 virtual void SetInheritOrientation(bool state); 00209 00212 virtual bool GetInheritOrientation(); 00213 00216 virtual void ResetOrientation(); 00217 00218 protected: 00221 void AttachToBone(SNode* newChild); 00222 00225 void DetachFromBone(SNode* existingChild); 00226 private: 00230 SBone(); 00231 }; 00232 00233 } 00234 00235 #endif
1.6.3