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.

90 lines
2.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "BaseVSShader.h"
  7. #include "convar.h"
  8. #include "overlay_fit_vs11.inc"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. // FIXME: Need to make a dx9 version so that "CENTROID" works.
  12. BEGIN_VS_SHADER_FLAGS( Overlay_Fit, "Help for TerrainTest2", SHADER_NOT_EDITABLE )
  13. BEGIN_SHADER_PARAMS
  14. END_SHADER_PARAMS
  15. // Set up anything that is necessary to make decisions in SHADER_FALLBACK.
  16. SHADER_INIT_PARAMS()
  17. {
  18. // No texture means no self-illum or env mask in base alpha
  19. CLEAR_FLAGS( MATERIAL_VAR_BASEALPHAENVMAPMASK );
  20. // If in decal mode, no debug override...
  21. if (IS_FLAG_SET(MATERIAL_VAR_DECAL))
  22. {
  23. SET_FLAGS( MATERIAL_VAR_NO_DEBUG_OVERRIDE );
  24. }
  25. SET_FLAGS2( MATERIAL_VAR2_LIGHTING_LIGHTMAP );
  26. }
  27. SHADER_FALLBACK
  28. {
  29. if ( IsPC() && !g_pHardwareConfig->SupportsVertexAndPixelShaders() )
  30. return "WorldTwoTextureBlend";
  31. return 0;
  32. }
  33. SHADER_INIT
  34. {
  35. CLEAR_FLAGS( MATERIAL_VAR_BASEALPHAENVMAPMASK );
  36. LoadTexture( BASETEXTURE );
  37. }
  38. SHADER_DRAW
  39. {
  40. SHADOW_STATE
  41. {
  42. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true ); // BASETEXTURE
  43. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true ); // LIGHTMAP
  44. pShaderShadow->EnableTexture( SHADER_SAMPLER2, true ); // BASETEXTURE
  45. // texcoord0 : base texcoord
  46. // texcoord1 : alpha texcoord (mapped to fill the overlay)
  47. unsigned int flags = VERTEX_POSITION | VERTEX_COLOR;
  48. int numTexCoords = 3;
  49. pShaderShadow->VertexShaderVertexFormat( flags, numTexCoords, 0, 0 );
  50. pShaderShadow->EnableBlending( true );
  51. pShaderShadow->BlendFunc( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE_MINUS_SRC_ALPHA );
  52. pShaderShadow->EnablePolyOffset( SHADER_POLYOFFSET_DECAL );
  53. overlay_fit_vs11_Static_Index vshIndex;
  54. pShaderShadow->SetVertexShader( "Overlay_Fit_vs11", vshIndex.GetIndex() );
  55. pShaderShadow->SetPixelShader ( "Overlay_Fit_ps11", 0 );
  56. FogToFogColor();
  57. }
  58. DYNAMIC_STATE
  59. {
  60. BindTexture( SHADER_SAMPLER0, false, BASETEXTURE, FRAME );
  61. pShaderAPI->BindStandardTexture( SHADER_SAMPLER1, false, TEXTURE_LIGHTMAP );
  62. BindTexture( SHADER_SAMPLER2, false, BASETEXTURE, FRAME );
  63. overlay_fit_vs11_Dynamic_Index vshIndex;
  64. vshIndex.SetDOWATERFOG( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z );
  65. pShaderAPI->SetVertexShaderIndex( vshIndex.GetIndex() );
  66. }
  67. Draw();
  68. }
  69. END_SHADER