VActor.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_VACTOR_H_
  24. #define _VT_VACTOR_H_
  25. #ifndef _VT_VACTORDATA_H_
  26. #include "VActorData.h"
  27. #endif
  28. #ifndef _VT_TYPES_H_
  29. #include "Types/VTypes.h"
  30. #endif
  31. //-----------------------------------------------------------------------------
  32. class VActorAnimationController;
  33. class VActorPhysicsController;
  34. //-----------------------------------------------------------------------------
  35. class VActor : public ShapeBase
  36. {
  37. typedef ShapeBase Parent;
  38. public:
  39. enum eMaskBits
  40. {
  41. // Physics Bits.
  42. MoveMask = Parent::NextFreeMask << 0,
  43. PhysicsMask = ( MoveMask ),
  44. NextFreeMask = Parent::NextFreeMask << 1,
  45. };
  46. enum eEventType
  47. {
  48. k_MountEvent,
  49. k_UnmountEvent,
  50. };
  51. typedef Signal<void( const eEventType& )> tEventSignal;
  52. protected:
  53. VActorData *mDataBlock;
  54. // Event Signal.
  55. tEventSignal mEventSignal;
  56. public:
  57. VActor( void );
  58. ~VActor( void );
  59. // Initialisation Methods.
  60. bool onAdd( void );
  61. void onRemove( void );
  62. bool onNewDataBlock( GameBaseData *pDataBlock, bool pReload );
  63. // Update Methods.
  64. virtual void processTick( const Move *pMove );
  65. virtual U32 packUpdate( NetConnection *pConnection, U32 pMask, BitStream *pStream );
  66. virtual void unpackUpdate( NetConnection *pConnection, BitStream *pStream );
  67. DECLARE_CONOBJECT( VActor );
  68. public:
  69. // Accessor Methods.
  70. inline VActorData *getDataBlock( void ) { return mDataBlock; };
  71. inline tEventSignal &getEventSignal( void ) { return mEventSignal; };
  72. // Animation Methods.
  73. /// Get Animation Controller.
  74. virtual VActorAnimationController *getAnimationController( void ) { return NULL; };
  75. // Physics Methods.
  76. /// Set Transform.
  77. virtual void setTransform( const MatrixF &pMatrix );
  78. /// Get Physics Controller.
  79. virtual VActorPhysicsController *getPhysicsController( void ) { return NULL; };
  80. /// On Mount.
  81. virtual void onMount( SceneObject *pObject, S32 pNode );
  82. /// On Unmount.
  83. virtual void onUnmount( SceneObject *pObject, S32 pNode );
  84. };
  85. #endif // _VT_VACTOR_H_