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.

59 lines
1.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. #include "BaseVSShader.h"
  3. #include "volume_clouds_helper.h"
  4. // memdbgon must be the last include file in a .cpp file!!!
  5. #include "tier0/memdbgon.h"
  6. DEFINE_FALLBACK_SHADER( VolumeClouds, VolumeClouds_dx9 )
  7. BEGIN_VS_SHADER( VolumeClouds_dx9, "VolumeClouds" )
  8. BEGIN_SHADER_PARAMS
  9. SHADER_PARAM( REFRACTAMOUNT, SHADER_PARAM_TYPE_FLOAT, "2", "" )
  10. SHADER_PARAM( BASETEXTURE, SHADER_PARAM_TYPE_TEXTURE, "", "Texture 1" )
  11. SHADER_PARAM( BASETEXTURE2, SHADER_PARAM_TYPE_TEXTURE, "", "Texture 2" )
  12. SHADER_PARAM( BASETEXTURE3, SHADER_PARAM_TYPE_TEXTURE, "", "Texture 3" )
  13. SHADER_PARAM( TIME, SHADER_PARAM_TYPE_FLOAT, "0.0", "Needs CurrentTime Proxy" )
  14. END_SHADER_PARAMS
  15. void SetupVarsVolumeClouds( VolumeCloudsVars_t &info )
  16. {
  17. info.m_nRefractAmount = REFRACTAMOUNT;
  18. info.m_nTexture1 = BASETEXTURE;
  19. info.m_nTexture2 = BASETEXTURE2;
  20. info.m_nTexture3 = BASETEXTURE3;
  21. info.m_nTime = TIME;
  22. }
  23. SHADER_INIT_PARAMS()
  24. {
  25. VolumeCloudsVars_t info;
  26. SetupVarsVolumeClouds( info );
  27. InitParamsVolumeClouds( this, params, pMaterialName, info );
  28. }
  29. SHADER_FALLBACK
  30. {
  31. if ( g_pHardwareConfig->GetDXSupportLevel() < 90 )
  32. {
  33. // Fallback to unlit generic
  34. return "UnlitGeneric_DX8";
  35. }
  36. return 0;
  37. }
  38. SHADER_INIT
  39. {
  40. VolumeCloudsVars_t info;
  41. SetupVarsVolumeClouds( info );
  42. InitVolumeClouds( this, params, info );
  43. }
  44. SHADER_DRAW
  45. {
  46. VolumeCloudsVars_t info;
  47. SetupVarsVolumeClouds( info );
  48. DrawVolumeClouds( this, params, pShaderAPI, pShaderShadow, info, vertexCompression );
  49. }
  50. END_SHADER