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 00026 #ifndef __Skeleton_H__ 00027 #define __Skeleton_H__ 00028 00029 #include "OgrePrerequisites.h" 00030 #include "OgreResource.h" 00031 #include "OgreAnimationState.h" 00032 #include "OgreQuaternion.h" 00033 #include "OgreVector3.h" 00034 00035 namespace Ogre { 00036 00038 enum SkeletonAnimationBlendMode { 00040 ANIMBLEND_AVERAGE, 00042 ANIMBLEND_CUMULATIVE 00043 }; 00044 00045 #define OGRE_MAX_NUM_BONES 256 00046 00072 class _OgreExport Skeleton : public Resource 00073 { 00074 friend class SkeletonInstance; 00075 public: 00082 Skeleton(const String& name); 00083 virtual ~Skeleton(); 00084 00087 virtual void load(void); 00088 00091 virtual void unload(void); 00092 00106 virtual Bone* createBone(void); 00107 00122 virtual Bone* createBone(unsigned short handle); 00123 00138 virtual Bone* createBone(const String& name); 00139 00151 virtual Bone* createBone(const String& name, unsigned short handle); 00152 00154 virtual unsigned short getNumBones(void) const; 00155 00167 virtual Bone* getRootBone(void) const; 00168 00169 typedef std::vector<Bone*> BoneList; 00170 typedef VectorIterator<BoneList> BoneIterator; 00172 virtual BoneIterator getRootBoneIterator(void); 00174 virtual BoneIterator getBoneIterator(void); 00175 00177 virtual Bone* getBone(unsigned short handle) const; 00178 00180 virtual Bone* getBone(const String& name) const; 00181 00185 virtual void setBindingPose(void); 00186 00196 virtual void reset(bool resetManualBones = false); 00197 00202 virtual Animation* createAnimation(const String& name, Real length); 00203 00205 virtual Animation* getAnimation(const String& name) const; 00206 00208 virtual void removeAnimation(const String& name); 00209 00221 virtual void setAnimationState(const AnimationStateSet& animSet); 00222 00224 virtual const AnimationStateSet& getAnimationState(void) const; 00225 00226 00231 virtual void _initAnimationState(AnimationStateSet* animSet); 00232 00239 virtual void _getBoneMatrices(Matrix4* pMatrices); 00240 00242 virtual unsigned short getNumAnimations(void) const; 00243 00245 virtual Animation* getAnimation(unsigned short index) const; 00246 00247 00249 virtual SkeletonAnimationBlendMode getBlendMode(); 00251 virtual void setBlendMode(SkeletonAnimationBlendMode state); 00252 00254 virtual void _updateTransforms(void); 00255 00256 00257 protected: 00258 SkeletonAnimationBlendMode mBlendState; 00260 BoneList mBoneList; 00262 typedef std::map<String, Bone*> BoneListByName; 00263 BoneListByName mBoneListByName; 00264 00265 00267 mutable BoneList mRootBones; 00269 unsigned short mNextAutoHandle; 00270 00271 00273 typedef std::map<String, Animation*> AnimationList; 00274 AnimationList mAnimationsList; 00275 00276 00278 AnimationStateSet mLastAnimationState; 00279 00285 void deriveRootBone(void) const; 00286 00288 void _dumpContents(const String& filename); 00289 00290 00291 }; 00292 00293 } 00294 00295 00296 #endif 00297
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:48 2004