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.

79 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "BaseVSShader.h"
  8. DEFINE_FALLBACK_SHADER( IntroScreenSpaceEffect, IntroScreenSpaceEffect_dx60 )
  9. BEGIN_SHADER_FLAGS( IntroScreenSpaceEffect_dx60, "Help for IntroScreenSpaceEffect_dx60", SHADER_NOT_EDITABLE )
  10. BEGIN_SHADER_PARAMS
  11. SHADER_PARAM( MODE, SHADER_PARAM_TYPE_INTEGER, "0", "" )
  12. END_SHADER_PARAMS
  13. SHADER_INIT_PARAMS()
  14. {
  15. SET_FLAGS2( MATERIAL_VAR2_NEEDS_FULL_FRAME_BUFFER_TEXTURE );
  16. }
  17. SHADER_INIT
  18. {
  19. }
  20. SHADER_DRAW
  21. {
  22. SHADOW_STATE
  23. {
  24. pShaderShadow->EnableCulling( false );
  25. pShaderShadow->EnableDepthWrites( false );
  26. pShaderShadow->EnableDepthTest( false );
  27. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  28. pShaderShadow->EnableTexture( SHADER_SAMPLER1, true );
  29. pShaderShadow->DrawFlags( SHADER_DRAW_POSITION | SHADER_DRAW_TEXCOORD0 | SHADER_DRAW_TEXCOORD1 );
  30. DisableFog();
  31. pShaderShadow->BlendFunc( SHADER_BLEND_SRC_ALPHA, SHADER_BLEND_ONE );
  32. pShaderShadow->EnableCustomPixelPipe( true );
  33. pShaderShadow->CustomTextureStages( 2 );
  34. pShaderShadow->EnableConstantAlpha( true );
  35. pShaderShadow->EnableBlending( true );
  36. pShaderShadow->CustomTextureOperation( SHADER_TEXTURE_STAGE0,
  37. SHADER_TEXCHANNEL_COLOR, SHADER_TEXOP_SELECTARG1,
  38. SHADER_TEXARG_TEXTURE, SHADER_TEXARG_NONE );
  39. pShaderShadow->CustomTextureOperation( SHADER_TEXTURE_STAGE1,
  40. SHADER_TEXCHANNEL_COLOR, SHADER_TEXOP_ADD,
  41. SHADER_TEXARG_TEXTURE, SHADER_TEXARG_PREVIOUSSTAGE );
  42. pShaderShadow->CustomTextureOperation( SHADER_TEXTURE_STAGE1,
  43. SHADER_TEXCHANNEL_ALPHA, SHADER_TEXOP_SELECTARG1,
  44. SHADER_TEXARG_CONSTANTCOLOR, SHADER_TEXARG_NONE );
  45. }
  46. DYNAMIC_STATE
  47. {
  48. switch( params[MODE]->GetIntValue() )
  49. {
  50. case 7:
  51. pShaderAPI->BindStandardTexture( SHADER_SAMPLER0, TEXTURE_FRAME_BUFFER_FULL_TEXTURE_0 );
  52. pShaderAPI->BindStandardTexture( SHADER_SAMPLER1, TEXTURE_BLACK );
  53. break;
  54. case 8:
  55. pShaderAPI->BindStandardTexture( SHADER_SAMPLER0, TEXTURE_FRAME_BUFFER_FULL_TEXTURE_1 );
  56. pShaderAPI->BindStandardTexture( SHADER_SAMPLER1, TEXTURE_BLACK );
  57. break;
  58. default:
  59. pShaderAPI->BindStandardTexture( SHADER_SAMPLER0, TEXTURE_FRAME_BUFFER_FULL_TEXTURE_0 );
  60. pShaderAPI->BindStandardTexture( SHADER_SAMPLER1, TEXTURE_FRAME_BUFFER_FULL_TEXTURE_1 );
  61. break;
  62. }
  63. float color[4] = { 1.0, 1.0, 1.0, 1.0 };
  64. color[3] = params[ALPHA]->GetFloatValue();
  65. s_pShaderAPI->Color4fv( color );
  66. }
  67. Draw();
  68. }
  69. END_SHADER