Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreSkeleton.h

Go to the documentation of this file.
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     public:
00081         Skeleton(const String& name);
00082         ~Skeleton();
00083 
00086         virtual void load(void);
00087 
00090         virtual void unload(void);
00091 
00105         Bone* createBone(void);
00106 
00121         Bone* createBone(unsigned short handle);
00122 
00137         Bone* createBone(const String& name);
00138 
00150         Bone* createBone(const String& name, unsigned short handle);
00151 
00153         unsigned short getNumBones(void) const;
00154 
00166         Bone* getRootBone(void) const;
00167 
00169         Bone* getBone(unsigned short handle) const;
00170 
00172         Bone* getBone(const String& name) const;
00173 
00177         void setBindingPose(void);
00178 
00185         void reset(void);
00186 
00191         Animation* createAnimation(const String& name, Real length);
00192 
00194         Animation* getAnimation(const String& name) const;
00195 
00197         void removeAnimation(const String& name);
00198 
00210         void setAnimationState(const AnimationStateSet& animSet);
00211 
00213         const AnimationStateSet& getAnimationState(void) const;
00214         
00215 
00220         void _initAnimationState(AnimationStateSet* animSet);
00221 
00228         void _getBoneMatrices(Matrix4* pMatrices);
00229 
00231         unsigned short getNumAnimations(void) const;
00232 
00234         Animation* getAnimation(unsigned short index) const;
00235 
00236 
00238         TagPoint* createTagPoint(const Quaternion &offsetOrientation = Quaternion::IDENTITY, 
00239                                  const Vector3    &offsetPosition    = Vector3::UNIT_SCALE);
00240 
00242         void setCurrentEntity(Entity *pCurrentEntity);
00244         Entity *getCurrentEntity(void);
00245   
00247         SkeletonAnimationBlendMode getBlendMode();
00249         void setBlendMode(SkeletonAnimationBlendMode state);
00250 
00251 
00252     protected:
00253         SkeletonAnimationBlendMode mBlendState;
00255         typedef std::map<unsigned short, Bone*> BoneList;
00256         BoneList mBoneList;
00258         typedef std::map<String, Bone*> BoneListByName;
00259         BoneListByName mBoneListByName;
00260 
00262         typedef std::map<unsigned short, TagPoint*> TagPointList;
00263         TagPointList mTagPointList;
00264 
00266         Entity *mCurrentEntity;
00267 
00269         mutable Bone *mRootBone;
00271         unsigned short mNextAutoHandle;
00272 
00274         unsigned short mNextTagPointAutoHandle;
00275 
00277         typedef std::map<String, Animation*> AnimationList;
00278         AnimationList mAnimationsList;
00279 
00280 
00282         AnimationStateSet mLastAnimationState;
00283 
00289         void deriveRootBone(void) const;
00290 
00292         void _dumpContents(const String& filename);
00293 
00294 
00295     };
00296 
00297 }
00298 
00299 
00300 #endif
00301 

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:28 2004