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.

75 lines
2.2 KiB

  1. //========== Copyright � 2005, Valve Corporation, All rights reserved. ========
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef CMATERIALPaintmapS_H
  7. #define CMATERIALPaintmapS_H
  8. #include "tier1/utlvector.h"
  9. #include "materialsystem/MaterialSystemUtil.h"
  10. #include "materialsystem/ipaintmapdatamanager.h"
  11. #ifndef MATSYS_INTERNAL
  12. #error "This file is private to the implementation of IMaterialSystem/IMaterialSystemInternal"
  13. #endif
  14. #if defined( _WIN32 )
  15. #pragma once
  16. #endif
  17. class CMaterialSystem;
  18. //-----------------------------------------------------------------------------
  19. // Manager of material system Paintmaps
  20. //-----------------------------------------------------------------------------
  21. class CMatPaintmaps : public IPaintmapTextureManager
  22. {
  23. public:
  24. CMatPaintmaps();
  25. bool IsEnabled( void );
  26. void RegisterPaintmapDataManager( IPaintmapDataManager *pDataManager );
  27. void BeginPaintTextureAllocation( int iPaintmapCount );
  28. void EndPaintTextureAllocation( void );
  29. void AllocatePaintmap( int paintmap, int iWidth, int iHeight );
  30. void ReleasePaintmaps( void );
  31. void RestorePaintmaps( int nNumLightmaps );
  32. void CleanupPaintmaps( void );
  33. ShaderAPITextureHandle_t GetPaintmapPageTextureHandle( int paintmap );
  34. CMaterialSystem *GetMaterialSystem() const;
  35. // Derived from IPaintmapTextureManager
  36. //------------------------------------------------
  37. virtual void BeginUpdatePaintmaps();
  38. virtual void UpdatePaintmap( int paintmap, BYTE* pPaintData, int numRects, Rect_t* pRects );
  39. virtual void EndUpdatePaintmaps();
  40. //------------------------------------------------
  41. IPaintmapDataManager *m_pDataManager;
  42. private:
  43. void InitPaintmapBits( int paintmap );
  44. bool LockPaintmap( int paintmap );
  45. void FillRect( int paintmap, Rect_t* RESTRICT pRect, BYTE* RESTRICT pPaintData, Rect_t* RESTRICT pSubRect = NULL ) RESTRICT;
  46. void AllocatePaintmapTexture( int paintmap, int iWidth, int iHeight );
  47. CPixelWriter m_PaintmapPixelWriter;
  48. CUtlVector<ShaderAPITextureHandle_t> m_PaintmapTextureHandles;
  49. int m_nLockedPaintmap;
  50. int m_nUpdatingPaintmapsStackDepth;
  51. };
  52. //-----------------------------------------------------------------------------
  53. #endif // CMATERIALPaintmapS_H