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.

66 lines
1.5 KiB

  1. //=========== Copyright � Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Mesh clipping operations.
  4. //
  5. //===========================================================================//
  6. #include "mesh.h"
  7. void CopyVertex( float *pOut, const float *pIn, int nFloats )
  8. {
  9. Q_memcpy( pOut, pIn, nFloats * sizeof( float ) );
  10. }
  11. void SubtractVertex( float *pOutput, const float *pLeft, const float *pRight, int nFloats )
  12. {
  13. for ( int f=0; f<nFloats; ++f )
  14. {
  15. pOutput[f] = pLeft[f] - pRight[f];
  16. }
  17. }
  18. void AddVertex( float *pOutput, const float *pLeft,const float *pRight, int nFloats )
  19. {
  20. for ( int f=0; f<nFloats; ++f )
  21. {
  22. pOutput[f] = pLeft[f] + pRight[f];
  23. }
  24. }
  25. void MultiplyVertex( float *pOutput, const float *pLeft, const float* pRight, float nFloats )
  26. {
  27. for ( int f=0; f<nFloats; ++f )
  28. {
  29. pOutput[f] = pLeft[f] * pRight[f];
  30. }
  31. }
  32. void AddVertexInPlace( float *pLeft, const float *pRight, int nFloats )
  33. {
  34. for ( int f=0; f<nFloats; ++f )
  35. {
  36. pLeft[f] += pRight[f];
  37. }
  38. }
  39. void MultiplyVertexInPlace( float *pLeft, const float flRight, int nFloats )
  40. {
  41. for ( int f=0; f<nFloats; ++f )
  42. {
  43. pLeft[f] *= flRight;
  44. }
  45. }
  46. void LerpVertex( float *pOutput, const float *pLeft, const float *pRight, float flLerp, int nFloats )
  47. {
  48. for ( int f=0; f<nFloats; ++f )
  49. {
  50. pOutput[f] = pLeft[f] + flLerp * ( pRight[f] - pLeft[f] );
  51. }
  52. }
  53. void BaryCentricVertices( float *pOutput, float *p0, float *p1, float *p2, float flU, float flV, float flW, int nFloats )
  54. {
  55. for ( int f=0; f<nFloats; ++f )
  56. {
  57. pOutput[f] = p0[f] * flU + p1[f] * flV + p2[f] * flW;
  58. }
  59. }