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.

79 lines
2.5 KiB

  1. //========= Copyright � 1996-2005, 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( ENTITYORIGIN, SHADER_PARAM_TYPE_VEC3,"0.0","center if the model in world space" )
  26. SHADER_PARAM( WARPPARAM, SHADER_PARAM_TYPE_FLOAT,"0.0","animation param between 0 and 1" )
  27. END_SHADER_PARAMS
  28. void SetupVars( Eyes_DX8_DX9_Vars_t &info )
  29. {
  30. info.m_nBaseTexture = BASETEXTURE;
  31. info.m_nFrame = FRAME;
  32. info.m_nIris = IRIS;
  33. info.m_nIrisFrame = IRISFRAME;
  34. info.m_nGlint = GLINT;
  35. info.m_nEyeOrigin = EYEORIGIN;
  36. info.m_nEyeUp = EYEUP;
  37. info.m_nIrisU = IRISU;
  38. info.m_nIrisV = IRISV;
  39. info.m_nGlintU = GLINTU;
  40. info.m_nGlintV = GLINTV;
  41. info.m_nDilation = DILATION;
  42. info.m_nEntityOrigin = ENTITYORIGIN;
  43. info.m_nWarpParam = WARPPARAM;
  44. }
  45. SHADER_INIT_PARAMS()
  46. {
  47. Eyes_DX8_DX9_Vars_t info;
  48. SetupVars( info );
  49. InitParamsEyes_DX8_DX9( this, params, pMaterialName, info );
  50. }
  51. SHADER_FALLBACK
  52. {
  53. return 0;
  54. }
  55. SHADER_INIT
  56. {
  57. Eyes_DX8_DX9_Vars_t info;
  58. SetupVars( info );
  59. InitEyes_DX8_DX9( this, params, info );
  60. }
  61. SHADER_DRAW
  62. {
  63. Eyes_DX8_DX9_Vars_t info;
  64. SetupVars( info );
  65. DrawEyes_DX8_DX9( true, this, params, pShaderAPI, pShaderShadow, info, vertexCompression );
  66. }
  67. END_SHADER