summaryrefslogtreecommitdiff
path: root/indra/newview/llhudrender.cpp
diff options
context:
space:
mode:
authorRye Mutt <rye@lindenlab.com>2024-09-12 09:22:10 -0700
committerGitHub <noreply@github.com>2024-09-12 11:22:10 -0500
commitb713f56d07cffb21cad5928bf30d6d4b6dc79de9 (patch)
tree9c64cef93e350c153c8ab590141650f21b99ed66 /indra/newview/llhudrender.cpp
parent264c57831bc6ca9be1c465c10a2558c3d28b936e (diff)
Replace glh_linear usage with GLM (#2554)
Diffstat (limited to 'indra/newview/llhudrender.cpp')
-rw-r--r--indra/newview/llhudrender.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index f027aa5552..4180e49e94 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -38,6 +38,9 @@
#include "llviewerwindow.h"
#include "llui.h"
+#include <glm/gtc/matrix_transform.hpp>
+#include <glm/gtc/type_ptr.hpp>
+
void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent,
LLFontVertexBuffer *font_buffer,
const LLFontGL &font,
@@ -102,26 +105,10 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
//get the render_pos in screen space
- F64 winX, winY, winZ;
LLRect world_view_rect = gViewerWindow->getWorldViewRectRaw();
- S32 viewport[4];
- viewport[0] = world_view_rect.mLeft;
- viewport[1] = world_view_rect.mBottom;
- viewport[2] = world_view_rect.getWidth();
- viewport[3] = world_view_rect.getHeight();
-
- F64 mdlv[16];
- F64 proj[16];
-
- for (U32 i = 0; i < 16; i++)
- {
- mdlv[i] = (F64) gGLModelView[i];
- proj[i] = (F64) gGLProjection[i];
- }
+ glm::ivec4 viewport(world_view_rect.mLeft, world_view_rect.mBottom, world_view_rect.getWidth(), world_view_rect.getHeight());
- gluProject(render_pos.mV[0], render_pos.mV[1], render_pos.mV[2],
- mdlv, proj, (GLint*) viewport,
- &winX, &winY, &winZ);
+ glm::vec3 win_coord = glm::project(glm::make_vec3(render_pos.mV), get_current_modelview(), get_current_projection(), viewport);
//fonts all render orthographically, set up projection``
gGL.matrixMode(LLRender::MM_PROJECTION);
@@ -133,11 +120,11 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight());
gViewerWindow->setup3DViewport();
- winX -= world_view_rect.mLeft;
- winY -= world_view_rect.mBottom;
+ win_coord.x -= world_view_rect.mLeft;
+ win_coord.y -= world_view_rect.mBottom;
LLUI::loadIdentity();
gGL.loadIdentity();
- LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f));
+ LLUI::translate((F32) win_coord.x*1.0f/LLFontGL::sScaleX, (F32) win_coord.y*1.0f/(LLFontGL::sScaleY), -(((F32) win_coord.z*2.f)-1.f));
F32 right_x;
if (font_buffer)