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.

86 lines
2.3 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_dx81, "Help for Bik_dx81" )
  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() < 81 )
  23. {
  24. return "bik_dx80";
  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. SHADOW_STATE
  50. {
  51. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  52. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
  53. pShaderShadow->EnableTexture( SHADER_SAMPLER2, true );
  54. // we don't do alpha for these on dx8
  55. // pShaderShadow->EnableTexture( SHADER_SAMPLER3, true );
  56. unsigned int flags = VERTEX_POSITION;
  57. int numTexCoords = 1;
  58. pShaderShadow->VertexShaderVertexFormat( flags, numTexCoords, 0, 0 );
  59. pShaderShadow->SetVertexShader( "bik_vs11", 0 );
  60. pShaderShadow->SetPixelShader( "bik_ps14", 0 );
  61. }
  62. DYNAMIC_STATE
  63. {
  64. BindTexture( SHADER_SAMPLER0, YTEXTURE, FRAME );
  65. BindTexture( SHADER_SAMPLER1, CRTEXTURE, FRAME );
  66. BindTexture( SHADER_SAMPLER2, CBTEXTURE, FRAME );
  67. // we don't do alpha for these on dx8
  68. // BindTexture( SHADER_SAMPLER3, ATEXTURE, FRAME );
  69. pShaderAPI->SetVertexShaderIndex( 0 );
  70. pShaderAPI->SetPixelShaderIndex( 0 );
  71. // We need the view matrix
  72. LoadViewMatrixIntoVertexShaderConstant( VERTEX_SHADER_VIEWMODEL );
  73. }
  74. Draw( );
  75. }
  76. END_SHADER