Advertisement
apocriva

UV Nudging for NGUI

Jan 30th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. # HG changeset patch
  2. # User apocriva
  3. # Date 1391132786 14400
  4. # Node ID 59aedd4e75a93bafcde575ec0d9bbcb03d05cf65
  5. # Parent  d5595fdc4e39bd3236e43f2a696e27358519f6de
  6. - Reapplying UV fix to NGUI.
  7.  
  8. diff --git a/Unity/Pollen/Assets/NGUI/Scripts/Internal/NGUIMath.cs b/Unity/Pollen/Assets/NGUI/Scripts/Internal/NGUIMath.cs
  9. --- a/Unity/Pollen/Assets/NGUI/Scripts/Internal/NGUIMath.cs
  10. +++ b/Unity/Pollen/Assets/NGUI/Scripts/Internal/NGUIMath.cs
  11. @@ -212,10 +212,10 @@
  12.  
  13.         if (width != 0f && height != 0f)
  14.         {
  15. -           final.xMin = rect.xMin / width;
  16. -           final.xMax = rect.xMax / width;
  17. -           final.yMin = 1f - rect.yMax / height;
  18. -           final.yMax = 1f - rect.yMin / height;
  19. +           final.xMin = rect.xMin / width + 0.00002f;
  20. +           final.xMax = rect.xMax / width + 0.00002f;
  21. +           final.yMin = 1f - rect.yMax / height - 0.00001f;
  22. +           final.yMax = 1f - rect.yMin / height - 0.00001f;
  23.         }
  24.         return final;
  25.     }
  26. diff --git a/Unity/Pollen/Assets/NGUI/Scripts/Internal/NGUIText.cs b/Unity/Pollen/Assets/NGUI/Scripts/Internal/NGUIText.cs
  27. --- a/Unity/Pollen/Assets/NGUI/Scripts/Internal/NGUIText.cs
  28. +++ b/Unity/Pollen/Assets/NGUI/Scripts/Internal/NGUIText.cs
  29. @@ -1104,10 +1104,10 @@
  30.                 {
  31.                     if (bitmapFont != null)
  32.                     {
  33. -                       glyph.u0.x = uvRect.xMin + invX * glyph.u0.x;
  34. -                       glyph.u1.x = uvRect.xMin + invX * glyph.u1.x;
  35. -                       glyph.u0.y = uvRect.yMax - invY * glyph.u0.y;
  36. -                       glyph.u1.y = uvRect.yMax - invY * glyph.u1.y;
  37. +                       glyph.u0.x = uvRect.xMin + invX * glyph.u0.x + 0.00002f;
  38. +                       glyph.u1.x = uvRect.xMin + invX * glyph.u1.x + 0.00002f;
  39. +                       glyph.u0.y = uvRect.yMax - invY * glyph.u0.y - 0.00001f;
  40. +                       glyph.u1.y = uvRect.yMax - invY * glyph.u1.y - 0.00001f;
  41.                     }
  42.  
  43.                     for (int j = 0, jmax = (bold ? 4 : 1); j < jmax; ++j)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement