summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-03-09 15:23:16 -0800
committerJames Cook <james@lindenlab.com>2010-03-09 15:23:16 -0800
commit7337b4b05bf2218796742a0ee1ddb0fdf27236c4 (patch)
tree99d0b69543b1d6db632436465c6ce3585d403df1
parent717a4800f1ae0ae6ea0bbe9ed0af21c7851f5d0a (diff)
More harmonization of LLHUDNameTag vs. LLHUDText
Eliminating now-unused code from LLHUDText
-rw-r--r--indra/newview/llhudnametag.cpp12
-rw-r--r--indra/newview/llhudnametag.h4
-rw-r--r--indra/newview/llhudtext.cpp113
-rw-r--r--indra/newview/llhudtext.h10
-rw-r--r--indra/newview/llvoavatar.cpp1
5 files changed, 30 insertions, 110 deletions
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 5d4c4571d5..7d194cc330 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -104,7 +104,6 @@ LLHUDNameTag::LLHUDNameTag(const U8 type)
mFadeDistance = 8.f;
mFadeRange = 4.f;
mZCompare = TRUE;
- mDropShadow = TRUE;
mOffscreen = FALSE;
mRadius = 0.1f;
LLPointer<LLHUDNameTag> ptr(this);
@@ -502,11 +501,7 @@ void LLHUDNameTag::renderText(BOOL for_select)
y_offset -= fontp->getLineHeight();
U8 style = segment_iter->mStyle;
- LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW;
- if (mDropShadow)
- {
- shadow = LLFontGL::DROP_SHADOW;
- }
+ LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
F32 x_offset;
if (mTextAlignment== ALIGN_TEXT_CENTER)
@@ -618,11 +613,6 @@ void LLHUDNameTag::addLabel(const std::string& label_utf8)
}
}
-void LLHUDNameTag::setDropShadow(const BOOL do_shadow)
-{
- mDropShadow = do_shadow;
-}
-
void LLHUDNameTag::setZCompare(const BOOL zcompare)
{
mZCompare = zcompare;
diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h
index 56b17bef6b..0b741057e5 100644
--- a/indra/newview/llhudnametag.h
+++ b/indra/newview/llhudnametag.h
@@ -104,8 +104,6 @@ public:
void setLabel(const std::string& label_utf8);
void addLabel(const std::string& label_utf8);
- void setDropShadow(const BOOL do_shadow);
-
// Sets the default font for lines with no font specified
void setFont(const LLFontGL* font);
void setColor(const LLColor4 &color);
@@ -152,8 +150,6 @@ protected:
private:
~LLHUDNameTag();
- //BOOL mUseBubble; always true
- BOOL mDropShadow;
BOOL mDoFade;
F32 mFadeRange;
F32 mFadeDistance;
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 406ad8c51e..c362128cb8 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -1,7 +1,6 @@
-
/**
* @file llhudtext.cpp
- * @brief LLHUDText class implementation
+ * @brief Floating text above objects, set via script with llSetText()
*
* $LicenseInfo:firstyear=2002&license=viewergpl$
*
@@ -69,9 +68,9 @@ const S32 NUM_OVERLAP_ITERATIONS = 10;
const F32 NEIGHBOR_FORCE_FRACTION = 1.f;
const F32 POSITION_DAMPING_TC = 0.2f;
const F32 MAX_STABLE_CAMERA_VELOCITY = 0.1f;
-const F32 LOD_0_SCREEN_COVERAGE = 0.15f;
-const F32 LOD_1_SCREEN_COVERAGE = 0.30f;
-const F32 LOD_2_SCREEN_COVERAGE = 0.40f;
+//const F32 LOD_0_SCREEN_COVERAGE = 0.15f;
+//const F32 LOD_1_SCREEN_COVERAGE = 0.30f;
+//const F32 LOD_2_SCREEN_COVERAGE = 0.40f;
std::set<LLPointer<LLHUDText> > LLHUDText::sTextObjects;
std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleTextObjects;
@@ -97,7 +96,7 @@ LLHUDText::LLHUDText(const U8 type) :
mOffsetY(0),
mTextAlignment(ALIGN_TEXT_CENTER),
mVertAlignment(ALIGN_VERT_CENTER),
- mLOD(0),
+// mLOD(0),
mHidden(FALSE)
{
mColor = LLColor4(1.f, 1.f, 1.f, 1.f);
@@ -105,7 +104,6 @@ LLHUDText::LLHUDText(const U8 type) :
mFadeDistance = 8.f;
mFadeRange = 4.f;
mZCompare = TRUE;
- mDropShadow = TRUE;
mOffscreen = FALSE;
mRadius = 0.1f;
LLPointer<LLHUDText> ptr(this);
@@ -232,28 +230,6 @@ void LLHUDText::renderText(BOOL for_select)
// Render label
{
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
-
- for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin();
- segment_iter != mLabelSegments.end(); ++segment_iter )
- {
- // Label segments use default font
- const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp;
- y_offset -= fontp->getLineHeight();
-
- F32 x_offset;
- if (mTextAlignment == ALIGN_TEXT_CENTER)
- {
- x_offset = -0.5f*segment_iter->getWidth(fontp);
- }
- else // ALIGN_LEFT
- {
- x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f);
- }
-
- LLColor4 label_color(0.f, 0.f, 0.f, 1.f);
- label_color.mV[VALPHA] = alpha_factor;
- hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, mOnHUDAttachment);
- }
}
// Render text
@@ -278,11 +254,7 @@ void LLHUDText::renderText(BOOL for_select)
y_offset -= fontp->getLineHeight();
U8 style = segment_iter->mStyle;
- LLFontGL::ShadowType shadow = LLFontGL::NO_SHADOW;
- if (mDropShadow)
- {
- shadow = LLFontGL::DROP_SHADOW;
- }
+ LLFontGL::ShadowType shadow = LLFontGL::DROP_SHADOW;
F32 x_offset;
if (mTextAlignment== ALIGN_TEXT_CENTER)
@@ -353,11 +325,6 @@ void LLHUDText::addLine(const std::string &text_utf8,
}
}
-void LLHUDText::setDropShadow(const BOOL do_shadow)
-{
- mDropShadow = do_shadow;
-}
-
void LLHUDText::setZCompare(const BOOL zcompare)
{
mZCompare = zcompare;
@@ -457,7 +424,7 @@ void LLHUDText::updateVisibility()
mLastDistance = (mPositionAgent - LLViewerCamera::getInstance()->getOrigin()).magVec();
- if (mLOD >= 3 || !mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange)))
+ if (!mTextSegments.size() || (mDoFade && (mLastDistance > mFadeDistance + mFadeRange)))
{
mVisible = FALSE;
return;
@@ -553,14 +520,6 @@ void LLHUDText::updateSize()
++iter;
}
- iter = mLabelSegments.begin();
- while (iter != mLabelSegments.end())
- {
- height += mFontp->getLineHeight();
- width = llmax(width, llmin(iter->getWidth(mFontp), HUD_TEXT_MAX_WIDTH));
- ++iter;
- }
-
if (width == 0.f)
{
return;
@@ -569,18 +528,8 @@ void LLHUDText::updateSize()
width += HORIZONTAL_PADDING;
height += VERTICAL_PADDING;
- if (!mResizeTimer.getStarted() && (width != mWidth || height != mHeight))
- {
- mResizeTimer.start();
- }
-
- // *NOTE: removed logic which did a divide by zero.
- F32 u = 1.f;//llclamp(mResizeTimer.getElapsedTimeF32() / RESIZE_TIME, 0.f, 1.f);
- if (u == 1.f)
- {
- mResizeTimer.stop();
- }
-
+ // *TODO: Could do some sort of timer-based resize logic here
+ F32 u = 1.f;
mWidth = llmax(width, lerp(mWidth, (F32)width, u));
mHeight = llmax(height, lerp(mHeight, (F32)height, u));
}
@@ -606,28 +555,29 @@ void LLHUDText::updateAll()
std::sort(sVisibleHUDTextObjects.begin(), sVisibleHUDTextObjects.end(), lltextobject_further_away());
}
-void LLHUDText::setLOD(S32 lod)
-{
- mLOD = lod;
- //RN: uncomment this to visualize LOD levels
- //std::string label = llformat("%d", lod);
- //setLabel(label);
-}
+//void LLHUDText::setLOD(S32 lod)
+//{
+// mLOD = lod;
+// //RN: uncomment this to visualize LOD levels
+// //std::string label = llformat("%d", lod);
+// //setLabel(label);
+//}
S32 LLHUDText::getMaxLines()
{
- switch(mLOD)
- {
- case 0:
- return mMaxLines;
- case 1:
- return mMaxLines > 0 ? mMaxLines / 2 : 5;
- case 2:
- return mMaxLines > 0 ? mMaxLines / 3 : 2;
- default:
- // label only
- return 0;
- }
+ return mMaxLines;
+ //switch(mLOD)
+ //{
+ //case 0:
+ // return mMaxLines;
+ //case 1:
+ // return mMaxLines > 0 ? mMaxLines / 2 : 5;
+ //case 2:
+ // return mMaxLines > 0 ? mMaxLines / 3 : 2;
+ //default:
+ // // label only
+ // return 0;
+ //}
}
void LLHUDText::markDead()
@@ -692,11 +642,6 @@ void LLHUDText::reshape()
{
segment_iter->clearFontWidthMap();
}
- for(segment_iter = textp->mLabelSegments.begin();
- segment_iter != textp->mLabelSegments.end(); ++segment_iter )
- {
- segment_iter->clearFontWidthMap();
- }
}
}
diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h
index 3acd2934e1..023c7d8ff3 100644
--- a/indra/newview/llhudtext.h
+++ b/indra/newview/llhudtext.h
@@ -40,7 +40,6 @@
#include "v4coloru.h"
#include "v2math.h"
#include "llrect.h"
-#include "llframetimer.h"
#include "llfontgl.h"
#include <set>
#include <vector>
@@ -100,8 +99,6 @@ public:
// Add text a line at a time, allowing custom formatting
void addLine(const std::string &text_utf8, const LLColor4& color, const LLFontGL::StyleFlags style = LLFontGL::NORMAL, const LLFontGL* font = NULL);
- void setDropShadow(const BOOL do_shadow);
-
// Sets the default font for lines with no font specified
void setFont(const LLFontGL* font);
void setColor(const LLColor4 &color);
@@ -122,7 +119,6 @@ public:
/*virtual*/ void markDead();
friend class LLHUDObject;
/*virtual*/ F32 getDistance() const { return mLastDistance; }
- S32 getLOD() { return mLOD; }
BOOL getVisible() { return mVisible; }
BOOL getHidden() const { return mHidden; }
void setHidden( BOOL hide ) { mHidden = hide; }
@@ -141,14 +137,11 @@ protected:
/*virtual*/ void renderForSelect();
void renderText(BOOL for_select);
static void updateAll();
- void setLOD(S32 lod);
S32 getMaxLines();
private:
~LLHUDText();
BOOL mOnHUDAttachment;
-// BOOL mUseBubble;
- BOOL mDropShadow;
BOOL mDoFade;
F32 mFadeRange;
F32 mFadeDistance;
@@ -172,11 +165,8 @@ private:
S32 mOffsetY;
F32 mRadius;
std::vector<LLHUDTextSegment> mTextSegments;
- std::vector<LLHUDTextSegment> mLabelSegments;
- LLFrameTimer mResizeTimer;
ETextAlignment mTextAlignment;
EVertAlignment mVertAlignment;
- S32 mLOD;
BOOL mHidden;
static BOOL sDisplayText ;
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index e039544779..5e1e2bb511 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2895,7 +2895,6 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
if (mVisibleChat)
{
- mNameText->setDropShadow(TRUE);
mNameText->setFont(LLFontGL::getFontSansSerif());
mNameText->setTextAlignment(LLHUDNameTag::ALIGN_TEXT_LEFT);
mNameText->setFadeDistance(CHAT_NORMAL_RADIUS * 2.f, 5.f);