VolumetricFogRTManager.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 mFogHasAnswered;
  53. U32 mWidth;
  54. U32 mHeight;
  55. void onRemove();
  56. void onSceneRemove();
  57. void ResizeRT(PlatformWindow *win, bool resize);
  58. static VolumetricFogRTMResizeSignal smVolumetricFogRTMResizeSignal;
  59. public:
  60. VolumetricFogRTManager();
  61. ~VolumetricFogRTManager();
  62. static VolumetricFogRTManager *get();
  63. bool Init();
  64. bool IsInitialized() { return mIsInitialized; }
  65. static void consoleInit();
  66. static VolumetricFogRTMResizeSignal& getVolumetricFogRTMResizeSignal() { return smVolumetricFogRTMResizeSignal; }
  67. void FogAnswered();
  68. S32 setQuality(U32 Quality);
  69. bool Resize();
  70. U32 IncFogObjects();
  71. U32 DecFogObjects();
  72. DECLARE_CONOBJECT(VolumetricFogRTManager);
  73. };
  74. extern VolumetricFogRTManager* gVolumetricFogRTManager;
  75. #endif