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.

94 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: The main manager of rendering
  4. //
  5. // $Revision: $
  6. // $NoKeywords: $
  7. //===========================================================================//
  8. #ifndef RENDERMANAGER_H
  9. #define RENDERMANAGER_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "gamemanager.h"
  14. #include "tier1/mempool.h"
  15. #include "mathlib/mathlib.h"
  16. //-----------------------------------------------------------------------------
  17. // Physics property for entities
  18. //-----------------------------------------------------------------------------
  19. class CCameraProperty
  20. {
  21. DECLARE_FIXEDSIZE_ALLOCATOR( CCameraProperty );
  22. public:
  23. CCameraProperty();
  24. void GetForward( Vector *pForward );
  25. // Array used for fixed-timestep simulation
  26. Vector m_Origin;
  27. QAngle m_Angles;
  28. Vector m_Velocity;
  29. QAngle m_AngVelocity;
  30. private:
  31. friend class CRenderManager;
  32. };
  33. //-----------------------------------------------------------------------------
  34. // Rendering management
  35. //-----------------------------------------------------------------------------
  36. class CRenderManager : public CGameManager<>
  37. {
  38. public:
  39. // Inherited from IGameManager
  40. virtual bool Init();
  41. virtual LevelRetVal_t LevelInit( bool bFirstCall );
  42. virtual void Update( );
  43. virtual LevelRetVal_t LevelShutdown( bool bFirstCall );
  44. virtual void Shutdown();
  45. // Property allocation
  46. CCameraProperty *CreateCameraProperty();
  47. void DestroyCameraProperty( CCameraProperty *pProperty );
  48. void RenderWorldInRect( int x, int y, int nWidth, int nHeight );
  49. void RenderWorldFullscreen();
  50. private:
  51. // Set up a projection matrix for a 90 degree fov
  52. void SetupProjectionMatrix( int nWidth, int nHeight, float flFOV );
  53. // Set up a orthographic projection matrix
  54. void SetupOrthoMatrix( int nWidth, int nHeight );
  55. // Sets up the camera
  56. void SetupCameraRenderState( );
  57. // Draws the world
  58. void RenderWorld();
  59. // Done completely client-side, want total smoothness, so simulate at render interval
  60. void UpdateLocalPlayerCamera();
  61. bool m_bRenderWorldFullscreen;
  62. int m_nRenderX;
  63. int m_nRenderY;
  64. int m_nRenderWidth;
  65. int m_nRenderHeight;
  66. };
  67. //-----------------------------------------------------------------------------
  68. // Singleton accessor
  69. //-----------------------------------------------------------------------------
  70. extern CRenderManager *g_pRenderManager;
  71. #endif // RENDERMANAGER_H