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.

84 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: eye renderer
  4. //
  5. // $Header: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #include "BaseVSShader.h"
  9. #include "eyes_dx8_dx9_helper.h"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. DEFINE_FALLBACK_SHADER( eyes, Eyes_dx9 )
  13. BEGIN_VS_SHADER( Eyes_dx9, "Help for Eyes" )
  14. BEGIN_SHADER_PARAMS
  15. SHADER_PARAM( IRIS, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "iris texture" )
  16. SHADER_PARAM( IRISFRAME, SHADER_PARAM_TYPE_INTEGER, "0", "frame for the iris texture" )
  17. SHADER_PARAM( GLINT, SHADER_PARAM_TYPE_TEXTURE, "shadertest/BaseTexture", "glint texture" )
  18. SHADER_PARAM( EYEORIGIN, SHADER_PARAM_TYPE_VEC3, "[0 0 0]", "origin for the eyes" )
  19. SHADER_PARAM( EYEUP, SHADER_PARAM_TYPE_VEC3, "[0 0 1]", "up vector for the eyes" )
  20. SHADER_PARAM( IRISU, SHADER_PARAM_TYPE_VEC4, "[0 1 0 0 ]", "U projection vector for the iris" )
  21. SHADER_PARAM( IRISV, SHADER_PARAM_TYPE_VEC4, "[0 0 1 0]", "V projection vector for the iris" )
  22. SHADER_PARAM( GLINTU, SHADER_PARAM_TYPE_VEC4, "[0 1 0 0]", "U projection vector for the glint" )
  23. SHADER_PARAM( GLINTV, SHADER_PARAM_TYPE_VEC4, "[0 0 1 0]", "V projection vector for the glint" )
  24. SHADER_PARAM( DILATION, SHADER_PARAM_TYPE_FLOAT, "0", "Pupil dilation (0 is none, 1 is maximal)" )
  25. SHADER_PARAM( INTRO, SHADER_PARAM_TYPE_BOOL, "0", "is eyes in the ep1 intro" )
  26. SHADER_PARAM( ENTITYORIGIN, SHADER_PARAM_TYPE_VEC3,"0.0","center if the model in world space" )
  27. SHADER_PARAM( WARPPARAM, SHADER_PARAM_TYPE_FLOAT,"0.0","animation param between 0 and 1" )
  28. END_SHADER_PARAMS
  29. void SetupVars( Eyes_DX8_DX9_Vars_t &info )
  30. {
  31. info.m_nBaseTexture = BASETEXTURE;
  32. info.m_nFrame = FRAME;
  33. info.m_nIris = IRIS;
  34. info.m_nIrisFrame = IRISFRAME;
  35. info.m_nGlint = GLINT;
  36. info.m_nEyeOrigin = EYEORIGIN;
  37. info.m_nEyeUp = EYEUP;
  38. info.m_nIrisU = IRISU;
  39. info.m_nIrisV = IRISV;
  40. info.m_nGlintU = GLINTU;
  41. info.m_nGlintV = GLINTV;
  42. info.m_nDilation = DILATION;
  43. info.m_nIntro = INTRO;
  44. info.m_nEntityOrigin = ENTITYORIGIN;
  45. info.m_nWarpParam = WARPPARAM;
  46. }
  47. SHADER_INIT_PARAMS()
  48. {
  49. Eyes_DX8_DX9_Vars_t info;
  50. SetupVars( info );
  51. InitParamsEyes_DX8_DX9( this, params, pMaterialName, info );
  52. }
  53. SHADER_FALLBACK
  54. {
  55. if ( g_pHardwareConfig->GetDXSupportLevel() < 90 )
  56. return "Eyes_dx8";
  57. return 0;
  58. }
  59. SHADER_INIT
  60. {
  61. Eyes_DX8_DX9_Vars_t info;
  62. SetupVars( info );
  63. InitEyes_DX8_DX9( this, params, info );
  64. }
  65. SHADER_DRAW
  66. {
  67. Eyes_DX8_DX9_Vars_t info;
  68. SetupVars( info );
  69. DrawEyes_DX8_DX9( true, this, params, pShaderAPI, pShaderShadow, info, vertexCompression );
  70. }
  71. END_SHADER