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.

99 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //
  4. //=============================================================================
  5. #ifndef OVERLAYTRANS_H
  6. #define OVERLAYTRANS_H
  7. #pragma once
  8. #include "utlvector.h"
  9. #include "mathlib/vector.h"
  10. #include "mathlib/vector2d.h"
  11. #include "MapHelper.h"
  12. class IEditorTexture;
  13. class CHelperInfo;
  14. class CMapEntity;
  15. class CMapFace;
  16. struct ShoreEntityData_t
  17. {
  18. IEditorTexture *m_pTexture;
  19. Vector2D m_vecLengthTexcoord;
  20. Vector2D m_vecWidthTexcoord;
  21. float m_flWidths[2];
  22. };
  23. //=============================================================================
  24. //
  25. // Overlay Transition Entity Helper
  26. //
  27. class CMapOverlayTransition : public CMapHelper
  28. {
  29. public:
  30. DECLARE_MAPCLASS(CMapOverlayTransition,CMapHelper)
  31. CMapOverlayTransition();
  32. ~CMapOverlayTransition();
  33. // Factory for building from a list of string parameters.
  34. static CMapClass *Create( CHelperInfo *pInfo, CMapEntity *pParent );
  35. // Virtual/Interface Implementation.
  36. virtual void PostloadWorld( CMapWorld *pWorld );
  37. void CalcBounds( BOOL bFullUpdate = FALSE );
  38. virtual CMapClass *Copy( bool bUpdateDependencies );
  39. virtual CMapClass *CopyFrom( CMapClass *pObject, bool bUpdateDependencies );
  40. virtual void OnParentKeyChanged( const char* szKey, const char* szValue );
  41. virtual void OnNotifyDependent( CMapClass *pObject, Notify_Dependent_t eNotifyType );
  42. virtual void OnAddToWorld(CMapWorld *pWorld);
  43. virtual void OnRemoveFromWorld(CMapWorld *pWorld, bool bNotifyChildren);
  44. void DoTransform( const VMatrix& matrix );
  45. void OnPaste( CMapClass *pCopy, CMapWorld *pSourceWorld, CMapWorld *pDestWorld,
  46. const CMapObjectList &OriginalList, CMapObjectList &NewList);
  47. void OnClone( CMapClass *pClone, CMapWorld *pWorld,
  48. const CMapObjectList &OriginalList, CMapObjectList &NewList );
  49. void OnUndoRedo( void );
  50. bool OnApply( void );
  51. void Render3D( CRender3D *pRender );
  52. inline virtual bool IsVisualElement( void ) { return true; }
  53. inline virtual bool ShouldRenderLast( void ) { return true; }
  54. inline const char* GetDescription() { return ( "Overlay Transition" ); }
  55. ChunkFileResult_t LoadVMF( CChunkFile *pFile );
  56. ChunkFileResult_t SaveVMF( CChunkFile *pFile, CSaveInfo *pSaveInfo );
  57. bool ShouldSerialize( void ) { return true; }
  58. private:
  59. bool BuildFaceCaches( void );
  60. static ChunkFileResult_t OverlayDataCallback( CChunkFile *pFile, CMapDisp *pDisp );
  61. static ChunkFileResult_t OverlayDataKeyCallback( const char *szKey, const char *szValue, CMapDisp *pDisp );
  62. private:
  63. bool m_bIsWater;
  64. ShoreEntityData_t m_ShoreData;
  65. CUtlVector<CMapFace*> m_aFaceCache1;
  66. CUtlVector<CMapFace*> m_aFaceCache2;
  67. int m_nShorelineId;
  68. CUtlVector<CMapEntity*> m_aOverlayChildren;
  69. bool m_bDebugDraw;
  70. };
  71. #endif // OVERLAYTRANS_H