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.

88 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Represents an entity in a VMF
  4. //
  5. //=============================================================================
  6. #ifndef DMEVMFENTITY_H
  7. #define DMEVMFENTITY_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "toolutils/dmerenderable.h"
  12. #include "datamodel/dmelement.h"
  13. #include "toolframework/itoolentity.h"
  14. #include "materialsystem/MaterialSystemUtil.h"
  15. //-----------------------------------------------------------------------------
  16. // Represents an editable entity; draws its helpers
  17. //-----------------------------------------------------------------------------
  18. class CDmeVMFEntity : public CDmeVisibilityControl< CDmeRenderable< CDmElement > >
  19. {
  20. DEFINE_ELEMENT( CDmeVMFEntity, CDmeVisibilityControl< CDmeRenderable< CDmElement > > );
  21. public:
  22. // Inherited from CDmElement
  23. virtual void OnAttributeChanged( CDmAttribute *pAttribute );
  24. public:
  25. // Inherited from DmeRenderable
  26. virtual const Vector &GetRenderOrigin( void );
  27. virtual const QAngle &GetRenderAngles( void );
  28. virtual int DrawModel( int flags );
  29. virtual void GetRenderBounds( Vector& mins, Vector& maxs );
  30. public:
  31. int GetEntityId() const;
  32. const char *GetClassName() const;
  33. const char *GetTargetName() const;
  34. bool IsPlaceholder() const;
  35. // Entity Key iteration
  36. CDmAttribute *FirstEntityKey();
  37. CDmAttribute *NextEntityKey( CDmAttribute *pEntityKey );
  38. // Attach/detach from an engine entity with the same editor index
  39. void AttachToEngineEntity( bool bAttach );
  40. private:
  41. bool IsEntityKey( CDmAttribute *pEntityKey );
  42. CDmaVar<Vector> m_vecLocalOrigin;
  43. CDmaVar<QAngle> m_vecLocalAngles;
  44. CDmaString m_ClassName;
  45. CDmaString m_TargetName;
  46. CDmaVar<bool> m_bIsPlaceholder;
  47. // The entity it's connected to in the engine
  48. HTOOLHANDLE m_hEngineEntity;
  49. CMaterialReference m_Wireframe;
  50. };
  51. //-----------------------------------------------------------------------------
  52. // Inline methods
  53. //-----------------------------------------------------------------------------
  54. inline const char *CDmeVMFEntity::GetClassName() const
  55. {
  56. return m_ClassName;
  57. }
  58. inline const char *CDmeVMFEntity::GetTargetName() const
  59. {
  60. return m_TargetName;
  61. }
  62. inline bool CDmeVMFEntity::IsPlaceholder() const
  63. {
  64. return m_bIsPlaceholder;
  65. }
  66. #endif // DMEVMFENTITY_H