VolumetricFogRTManager.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _VolumetricFogRTManager_H_
  23. #define _VolumetricFogRTManager_H_
  24. #ifndef _SCENEOBJECT_H_
  25. #include "scene/sceneObject.h"
  26. #endif
  27. #ifndef _MATTEXTURETARGET_H_
  28. #include "materials/matTextureTarget.h"
  29. #endif
  30. #ifndef _GFXTARGET_H_
  31. #include "gfx/gfxTarget.h"
  32. #endif
  33. #ifndef _SIGNAL_H_
  34. #include "core/util/tSignal.h"
  35. #endif
  36. class VolumetricFogRTManager;
  37. typedef Signal<void(VolumetricFogRTManager *VolumetricFogRTManager, bool resize)> VolumetricFogRTMResizeSignal;
  38. #define VFRTM VolumetricFogRTManager::get()
  39. class VolumetricFogRTManager : public SceneObject
  40. {
  41. public:
  42. typedef SceneObject Parent;
  43. protected:
  44. GFXTexHandle mDepthBuffer;
  45. GFXTexHandle mFrontBuffer;
  46. NamedTexTarget mDepthTarget;
  47. NamedTexTarget mFrontTarget;
  48. PlatformWindow* mPlatformWindow;
  49. static S32 mTargetScale;
  50. bool mIsInitialized;
  51. U32 mNumFogObjects;
  52. U32 mWidth;
  53. U32 mHeight;
  54. void onRemove();
  55. void onSceneRemove();
  56. void ResizeRT(WindowId did, S32 width, S32 height);
  57. static VolumetricFogRTMResizeSignal smVolumetricFogRTMResizeSignal;
  58. public:
  59. VolumetricFogRTManager();
  60. ~VolumetricFogRTManager();
  61. static VolumetricFogRTManager *get();
  62. bool Init();
  63. bool IsInitialized() { return mIsInitialized; }
  64. static void consoleInit();
  65. static VolumetricFogRTMResizeSignal& getVolumetricFogRTMResizeSignal() { return smVolumetricFogRTMResizeSignal; }
  66. void FogAnswered();
  67. S32 setQuality(U32 Quality);
  68. bool Resize();
  69. U32 IncFogObjects();
  70. U32 DecFogObjects();
  71. DECLARE_CONOBJECT(VolumetricFogRTManager);
  72. };
  73. extern VolumetricFogRTManager* gVolumetricFogRTManager;
  74. #endif