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.

68 lines
1.7 KiB

  1. //========= Copyright � 1996-2002, Valve LLC, All rights reserved. ============
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #include "BaseVSShader.h"
  8. #include "screenspaceeffect_vs20.inc"
  9. #include "filmdust_ps20.inc"
  10. #include "../materialsystem_global.h"
  11. // memdbgon must be the last include file in a .cpp file!!!
  12. #include "tier0/memdbgon.h"
  13. BEGIN_VS_SHADER_FLAGS( FilmDust, "Help for FilmDust", SHADER_NOT_EDITABLE )
  14. BEGIN_SHADER_PARAMS
  15. SHADER_PARAM( DUST_TEXTURE, SHADER_PARAM_TYPE_TEXTURE, "0", "Film dust texture" )
  16. SHADER_PARAM( CHANNEL_SELECT, SHADER_PARAM_TYPE_VEC4, "", "Select which color channel to use" )
  17. END_SHADER_PARAMS
  18. SHADER_INIT_PARAMS()
  19. {
  20. SET_FLAGS2( MATERIAL_VAR2_NEEDS_FULL_FRAME_BUFFER_TEXTURE );
  21. }
  22. SHADER_FALLBACK
  23. {
  24. return 0;
  25. }
  26. SHADER_INIT
  27. {
  28. LoadTexture( DUST_TEXTURE );
  29. }
  30. SHADER_DRAW
  31. {
  32. SHADOW_STATE
  33. {
  34. pShaderShadow->EnableCulling( false );
  35. pShaderShadow->EnableBlending( true );
  36. pShaderShadow->BlendFunc( SHADER_BLEND_ZERO, SHADER_BLEND_SRC_COLOR );
  37. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  38. int fmt = VERTEX_POSITION;
  39. pShaderShadow->VertexShaderVertexFormat( fmt, 1, 0, 0 );
  40. DECLARE_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  41. SET_STATIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  42. DECLARE_STATIC_PIXEL_SHADER( filmdust_ps20 );
  43. SET_STATIC_PIXEL_SHADER( filmdust_ps20 );
  44. }
  45. DYNAMIC_STATE
  46. {
  47. BindTexture( SHADER_SAMPLER0, TEXTURE_BINDFLAGS_NONE, DUST_TEXTURE, -1 );
  48. SetPixelShaderConstant( 0, CHANNEL_SELECT );
  49. DECLARE_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  50. SET_DYNAMIC_VERTEX_SHADER( screenspaceeffect_vs20 );
  51. }
  52. Draw();
  53. }
  54. END_SHADER