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.

94 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #include "BaseVSShader.h"
  7. #include "debugdrawenvmapmask_vs20.inc"
  8. #include "debugdrawenvmapmask_ps20.inc"
  9. #include "debugdrawenvmapmask_ps20b.inc"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. BEGIN_VS_SHADER_FLAGS( DebugDrawEnvmapMask, "Help for DebugDrawEnvmapMask", SHADER_NOT_EDITABLE )
  13. BEGIN_SHADER_PARAMS
  14. SHADER_PARAM( SHOWALPHA, SHADER_PARAM_TYPE_INTEGER, "0", "" )
  15. END_SHADER_PARAMS
  16. SHADER_INIT_PARAMS()
  17. {
  18. SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING );
  19. }
  20. SHADER_INIT
  21. {
  22. }
  23. SHADER_FALLBACK
  24. {
  25. if( g_pHardwareConfig->GetDXSupportLevel() < 90 )
  26. {
  27. // Assert( 0 );
  28. return "Wireframe";
  29. }
  30. return 0;
  31. }
  32. SHADER_DRAW
  33. {
  34. SHADOW_STATE
  35. {
  36. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  37. // Set stream format (note that this shader supports compression)
  38. unsigned int flags = VERTEX_POSITION | VERTEX_FORMAT_COMPRESSED;
  39. int nTexCoordCount = 1;
  40. int userDataSize = 0;
  41. pShaderShadow->VertexShaderVertexFormat( flags, nTexCoordCount, NULL, userDataSize );
  42. DECLARE_STATIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 );
  43. SET_STATIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 );
  44. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  45. {
  46. DECLARE_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b );
  47. SET_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b );
  48. }
  49. else
  50. {
  51. DECLARE_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 );
  52. SET_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 );
  53. }
  54. }
  55. DYNAMIC_STATE
  56. {
  57. int numBones = s_pShaderAPI->GetCurrentNumBones();
  58. DECLARE_DYNAMIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 );
  59. SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 );
  60. SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression );
  61. SET_DYNAMIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 );
  62. bool bShowAlpha = params[SHOWALPHA]->GetIntValue() ? true : false;
  63. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  64. {
  65. DECLARE_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b );
  66. SET_DYNAMIC_PIXEL_SHADER_COMBO( SHOWALPHA, bShowAlpha );
  67. SET_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b );
  68. }
  69. else
  70. {
  71. DECLARE_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 );
  72. SET_DYNAMIC_PIXEL_SHADER_COMBO( SHOWALPHA, bShowAlpha );
  73. SET_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 );
  74. }
  75. BindTexture( SHADER_SAMPLER0, BASETEXTURE, FRAME );
  76. SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, BASETEXTURETRANSFORM );
  77. }
  78. Draw();
  79. }
  80. END_SHADER