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.

116 lines
2.4 KiB

  1. //===== Copyright 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #include "cbase.h"
  8. #include "c_point_camera.h"
  9. #include "toolframework/itoolframework.h"
  10. #include "toolframework_client.h"
  11. #include "tier1/keyvalues.h"
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include "tier0/memdbgon.h"
  14. IMPLEMENT_CLIENTCLASS_DT( C_PointCamera, DT_PointCamera, CPointCamera )
  15. RecvPropFloat( RECVINFO( m_FOV ) ),
  16. RecvPropFloat( RECVINFO( m_Resolution ) ),
  17. RecvPropInt( RECVINFO( m_bFogEnable ) ),
  18. RecvPropInt( RECVINFO( m_FogColor ), 0, RecvProxy_Int32ToColor32 ),
  19. RecvPropFloat( RECVINFO( m_flFogStart ) ),
  20. RecvPropFloat( RECVINFO( m_flFogEnd ) ),
  21. RecvPropFloat( RECVINFO( m_flFogMaxDensity ) ),
  22. RecvPropInt( RECVINFO( m_bActive ) ),
  23. RecvPropInt( RECVINFO( m_bUseScreenAspectRatio ) ),
  24. END_RECV_TABLE()
  25. C_EntityClassList<C_PointCamera> g_PointCameraList;
  26. template<> C_PointCamera *C_EntityClassList<C_PointCamera>::m_pClassList = NULL;
  27. C_PointCamera* GetPointCameraList()
  28. {
  29. return g_PointCameraList.m_pClassList;
  30. }
  31. C_PointCamera::C_PointCamera()
  32. {
  33. m_bActive = false;
  34. m_bFogEnable = false;
  35. g_PointCameraList.Insert( this );
  36. }
  37. C_PointCamera::~C_PointCamera()
  38. {
  39. g_PointCameraList.Remove( this );
  40. }
  41. bool C_PointCamera::ShouldDraw()
  42. {
  43. return false;
  44. }
  45. float C_PointCamera::GetFOV()
  46. {
  47. return m_FOV;
  48. }
  49. float C_PointCamera::GetResolution()
  50. {
  51. return m_Resolution;
  52. }
  53. bool C_PointCamera::IsFogEnabled()
  54. {
  55. return m_bFogEnable;
  56. }
  57. void C_PointCamera::GetFogColor( unsigned char &r, unsigned char &g, unsigned char &b )
  58. {
  59. r = m_FogColor.r;
  60. g = m_FogColor.g;
  61. b = m_FogColor.b;
  62. }
  63. float C_PointCamera::GetFogStart()
  64. {
  65. return m_flFogStart;
  66. }
  67. float C_PointCamera::GetFogEnd()
  68. {
  69. return m_flFogEnd;
  70. }
  71. float C_PointCamera::GetFogMaxDensity()
  72. {
  73. return m_flFogMaxDensity;
  74. }
  75. bool C_PointCamera::IsActive()
  76. {
  77. return m_bActive;
  78. }
  79. void C_PointCamera::GetToolRecordingState( KeyValues *msg )
  80. {
  81. BaseClass::GetToolRecordingState( msg );
  82. unsigned char r, g, b;
  83. static MonitorRecordingState_t state;
  84. state.m_bActive = IsActive() && !IsDormant();
  85. state.m_flFOV = GetFOV();
  86. state.m_bFogEnabled = IsFogEnabled();
  87. state.m_flFogStart = GetFogStart();
  88. state.m_flFogEnd = GetFogEnd();
  89. GetFogColor( r, g, b );
  90. state.m_FogColor.SetColor( r, g, b, 255 );
  91. msg->SetPtr( "monitor", &state );
  92. }