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.

51 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Clears color/depth, but obeys stencil while doing so
  4. //
  5. // $Header: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #include "shaderlib/cshader.h"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. DEFINE_FALLBACK_SHADER( BufferClearObeyStencil, BufferClearObeyStencil_DX6 )
  12. BEGIN_SHADER_FLAGS( BufferClearObeyStencil_DX6, "Help for BufferClearObeyStencil_DX6", SHADER_NOT_EDITABLE )
  13. BEGIN_SHADER_PARAMS
  14. SHADER_PARAM( CLEARCOLOR, SHADER_PARAM_TYPE_INTEGER, "1", "activates clearing of color" )
  15. SHADER_PARAM( CLEARDEPTH, SHADER_PARAM_TYPE_INTEGER, "1", "activates clearing of depth" )
  16. END_SHADER_PARAMS
  17. SHADER_INIT_PARAMS()
  18. {
  19. }
  20. SHADER_INIT
  21. {
  22. }
  23. SHADER_DRAW
  24. {
  25. SHADOW_STATE
  26. {
  27. pShaderShadow->DepthFunc( SHADER_DEPTHFUNC_ALWAYS );
  28. bool bEnableDepthWrites = params[CLEARDEPTH]->GetIntValue() != 0;
  29. pShaderShadow->EnableDepthWrites( bEnableDepthWrites );
  30. bool bEnableColorWrites = params[CLEARCOLOR]->GetIntValue() != 0;
  31. pShaderShadow->EnableColorWrites( bEnableColorWrites );
  32. pShaderShadow->EnableAlphaWrites( bEnableColorWrites );
  33. pShaderShadow->DrawFlags( SHADER_DRAW_POSITION | SHADER_DRAW_COLOR );
  34. DisableFog();
  35. }
  36. DYNAMIC_STATE
  37. {
  38. }
  39. Draw( );
  40. }
  41. END_SHADER