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.

98 lines
2.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #if !defined( VIEW_H )
  10. #define VIEW_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #if _DEBUG
  15. extern bool g_bRenderingCameraView; // For debugging (frustum fix for cameras)...
  16. #endif
  17. class VMatrix;
  18. class Vector;
  19. class QAngle;
  20. class VPlane;
  21. // near and far Z it uses to render the world.
  22. #ifndef HL1_CLIENT_DLL
  23. #define VIEW_NEARZ 7
  24. #else
  25. #define VIEW_NEARZ 3
  26. #endif
  27. //#define VIEW_FARZ 28400
  28. //-----------------------------------------------------------------------------
  29. // There's a difference between the 'current view' and the 'main view'
  30. // The 'main view' is where the player is sitting. Current view is just
  31. // what's currently being rendered, which, owing to monitors or water,
  32. // could be just about anywhere.
  33. //-----------------------------------------------------------------------------
  34. const Vector &MainViewOrigin();
  35. const QAngle &MainViewAngles();
  36. const Vector &PrevMainViewOrigin();
  37. const QAngle &PrevMainViewAngles();
  38. const VMatrix &MainWorldToViewMatrix();
  39. const Vector &MainViewForward();
  40. const Vector &MainViewRight();
  41. const Vector &MainViewUp();
  42. const Vector &CurrentViewOrigin();
  43. const QAngle &CurrentViewAngles();
  44. const VMatrix &CurrentWorldToViewMatrix();
  45. const Vector &CurrentViewForward();
  46. const Vector &CurrentViewRight();
  47. const Vector &CurrentViewUp();
  48. void AllowCurrentViewAccess( bool allow );
  49. bool IsCurrentViewAccessAllowed();
  50. // Returns true of the sphere is outside the frustum defined by pPlanes.
  51. // (planes point inwards).
  52. bool R_CullSphere( const VPlane *pPlanes, int nPlanes, const Vector *pCenter, float radius );
  53. float ScaleFOVByWidthRatio( float fovDegrees, float ratio );
  54. extern ConVar mat_wireframe;
  55. extern const ConVar *sv_cheats;
  56. static inline int WireFrameMode( void )
  57. {
  58. if ( !sv_cheats )
  59. {
  60. sv_cheats = cvar->FindVar( "sv_cheats" );
  61. }
  62. if ( sv_cheats && sv_cheats->GetBool() )
  63. return mat_wireframe.GetInt();
  64. else
  65. return 0;
  66. }
  67. static inline bool ShouldDrawInWireFrameMode( void )
  68. {
  69. if ( !sv_cheats )
  70. {
  71. sv_cheats = cvar->FindVar( "sv_cheats" );
  72. }
  73. if ( sv_cheats && sv_cheats->GetBool() )
  74. return ( mat_wireframe.GetInt() != 0 );
  75. else
  76. return false;
  77. }
  78. void ComputeCameraVariables( const Vector &vecOrigin, const QAngle &vecAngles, Vector *pVecForward, Vector *pVecRight, Vector *pVecUp, VMatrix *pMatCamInverse );
  79. #endif // VIEW_H