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.

145 lines
4.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //===========================================================================//
  9. #if !defined( IVIEWRENDER_H )
  10. #define IVIEWRENDER_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "ivrenderview.h"
  15. // These are set as it draws reflections, refractions, etc, so certain effects can avoid
  16. // drawing themselves in reflections.
  17. enum DrawFlags_t
  18. {
  19. DF_RENDER_REFRACTION = 0x1,
  20. DF_RENDER_REFLECTION = 0x2,
  21. DF_CLIP_Z = 0x4,
  22. DF_CLIP_BELOW = 0x8,
  23. DF_RENDER_UNDERWATER = 0x10,
  24. DF_RENDER_ABOVEWATER = 0x20,
  25. DF_RENDER_WATER = 0x40,
  26. DF_SSAO_DEPTH_PASS = 0x100,
  27. DF_WATERHEIGHT = 0x200,
  28. DF_DRAW_SSAO = 0x400,
  29. DF_DRAWSKYBOX = 0x800,
  30. DF_FUDGE_UP = 0x1000,
  31. DF_DRAW_ENTITITES = 0x2000,
  32. DF_UNUSED3 = 0x4000,
  33. DF_UNUSED4 = 0x8000,
  34. DF_UNUSED5 = 0x10000,
  35. DF_SAVEGAMESCREENSHOT = 0x20000,
  36. DF_CLIP_SKYBOX = 0x40000,
  37. DF_SHADOW_DEPTH_MAP = 0x100000 // Currently rendering a shadow depth map
  38. };
  39. //-----------------------------------------------------------------------------
  40. // Purpose: View setup and rendering
  41. //-----------------------------------------------------------------------------
  42. class CViewSetup;
  43. class C_BaseEntity;
  44. struct vrect_t;
  45. class C_BaseViewModel;
  46. struct WriteReplayScreenshotParams_t;
  47. class IReplayScreenshotSystem;
  48. abstract_class IViewRender
  49. {
  50. public:
  51. // SETUP
  52. // Initialize view renderer
  53. virtual void Init( void ) = 0;
  54. // Clear any systems between levels
  55. virtual void LevelInit( void ) = 0;
  56. virtual void LevelShutdown( void ) = 0;
  57. // Shutdown
  58. virtual void Shutdown( void ) = 0;
  59. // RENDERING
  60. // Called right before simulation. It must setup the view model origins and angles here so
  61. // the correct attachment points can be used during simulation.
  62. virtual void OnRenderStart() = 0;
  63. // Called to render the entire scene
  64. virtual void Render( vrect_t *rect ) = 0;
  65. // Called to render just a particular setup ( for timerefresh and envmap creation )
  66. virtual void RenderView( const CViewSetup &view, int nClearFlags, int whatToDraw ) = 0;
  67. // What are we currently rendering? Returns a combination of DF_ flags.
  68. virtual int GetDrawFlags() = 0;
  69. // MISC
  70. // Start and stop pitch drifting logic
  71. virtual void StartPitchDrift( void ) = 0;
  72. virtual void StopPitchDrift( void ) = 0;
  73. // This can only be called during rendering (while within RenderView).
  74. virtual VPlane* GetFrustum() = 0;
  75. virtual bool ShouldDrawBrushModels( void ) = 0;
  76. virtual const CViewSetup *GetPlayerViewSetup( void ) const = 0;
  77. virtual const CViewSetup *GetViewSetup( void ) const = 0;
  78. virtual void DisableVis( void ) = 0;
  79. virtual int BuildWorldListsNumber() const = 0;
  80. virtual void SetCheapWaterStartDistance( float flCheapWaterStartDistance ) = 0;
  81. virtual void SetCheapWaterEndDistance( float flCheapWaterEndDistance ) = 0;
  82. virtual void GetWaterLODParams( float &flCheapWaterStartDistance, float &flCheapWaterEndDistance ) = 0;
  83. virtual void DriftPitch (void) = 0;
  84. virtual void SetScreenOverlayMaterial( IMaterial *pMaterial ) = 0;
  85. virtual IMaterial *GetScreenOverlayMaterial( ) = 0;
  86. virtual void WriteSaveGameScreenshot( const char *pFilename ) = 0;
  87. virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height, bool bCreatePowerOf2Padded = false, bool bWriteVTF = false ) = 0;
  88. virtual void WriteReplayScreenshot( WriteReplayScreenshotParams_t &params ) = 0;
  89. virtual void UpdateReplayScreenshotCache() = 0;
  90. // Draws another rendering over the top of the screen
  91. virtual void QueueOverlayRenderView( const CViewSetup &view, int nClearFlags, int whatToDraw ) = 0;
  92. // Returns znear and zfar
  93. virtual float GetZNear() = 0;
  94. virtual float GetZFar() = 0;
  95. virtual void GetScreenFadeDistances( float *min, float *max ) = 0;
  96. virtual C_BaseEntity *GetCurrentlyDrawingEntity() = 0;
  97. virtual void SetCurrentlyDrawingEntity( C_BaseEntity *pEnt ) = 0;
  98. virtual bool UpdateShadowDepthTexture( ITexture *pRenderTarget, ITexture *pDepthTexture, const CViewSetup &shadowView ) = 0;
  99. virtual void FreezeFrame( float flFreezeTime ) = 0;
  100. virtual IReplayScreenshotSystem *GetReplayScreenshotSystem() = 0;
  101. };
  102. extern IViewRender *view;
  103. #endif // IVIEWRENDER_H