HBTAvatarMesh.h

Go to the documentation of this file.
00001 #if !defined HBT_AVATARMESH_H
00002 #define HBT_AVATARMESH_H
00003 
00004 #include "HBT.h"
00005 #include "Ogre.h"
00006 #include <iostream>
00007 #include <vector>
00008 
00009 namespace HBT
00010 {
00011 // Structure to initialise the AvatarMesh
00012 struct InitialisationSequence ;
00013 // Structure to update the AvatarMesh
00014 struct PostureData ;
00021 class HBT_API AvatarMesh
00022 {
00023 public:
00025 
00026 
00027   AvatarMesh();
00028 
00030   virtual ~AvatarMesh();
00031 
00036   bool init( Ogre::SceneManager *ogreSceneManager, const InitialisationSequence *initSequence ) ;
00037 
00040   static AvatarMesh* create()
00041   {
00042     return new AvatarMesh();
00043   }
00044 
00047   void close();
00048 
00049 
00052   bool isInitialised() const
00053   {
00054     return _initialised;
00055   }
00057 
00059 
00060 
00061 
00062   void update( const PostureData& postureData );
00063 
00067   virtual void show( const bool show = true )
00068   {
00069     hide( !show );
00070   }
00071 
00075   virtual void hide( const bool hide = true ) ;
00076 
00079   virtual bool isHidden() const
00080   {
00081     return _hidden;
00082   }
00084 
00086 
00087 
00088 
00089   void* getObjectSceneNode() const
00090   {
00091     return _pObjectSceneNode;
00092   }
00094 
00096 
00097 
00098 
00099   virtual Ogre::Vector3 getPos() const;
00100 
00103   virtual Ogre::Quaternion getRot() const;
00104 
00107   virtual Ogre::Vector3 getScl() const;
00108 
00109 
00112   virtual void setPos( const Ogre::Vector3& vec );
00113 
00116   virtual void setRot( const Ogre::Quaternion& q );
00117 
00120   virtual void setScl( const Ogre::Vector3& scl );
00122 
00124 
00125 
00126 
00127   unsigned short getNbBones() const;
00128 
00132   int getBoneID( const std::string& boneName ) const;
00133 
00138   void setBoneOrientation( const int boneID, 
00139                            const Ogre::Quaternion &quat, 
00140                            const bool inWorldFrame = false );
00141 
00144   void setBoneOrientation( const std::string &boneName, 
00145                            const Ogre::Quaternion &quat, 
00146                            const bool inWorldFrame = false )
00147   {
00148     setBoneOrientation( getBoneID( boneName ), quat ) ;
00149   }
00151 
00153 
00154 
00155 
00156   Ogre::SceneNode* getOgreSceneNode() { return _pObjectSceneNode ; }
00158 
00160 
00161 protected:
00162   Ogre::SceneNode* _pObjectSceneNode ;
00163   Ogre::SceneNode* _meshNode ;
00164   Ogre::Entity* _entity ;
00165 
00166 private:
00167   bool _hidden;
00168   bool _initialised;
00169   unsigned short _nbBones;
00170   Ogre::Quaternion _sceneNodeInverseQuat;
00172 };
00173 }
00174 
00175 #endif // HBT_AVATARMESH_H
00176 

logo OpenMask

Documentation generated on Mon Jun 9 11:45:55 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007