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.

86 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Responsible for drawing the scene
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #include "cbase.h"
  8. #include "iviewrender.h"
  9. #include "view_shared.h"
  10. #include "tf_viewrender.h"
  11. #include "viewpostprocess.h"
  12. #include <game/client/iviewport.h>
  13. #include "clienteffectprecachesystem.h"
  14. // memdbgon must be the last include file in a .cpp file!!!
  15. #include "tier0/memdbgon.h"
  16. CLIENTEFFECT_REGISTER_BEGIN( PrecachePostProcessingGlowEffects )
  17. CLIENTEFFECT_MATERIAL( "dev/glow_blur_x" )
  18. CLIENTEFFECT_MATERIAL( "dev/glow_blur_y" )
  19. CLIENTEFFECT_MATERIAL( "dev/glow_color" )
  20. CLIENTEFFECT_MATERIAL( "dev/glow_downsample" )
  21. CLIENTEFFECT_MATERIAL( "dev/halo_add_to_screen" )
  22. CLIENTEFFECT_REGISTER_END()
  23. static CTFViewRender g_ViewRender;
  24. CTFViewRender::CTFViewRender()
  25. {
  26. view = ( IViewRender * )this;
  27. }
  28. struct ConVarFlags
  29. {
  30. const char *name;
  31. int flags;
  32. const char *optional_default;
  33. };
  34. ConVarFlags s_flaggedConVars[] =
  35. {
  36. { "r_screenfademinsize", FCVAR_CHEAT, "0" },
  37. { "r_screenfademaxsize", FCVAR_CHEAT, "0" },
  38. { "mat_dxlevel", FCVAR_SPONLY, NULL },
  39. };
  40. //-----------------------------------------------------------------------------
  41. // Purpose:
  42. //-----------------------------------------------------------------------------
  43. void CTFViewRender::Init()
  44. {
  45. for ( int i=0; i<ARRAYSIZE( s_flaggedConVars ); ++i )
  46. {
  47. ConVar *flaggedConVar = cvar->FindVar( s_flaggedConVars[i].name );
  48. if ( flaggedConVar )
  49. {
  50. flaggedConVar->AddFlags( s_flaggedConVars[i].flags );
  51. if ( s_flaggedConVars[i].optional_default )
  52. {
  53. flaggedConVar->SetDefault( s_flaggedConVars[i].optional_default );
  54. flaggedConVar->Revert();
  55. }
  56. }
  57. }
  58. BaseClass::Init();
  59. }
  60. //-----------------------------------------------------------------------------
  61. // Purpose: Renders extra 2D effects in derived classes while the 2D view is on the stack
  62. //-----------------------------------------------------------------------------
  63. void CTFViewRender::Render2DEffectsPostHUD( const CViewSetup &viewTF )
  64. {
  65. BaseClass::Render2DEffectsPostHUD( viewTF );
  66. #if defined( _X360 )
  67. // if we're in the intro menus
  68. if ( gViewPortInterface->GetActivePanel() != NULL )
  69. {
  70. DoEnginePostProcessing( viewTF.x, viewTF.y, viewTF.width, viewTF.height, false, true );
  71. }
  72. #endif //_X360
  73. }