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.

78 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MAPALIGNEDBOX_H
  8. #define MAPALIGNEDBOX_H
  9. #pragma once
  10. #include "MapHelper.h"
  11. class CHelperInfo;
  12. class CRender2D;
  13. class CRender3D;
  14. #define MAX_KEYNAME_SIZE 32
  15. class CMapAlignedBox : public CMapHelper
  16. {
  17. public:
  18. DECLARE_MAPCLASS(CMapAlignedBox,CMapHelper)
  19. //
  20. // Factory for building from a list of string parameters.
  21. //
  22. static CMapClass *Create(CHelperInfo *pInfo, CMapEntity *pParent);
  23. //
  24. // Construction/destruction:
  25. //
  26. CMapAlignedBox(void);
  27. CMapAlignedBox(Vector& pfMins, Vector& pfMaxs);
  28. CMapAlignedBox(const char *pMinsKeyName, const char *pMaxsKeyName);
  29. ~CMapAlignedBox(void);
  30. virtual void CalcBounds(BOOL bFullUpdate = FALSE);
  31. virtual CMapClass *Copy(bool bUpdateDependencies);
  32. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  33. virtual void Render2D(CRender2D *pRender);
  34. virtual void Render3D(CRender3D *pRender);
  35. int SerializeRMF(std::fstream &File, BOOL bRMF);
  36. int SerializeMAP(std::fstream &File, BOOL bRMF);
  37. bool IsVisualElement(void) { return !m_bWireframe; }
  38. const char* GetDescription() { return("Aligned box"); }
  39. virtual void OnParentKeyChanged( const char* key, const char* value );
  40. protected:
  41. //void UpdateBox(const Vector &vecMins, const Vector &vecMaxs);
  42. bool m_bWireframe; // Whether we render as a wireframe box when the entity is selected.
  43. // Determines whether we use the key names to get the box size
  44. // or m_fMins/m_fMaxs.
  45. bool m_bUseKeyName;
  46. char m_MinsKeyName[MAX_KEYNAME_SIZE];
  47. char m_MaxsKeyName[MAX_KEYNAME_SIZE];
  48. Vector m_Mins;
  49. Vector m_Maxs;
  50. };
  51. #endif // MAPALIGNEDBOX_H