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.

120 lines
4.3 KiB

  1. //========= Copyright � Valve Corporation, All rights reserved. ============//
  2. #ifndef WEAPONDECAL_HELPER_H
  3. #define WEAPONDECAL_HELPER_H
  4. #ifdef _WIN32
  5. #pragma once
  6. #endif
  7. #include <string.h>
  8. //-----------------------------------------------------------------------------
  9. // Forward declarations
  10. //-----------------------------------------------------------------------------
  11. class CBaseVSShader;
  12. class IMaterialVar;
  13. class IShaderDynamicAPI;
  14. class IShaderShadow;
  15. //-----------------------------------------------------------------------------
  16. // Struct to hold shader param indices
  17. //-----------------------------------------------------------------------------
  18. struct WeaponDecalVars_t
  19. {
  20. WeaponDecalVars_t()
  21. {
  22. memset( this, 0xFF, sizeof( WeaponDecalVars_t ) );
  23. }
  24. int m_nBaseTexture;
  25. int m_nBaseTextureTransform;
  26. int m_nAOTexture;
  27. int m_nNormalMap;
  28. int m_nWearProgress;
  29. int m_nWearRemapMin;
  30. int m_nWearRemapMid;
  31. int m_nWearRemapMax;
  32. int m_nWearWidthMin;
  33. int m_nWearWidthMax;
  34. int m_nUnWearStrength;
  35. int m_nExpTexture;
  36. int m_nHologramSpectrum;
  37. int m_nHologramMask;
  38. int m_nGrungeTexture;
  39. int m_nWearTexture;
  40. int m_nAnisoDirTexture;
  41. int m_nPhong;
  42. int m_nPhongExponent;
  43. int m_nPhongFresnelRanges;
  44. int m_nPhongAlbedoTint;
  45. int m_nPhongBoost;
  46. int m_nPhongAlbedoBoost;
  47. int m_nEnvmapTexture;
  48. int m_nEnvmapTint;
  49. int m_nDecalStyle;
  50. int m_nColorTint;
  51. int m_nColorTint2;
  52. int m_nColorTint3;
  53. int m_nColorTint4;
  54. int m_nAlpha;
  55. //int m_nPatternTextureTransform;
  56. int m_nPatternRotation;
  57. int m_nPatternScale;
  58. int m_nMirrorHorizontal;
  59. int m_nThirdPerson;
  60. int m_nHighlight;
  61. int m_nHighlightCycle;
  62. int m_nPeel;
  63. int m_nWearBias;
  64. int m_nAlphaMask;
  65. //int m_nFastWearThreshold;
  66. int m_nGrungeScale;
  67. int m_nDesatBaseTint;
  68. };
  69. // default shader param values
  70. static const float kDefaultWearProgress = 0.0f;
  71. static const float kDefaultWearRemapMin = 0.8f;
  72. static const float kDefaultWearRemapMid = 0.75f;
  73. static const float kDefaultWearRemapMax = 1.0f;
  74. static const float kDefaultWearWidthMin = 0.06f;
  75. static const float kDefaultWearWidthMax = 0.12f;
  76. static const float kDefaultUnWearStrength = 0.2f;
  77. static const int kDefaultPhong = 0;
  78. static const int kDefaultPhongExponent = 4;
  79. static const float kDefaultPhongFresnelRanges[3] = { 1.0f, 1.0f, 1.0f };
  80. static const float kDefaultPhongAlbedoTint = 0.0f;
  81. static const float kDefaultPhongBoost = 1.0f;
  82. static const float kDefaultPhongAlbedoBoost = 1.0f;
  83. static const float kDefaultEnvmapTint[3] = { 1.0f, 1.0f, 1.0f };
  84. static const int kDefaultDecalStyle = 1;
  85. static const float kDefaultColorTint[3] = { 255.0f, 255.0f, 255.0f };
  86. static const float kDefaultColorTint2[3] = { 0.0f, 0.0f, 0.0f };
  87. static const float kDefaultColorTint3[3] = { 0.0f, 0.0f, 0.0f };
  88. static const float kDefaultColorTint4[3] = { 0.0f, 0.0f, 0.0f };
  89. static const int kDefaultAlpha = 1;
  90. static const float kDefaultPatternRotation = 0.0f;
  91. static const float kDefaultPatternScale = 1.0f;
  92. static const int kDefaultMirrorHorizontal = 0;
  93. static const int kDefaultThirdPerson = 0;
  94. static const char *kDefaultBaseTexture = "models/weapons/customization/stickers/default/sticker_default";
  95. static const char *kDefaultAOTexture = "models/weapons/customization/stickers/default/ao_default";
  96. static const char *kDefaultGrungeTexture = "models/weapons/customization/shared/sticker_paper";
  97. static const char *kDefaultWearTexture = "models/weapons/customization/shared/paint_wear";
  98. static const float kDefaultHighlight = 0.0f;
  99. static const float kDefaultHighlightCycle = 0.0f;
  100. static const float kDefaultPeel = 0.0f;
  101. static const float kDefaultWearBias = 0.0f;
  102. static const int kDefaultAlphaMask = 0;
  103. //static const float kDefaultFastWearThreshold = 0.0f;
  104. static const float kDefaultGrungeScale = 2.0f;
  105. static const float kDefaultDesatBaseTint = 0.0f;
  106. void InitParamsWeaponDecal( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, WeaponDecalVars_t &info );
  107. void InitWeaponDecal( CBaseVSShader *pShader, IMaterialVar** params, WeaponDecalVars_t &info );
  108. void DrawWeaponDecal( CBaseVSShader *pShader, IMaterialVar** params, IShaderDynamicAPI *pShaderAPI,
  109. IShaderShadow* pShaderShadow, WeaponDecalVars_t &info, VertexCompressionType_t vertexCompression,
  110. CBasePerMaterialContextData **pContextDataPtr );
  111. #endif // WEAPONDECAL_HELPER_H