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
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DISPPAINT_H
  8. #define DISPPAINT_H
  9. #pragma once
  10. #include "mathlib/vector.h"
  11. #include "utlvector.h"
  12. #include "DispManager.h"
  13. class CMapDisp;
  14. struct SpatialPaintData_t
  15. {
  16. int m_nEffect;
  17. Vector m_vCenter;
  18. float m_flRadius;
  19. float m_flScalar;
  20. Vector m_vPaintAxis;
  21. unsigned int m_uiBrushType;
  22. bool m_bNudge;
  23. bool m_bNudgeInit;
  24. // Cache
  25. float m_flRadius2;
  26. float m_flOORadius2;
  27. };
  28. class CDispPaintMgr
  29. {
  30. public:
  31. CDispPaintMgr();
  32. ~CDispPaintMgr();
  33. bool Paint( SpatialPaintData_t &spatialData, bool bAutoSew );
  34. protected:
  35. // Painting.
  36. bool PrePaint( SpatialPaintData_t &spatialData );
  37. bool PostPaint( bool bAutoSew );
  38. bool DoPaint( SpatialPaintData_t &spatialData );
  39. void DoPaintAdd( SpatialPaintData_t &spatialData, CMapDisp *pDisp );
  40. void DoPaintEqual( SpatialPaintData_t &spatialData, CMapDisp *pDisp );
  41. void DoPaintSmooth( SpatialPaintData_t &spatialData, CMapDisp *pDisp );
  42. void DoPaintOneOverR( const SpatialPaintData_t &spatialData, const Vector &vPos, float flDistance2, Vector &vNewPos );
  43. void DoPaintOne( const SpatialPaintData_t &spatialData, const Vector &vPos, Vector &vNewPos );
  44. bool DoPaintSmoothOneOverExp( const SpatialPaintData_t &spatialData, const Vector &vNewCenter, Vector &vPaintPos );
  45. // Utility.
  46. bool PaintSphereDispBBoxOverlap( const Vector &vCenter, float flRadius, const Vector &vBBoxMin, const Vector &vBBoxMax );
  47. bool IsInSphereRadius( const Vector &vCenter, float flRadius2, const Vector &vPos, float &flDistance2 );
  48. float CalcSmoothRadius2( const SpatialPaintData_t &spatialData, const Vector &vPoint );
  49. void AddToUndo( CMapDisp **pDisp );
  50. // Nudge
  51. void NudgeAdd( CMapDisp *pDisp, int iVert );
  52. void DoNudgeAdd( SpatialPaintData_t &spatialData );
  53. protected:
  54. struct DispVertPair_t
  55. {
  56. EditDispHandle_t m_hDisp;
  57. int m_iVert;
  58. };
  59. CUtlVector<DispVertPair_t> m_aNudgeData;
  60. };
  61. #endif // DISPPAINT_H