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.

111 lines
3.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef REPLAYRENDERER_H
  5. #define REPLAYRENDERER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //-----------------------------------------------------------------------------
  10. #include "replay/ireplaymovierenderer.h"
  11. #include "replay/rendermovieparams.h"
  12. #include "movieobjects/timeutils.h"
  13. #include "fmtstr.h"
  14. //-----------------------------------------------------------------------------
  15. class CReplay;
  16. class CReplayPerformance;
  17. class IQuickTimeMovieMaker;
  18. class CReplayRenderOverlay;
  19. class IVideoRecorder;
  20. //-----------------------------------------------------------------------------
  21. class CReplayRenderer : public IReplayMovieRenderer
  22. {
  23. public:
  24. CReplayRenderer( CReplayRenderOverlay *pOverlay );
  25. ~CReplayRenderer();
  26. const CReplayPerformance *GetPerformance() const;
  27. const char *GetMovieFilename() const;
  28. static int GetNumMotionBlurTimeSteps( int nQuality );
  29. //
  30. // IReplayMovieRenderer interface
  31. //
  32. virtual bool SetupRenderer( RenderMovieParams_t &params, IReplayMovie *pMovie );
  33. virtual void ShutdownRenderer();
  34. virtual void RenderVideo();
  35. virtual void RenderAudio( unsigned char *pBuffer, int nSize, int nNumSamples );
  36. virtual void SetAudioSyncFrame( bool isSync = false );
  37. virtual bool IsAudioSyncFrame();
  38. virtual float GetRecordingFrameDuration();
  39. private:
  40. bool IsDepthOfFieldEnabled() const;
  41. bool IsAntialiasingEnabled() const;
  42. bool IsHDR() const;
  43. bool IsMotionBlurEnabled() const;
  44. int GetMotionBlurQuality() const;
  45. int GetDepthOfFieldQuality() const;
  46. int NumMotionBlurTimeSteps() const;
  47. float GetFramerate() const;
  48. void ComputeSampleCounts( int *pNSamplesPerTimeStep, int *pNTotalSamples ) const;
  49. float GetViewModelFOVOffset();
  50. void SetupDOFMatrixSkewView( const Vector &pos, const QAngle &angles, int nSample, CViewSetup& viewSetup );
  51. void BeginRenderingSample( int nSample, int x, int y, int nWidth, int nHeight, float fTonemapScale );
  52. void EndRendering();
  53. void SetupSampleView( int x, int y, int w, int h, int nSample, CViewSetup& viewSetup );
  54. void InitBuffers( const RenderMovieParams_t &params );
  55. void DrawResolvingQuad( int nWidth, int nHeight );
  56. float GetRenderLength( const CReplay *pReplay );
  57. void CompositeAndLayoffFrame( int nFrame );
  58. void RenderLayoffFrame( DmeTime_t time, int nCurSample, int nNumTotalSamples );
  59. void ResolveSamples( int nSample, DmeTime_t frametime, int x, int y, int nWidth, int nHeight, bool bShowUser, float flBloomScale );
  60. void LayoffFrame( int nFrame );
  61. double GetShutterSpeed() const;
  62. void ClearToBlack( CTextureReference &buf, int x, int y, int nWidth, int nHeight );
  63. bool SetupJitterTable();
  64. void GetViewSetup( CViewSetup &viewsetup );
  65. bool m_bIsAudioSyncFrame;
  66. const Vector2D *m_pJitterTable;
  67. int m_nNumJitterSamples;
  68. IVideoRecorder *m_pMovieMaker;
  69. bool m_bCacheFullSceneState;
  70. BGRA8888_t *m_pLayoffBuf;
  71. IReplayMovie *m_pMovie;
  72. RenderMovieParams_t m_RenderParams;
  73. CTextureReference m_AccumBuffSample;
  74. CTextureReference m_LayoffResult;
  75. CTextureReference m_AccumBuffPingPong[2]; // Buffers and materials for ping-pong accumulation buffer
  76. CMaterialReference m_FourSampleResolveMatRef;
  77. bool m_bForceCheapDoF;
  78. bool m_bShutterClosed;
  79. int m_nCurrentPingPong;
  80. int m_nFrame;
  81. ConVar *m_pViewmodelFov;
  82. ConVar *m_pDefaultFov;
  83. int m_nTimeStep;
  84. int m_nCurSample;
  85. DmeTime_t m_curSampleTime;
  86. int m_iTgaFrame;
  87. CFmtStr m_fmtTgaRenderDirName;
  88. CReplayRenderOverlay *m_pRenderOverlay;
  89. };
  90. //-----------------------------------------------------------------------------
  91. #endif // REPLAYRENDERER_H