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.

153 lines
4.3 KiB

  1. //========= Copyright (c) 1996-2014, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef LIGHTMAPPED_4WAYBLEND_DX9_HELPER_H
  8. #define LIGHTMAPPED_4WAYBLEND_DX9_HELPER_H
  9. #include <string.h>
  10. #include "BaseVSShader.h"
  11. #include "shaderlib/commandbuilder.h"
  12. //-----------------------------------------------------------------------------
  13. // Forward declarations
  14. //-----------------------------------------------------------------------------
  15. class CBaseVSShader;
  16. class IMaterialVar;
  17. class IShaderDynamicAPI;
  18. class IShaderShadow;
  19. //-----------------------------------------------------------------------------
  20. // Init params/ init/ draw methods
  21. //-----------------------------------------------------------------------------
  22. struct Lightmapped_4WayBlend_DX9_Vars_t
  23. {
  24. Lightmapped_4WayBlend_DX9_Vars_t() { memset( this, 0xFF, sizeof(Lightmapped_4WayBlend_DX9_Vars_t) ); }
  25. int m_nBaseTexture;
  26. int m_nBaseTextureFrame;
  27. int m_nBaseTextureTransform;
  28. int m_nSelfIllumTint;
  29. int m_nDetail;
  30. int m_nDetailFrame;
  31. int m_nDetailScale;
  32. int m_nDetailTextureCombineMode;
  33. int m_nDetailTextureBlendFactor;
  34. int m_nDetailTextureBlendFactor2;
  35. int m_nDetailTextureBlendFactor3;
  36. int m_nDetailTextureBlendFactor4;
  37. int m_nDetailTint;
  38. int m_nEnvmap;
  39. int m_nEnvmapFrame;
  40. int m_nEnvmapMask;
  41. int m_nEnvmapMaskFrame;
  42. int m_nEnvmapMaskTransform;
  43. int m_nEnvmapTint;
  44. int m_nBumpmap;
  45. int m_nBumpFrame;
  46. int m_nBumpTransform;
  47. int m_nEnvmapContrast;
  48. int m_nEnvmapSaturation;
  49. int m_nFresnelReflection;
  50. int m_nNoDiffuseBumpLighting;
  51. int m_nTexture1LumStart;
  52. int m_nTexture1LumEnd;
  53. int m_nBumpmap2;
  54. int m_nBumpFrame2;
  55. int m_nBumpTransform2;
  56. int m_nBaseTexture2;
  57. int m_nBaseTexture2Frame;
  58. int m_nTexture2uvScale;
  59. int m_nTexture2BlendStart;
  60. int m_nTexture2BlendEnd;
  61. int m_nTexture2LumStart;
  62. int m_nTexture2LumEnd;
  63. int m_nTexture2BumpBlendFactor;
  64. int m_nBaseTexture3;
  65. int m_nTexture3BlendMode;
  66. int m_nBaseTexture3Frame;
  67. int m_nTexture3uvScale;
  68. int m_nTexture3BlendStart;
  69. int m_nTexture3BlendEnd;
  70. int m_nTexture3LumStart;
  71. int m_nTexture3LumEnd;
  72. int m_nTexture3BumpBlendFactor;
  73. int m_nBaseTexture4;
  74. int m_nTexture4BlendMode;
  75. int m_nBaseTexture4Frame;
  76. int m_nTexture4uvScale;
  77. int m_nTexture4BlendStart;
  78. int m_nTexture4BlendEnd;
  79. int m_nTexture4LumStart;
  80. int m_nTexture4LumEnd;
  81. int m_nTexture4BumpBlendFactor;
  82. int m_nLumBlendFactor2;
  83. int m_nLumBlendFactor3;
  84. int m_nLumBlendFactor4;
  85. int m_nFlashlightTexture;
  86. int m_nFlashlightTextureFrame;
  87. int m_nSelfShadowedBumpFlag;
  88. int m_nForceBumpEnable;
  89. int m_nSeamlessMappingScale;
  90. int m_nAlphaTestReference;
  91. int m_nEnvmapAnisotropy;
  92. int m_nEnvmapAnisotropyScale;
  93. int m_nShaderSrgbRead360;
  94. int m_nEnvMapLightScale;
  95. int m_nEnvMapLightScaleMinMax;
  96. float m_uvScaleDefault;
  97. };
  98. class CLightmapped_4WayBlend_DX9_Context : public CBasePerMaterialContextData
  99. {
  100. public:
  101. uint8 *m_pStaticCmds;
  102. CCommandBufferBuilder< CFixedCommandStorageBuffer< 900 > > m_SemiStaticCmdsOut;
  103. #ifdef _PS3
  104. CCommandBufferBuilder< CFixedCommandStorageBuffer< 256 > > m_flashlightECB;
  105. #endif
  106. bool m_bVertexShaderFastPath;
  107. bool m_bPixelShaderFastPath;
  108. bool m_bFullyOpaque;
  109. bool m_bFullyOpaqueWithoutAlphaTest;
  110. void ResetStaticCmds( void )
  111. {
  112. if ( m_pStaticCmds )
  113. {
  114. delete[] m_pStaticCmds;
  115. m_pStaticCmds = NULL;
  116. }
  117. }
  118. CLightmapped_4WayBlend_DX9_Context( void )
  119. {
  120. m_pStaticCmds = NULL;
  121. }
  122. ~CLightmapped_4WayBlend_DX9_Context( void )
  123. {
  124. ResetStaticCmds();
  125. }
  126. };
  127. void InitParamsLightmapped_4WayBlend_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, Lightmapped_4WayBlend_DX9_Vars_t &info );
  128. void InitLightmapped_4WayBlend_DX9( CBaseVSShader *pShader, IMaterialVar** params, Lightmapped_4WayBlend_DX9_Vars_t &info );
  129. void DrawLightmapped_4WayBlend_DX9( CBaseVSShader *pShader, IMaterialVar** params, IShaderDynamicAPI *pShaderAPI, IShaderShadow* pShaderShadow,
  130. Lightmapped_4WayBlend_DX9_Vars_t &info, CBasePerMaterialContextData **pContextDataPtr );
  131. void DrawLightmapped_4WayBlend_DX9_FastPath( int *dynVSIdx, int *dynPSIdx, CBaseVSShader *pShader, IMaterialVar** params,
  132. IShaderDynamicAPI *pShaderAPI, Lightmapped_4WayBlend_DX9_Vars_t &info, CBasePerMaterialContextData **pContextDataPtr, BOOL bCSMEnabled );
  133. #endif // MULTIBLEND_DX9_HELPER_H