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.

56 lines
1.6 KiB

  1. //========== Copyright (c) Valve Corporation, All rights reserved. ==========//
  2. #include "common_vs_fxc.h"
  3. const float4x4 g_FlashlightWorldToTexture : register( SHADER_SPECIFIC_CONST_0 );
  4. // SHADER_SPECIFIC_CONST_1
  5. // SHADER_SPECIFIC_CONST_2
  6. // SHADER_SPECIFIC_CONST_3
  7. const float4x4 g_FlashlightWorldToLight : register( SHADER_SPECIFIC_CONST_4 );
  8. // SHADER_SPECIFIC_CONST_5
  9. // SHADER_SPECIFIC_CONST_6
  10. // SHADER_SPECIFIC_CONST_7
  11. //-----------------------------------------------------------------------------
  12. // Input vertex format
  13. //-----------------------------------------------------------------------------
  14. struct VS_INPUT
  15. {
  16. // This is all of the stuff that we ever use.
  17. float4 vPos : POSITION;
  18. };
  19. struct VS_OUTPUT
  20. {
  21. float4 projPos : POSITION;
  22. float3 vWorldPos : TEXCOORD0;
  23. float4 vProjPos : TEXCOORD1;
  24. float4 spotTexCoord : TEXCOORD2;
  25. float4 uberLightPos : TEXCOORD3;
  26. };
  27. //-----------------------------------------------------------------------------
  28. // Main shader entry point
  29. //-----------------------------------------------------------------------------
  30. VS_OUTPUT main( const VS_INPUT v )
  31. {
  32. VS_OUTPUT o = (VS_OUTPUT) 0;
  33. float4 vPosition = v.vPos;
  34. // Transform to world space
  35. float3 worldPos = vPosition;
  36. // Transform into projection space
  37. float4 vProjPos = mul( float4( worldPos, 1 ), cViewProj );
  38. o.projPos = vProjPos;
  39. o.vWorldPos.xyz = worldPos;
  40. o.vProjPos = vProjPos;
  41. o.spotTexCoord = mul( float4( worldPos, 1.0f ), g_FlashlightWorldToTexture );
  42. o.uberLightPos = mul( float4( worldPos, 1.0f ), g_FlashlightWorldToLight ).yzxw;
  43. return o;
  44. }