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.

70 lines
1.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "BaseVSShader.h"
  7. #include "windowimposter_vs11.inc"
  8. #include "windowimposter_ps11.inc"
  9. // memdbgon must be the last include file in a .cpp file!!!
  10. #include "tier0/memdbgon.h"
  11. DEFINE_FALLBACK_SHADER( WindowImposter, WindowImposter_DX80 )
  12. BEGIN_VS_SHADER( WindowImposter_DX80,
  13. "Help for WindowImposter_DX80" )
  14. BEGIN_SHADER_PARAMS
  15. SHADER_PARAM( ENVMAP, SHADER_PARAM_TYPE_TEXTURE, "shadertest/shadertest_env", "envmap" )
  16. END_SHADER_PARAMS
  17. // Set up anything that is necessary to make decisions in SHADER_FALLBACK.
  18. SHADER_INIT_PARAMS()
  19. {
  20. }
  21. SHADER_FALLBACK
  22. {
  23. if ( IsPC() && g_pHardwareConfig->GetDXSupportLevel() < 80)
  24. return "WindowImposter_DX60";
  25. return NULL;
  26. }
  27. SHADER_INIT
  28. {
  29. LoadCubeMap( ENVMAP );
  30. }
  31. SHADER_DRAW
  32. {
  33. SHADOW_STATE
  34. {
  35. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  36. windowimposter_vs11_Static_Index vshIndex;
  37. pShaderShadow->SetVertexShader( "windowimposter_vs11", vshIndex.GetIndex() );
  38. pShaderShadow->SetPixelShader("windowimposter_ps11");
  39. pShaderShadow->VertexShaderVertexFormat( VERTEX_POSITION, 1, 0, 0 );
  40. pShaderShadow->EnableBlending( true );
  41. pShaderShadow->BlendFunc( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE_MINUS_SRC_ALPHA );
  42. pShaderShadow->EnableDepthWrites( false );
  43. FogToFogColor();
  44. }
  45. DYNAMIC_STATE
  46. {
  47. windowimposter_vs11_Dynamic_Index vshIndex;
  48. vshIndex.SetDOWATERFOG( pShaderAPI->GetSceneFogMode() == MATERIAL_FOG_LINEAR_BELOW_FOG_Z );
  49. pShaderAPI->SetVertexShaderIndex( vshIndex.GetIndex() );
  50. BindTexture( SHADER_SAMPLER0, ENVMAP, -1 );
  51. SetModulationVertexShaderDynamicState();
  52. }
  53. Draw();
  54. }
  55. END_SHADER