2D Toolkit Forum

2D Toolkit => Support => Topic started by: dustinbahr on June 28, 2013, 10:21:24 pm

Title: Textmesh Letters - Rendering Order / Depth
Post by: dustinbahr 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!

(http://i.imgur.com/hse0VIr.png)
Title: Re: Textmesh Letters - Rendering Order / Depth
Post by: unikronsoftware 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;
      }
Title: Re: Textmesh Letters - Rendering Order / Depth
Post by: dustinbahr 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!