Hello Guest

Author Topic: Textmesh Letters - Rendering Order / Depth  (Read 5406 times)

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Textmesh Letters - Rendering Order / Depth
« on: June 28, 2013, 10:21:24 pm »
Hello,

I was just wondering if it was possible to have a textmesh render its layers from right to left, instead of left to right?
I attached an example image of why this might be a problem, as the letters are overlapping and I wanted the shadows to be behind the letters.

Thanks!


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Textmesh Letters - Rendering Order / Depth
« Reply #1 on: June 28, 2013, 10:35:28 pm »
No plans to do that at the moment, though I can see why you want to do this.
If you want to do this yourself, modify the code that builds the indices so it draws the opposite way. This is from tk2d 2.0, but there is similar code in tk2d 1.0. More or less something like this.

      for (int i = 0; i < data.maxChars; ++i)
      {
                        int j = (data.maxChars - 1 - i);
         indices[offset + i * 6 + 0] = vStart + j * 4 + 0;
         indices[offset + i * 6 + 1] = vStart + j * 4 + 1;
         indices[offset + i * 6 + 2] = vStart + j * 4 + 3;
         indices[offset + i * 6 + 3] = vStart + j * 4 + 2;
         indices[offset + i * 6 + 4] = vStart + j * 4 + 0;
         indices[offset + i * 6 + 5] = vStart + j * 4 + 3;
      }

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: Textmesh Letters - Rendering Order / Depth
« Reply #2 on: June 28, 2013, 11:31:05 pm »
Thanks much!
I just added a seperate SetIndicesBackwards function that gets called using your new code if it detects a certain script on the textmesh gameobject.

That way can have the best of both worlds!