From 006ab5e9e1dbe1b925c50afe53afb9e2965838f5 Mon Sep 17 00:00:00 2001
From: Tom Grimshaw
Date: Mon, 24 May 2010 21:55:46 +0100
Subject: Show names above the "look at" beacons. Ported from Emerald, full
credit to them.
---
linden/indra/newview/app_settings/settings.xml | 11 ++++++++
linden/indra/newview/llhudeffectlookat.cpp | 36 +++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 1 deletion(-)
(limited to 'linden')
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 7c9b7d7..d8051a0 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -13007,5 +13007,16 @@
Value
0
+ ShowLookAtNames
+
diff --git a/linden/indra/newview/llhudeffectlookat.cpp b/linden/indra/newview/llhudeffectlookat.cpp
index 00bff21..99328f1 100644
--- a/linden/indra/newview/llhudeffectlookat.cpp
+++ b/linden/indra/newview/llhudeffectlookat.cpp
@@ -33,6 +33,7 @@
#include "llviewerprecompiledheaders.h"
#include "llhudeffectlookat.h"
+#include "llhudrender.h"
#include "llrender.h"
@@ -41,10 +42,11 @@
#include "llvoavatar.h"
#include "lldrawable.h"
#include "llviewerobjectlist.h"
+#include "llviewerwindow.h"
#include "llrendersphere.h"
#include "llselectmgr.h"
#include "llglheaders.h"
-
+#include "llresmgr.h"
#include "llxmltree.h"
@@ -545,6 +547,38 @@ void LLHUDEffectLookAt::render()
gGL.vertex3f(0.f, 0.f, 1.f);
} gGL.end();
gGL.popMatrix();
+
+ if( gSavedSettings.getBOOL("ShowLookAtNames") )
+ {
+ const LLFontGL* fontp = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
+ LLGLEnable color_mat(GL_COLOR_MATERIAL);
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
+ LLGLState gls_blend(GL_BLEND, TRUE);
+ LLGLState gls_alpha(GL_ALPHA_TEST, TRUE);
+ glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
+ gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+
+ // Well.. after that nasty complex try at somehow getting it to work initialising all sorts of stuff
+ // It seems to work and fix the previous bug of merely displaying untextured cubes,
+ // probably due to the helpful getTexUnit->enable. - Nexii
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+ LLVector3 render_pos = target + LLVector3( 0.f, 0.f, 0.25f );
+ LLColor4 Color = LLColor4( (*mAttentions)[mTargetType].mColor, 1.0f );
+ std::string text = ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->getFullname();
+
+ // Show anonyms in place of actual names when @shownames=n restricted
+ if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
+ {
+ text = gRlvHandler.getAnonym(text);
+ }
+
+ gViewerWindow->setupViewport();
+ hud_render_utf8text(text, render_pos, *fontp, LLFontGL::NORMAL, -0.5f * fontp->getWidthF32(text), 3.f, Color, FALSE );
+
+ glPopMatrix();
+ }
}
}
--
cgit v1.1