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.

98 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MAPCYLINDER_H
  8. #define MAPCYLINDER_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "MapHelper.h"
  13. class CRender3D;
  14. #define MAX_KEYNAME_SIZE 32
  15. class CMapCylinder : public CMapHelper
  16. {
  17. public:
  18. DECLARE_MAPCLASS(CMapCylinder, 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. CMapCylinder(void);
  27. CMapCylinder(const char *pszStartValueKey, const char *pszStartKey, const char *pszStartRadiusKey,
  28. const char *pszEndValueKey, const char *pszEndKey, const char *pszEndRadiusKey );
  29. ~CMapCylinder(void);
  30. void Initialize(void);
  31. void CalcBounds(BOOL bFullUpdate = FALSE);
  32. virtual CMapClass *Copy(bool bUpdateDependencies);
  33. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  34. void Render3D(CRender3D *pRender);
  35. void Render2D(CRender2D *pRender);
  36. int SerializeRMF(std::fstream &File, BOOL bRMF);
  37. int SerializeMAP(std::fstream &File, BOOL bRMF);
  38. bool IsVisualElement(void) { return(true); }
  39. bool IsCulledByCordon(const Vector &vecMins, const Vector &vecMaxs) { return false; } // We don't hide unless our parent hides.
  40. virtual CMapClass *PrepareSelection(SelectMode_t eSelectMode);
  41. const char* GetDescription() { return("Cylinder helper"); }
  42. void OnAddToWorld(CMapWorld *pWorld);
  43. void OnNotifyDependent(CMapClass *pObject, Notify_Dependent_t eNotifyType);
  44. void OnParentKeyChanged( const char* key, const char* value );
  45. void OnRemoveFromWorld(CMapWorld *pWorld, bool bNotifyChildren);
  46. virtual void UpdateDependencies(CMapWorld *pWorld, CMapClass *pObject);
  47. protected:
  48. void BuildCylinder(void);
  49. // Computes the vertices of the cylinder
  50. void ComputeCylinderPoints( int nCount, Vector *pStartVerts, Vector *pEndVerts );
  51. // How do we draw it?
  52. bool ShouldDrawAsLine();
  53. // Implements CMapAtom transformation functions.
  54. void DoTransform(const VMatrix &matrix);
  55. char m_szStartValueKey[80]; // The key in our parent entity to look at for our start target.
  56. char m_szStartKey[80]; // The value in our parent entity to look at for our start target.
  57. char m_szStartRadiusKey[80]; // The key in our parent entity to look at for the cylinder Radius
  58. char m_szEndValueKey[80]; //
  59. char m_szEndKey[80]; //
  60. char m_szEndRadiusKey[80]; //
  61. CMapEntity *m_pStartEntity; // Our start target.
  62. CMapEntity *m_pEndEntity; // Our end target.
  63. float m_flStartRadius;
  64. float m_flEndRadius;
  65. };
  66. #endif // MAPCYLINDER_H