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.

122 lines
2.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef MAPLIGHTCONE_H
  7. #define MAPLIGHTCONE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "MapHelper.h"
  12. #include "MapFace.h"
  13. #include "fgdlib/WCKeyValues.h"
  14. class CHelperInfo;
  15. class CRender3D;
  16. class CMapLightCone : public CMapHelper
  17. {
  18. public:
  19. DECLARE_MAPCLASS(CMapLightCone,CMapHelper);
  20. //
  21. // Factory for building from a list of string parameters.
  22. //
  23. static CMapClass *Create(CHelperInfo *pInfo, CMapEntity *pParent);
  24. //
  25. // Construction/destruction:
  26. //
  27. CMapLightCone(void);
  28. ~CMapLightCone(void);
  29. void CalcBounds(BOOL bFullUpdate = FALSE);
  30. virtual CMapClass *Copy(bool bUpdateDependencies);
  31. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  32. void Render3D(CRender3D *pRender);
  33. int SerializeRMF(std::fstream &File, BOOL bRMF);
  34. int SerializeMAP(std::fstream &File, BOOL bRMF);
  35. virtual void PostloadWorld(CMapWorld *pWorld);
  36. virtual bool IsVisualElement(void) { return(false); } // Only visible when parent entity is selected.
  37. virtual bool IsClutter(void) const { return true; }
  38. virtual bool CanBeCulledByCordon() const { return false; } // We don't hide unless our parent hides.
  39. virtual CMapClass *PrepareSelection(SelectMode_t eSelectMode);
  40. const char* GetDescription() { return("Light cone helper"); }
  41. void OnParentKeyChanged( const char* key, const char* value );
  42. bool ShouldRenderLast(void) { return(true); }
  43. void GetAngles(QAngle& fAngles);
  44. float GetInnerConeAngle(void) const
  45. {
  46. return m_fInnerConeAngle;
  47. }
  48. float GetOuterConeAngle(void) const
  49. {
  50. return m_fOuterConeAngle;
  51. }
  52. Vector GetColor(void) const
  53. {
  54. float multiplier=m_fBrightness/256.0;
  55. Vector ret;
  56. ret.x=GammaToLinear(m_LightColor.x/255.0)*multiplier;
  57. ret.y=GammaToLinear(m_LightColor.y/255.0)*multiplier;
  58. ret.z=GammaToLinear(m_LightColor.z/255.0)*multiplier;
  59. return ret;
  60. }
  61. float m_fQuadraticAttn;
  62. float m_fLinearAttn;
  63. float m_fConstantAttn;
  64. float m_fFiftyPercentDistance; // "_fifty_percent_distance" <0 = not
  65. // using this mode
  66. float m_fZeroPercentDistance; // "_zero_percent_distance"
  67. protected:
  68. void BuildCone(void);
  69. float GetBrightnessAtDist(float fDistance);
  70. float GetLightDist(float fBrightness);
  71. bool SolveQuadratic(float &x, float y, float A, float B, float C);
  72. Vector m_LightColor;
  73. float m_fBrightness;
  74. float m_fInnerConeAngle;
  75. float m_fOuterConeAngle;
  76. QAngle m_Angles;
  77. bool m_bPitchSet;
  78. float m_fPitch;
  79. float m_fFocus;
  80. CMapFaceList m_Faces;
  81. char m_szColorKeyName[KEYVALUE_MAX_KEY_LENGTH];
  82. char m_szInnerConeKeyName[KEYVALUE_MAX_KEY_LENGTH];
  83. char m_szOuterConeKeyName[KEYVALUE_MAX_KEY_LENGTH];
  84. float m_flPitchScale;
  85. };
  86. #endif // MAPLIGHTCONE_H