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.

52 lines
1.5 KiB

  1. //===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: Ambient light controller entity.
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #include "cbase.h"
  8. #include "spatialentity.h"
  9. #include "env_ambient_light.h"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. #define AMBIENT_LIGHT_ENT_THINK_RATE TICK_INTERVAL
  13. LINK_ENTITY_TO_CLASS(env_ambient_light, CEnvAmbientLight);
  14. BEGIN_DATADESC( CEnvAmbientLight )
  15. DEFINE_KEYFIELD( m_Color, FIELD_COLOR32, "Color" ),
  16. DEFINE_FIELD( m_vecColor, FIELD_VECTOR ),
  17. DEFINE_INPUTFUNC( FIELD_COLOR32, "SetColor", InputSetColor ),
  18. END_DATADESC()
  19. IMPLEMENT_SERVERCLASS_ST(CEnvAmbientLight, DT_EnvAmbientLight)
  20. SendPropVector( SENDINFO(m_vecColor), 0, SPROP_NOSCALE),
  21. END_SEND_TABLE()
  22. void CEnvAmbientLight::Spawn( void )
  23. {
  24. BaseClass::Spawn();
  25. m_vecColor.SetX( static_cast<float>( m_Color.r ) / 255.0f );
  26. m_vecColor.SetY( static_cast<float>( m_Color.g ) / 255.0f );
  27. m_vecColor.SetZ( static_cast<float>( m_Color.b ) / 255.0f );
  28. }
  29. void CEnvAmbientLight::InputSetColor(inputdata_t &inputdata)
  30. {
  31. m_Color = inputdata.value.Color32();
  32. m_vecColor.SetX( static_cast<float>( m_Color.r ) / 255.0f );
  33. m_vecColor.SetY( static_cast<float>( m_Color.g ) / 255.0f );
  34. m_vecColor.SetZ( static_cast<float>( m_Color.b ) / 255.0f );
  35. }
  36. void CEnvAmbientLight::SetColor( const Vector &vecColor )
  37. {
  38. m_vecColor = vecColor;
  39. }