correction to yoffset char positions in distance field fonts example

This commit is contained in:
Jarred de Beer 2020-06-29 20:59:38 +02:00
parent 889125c377
commit 79b89e5cc0

View file

@ -285,7 +285,6 @@ public:
float dimx = 1.0f * charw; float dimx = 1.0f * charw;
float charh = ((float)(charInfo->height) / 36.0f); float charh = ((float)(charInfo->height) / 36.0f);
float dimy = 1.0f * charh; float dimy = 1.0f * charh;
posy = 1.0f - charh;
float us = charInfo->x / w; float us = charInfo->x / w;
float ue = (charInfo->x + charInfo->width) / w; float ue = (charInfo->x + charInfo->width) / w;
@ -295,6 +294,8 @@ public:
float xo = charInfo->xoffset / 36.0f; float xo = charInfo->xoffset / 36.0f;
float yo = charInfo->yoffset / 36.0f; float yo = charInfo->yoffset / 36.0f;
posy = yo;
vertices.push_back({ { posx + dimx + xo, posy + dimy, 0.0f }, { ue, te } }); vertices.push_back({ { posx + dimx + xo, posy + dimy, 0.0f }, { ue, te } });
vertices.push_back({ { posx + xo, posy + dimy, 0.0f }, { us, te } }); vertices.push_back({ { posx + xo, posy + dimy, 0.0f }, { us, te } });
vertices.push_back({ { posx + xo, posy, 0.0f }, { us, ts } }); vertices.push_back({ { posx + xo, posy, 0.0f }, { us, ts } });