VCameraGroup.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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_VCAMERAGROUP_H_
  24. #define _VT_VCAMERAGROUP_H_
  25. #ifndef _VT_VSCENEOBJECTGROUP_H_
  26. #include "Verve/Extension/SceneObject/VSceneObjectGroup.h"
  27. #endif
  28. #ifndef _VT_VCONTROLLER_H
  29. #include "Verve/Core/VController.h"
  30. #endif
  31. //-----------------------------------------------------------------------------
  32. class VCameraGroup;
  33. //-----------------------------------------------------------------------------
  34. class VCameraGroup : public VSceneObjectGroup
  35. {
  36. typedef VSceneObjectGroup Parent;
  37. public:
  38. enum eCameraEventType
  39. {
  40. k_EventActivate,
  41. k_EventDeactivate,
  42. };
  43. typedef Signal<bool( const eCameraEventType & )> CameraEventSignal;
  44. typedef Signal<void( VCameraGroup* )> CameraChangeSignal;
  45. protected:
  46. static VCameraGroup *mActiveGroup;
  47. static CameraChangeSignal mCameraChangeSignal;
  48. CameraEventSignal mCameraEventSignal;
  49. public:
  50. VCameraGroup( void );
  51. // Tree Methods.
  52. void onAttach( void );
  53. void onDetach( void );
  54. // Controller Methods.
  55. bool onControllerEvent( VController::eControllerEventType pEvent );
  56. // Camera Methods.
  57. inline bool isActive( void ) { return ( bool )( this == getActiveGroup() ); };
  58. inline VCameraGroup *getActiveGroup( void ) { return mActiveGroup; };
  59. void setActive( void );
  60. static void clearActiveGroup( void );
  61. static void setActiveGroup( VCameraGroup *pCameraGroup );
  62. // Signal Methods.
  63. static inline CameraChangeSignal &getCameraChangeSignal( void ) { return mCameraChangeSignal; };
  64. inline CameraEventSignal &getCameraEventSignal( void ) { return mCameraEventSignal; };
  65. // Console Declaration.
  66. DECLARE_CONOBJECT( VCameraGroup );
  67. };
  68. //-----------------------------------------------------------------------------
  69. #endif // _VT_VCAMERAGROUP_H_