Team Fortress 2 Source Code as on 22/4/2020
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
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef MAPFRUSTUM_H
  7. #define MAPFRUSTUM_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 CMapFrustum : public CMapHelper
  17. {
  18. public:
  19. DECLARE_MAPCLASS(CMapFrustum,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. CMapFrustum(void);
  28. ~CMapFrustum(void);
  29. void BuildFrustumFaces();
  30. void CalcBounds(BOOL bFullUpdate = FALSE);
  31. virtual CMapClass *Copy(bool bUpdateDependencies);
  32. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  33. void Render3D(CRender3D *pRender);
  34. int SerializeRMF(std::fstream &File, BOOL bRMF);
  35. int SerializeMAP(std::fstream &File, BOOL bRMF);
  36. virtual void PostloadWorld(CMapWorld *pWorld);
  37. virtual bool IsVisualElement(void) { return(false); } // Only visible when parent entity is selected.
  38. virtual bool IsClutter(void) { return true; }
  39. virtual bool IsCulledByCordon(const Vector &vecMins, const Vector &vecMaxs) { return false; } // We don't hide unless our parent hides.
  40. const char* GetDescription() { return("Frustum helper"); }
  41. void OnParentKeyChanged( const char* key, const char* value );
  42. bool ShouldRenderLast(void) { return(true); }
  43. void GetAngles(QAngle& fAngles);
  44. private:
  45. CMapFace* CreateMapFace( const Vector &v1, const Vector &v2, const Vector &v3, const Vector &v4, float flAlpha );
  46. protected:
  47. CMapFaceList m_Faces;
  48. float m_flFOV;
  49. float m_flNearPlane;
  50. float m_flFarPlane;
  51. float m_flPitchScale;
  52. float m_fBrightness;
  53. QAngle m_Angles;
  54. char m_szFOVKeyName[KEYVALUE_MAX_KEY_LENGTH];
  55. char m_szColorKeyName[KEYVALUE_MAX_KEY_LENGTH];
  56. char m_szNearPlaneKeyName[KEYVALUE_MAX_KEY_LENGTH];
  57. char m_szFarPlaneKeyName[KEYVALUE_MAX_KEY_LENGTH];
  58. };
  59. #endif // MAPFRUSTUM_H