Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #if !defined( REPLAY_SCREENSHOT_H )
  5. #define REPLAY_SCREENSHOT_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //-----------------------------------------------------------------------------
  10. #include "replay/screenshot.h"
  11. //-----------------------------------------------------------------------------
  12. class IViewRender;
  13. //-----------------------------------------------------------------------------
  14. //
  15. // Takes screenshots as VTF's for the replay system - allocates enough
  16. // memory up-front as opposed to every frame. Should be destroyed and recreated
  17. // any time the cvar "replay_screenshotresolution" changes OR the actual screen
  18. // resolution.
  19. //
  20. class CReplayScreenshotTaker
  21. {
  22. public:
  23. CReplayScreenshotTaker( IViewRender *pViewRender, CViewSetup &view );
  24. ~CReplayScreenshotTaker();
  25. void TakeScreenshot( WriteReplayScreenshotParams_t &params );
  26. static void CreateRenderTarget( IMaterialSystem *pMaterialSystem );
  27. private:
  28. IViewRender *m_pViewRender;
  29. CViewSetup &m_View;
  30. uint8 *m_pUnpaddedPixels;
  31. uint8 *m_pPaddedPixels;
  32. IVTFTexture *m_pVTFTexture;
  33. uint8 *m_pVTFPixels;
  34. int m_aUnpaddedDims[2]; // Width & height of m_pUnpaddedPixels
  35. int m_aPaddedDims[2]; // Width & height of m_pPaddedPixels
  36. CUtlBuffer *m_pBuffer;
  37. static ITexture *m_pScreenshotTarget;
  38. };
  39. #endif // REPLAY_SCREENSHOT_H