Team Fortress 2 Source Code as on 22/4/2020
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.

61 lines
1.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "BaseVSShader.h"
  8. #include "writez.inc"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. DEFINE_FALLBACK_SHADER( WriteStencil, WriteStencil_DX8 )
  12. BEGIN_VS_SHADER_FLAGS( WriteStencil_DX8, "Help for WriteStencil", SHADER_NOT_EDITABLE )
  13. BEGIN_SHADER_PARAMS
  14. END_SHADER_PARAMS
  15. SHADER_INIT_PARAMS()
  16. {
  17. }
  18. SHADER_FALLBACK
  19. {
  20. if ( IsPC() && g_pHardwareConfig->GetDXSupportLevel() < 80 )
  21. return "WriteStencil_DX6";
  22. return 0;
  23. }
  24. SHADER_INIT
  25. {
  26. }
  27. SHADER_DRAW
  28. {
  29. SHADOW_STATE
  30. {
  31. pShaderShadow->EnableColorWrites( false ); //
  32. pShaderShadow->EnableAlphaWrites( false ); // Write ONLY to stencil
  33. pShaderShadow->EnableDepthWrites( false ); //
  34. writez_Static_Index vshIndex;
  35. pShaderShadow->SetVertexShader( "writez", vshIndex.GetIndex() );
  36. pShaderShadow->SetPixelShader( "white" );
  37. pShaderShadow->VertexShaderVertexFormat( VERTEX_POSITION, 1, 0, 0 );
  38. }
  39. DYNAMIC_STATE
  40. {
  41. writez_Dynamic_Index vshIndex;
  42. vshIndex.SetDOWATERFOG( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z );
  43. pShaderAPI->SetVertexShaderIndex( vshIndex.GetIndex() );
  44. }
  45. Draw();
  46. }
  47. END_SHADER