mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
update font rendering
This commit is contained in:
parent
b3ab037115
commit
edbd851d11
3 changed files with 58 additions and 35 deletions
|
|
@ -419,12 +419,19 @@ void WorldRenderer::renderTexts(
|
|||
shader.uniformMatrix("u_apply", glm::mat4(1.0f));
|
||||
batch3d->begin();
|
||||
std::wstring string = L"Segmentation fault (core dumped)";
|
||||
glm::vec3 pos(0, 100, 0);
|
||||
auto zvec = camera.position - pos;
|
||||
zvec.y = 0;
|
||||
std::swap(zvec.x, zvec.z);
|
||||
zvec.z *= -1;
|
||||
zvec = glm::normalize(zvec);
|
||||
|
||||
font.draw(
|
||||
*batch3d,
|
||||
camera,
|
||||
string,
|
||||
glm::vec3(0, 100, 0) -
|
||||
camera.right * (font.calcWidth(string, string.length()) * 0.5f)
|
||||
pos - zvec * (font.calcWidth(string, string.length()) * 0.5f),
|
||||
zvec,
|
||||
camera.up
|
||||
);
|
||||
batch3d->flush();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue