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.

95 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Header: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #include "BaseVSShader.h"
  9. #include "cpp_shader_constant_register_map.h"
  10. BEGIN_VS_SHADER( Bik_dx80, "Help for Bik_dx80" )
  11. BEGIN_SHADER_PARAMS
  12. SHADER_PARAM( YTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "Y Bink Texture" )
  13. // SHADER_PARAM( ATEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "A Bink Texture" )
  14. SHADER_PARAM( CRTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "Cr Bink Texture" )
  15. SHADER_PARAM( CBTEXTURE, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "Cb Bink Texture" )
  16. END_SHADER_PARAMS
  17. SHADER_INIT_PARAMS()
  18. {
  19. }
  20. SHADER_FALLBACK
  21. {
  22. if ( g_pHardwareConfig->GetDXSupportLevel() < 80 )
  23. {
  24. return "wireframe";
  25. }
  26. return 0;
  27. }
  28. SHADER_INIT
  29. {
  30. if ( params[YTEXTURE]->IsDefined() )
  31. {
  32. LoadTexture( YTEXTURE );
  33. }
  34. // if ( params[ATEXTURE]->IsDefined() )
  35. // {
  36. // LoadTexture( ATEXTURE );
  37. // }
  38. if ( params[CRTEXTURE]->IsDefined() )
  39. {
  40. LoadTexture( CRTEXTURE );
  41. }
  42. if ( params[CBTEXTURE]->IsDefined() )
  43. {
  44. LoadTexture( CBTEXTURE );
  45. }
  46. }
  47. SHADER_DRAW
  48. {
  49. int nPass;
  50. for( nPass = 0; nPass < 2; nPass++ )
  51. {
  52. SHADOW_STATE
  53. {
  54. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  55. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
  56. pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
  57. // we don't do alpha for these on dx8
  58. // pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
  59. unsigned int flags = VERTEX_POSITION;
  60. int numTexCoords = 1;
  61. pShaderShadow->VertexShaderVertexFormat( flags, numTexCoords, 0, 0 );
  62. pShaderShadow->SetVertexShader( "bik_vs11", 0 );
  63. pShaderShadow->SetPixelShader( "bik_ps11", 0 );
  64. if( nPass > 0 )
  65. {
  66. EnableAlphaBlending( SHADER_BLEND_ONE, SHADER_BLEND_ONE );
  67. }
  68. }
  69. DYNAMIC_STATE
  70. {
  71. BindTexture( SHADER_SAMPLER0, YTEXTURE, FRAME );
  72. BindTexture( SHADER_SAMPLER1, CRTEXTURE, FRAME );
  73. BindTexture( SHADER_SAMPLER2, CBTEXTURE, FRAME );
  74. // we don't do alpha for these on dx8
  75. // BindTexture( SHADER_SAMPLER3, ATEXTURE, FRAME );
  76. pShaderAPI->SetVertexShaderIndex( 0 );
  77. pShaderAPI->SetPixelShaderIndex( nPass );
  78. // We need the view matrix
  79. LoadViewMatrixIntoVertexShaderConstant( VERTEX_SHADER_VIEWMODEL );
  80. }
  81. Draw( );
  82. }
  83. }
  84. END_SHADER