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.

54 lines
1.2 KiB

  1. #include "common_fog_vs_fxc.h"
  2. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  3. //
  4. // Purpose:
  5. //
  6. //===========================================================================
  7. #include "common_vs_fxc.h"
  8. static const int g_FogType = DOWATERFOG;
  9. struct VS_INPUT
  10. {
  11. float3 vPos : POSITION;
  12. };
  13. struct VS_OUTPUT
  14. {
  15. float4 projPos : POSITION;
  16. #if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
  17. float fog : FOG;
  18. #endif
  19. float3 eyeToVertVector : TEXCOORD0;
  20. float4 vertexColor : COLOR;
  21. float4 worldPos_projPosZ : TEXCOORD7; // Necessary for pixel fog
  22. };
  23. VS_OUTPUT main( const VS_INPUT v )
  24. {
  25. VS_OUTPUT o = ( VS_OUTPUT )0;
  26. float3 worldPos = mul4x3( float4( v.vPos, 1 ), cModel[0] );
  27. o.projPos = mul( float4( worldPos, 1 ), cViewProj );
  28. #ifdef _PS3
  29. // Account for OpenGL's flipped y coordinate and expanded z range [-1,1] instead of [0,1]
  30. o.projPos.y = -o.projPos.y;
  31. o.projPos.z = 2.0f * o.projPos.z - o.projPos.w;
  32. #endif // _PS3
  33. o.worldPos_projPosZ = float4( worldPos.xyz, o.projPos.z );
  34. o.eyeToVertVector = worldPos - cEyePos;
  35. #if !defined( _X360 ) && !defined( SHADER_MODEL_VS_3_0 )
  36. o.fog = CalcFixedFunctionFog( worldPos, g_FogType );
  37. #endif
  38. o.vertexColor = cModulationColor;
  39. return o;
  40. }