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
1.6 KiB

  1. #include "common_fog_vs_forcevertexfog_fxc.h"
  2. #include "common_vs_fxc.h"
  3. // DYNAMIC: "SKINNING" "0..1"
  4. // DYNAMIC: "COMPRESSED_VERTS" "0..1"
  5. // DYNAMIC: "FLASHLIGHT" "0..1"
  6. struct VS_INPUT
  7. {
  8. float4 vPos : POSITION;
  9. float4 vNormal : NORMAL;
  10. float4 vBoneWeights : BLENDWEIGHT;
  11. float4 vBoneIndices : BLENDINDICES;
  12. float2 vBaseTexCoord : TEXCOORD0;
  13. };
  14. struct VS_OUTPUT
  15. {
  16. float4 projPos : POSITION; // Projection-space position
  17. #if ( HARDWAREFOGBLEND )
  18. float fog : FOG;
  19. #else
  20. float fog : TEXCOORD0;
  21. #endif
  22. float2 vBaseTexCoord : TEXCOORD1;
  23. #if ( FLASHLIGHT )
  24. float3 worldPos : TEXCOORD2;
  25. float3 worldNormal : TEXCOORD3;
  26. #endif
  27. };
  28. VS_OUTPUT main( const VS_INPUT v )
  29. {
  30. VS_OUTPUT o;
  31. float3 worldPos, vNormal, worldNormal;
  32. #if ( FLASHLIGHT )
  33. {
  34. DecompressVertex_Normal( v.vNormal, vNormal );
  35. SkinPositionAndNormal( SKINNING, v.vPos, vNormal, v.vBoneWeights, v.vBoneIndices, worldPos, worldNormal );
  36. o.worldPos = worldPos;
  37. o.worldNormal = worldNormal;
  38. }
  39. #else
  40. {
  41. SkinPosition( SKINNING, v.vPos, v.vBoneWeights, v.vBoneIndices, worldPos );
  42. }
  43. #endif
  44. // Transform into projection space
  45. o.projPos = mul( float4( worldPos, 1 ), cViewProj );
  46. #ifdef _PS3
  47. {
  48. // Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1]
  49. o.projPos.y = -o.projPos.y;
  50. o.projPos.z = 2.0f * o.projPos.z - o.projPos.w;
  51. }
  52. #endif // _PS3
  53. #if ( HARDWAREFOGBLEND )
  54. {
  55. o.fog = CalcFixedFunctionFog( worldPos, DOWATERFOG );
  56. }
  57. #else
  58. {
  59. o.fog = CalcNonFixedFunctionFog( worldPos, false );
  60. }
  61. #endif
  62. o.vBaseTexCoord = v.vBaseTexCoord;
  63. return o;
  64. }