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.

81 lines
2.7 KiB

  1. //========= Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Header: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #include "shaderlib/cshader.h"
  9. #include "debugtangentspace_vs20.inc"
  10. #include "unlitgeneric_notexture_ps20.inc"
  11. #include "unlitgeneric_notexture_ps20b.inc"
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include "tier0/memdbgon.h"
  14. BEGIN_SHADER( DebugTangentSpace, "Help for DebugTangentSpace" )
  15. BEGIN_SHADER_PARAMS
  16. SHADER_PARAM_OVERRIDE( BASETEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/basetexture", "unused", SHADER_PARAM_NOT_EDITABLE )
  17. SHADER_PARAM_OVERRIDE( FRAME, SHADER_PARAM_TYPE_INTEGER, "0", "unused", SHADER_PARAM_NOT_EDITABLE )
  18. SHADER_PARAM_OVERRIDE( BASETEXTURETRANSFORM, SHADER_PARAM_TYPE_MATRIX, "center .5 .5 scale 1 1 rotate 0 translate 0 0", "unused", SHADER_PARAM_NOT_EDITABLE )
  19. SHADER_PARAM_OVERRIDE( COLOR, SHADER_PARAM_TYPE_COLOR, "{255 255 255}", "unused", SHADER_PARAM_NOT_EDITABLE )
  20. SHADER_PARAM_OVERRIDE( ALPHA, SHADER_PARAM_TYPE_FLOAT, "1.0", "unused", SHADER_PARAM_NOT_EDITABLE )
  21. END_SHADER_PARAMS
  22. SHADER_INIT_PARAMS()
  23. {
  24. SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING );
  25. }
  26. SHADER_INIT
  27. {
  28. }
  29. SHADER_DRAW
  30. {
  31. SHADOW_STATE
  32. {
  33. // Set stream format (note that this shader supports compression)
  34. unsigned int flags = VERTEX_POSITION | VERTEX_NORMAL | VERTEX_FORMAT_COMPRESSED;
  35. int nTexCoordCount = 0;
  36. int userDataSize = 4;
  37. pShaderShadow->VertexShaderVertexFormat( flags, nTexCoordCount, NULL, userDataSize );
  38. DECLARE_STATIC_VERTEX_SHADER( debugtangentspace_vs20 );
  39. SET_STATIC_VERTEX_SHADER( debugtangentspace_vs20 );
  40. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  41. {
  42. DECLARE_STATIC_PIXEL_SHADER( unlitgeneric_notexture_ps20b );
  43. SET_STATIC_PIXEL_SHADER( unlitgeneric_notexture_ps20b );
  44. }
  45. else
  46. {
  47. DECLARE_STATIC_PIXEL_SHADER( unlitgeneric_notexture_ps20 );
  48. SET_STATIC_PIXEL_SHADER( unlitgeneric_notexture_ps20 );
  49. }
  50. }
  51. DYNAMIC_STATE
  52. {
  53. DECLARE_DYNAMIC_VERTEX_SHADER( debugtangentspace_vs20 );
  54. SET_DYNAMIC_VERTEX_SHADER_COMBO( SKINNING, pShaderAPI->GetCurrentNumBones() > 0 );
  55. SET_DYNAMIC_VERTEX_SHADER_COMBO( COMPRESSED_VERTS, (int)vertexCompression );
  56. SET_DYNAMIC_VERTEX_SHADER( debugtangentspace_vs20 );
  57. if( g_pHardwareConfig->SupportsPixelShaders_2_b() )
  58. {
  59. DECLARE_DYNAMIC_PIXEL_SHADER( unlitgeneric_notexture_ps20b );
  60. SET_DYNAMIC_PIXEL_SHADER( unlitgeneric_notexture_ps20b );
  61. }
  62. else
  63. {
  64. DECLARE_DYNAMIC_PIXEL_SHADER( unlitgeneric_notexture_ps20 );
  65. SET_DYNAMIC_PIXEL_SHADER( unlitgeneric_notexture_ps20 );
  66. }
  67. }
  68. Draw();
  69. }
  70. END_SHADER