home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / Source / Chapter 11 / Engine / AnimatedObject.h next >
Encoding:
C/C++ Source or Header  |  2004-10-01  |  1.5 KB  |  38 lines

  1. //-----------------------------------------------------------------------------
  2. // A derived scene object that supports mesh animation.
  3. //
  4. // Programming a Multiplayer First Person Shooter in DirectX
  5. // Copyright (c) 2004 Vaughan Young
  6. //-----------------------------------------------------------------------------
  7. #ifndef ANIMATED_OBJECT_H
  8. #define ANIMATED_OBJECT_H
  9.  
  10. //-----------------------------------------------------------------------------
  11. // Animated Object Type Define
  12. //-----------------------------------------------------------------------------
  13. #define TYPE_ANIMATED_OBJECT 1
  14.  
  15. //-----------------------------------------------------------------------------
  16. // Animated Object Class
  17. //-----------------------------------------------------------------------------
  18. class AnimatedObject : public SceneObject, public ID3DXAnimationCallbackHandler
  19. {
  20. public:
  21.     AnimatedObject( char *meshName, char *meshPath = "./", unsigned long type = TYPE_ANIMATED_OBJECT );
  22.     virtual ~AnimatedObject();
  23.  
  24.     virtual void Update( float elapsed, bool addVelocity = true );
  25.  
  26.     void PlayAnimation( unsigned int animation, float transitionTime, bool loop = true );
  27.     ID3DXAnimationController *GetAnimationController();
  28.  
  29. private:
  30.     virtual HRESULT CALLBACK HandleCallback( THIS_ UINT Track, LPVOID pCallbackData );
  31.  
  32. private:
  33.     ID3DXAnimationController *m_animationController; // Controller for managing mesh animation playback.
  34.     unsigned int m_currentTrack; // The track of the currently playing animation.
  35.     float m_currentTime; // Timer used for animation.
  36. };
  37.  
  38. #endif