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.

69 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "BaseVSShader.h"
  7. // memdbgon must be the last include file in a .cpp file!!!
  8. #include "tier0/memdbgon.h"
  9. DEFINE_FALLBACK_SHADER( Teeth, Teeth_DX6 )
  10. BEGIN_VS_SHADER( Teeth_DX6,
  11. "Help for Teeth_DX6" )
  12. BEGIN_SHADER_PARAMS
  13. SHADER_PARAM( ILLUMFACTOR, SHADER_PARAM_TYPE_FLOAT, "1", "Amount to darken or brighten the teeth" )
  14. SHADER_PARAM( FORWARD, SHADER_PARAM_TYPE_VEC3, "[1 0 0]", "Forward direction vector for teeth lighting" )
  15. END_SHADER_PARAMS
  16. SHADER_INIT_PARAMS()
  17. {
  18. // FLASHLIGHTFIXME
  19. params[FLASHLIGHTTEXTURE]->SetStringValue( "effects/flashlight001" );
  20. SET_FLAGS2( MATERIAL_VAR2_SUPPORTS_HW_SKINNING );
  21. }
  22. SHADER_INIT
  23. {
  24. LoadTexture( FLASHLIGHTTEXTURE );
  25. LoadTexture( BASETEXTURE );
  26. }
  27. void DrawUsingSoftwareLighting( IMaterialVar** params, IShaderDynamicAPI *pShaderAPI, IShaderShadow* pShaderShadow )
  28. {
  29. SHADOW_STATE
  30. {
  31. pShaderShadow->EnableTexture( SHADER_SAMPLER0, true );
  32. pShaderShadow->OverbrightValue( SHADER_TEXTURE_STAGE0, OVERBRIGHT );
  33. pShaderShadow->DrawFlags( SHADER_DRAW_POSITION | SHADER_DRAW_COLOR | SHADER_DRAW_TEXCOORD0 );
  34. FogToFogColor();
  35. }
  36. DYNAMIC_STATE
  37. {
  38. BindTexture( SHADER_SAMPLER0, BASETEXTURE, FRAME );
  39. }
  40. Draw();
  41. }
  42. SHADER_DRAW
  43. {
  44. SHADOW_STATE
  45. {
  46. SET_FLAGS2( MATERIAL_VAR2_LIGHTING_VERTEX_LIT );
  47. }
  48. bool hasFlashlight = UsingFlashlight( params );
  49. if( hasFlashlight )
  50. {
  51. DrawFlashlight_dx70( params, pShaderAPI, pShaderShadow, FLASHLIGHTTEXTURE, FLASHLIGHTTEXTUREFRAME );
  52. }
  53. else
  54. {
  55. DrawUsingSoftwareLighting( params, pShaderAPI, pShaderShadow );
  56. }
  57. }
  58. END_SHADER