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.

104 lines
2.8 KiB

  1. //========= Copyright � 1996-2013, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Provide custom texture generation (compositing)
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef BASE_VISUALS_DATA_PROCESSOR_H
  8. #define BASE_VISUALS_DATA_PROCESSOR_H
  9. #include "ivisualsdataprocessor.h"
  10. #include "utlbuffer.h"
  11. #include "utlbufferutil.h"
  12. // derive from and extend this class if you have additional items to compare in your Visuals Data Processor
  13. class CBaseVisualsDataCompare : public IVisualsDataCompare
  14. {
  15. public:
  16. CBaseVisualsDataCompare() = default;
  17. CBaseVisualsDataCompare( CBaseVisualsDataCompare&& moveFrom ) // = default;
  18. : m_nIndex( Move( moveFrom.m_nIndex ) )
  19. , m_nSeed( Move( moveFrom.m_nSeed ) )
  20. , m_flWear( Move( moveFrom.m_flWear ) )
  21. , m_nLOD( Move( moveFrom.m_nLOD ) )
  22. , m_nModelID( Move( moveFrom.m_nModelID ) )
  23. , m_compareBlob( Move( moveFrom.m_compareBlob ) )
  24. {}
  25. CBaseVisualsDataCompare& operator=( CBaseVisualsDataCompare&& moveFrom ) // = default;
  26. {
  27. m_nIndex = Move( moveFrom.m_nIndex );
  28. m_nSeed = Move( moveFrom.m_nSeed );
  29. m_flWear = Move( moveFrom.m_flWear );
  30. m_nLOD = Move( moveFrom.m_nLOD );
  31. m_nModelID = Move( moveFrom.m_nModelID );
  32. m_compareBlob = Move( moveFrom.m_compareBlob );
  33. return *this;
  34. }
  35. virtual void FillCompareBlob()
  36. {
  37. SerializeToBuffer( m_compareBlob );
  38. }
  39. virtual const CUtlBuffer &GetCompareBlob() const
  40. {
  41. return m_compareBlob;
  42. }
  43. virtual bool Compare( const CUtlBuffer &otherBuf )
  44. {
  45. return ( m_compareBlob.TellPut() == otherBuf.TellPut() && V_memcmp( otherBuf.Base(), m_compareBlob.Base(), m_compareBlob.TellPut() ) == 0 );
  46. }
  47. int m_nIndex;
  48. int m_nSeed;
  49. float m_flWear;
  50. int m_nLOD;
  51. int m_nModelID; // for weapons this is CSWeaponID, for clothing this is ClothingDefinitionSlotId_t
  52. protected:
  53. virtual void SerializeToBuffer( CUtlBuffer &buf )
  54. {
  55. buf.Clear();
  56. Serialize( buf, m_nIndex );
  57. Serialize( buf, m_nSeed );
  58. Serialize( buf, m_flWear );
  59. Serialize( buf, m_nLOD );
  60. Serialize( buf, m_nModelID );
  61. }
  62. private:
  63. CUtlBuffer m_compareBlob;
  64. };
  65. template< class T >
  66. class CBaseVisualsDataProcessor : public IVisualsDataProcessor
  67. {
  68. public:
  69. CBaseVisualsDataProcessor() {}
  70. virtual bool Compare( const CUtlBuffer &otherBuf ) { return GetCompareObject()->Compare( otherBuf ); }
  71. virtual IVisualsDataCompare *GetCompareObject() { return &m_compareObject; }
  72. virtual const char *GetPatternVTFName() const { return NULL; }
  73. protected:
  74. T m_compareObject;
  75. };
  76. enum MaterialParamID_t
  77. {
  78. MATERIAL_PARAM_ID_BASE_DIFFUSE_TEXTURE = 0,
  79. MATERIAL_PARAM_ID_PHONG_EXPONENT_TEXTURE,
  80. MATERIAL_PARAM_ID_BUMP_MAP,
  81. MATERIAL_PARAM_ID_ANISOTROPY_MAP,
  82. MATERIAL_PARAM_ID_MASKS1_MAP,
  83. MATERIAL_PARAM_ID_COUNT
  84. };
  85. extern const char g_szMaterialParamNames[MATERIAL_PARAM_ID_COUNT][32];
  86. #endif // BASE_VISUALS_DATA_PROCESSOR_H