00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #include "OgreStableHeaders.h" 00026 00027 #include "OgreBone.h" 00028 #include "OgreSkeleton.h" 00029 #include "OgreTagPoint.h" 00030 00031 namespace Ogre { 00032 00033 //--------------------------------------------------------------------- 00034 Bone::Bone(unsigned short handle, Skeleton* creator) 00035 : Node(), mHandle(handle), mManuallyControlled(false), mCreator(creator) 00036 { 00037 } 00038 //--------------------------------------------------------------------- 00039 Bone::Bone(const String& name, unsigned short handle, Skeleton* creator) 00040 : Node(name), mHandle(handle), mManuallyControlled(false), mCreator(creator) 00041 { 00042 } 00043 //--------------------------------------------------------------------- 00044 Bone::~Bone() 00045 { 00046 } 00047 //--------------------------------------------------------------------- 00048 Bone* Bone::createChild(unsigned short handle, const Vector3& translate, 00049 const Quaternion& rotate) 00050 { 00051 Bone* retBone = mCreator->createBone(handle); 00052 retBone->translate(translate); 00053 retBone->rotate(rotate); 00054 this->addChild(retBone); 00055 return retBone; 00056 } 00057 //--------------------------------------------------------------------- 00058 Node* Bone::createChildImpl(void) 00059 { 00060 return mCreator->createBone(); 00061 } 00062 //--------------------------------------------------------------------- 00063 Node* Bone::createChildImpl(const String& name) 00064 { 00065 return mCreator->createBone(name); 00066 } 00067 //--------------------------------------------------------------------- 00068 void Bone::setBindingPose(void) 00069 { 00070 setInitialState(); 00071 00072 // Save inverse derived, used for mesh transform later (assumes _update() has been called by Skeleton) 00073 makeInverseTransform(_getDerivedPosition(), Vector3::UNIT_SCALE , 00074 _getDerivedOrientation(), mBindDerivedInverseTransform); 00075 } 00076 //--------------------------------------------------------------------- 00077 void Bone::reset(void) 00078 { 00079 resetToInitialState(); 00080 } 00081 //--------------------------------------------------------------------- 00082 void Bone::setManuallyControlled(bool manuallyControlled) { 00083 this->mManuallyControlled = manuallyControlled; 00084 } 00085 //--------------------------------------------------------------------- 00086 bool Bone::isManuallyControlled() const { 00087 return mManuallyControlled; 00088 } 00089 //--------------------------------------------------------------------- 00090 const Matrix4& Bone::_getBindingPoseInverseTransform(void) const 00091 { 00092 return mBindDerivedInverseTransform; 00093 } 00094 //--------------------------------------------------------------------- 00095 unsigned short Bone::getHandle(void) const 00096 { 00097 return mHandle; 00098 } 00099 00100 TagPoint *Bone::createChildTagPoint(const Quaternion &offsetOrientation,const Vector3 &offsetPosition) 00101 { 00102 TagPoint *tp = mCreator->createTagPoint(offsetOrientation, offsetPosition); 00103 addChild(tp); 00104 00105 return tp; 00106 } 00107 00108 00109 00110 00111 00112 } 00113
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:02 2004