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.

89 lines
2.6 KiB

  1. //===== Copyright (c) 1996-2005, 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. return 0;
  26. }
  27. SHADER_DRAW
  28. {
  29. SHADOW_STATE
  30. {
  31. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  32. // Set stream format (note that this shader supports compression)
  33. unsigned int flags = VERTEX_POSITION | VERTEX_FORMAT_COMPRESSED;
  34. int nTexCoordCount = 1;
  35. int userDataSize = 0;
  36. pShaderShadow->VertexShaderVertexFormat( flags, nTexCoordCount, NULL, userDataSize );
  37. DECLARE_STATIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 );
  38. SET_STATIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 );
  39. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  40. {
  41. DECLARE_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b );
  42. SET_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b );
  43. }
  44. else
  45. {
  46. DECLARE_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 );
  47. SET_STATIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 );
  48. }
  49. }
  50. DYNAMIC_STATE
  51. {
  52. int numBones = s_pShaderAPI->GetCurrentNumBones();
  53. DECLARE_DYNAMIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 );
  54. SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, numBones > 0 );
  55. SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression );
  56. SET_DYNAMIC_VERTEX_SHADER( debugdrawenvmapmask_vs20 );
  57. bool bShowAlpha = params[SHOWALPHA]->GetIntValue() ? true : false;
  58. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  59. {
  60. DECLARE_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b );
  61. SET_DYNAMIC_PIXEL_SHADER_COMBO( SHOWALPHA, bShowAlpha );
  62. SET_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20b );
  63. }
  64. else
  65. {
  66. DECLARE_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 );
  67. SET_DYNAMIC_PIXEL_SHADER_COMBO( SHOWALPHA, bShowAlpha );
  68. SET_DYNAMIC_PIXEL_SHADER( debugdrawenvmapmask_ps20 );
  69. }
  70. BindTexture( SHADER_SAMPLER0, TEXTURE_BINDFLAGS_NONE, BASETEXTURE, FRAME );
  71. SetVertexShaderTextureTransform( VERTEX_SHADER_SHADER_SPECIFIC_CONST_0, BASETEXTURETRANSFORM );
  72. }
  73. Draw();
  74. }
  75. END_SHADER