VActorAnimationController.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //-----------------------------------------------------------------------------
  2. // Verve
  3. // Copyright (C) 2014 - Violent Tulip
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to
  7. // deal in the Software without restriction, including without limitation the
  8. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9. // sell copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. // IN THE SOFTWARE.
  22. //-----------------------------------------------------------------------------
  23. #ifndef _VT_VACTORANIMATIONCONTROLLER_H_
  24. #define _VT_VACTORANIMATIONCONTROLLER_H_
  25. #ifndef _VT_TYPES_H_
  26. #include "Types/VTypes.h"
  27. #endif
  28. #ifndef _VT_VACTORSTATETABLE_H_
  29. #include "VActorStateTable.h"
  30. #endif
  31. #ifndef _TSSHAPEINSTANCE_H_
  32. #include "ts/tsShapeInstance.h"
  33. #endif
  34. //-----------------------------------------------------------------------------
  35. class VActor;
  36. class VActorStateTable;
  37. //-----------------------------------------------------------------------------
  38. class VActorAnimationController
  39. {
  40. public:
  41. struct sAnimationRef
  42. {
  43. U32 Index;
  44. TSThread *Thread;
  45. sAnimationRef( void ) :
  46. Index( U32_MAX ),
  47. Thread( NULL )
  48. {
  49. // Void.
  50. }
  51. };
  52. protected:
  53. VActor *mObject;
  54. VActorStateTable mAnimationTable;
  55. sAnimationRef mBaseAnimation;
  56. public:
  57. VActorAnimationController( void );
  58. virtual ~VActorAnimationController( void );
  59. // Initialisation Methods.
  60. bool initAnimationTable( void );
  61. bool initAnimation( sAnimationRef &pAnimation, const U32 &pIndex, const F32 &pPosition, const F32 &pTimeScale );
  62. bool initAnimationThread( TSThread *&pThread, const U32 &pIndex, const F32 &pPosition, const F32 &pTimeScale );
  63. bool initBaseAnimation( const U32 &pIndex, const F32 &pPosition, const F32 &pTimeScale );
  64. // Accessor Methods.
  65. bool isValidObject( void );
  66. VActor *getObject( void );
  67. void setObject( VActor *pObject );
  68. const TSShape *getShape( void );
  69. TSShapeInstance *getShapeInstance( void );
  70. // Animation Methods.
  71. virtual void update( const F32 &pDelta );
  72. bool isAnimationSequence( const U32 &pIndex );
  73. S32 getAnimationSequence( const U32 &pIndex );
  74. U32 getAnimation( void );
  75. void setAnimation( const U32 &pIndex );
  76. };
  77. #endif // _VT_VACTORANIMATIONCONTROLLER_H_