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.

99 lines
3.1 KiB

  1. //========= Copyright � Valve Corporation, All rights reserved. ============//
  2. #ifndef CUSTOMWEAPON_HELPER_H
  3. #define CUSTOMWEAPON_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 CustomWeaponVars_t
  19. {
  20. CustomWeaponVars_t()
  21. {
  22. memset( this, 0xFF, sizeof( CustomWeaponVars_t ) );
  23. }
  24. int m_nBaseTexture;
  25. int m_nBaseTextureTransform;
  26. int m_nSurfaceTexture;
  27. int m_nAOTexture;
  28. int m_nMasksTexture;
  29. int m_nPosTexture;
  30. int m_nGrungeTexture;
  31. int m_nWearTexture;
  32. int m_nPaintTexture;
  33. int m_nExpTexture;
  34. int m_nCamoColor0;
  35. int m_nCamoColor1;
  36. int m_nCamoColor2;
  37. int m_nCamoColor3;
  38. int m_nBaseDiffuseOverride;
  39. int m_nPhongExponent;
  40. int m_nPhongIntensity;
  41. int m_nWearProgress;
  42. int m_nPhongAlbedoBoost;
  43. int m_nPaintStyle;
  44. int m_nExponentMode;
  45. int m_nPatternTextureTransform;
  46. int m_nWearTextureTransform;
  47. int m_nGrungeTextureTransform;
  48. int m_nCheap;
  49. int m_nPhongAlbedoFactor;
  50. int m_nPreview;
  51. int m_nPreviewPhongFresnelRanges;
  52. int m_nPreviewPhongAlbedoTint;
  53. int m_nPreviewPhongBoost;
  54. int m_nPreviewPaintPhongAlbedoBoost;
  55. int m_nPreviewEnvMap;
  56. int m_nPreviewWeaponObjScale;
  57. int m_nPreviewWeaponUVScale;
  58. int m_nPreviewIgnoreWeaponScale;
  59. };
  60. // default shader param values
  61. static const float kDefaultCamoColor0[3] = { 0.0f, 0.0f, 0.0f };
  62. static const float kDefaultCamoColor1[3] = { 0.0f, 0.0f, 0.0f };
  63. static const float kDefaultCamoColor2[3] = { 0.0f, 0.0f, 0.0f };
  64. static const float kDefaultCamoColor3[3] = { 0.0f, 0.0f, 0.0f };
  65. static const float kDefaultPreviewPhongFresnelRanges[3] = { 1.0f, 1.0f, 1.0f };
  66. static const int kDefaultBaseDiffuseOverride = 0;
  67. static const int kDefaultPhongExponent = 4;
  68. static const int kDefaultPhongIntensity = 10;
  69. static const float kDefaultWearProgress = 0.45f;
  70. static const float kDefaultPhongAlbedoBoost = 1.0f;
  71. static const int kDefaultPaintStyle = 0;
  72. static const int kDefaultExponentMode = 0;
  73. static const float kDefaultPatternScale = 0.5f;
  74. static const float kDefaultPatternOffset = 0.34f;
  75. static const float kDefaultWearOffset = 0.16f;
  76. static const float kDefaultPhongAlbedoFactor = 1.0f;
  77. static const float kDefaultPreviewPhongBoost = -1.0f;
  78. static const float kDefaultWeaponScale = 1.0f;
  79. void InitParamsCustomWeapon( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, CustomWeaponVars_t &info );
  80. void InitCustomWeapon( CBaseVSShader *pShader, IMaterialVar** params, CustomWeaponVars_t &info );
  81. void DrawCustomWeapon( CBaseVSShader *pShader, IMaterialVar** params, IShaderDynamicAPI *pShaderAPI,
  82. IShaderShadow* pShaderShadow, CustomWeaponVars_t &info, VertexCompressionType_t vertexCompression,
  83. CBasePerMaterialContextData **pContextDataPtr );
  84. #endif // CUSTOMWEAPON_HELPER_H