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://ogre.sourceforge.net/
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 
00033 namespace Ogre {
00034 
00036     enum SkeletonAnimationBlendMode {
00038         ANIMBLEND_AVERAGE,
00040         ANIMBLEND_CUMULATIVE
00041     };
00042 
00043 #define OGRE_MAX_NUM_BONES 256
00044 
00070     class _OgreExport Skeleton : public Resource
00071     {
00072     public:
00079         Skeleton(String name);
00080         ~Skeleton();
00081 
00084         virtual void load(void);
00085 
00088         virtual void unload(void);
00089 
00103         Bone* createBone(void);
00104 
00119         Bone* createBone(unsigned short handle);
00120 
00135         Bone* createBone(const String& name);
00136 
00148         Bone* createBone(const String& name, unsigned short handle);
00149 
00151         unsigned short getNumBones(void) const;
00152 
00164         Bone* getRootBone(void) const;
00165 
00167         Bone* getBone(unsigned short handle) const;
00168 
00170         Bone* getBone(const String& name) const;
00171 
00175         void setBindingPose(void);
00176 
00183         void reset(void);
00184 
00189         Animation* createAnimation(const String& name, Real length);
00190 
00192         Animation* getAnimation(const String& name) const;
00193 
00195         void removeAnimation(const String& name);
00196 
00208         void setAnimationState(const AnimationStateSet& animSet);
00209 
00211         const AnimationStateSet& getAnimationState(void) const;
00212         
00213 
00218         void _initAnimationState(AnimationStateSet* animSet);
00219 
00226         void _getBoneMatrices(Matrix4* pMatrices);
00227 
00229         unsigned short getNumAnimations(void) const;
00230 
00232         Animation* getAnimation(unsigned short index) const;
00233 
00235         SkeletonAnimationBlendMode getBlendMode();
00237         void setBlendMode(SkeletonAnimationBlendMode state);
00238 
00239 
00240     protected:
00241         SkeletonAnimationBlendMode mBlendState;
00243         typedef std::map<unsigned short, Bone*> BoneList;
00244         BoneList mBoneList;
00246         typedef std::map<String, Bone*> BoneListByName;
00247         BoneListByName mBoneListByName;
00248 
00250         mutable Bone *mRootBone;
00252         unsigned short mNextAutoHandle;
00253 
00255         typedef std::map<String, Animation*> AnimationList;
00256         AnimationList mAnimationsList;
00257 
00258 
00260         AnimationStateSet mLastAnimationState;
00261 
00267         void deriveRootBone(void) const;
00268 
00270         void _dumpContents(const String& filename);
00271 
00272 
00273     };
00274 
00275 }
00276 
00277 
00278 #endif
00279 

Copyright © 2002 by The OGRE Team