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.

176 lines
4.5 KiB

  1. //========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef LIGHTMAPPEDGENERIC_DX9_HELPER_H
  8. #define LIGHTMAPPEDGENERIC_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 LightmappedGeneric_DX9_Vars_t
  23. {
  24. LightmappedGeneric_DX9_Vars_t() { memset( this, 0xFF, sizeof(LightmappedGeneric_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_nDetailTint;
  35. int m_nDetail2;
  36. int m_nDetailFrame2;
  37. int m_nDetailScale2;
  38. int m_nDetailTextureBlendFactor2;
  39. int m_nDetailTint2;
  40. int m_nEnvmap;
  41. int m_nEnvmapFrame;
  42. int m_nEnvmapMask;
  43. int m_nEnvmapMaskFrame;
  44. int m_nEnvmapMaskTransform;
  45. int m_nEnvmapTint;
  46. int m_nBumpmap;
  47. int m_nBumpFrame;
  48. int m_nBumpTransform;
  49. int m_nEnvmapContrast;
  50. int m_nEnvmapSaturation;
  51. int m_nFresnelReflection;
  52. int m_nNoDiffuseBumpLighting;
  53. int m_nBumpmap2;
  54. int m_nBumpFrame2;
  55. int m_nBumpTransform2;
  56. int m_nBumpMask;
  57. int m_nBaseTexture2;
  58. int m_nBaseTextureFrame2;
  59. int m_nBaseTextureTransform2;
  60. int m_nFlashlightTexture;
  61. int m_nFlashlightTextureFrame;
  62. int m_nBlendModulateTexture;
  63. int m_nSelfShadowedBumpFlag;
  64. int m_nForceBumpEnable;
  65. int m_nSeamlessMappingScale;
  66. int m_nAlphaTestReference;
  67. int m_nEnvmapAnisotropy;
  68. int m_nEnvmapAnisotropyScale;
  69. int m_nNoEnvmapMip;
  70. int m_nAddBumpMaps;
  71. int m_nBumpDetailScale1;
  72. int m_nBumpDetailScale2;
  73. int m_nShaderSrgbRead360;
  74. int m_nEnvMapLightScale;
  75. int m_nEnvMapLightScaleMinMax;
  76. int m_nPaintSplatNormal;
  77. int m_nPaintSplatBubbleLayout;
  78. int m_nPaintSplatBubble;
  79. int m_nPaintEnvmap;
  80. int m_nPhong;
  81. int m_nPhongExp;
  82. int m_nPhongExp2;
  83. int m_nPhongBaseTint;
  84. int m_nPhongBaseTint2;
  85. int m_nPhongMaskContrastBrightness;
  86. int m_nPhongMaskContrastBrightness2;
  87. int m_nPhongAmount;
  88. int m_nPhongAmount2;
  89. int m_nDropShadowOpacity;
  90. int m_nDropShadowScale;
  91. int m_nDropShadowHighlightScale;
  92. int m_nDropShadowDepthExaggeration;
  93. int m_nLayerTint1;
  94. int m_nLayerTint2;
  95. int m_nBlendModulateTransform;
  96. int m_nEnvmapMask2;
  97. int m_nEnvmapMaskFrame2;
  98. int m_nEnvmapMaskTransform2;
  99. int m_nAltLayerBlending;
  100. int m_nBlendSoftness;
  101. int m_nLayerBorderStrength;
  102. int m_nLayerBorderOffset;
  103. int m_nLayerBorderSoftness;
  104. int m_nLayerBorderTint;
  105. int m_nLayerEdgePunchIn;
  106. int m_nLayerEdgeStrength;
  107. int m_nLayerEdgeOffset;
  108. int m_nLayerEdgeSoftness;
  109. int m_nLayerEdgeNormal;
  110. };
  111. class CLightmappedGeneric_DX9_Context : public CBasePerMaterialContextData
  112. {
  113. public:
  114. uint8 *m_pStaticCmds;
  115. CCommandBufferBuilder< CFixedCommandStorageBuffer< 900 > > m_SemiStaticCmdsOut;
  116. #ifdef _PS3
  117. CCommandBufferBuilder< CFixedCommandStorageBuffer< 256 > > m_flashlightECB;
  118. #endif
  119. bool m_bVertexShaderFastPath;
  120. bool m_bPixelShaderFastPath;
  121. bool m_bFullyOpaque;
  122. bool m_bFullyOpaqueWithoutAlphaTest;
  123. void ResetStaticCmds( void )
  124. {
  125. if ( m_pStaticCmds )
  126. {
  127. delete[] m_pStaticCmds;
  128. m_pStaticCmds = NULL;
  129. }
  130. }
  131. CLightmappedGeneric_DX9_Context( void )
  132. {
  133. m_pStaticCmds = NULL;
  134. }
  135. ~CLightmappedGeneric_DX9_Context( void )
  136. {
  137. ResetStaticCmds();
  138. }
  139. };
  140. void InitParamsLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, const char *pMaterialName, LightmappedGeneric_DX9_Vars_t &info );
  141. void InitLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params, LightmappedGeneric_DX9_Vars_t &info );
  142. void DrawLightmappedGeneric_DX9( CBaseVSShader *pShader, IMaterialVar** params,
  143. IShaderDynamicAPI *pShaderAPI, IShaderShadow* pShaderShadow,
  144. LightmappedGeneric_DX9_Vars_t &info, CBasePerMaterialContextData **pContextDataPtr );
  145. void DrawLightmappedGeneric_DX9_FastPath( int *dynVSIdx, int *dynPSIdx, CBaseVSShader *pShader, IMaterialVar** params,
  146. IShaderDynamicAPI *pShaderAPI,
  147. LightmappedGeneric_DX9_Vars_t &info, CBasePerMaterialContextData **pContextDataPtr, BOOL bCSMEnabled );
  148. #endif // LIGHTMAPPEDGENERIC_DX9_HELPER_H