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.

86 lines
1.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef C_SUN_H
  8. #define C_SUN_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "c_baseentity.h"
  13. #include "utllinkedlist.h"
  14. #include "glow_overlay.h"
  15. #include "sun_shared.h"
  16. //
  17. // Special glow overlay
  18. //
  19. class C_SunGlowOverlay : public CGlowOverlay
  20. {
  21. virtual void CalcSpriteColorAndSize( float flDot, CGlowSprite *pSprite, float *flHorzSize, float *flVertSize, Vector *vColor )
  22. {
  23. if ( m_bModulateByDot )
  24. {
  25. float alpha = RemapVal( flDot, 1.0f, 0.9f, 0.75f, 0.0f );
  26. alpha = clamp( alpha, 0.0f, 0.75f );
  27. *flHorzSize = pSprite->m_flHorzSize * 6.0f;
  28. *flVertSize = pSprite->m_flVertSize * 6.0f;
  29. *vColor = pSprite->m_vColor * alpha * m_flGlowObstructionScale;
  30. }
  31. else
  32. {
  33. *flHorzSize = pSprite->m_flHorzSize;
  34. *flVertSize = pSprite->m_flVertSize;
  35. *vColor = pSprite->m_vColor * m_flGlowObstructionScale;
  36. }
  37. }
  38. public:
  39. void SetModulateByDot( bool state = true )
  40. {
  41. m_bModulateByDot = state;
  42. }
  43. protected:
  44. bool m_bModulateByDot;
  45. };
  46. //
  47. // Sun entity
  48. //
  49. class C_Sun : public C_BaseEntity
  50. {
  51. public:
  52. DECLARE_CLASS( C_Sun, C_BaseEntity );
  53. DECLARE_CLIENTCLASS();
  54. C_Sun();
  55. ~C_Sun();
  56. virtual void OnDataChanged( DataUpdateType_t updateType );
  57. public:
  58. C_SunGlowOverlay m_Overlay;
  59. C_SunGlowOverlay m_GlowOverlay;
  60. color32 m_clrOverlay;
  61. int m_nSize;
  62. int m_nOverlaySize;
  63. Vector m_vDirection;
  64. bool m_bOn;
  65. int m_nMaterial;
  66. int m_nOverlayMaterial;
  67. };
  68. #endif // C_SUN_H