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.

94 lines
2.5 KiB

  1. //========= Copyright 1996-2005, 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. #define VIEW_NEARZ 7
  23. //#define VIEW_FARZ 28400
  24. //-----------------------------------------------------------------------------
  25. // There's a difference between the 'current view' and the 'main view'
  26. // The 'main view' is where the player is sitting. Current view is just
  27. // what's currently being rendered, which, owing to monitors or water,
  28. // could be just about anywhere.
  29. //-----------------------------------------------------------------------------
  30. const Vector &MainViewOrigin( int nSlot );
  31. const QAngle &MainViewAngles( int nSlot );
  32. const Vector &PrevMainViewOrigin( int nSlot );
  33. const QAngle &PrevMainViewAngles( int nSlot );
  34. const VMatrix &MainWorldToViewMatrix( int nSlot );
  35. const Vector &MainViewForward( int nSlot );
  36. const Vector &MainViewRight( int nSlot );
  37. const Vector &MainViewUp( int nSlot );
  38. const Vector &CurrentViewOrigin();
  39. const QAngle &CurrentViewAngles();
  40. const VMatrix &CurrentWorldToViewMatrix();
  41. const Vector &CurrentViewForward();
  42. const Vector &CurrentViewRight();
  43. const Vector &CurrentViewUp();
  44. void AllowCurrentViewAccess( bool allow );
  45. bool IsCurrentViewAccessAllowed();
  46. // Returns true of the sphere is outside the frustum defined by pPlanes.
  47. // (planes point inwards).
  48. bool R_CullSphere( const VPlane *pPlanes, int nPlanes, const Vector *pCenter, float radius );
  49. float ScaleFOVByWidthRatio( float fovDegrees, float ratio );
  50. extern ConVar mat_wireframe;
  51. extern const ConVar *sv_cheats;
  52. static inline int WireFrameMode( void )
  53. {
  54. if ( !sv_cheats )
  55. {
  56. sv_cheats = cvar->FindVar( "sv_cheats" );
  57. }
  58. if ( sv_cheats && sv_cheats->GetBool() )
  59. return mat_wireframe.GetInt();
  60. else
  61. return 0;
  62. }
  63. static inline bool ShouldDrawInWireFrameMode( void )
  64. {
  65. if ( !sv_cheats )
  66. {
  67. sv_cheats = cvar->FindVar( "sv_cheats" );
  68. }
  69. if ( sv_cheats && sv_cheats->GetBool() )
  70. return ( mat_wireframe.GetInt() != 0 );
  71. else
  72. return false;
  73. }
  74. void ComputeCameraVariables( const Vector &vecOrigin, const QAngle &vecAngles, Vector *pVecForward, Vector *pVecRight, Vector *pVecUp, VMatrix *pMatCamInverse );
  75. #endif // VIEW_H