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.

133 lines
4.5 KiB

  1. //========= Copyright � 1996-2007, Valve Corporation, All rights reserved. ============//
  2. #ifndef BLOB_HELPER_H
  3. #define BLOB_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 BlobVars_t
  19. {
  20. BlobVars_t()
  21. {
  22. memset( this, 0xFF, sizeof( BlobVars_t ) );
  23. }
  24. int m_nBackSurface;
  25. int m_nBumpStrength;
  26. int m_nFresnelBumpStrength;
  27. int m_nNormalMap;
  28. int m_nBaseTexture;
  29. int m_nLightWarpTexture;
  30. int m_nFresnelWarpTexture;
  31. int m_nOpacityTexture;
  32. int m_nSpecMap;
  33. int m_nUVScale;
  34. int m_nInteriorEnable;
  35. int m_nInteriorFogStrength;
  36. int m_nInteriorFogLimit;
  37. int m_nInteriorFogNormalBoost;
  38. int m_nInteriorBackgroundBoost;
  39. int m_nInteriorAmbientScale;
  40. int m_nInteriorBackLightScale;
  41. int m_nInteriorColor;
  42. int m_nInteriorRefractStrength;
  43. int m_nInteriorRefractBlur;
  44. int m_nFresnelParams;
  45. int m_nDiffuseScale;
  46. int m_nSpecExp;
  47. int m_nSpecScale;
  48. int m_nSpecExp2;
  49. int m_nSpecScale2;
  50. int m_nRimLightExp;
  51. int m_nRimLightScale;
  52. int m_nBaseColorTint;
  53. int m_nSelfIllumFresnelEnable;
  54. int m_nSelfIllumFresnelParams;
  55. int m_nSelfIllumTint;
  56. int m_nUVProjOffset;
  57. int m_nBBMin;
  58. int m_nBBMax;
  59. int m_nArmature;
  60. int m_nFlashlightTexture;
  61. int m_nFlashlightTextureFrame;
  62. int m_nArmColorTint;
  63. int m_nArmWiden;
  64. int m_nArmWidthExp;
  65. int m_nArmWidthScale;
  66. int m_nArmWidthBias;
  67. int m_nAnimateArmPulses;
  68. int m_nVolumeTex;
  69. int m_nBumpFrame;
  70. int m_nGlowScale;
  71. int m_nPulse;
  72. int m_nContactShadows;
  73. };
  74. // default shader param values
  75. static const int kDefaultBackSurface = 0;
  76. static const float kDefaultBumpStrength = 1.0f;
  77. static const float kDefaultFresnelBumpStrength = 1.0f;
  78. static const float kDefaultUVScale = 0.02f;
  79. static const int kDefaultInteriorEnable = 1;
  80. static const float kDefaultInteriorFogStrength = 0.06f;
  81. static const float kDefaultInteriorFogLimit = 0.8f;
  82. static const float kDefaultInteriorFogNormalBoost = 0.0f;
  83. static const float kDefaultInteriorBackgroundBoost = 0.0f;
  84. static const float kDefaultInteriorAmbientScale = 0.3f;
  85. static const float kDefaultInteriorBackLightScale = 0.3f;
  86. static const float kDefaultInteriorColor[3] = { 0.5f, 0.5f, 0.5f };
  87. static const float kDefaultInteriorRefractStrength = 0.015f;
  88. static const float kDefaultInteriorRefractBlur = 0.2f;
  89. static const float kDefaultFresnelParams[3] = { 0.0f, 0.5f, 2.0f };
  90. static const float kDefaultBaseColorTint[3] = { 1.0f, 1.0f, 1.0f };
  91. static const float kDefaultDiffuseScale = 1.0f;
  92. static const float kDefaultSpecExp = 1.0f;
  93. static const float kDefaultSpecScale = 1.0f;
  94. static const float kDefaultRimLightExp = 10.0f;
  95. static const float kDefaultRimLightScale = 1.0f;
  96. static const int kDefaultSelfIllumFresnelEnable = 0;
  97. static const float kDefaultSelfIllumFresnelParams[3] = { 0.0f, 1.0f, 1.0f };
  98. static const float kDefaultSelfIllumTint[3] = { 1.0f, 1.0f, 1.0f };
  99. static const float kDefaultUVProjOffset[3] = { 0.0f, 0.0f, 0.0f };
  100. static const float kDefaultBB[3] = { 0.0f, 0.0f, 0.0f };
  101. static const int kDefaultArmature = 0;
  102. static const float kDefaultArmColorTint[3] = { 1.0f, 1.0f, 1.0f };
  103. static const int kDefaultArmWiden = 0;
  104. static const float kDefaultArmWidthExp = 1.0f;
  105. static const float kDefaultArmWidthScale = 1.0f;
  106. static const float kDefaultArmWidthBias = 0.0f;
  107. static const int kDefaultAnimateArmPulses = 1;
  108. static const int kDefaultVolumeTex = 0;
  109. static const int kDefaultBumpFrame = 0;
  110. static const float kDefaultGlowScale = 1.0f;
  111. static const int kDefaultPulse = 0;
  112. static const int kDefaultContactShadows = 0;
  113. void InitParamsBlob( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, BlobVars_t &info );
  114. void InitBlob( CBaseVSShader *pShader, IMaterialVar** params, BlobVars_t &info );
  115. void DrawBlob( CBaseVSShader *pShader, IMaterialVar** params, IShaderDynamicAPI *pShaderAPI,
  116. IShaderShadow* pShaderShadow, BlobVars_t &info, VertexCompressionType_t vertexCompression );
  117. void DrawArmature( CBaseVSShader *pShader, IMaterialVar** params, IShaderDynamicAPI *pShaderAPI,
  118. IShaderShadow* pShaderShadow, BlobVars_t &info, VertexCompressionType_t vertexCompression, int nPassIdx );
  119. #endif // BLOB_HELPER_H