Leaked source code of windows server 2003
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.3 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // texdiff.h
  4. //
  5. // TextureDiff base code for inclusion as an inline function or
  6. // regular function from common code.
  7. //
  8. // Copyright (C) Microsoft Corporation, 1997.
  9. //
  10. //----------------------------------------------------------------------------
  11. //----------------------------------------------------------------------------
  12. //
  13. // TextureDiff
  14. //
  15. // Computes the difference between two texture coordinates according
  16. // to the given texture wrap mode.
  17. //
  18. //----------------------------------------------------------------------------
  19. {
  20. FLOAT fDiff1 = fTb - fTa;
  21. if (iMode == 0)
  22. {
  23. // Wrap not set, return plain difference.
  24. return fDiff1;
  25. }
  26. else
  27. {
  28. FLOAT fDiff2;
  29. // Wrap set, compute shortest distance of plain difference
  30. // and wrap difference.
  31. fDiff2 = fDiff1;
  32. if (FLOAT_LTZ(fDiff1))
  33. {
  34. fDiff2 += g_fOne;
  35. }
  36. else if (FLOAT_GTZ(fDiff1))
  37. {
  38. fDiff2 -= g_fOne;
  39. }
  40. if (ABSF(fDiff1) < ABSF(fDiff2))
  41. {
  42. return fDiff1;
  43. }
  44. else
  45. {
  46. return fDiff2;
  47. }
  48. }
  49. }