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.

48 lines
1.0 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "mathlib/vector.h"
  7. #include "bspfile.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. void SetupLightNormalFromProps( const QAngle &angles, float angle, float pitch, Vector &output )
  11. {
  12. if (angle == ANGLE_UP)
  13. {
  14. output[0] = output[1] = 0;
  15. output[2] = 1;
  16. }
  17. else if (angle == ANGLE_DOWN)
  18. {
  19. output[0] = output[1] = 0;
  20. output[2] = -1;
  21. }
  22. else
  23. {
  24. // if we don't have a specific "angle" use the "angles" YAW
  25. if ( !angle )
  26. {
  27. angle = angles[YAW];
  28. }
  29. output[2] = 0;
  30. output[0] = (float)cos (angle/180*M_PI);
  31. output[1] = (float)sin (angle/180*M_PI);
  32. }
  33. if ( !pitch )
  34. {
  35. // if we don't have a specific "pitch" use the "angles" PITCH
  36. pitch = angles[PITCH];
  37. }
  38. output[2] = (float)sin(pitch/180*M_PI);
  39. output[0] *= (float)cos(pitch/180*M_PI);
  40. output[1] *= (float)cos(pitch/180*M_PI);
  41. }