Counter Strike : Global Offensive Source Code
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.

155 lines
5.0 KiB

  1. //===== Copyright � 1996-2005, 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. #define MAX_DEPTH_TEXTURE_SHADOWS 1
  16. #define MAX_DEPTH_TEXTURE_HIGHRES_SHADOWS 0
  17. #define MAX_DEPTH_TEXTURE_SHADOWS_TOOLS 8
  18. #define MAX_DEPTH_TEXTURE_HIGHRES_SHADOWS_TOOLS 0
  19. // These are set as it draws reflections, refractions, etc, so certain effects can avoid
  20. // drawing themselves in reflections.
  21. enum DrawFlags_t
  22. {
  23. DF_RENDER_REFRACTION = 0x1,
  24. DF_RENDER_REFLECTION = 0x2,
  25. DF_CLIP_Z = 0x4,
  26. DF_CLIP_BELOW = 0x8,
  27. DF_RENDER_UNDERWATER = 0x10,
  28. DF_RENDER_ABOVEWATER = 0x20,
  29. DF_RENDER_WATER = 0x40,
  30. DF_SSAO_DEPTH_PASS = 0x80,
  31. DF_RENDER_PSEUDO_TRANSLUCENT_WATER = 0x100, // Pseudo-translucent water is water that renders after all opaques but before all transparents, writes to depth, and uses alpha blending
  32. DF_WATERHEIGHT = 0x200,
  33. DF_DRAW_SSAO = 0x400,
  34. DF_DRAWSKYBOX = 0x800,
  35. DF_FUDGE_UP = 0x1000,
  36. DF_DRAW_ENTITITES = 0x2000,
  37. DF_SKIP_WORLD = 0x4000,
  38. DF_SKIP_WORLD_DECALS_AND_OVERLAYS = 0x8000,
  39. DF_UNUSED5 = 0x10000,
  40. DF_SAVEGAMESCREENSHOT = 0x20000,
  41. DF_CLIP_SKYBOX = 0x40000,
  42. DF_DRAW_SIMPLE_WORLD_MODEL = 0x80000, // Draw a singe studio model for the world to save CPU.
  43. DF_SHADOW_DEPTH_MAP = 0x100000, // Currently rendering a shadow depth map
  44. DF_FAST_ENTITY_RENDERING = 0x200000, // Used with DF_DRAW_ENTITIES to only render marked entities into the water reflection buffer for "fast reflections"
  45. DF_DRAW_SIMPLE_WORLD_MODEL_WATER = 0x400000, // Draw a singe studio model for the world to save CPU.
  46. };
  47. //-----------------------------------------------------------------------------
  48. // Purpose: View setup and rendering
  49. //-----------------------------------------------------------------------------
  50. class CViewSetup;
  51. class C_BaseEntity;
  52. struct vrect_t;
  53. class C_BaseViewModel;
  54. abstract_class IViewRender
  55. {
  56. public:
  57. // SETUP
  58. // Initialize view renderer
  59. virtual void Init( void ) = 0;
  60. // Clear any systems between levels
  61. virtual void LevelInit( void ) = 0;
  62. virtual void LevelShutdown( void ) = 0;
  63. // Shutdown
  64. virtual void Shutdown( void ) = 0;
  65. // RENDERING
  66. // Called right before simulation. It must setup the view model origins and angles here so
  67. // the correct attachment points can be used during simulation.
  68. virtual void OnRenderStart() = 0;
  69. // Called to render the entire scene
  70. virtual void Render( vrect_t *rect ) = 0;
  71. // Called to render just a particular setup ( for timerefresh and envmap creation )
  72. // First argument is 3d view setup, second is for the HUD (in most cases these are ==, but in split screen the client .dll handles this differently)
  73. virtual void RenderView( const CViewSetup &view, const CViewSetup &hudViewSetup, int nClearFlags, int whatToDraw ) = 0;
  74. // What are we currently rendering? Returns a combination of DF_ flags.
  75. virtual int GetDrawFlags() = 0;
  76. // MISC
  77. // Start and stop pitch drifting logic
  78. virtual void StartPitchDrift( void ) = 0;
  79. virtual void StopPitchDrift( void ) = 0;
  80. // This can only be called during rendering (while within RenderView).
  81. virtual VPlane* GetFrustum() = 0;
  82. virtual bool ShouldDrawBrushModels( void ) = 0;
  83. virtual const CViewSetup *GetPlayerViewSetup( int nSlot = -1 ) const = 0;
  84. virtual const CViewSetup *GetViewSetup( void ) const = 0;
  85. virtual void DisableVis( void ) = 0;
  86. virtual int BuildWorldListsNumber() const = 0;
  87. virtual void SetCheapWaterStartDistance( float flCheapWaterStartDistance ) = 0;
  88. virtual void SetCheapWaterEndDistance( float flCheapWaterEndDistance ) = 0;
  89. virtual void GetWaterLODParams( float &flCheapWaterStartDistance, float &flCheapWaterEndDistance ) = 0;
  90. virtual void DriftPitch (void) = 0;
  91. virtual void SetScreenOverlayMaterial( IMaterial *pMaterial ) = 0;
  92. virtual IMaterial *GetScreenOverlayMaterial( ) = 0;
  93. virtual void WriteSaveGameScreenshot( const char *pFilename ) = 0;
  94. virtual void WriteSaveGameScreenshotOfSize( const char *pFilename, int width, int height ) = 0;
  95. // Draws another rendering over the top of the screen
  96. virtual void QueueOverlayRenderView( const CViewSetup &view, int nClearFlags, int whatToDraw ) = 0;
  97. // Returns znear and zfar
  98. virtual float GetZNear() = 0;
  99. virtual float GetZFar() = 0;
  100. // Returns the min/max fade distances, and distance scale
  101. virtual void GetScreenFadeDistances( float *pMin, float *pMax, float *pScale ) = 0;
  102. virtual C_BaseEntity *GetCurrentlyDrawingEntity() = 0;
  103. virtual void SetCurrentlyDrawingEntity( C_BaseEntity *pEnt ) = 0;
  104. virtual bool UpdateShadowDepthTexture( ITexture *pRenderTarget, ITexture *pDepthTexture, const CViewSetup &shadowView, bool bRenderWorldAndObjects = true, bool bRenderViewModels = false ) = 0;
  105. virtual void FreezeFrame( float flFreezeTime ) = 0;
  106. virtual void InitFadeData( void ) = 0;
  107. };
  108. extern IViewRender *view;
  109. #endif // IVIEWRENDER_H