summaryrefslogtreecommitdiff
path: root/indra/newview/llhudnametag.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llhudnametag.cpp')
-rw-r--r--indra/newview/llhudnametag.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 26fc899eb5..5524bb7f09 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -897,6 +897,15 @@ void LLHUDNameTag::shift(const LLVector3& offset)
mPositionAgent += offset;
}
+F32 LLHUDNameTag::getWorldHeight() const
+{
+ const LLViewerCamera* camera = LLViewerCamera::getInstance();
+ F32 height_meters = mLastDistance * (F32)tan(camera->getView() / 2.f);
+ F32 height_pixels = camera->getViewHeightInPixels() / 2.f;
+ F32 meters_per_pixel = height_meters / height_pixels;
+ return mHeight * meters_per_pixel * gViewerWindow->getDisplayScale().mV[VY];
+}
+
//static
void LLHUDNameTag::addPickable(std::set<LLViewerObject*> &pick_list)
{