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.

100 lines
2.7 KiB

  1. //====== Copyright � 1996-2005, 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/dmemdlrenderable.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 CDmeCommentaryNodeEntity : public CDmeMdlRenderable<CDmElement>
  19. {
  20. DEFINE_ELEMENT( CDmeCommentaryNodeEntity, CDmeMdlRenderable<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, const RenderableInstance_t &instance );
  29. virtual void GetRenderBounds( Vector& mins, Vector& maxs );
  30. virtual RenderableTranslucencyType_t ComputeTranslucencyType( void );
  31. public:
  32. int GetEntityId() const;
  33. const char *GetClassName() const;
  34. const char *GetTargetName() const;
  35. bool IsPlaceholder() const;
  36. // Entity Key iteration
  37. CDmAttribute *FirstEntityKey();
  38. CDmAttribute *NextEntityKey( CDmAttribute *pEntityKey );
  39. // Attach/detach from an engine entity with the same editor index
  40. void AttachToEngineEntity( HTOOLHANDLE hToolHandle );
  41. void SetRenderOrigin( const Vector &vecOrigin );
  42. void SetRenderAngles( const QAngle &angles );
  43. void MarkDirty( bool bDirty = true );
  44. private:
  45. bool IsEntityKey( CDmAttribute *pEntityKey );
  46. // Draws the helper for the entity
  47. void DrawSprite( IMaterial *pMaterial );
  48. CDmaVar<Vector> m_vecLocalOrigin;
  49. CDmaVar<Vector> m_vecLocalAngles;
  50. CDmaString m_ClassName;
  51. CDmaString m_TargetName;
  52. CDmaVar<bool> m_bIsPlaceholder;
  53. bool m_bInfoTarget;
  54. bool m_bIsDirty;
  55. // The entity it's connected to in the engine
  56. HTOOLHANDLE m_hEngineEntity;
  57. CMaterialReference m_SelectedInfoTarget;
  58. CMaterialReference m_InfoTargetSprite;
  59. };
  60. //-----------------------------------------------------------------------------
  61. // Inline methods
  62. //-----------------------------------------------------------------------------
  63. inline const char *CDmeCommentaryNodeEntity::GetClassName() const
  64. {
  65. return m_ClassName;
  66. }
  67. inline const char *CDmeCommentaryNodeEntity::GetTargetName() const
  68. {
  69. return m_TargetName;
  70. }
  71. inline bool CDmeCommentaryNodeEntity::IsPlaceholder() const
  72. {
  73. return m_bIsPlaceholder;
  74. }
  75. #endif // DMEVMFENTITY_H