diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llhudnametag.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llhudnametag.h | 4 | ||||
-rw-r--r-- | indra/newview/llhudrender.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llhudrender.h | 5 | ||||
-rw-r--r-- | indra/newview/llhudtext.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llhudtext.h | 2 | ||||
-rw-r--r-- | indra/newview/llmanip.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llmaniprotate.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llmanipscale.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llmaniptranslate.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpanelmarketplaceinbox.cpp | 44 | ||||
-rw-r--r-- | indra/newview/llpanelmarketplaceinbox.h | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 3 |
13 files changed, 86 insertions, 34 deletions
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 11f049564a..19ae35813c 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -290,6 +290,15 @@ void LLHUDNameTag::renderText() LLVector3 render_position = mPositionAgent + (x_pixel_vec * screen_offset.mV[VX]) + (y_pixel_vec * screen_offset.mV[VY]); + bool reset_buffers = false; + const F32 treshold = 0.000001f; + if (abs(mLastRenderPosition.mV[VX] - render_position.mV[VX]) > treshold + || abs(mLastRenderPosition.mV[VY] - render_position.mV[VY]) > treshold + || abs(mLastRenderPosition.mV[VZ] - render_position.mV[VZ]) > treshold) + { + reset_buffers = true; + mLastRenderPosition = render_position; + } LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); LLRect screen_rect; @@ -313,6 +322,11 @@ void LLHUDNameTag::renderText() for(std::vector<LLHUDTextSegment>::iterator segment_iter = mLabelSegments.begin(); segment_iter != mLabelSegments.end(); ++segment_iter ) { + if (reset_buffers) + { + segment_iter->mFontBufferLabel.reset(); + } + // Label segments use default font const LLFontGL* fontp = (segment_iter->mStyle == LLFontGL::BOLD) ? mBoldFontp : mFontp; y_offset -= fontp->getLineHeight(); @@ -328,7 +342,7 @@ void LLHUDNameTag::renderText() } LLColor4 label_color(0.f, 0.f, 0.f, alpha_factor); - hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false); + hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferLabel, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false); } } @@ -350,6 +364,11 @@ void LLHUDNameTag::renderText() for (std::vector<LLHUDTextSegment>::iterator segment_iter = mTextSegments.begin() + start_segment; segment_iter != mTextSegments.end(); ++segment_iter ) { + if (reset_buffers) + { + segment_iter->mFontBufferText.reset(); + } + const LLFontGL* fontp = segment_iter->mFont; y_offset -= fontp->getLineHeight(); y_offset -= LINE_PADDING; @@ -373,7 +392,7 @@ void LLHUDNameTag::renderText() text_color = segment_iter->mColor; text_color.mV[VALPHA] *= alpha_factor; - hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, false); + hud_render_text(segment_iter->getText(), render_position, &segment_iter->mFontBufferText, *fontp, style, shadow, x_offset, y_offset, text_color, false); } } /// Reset the default color to white. The renderer expects this to be the default. diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h index 5cb7fa877e..b48a606982 100644 --- a/indra/newview/llhudnametag.h +++ b/indra/newview/llhudnametag.h @@ -37,6 +37,7 @@ #include "llrect.h" //#include "llframetimer.h" #include "llfontgl.h" +#include "llfontvertexbuffer.h" #include <set> #include <vector> @@ -67,6 +68,8 @@ protected: LLColor4 mColor; LLFontGL::StyleFlags mStyle; const LLFontGL* mFont; + LLFontVertexBuffer mFontBufferLabel; + LLFontVertexBuffer mFontBufferText; private: LLWString mText; std::map<const LLFontGL*, F32> mFontWidthMap; @@ -174,6 +177,7 @@ private: S32 mMaxLines; S32 mOffsetY; F32 mRadius; + LLVector3 mLastRenderPosition; std::vector<LLHUDTextSegment> mTextSegments; std::vector<LLHUDTextSegment> mLabelSegments; // LLFrameTimer mResizeTimer; diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 5608ab763f..f027aa5552 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -39,6 +39,7 @@ #include "llui.h" void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, + LLFontVertexBuffer *font_buffer, const LLFontGL &font, const U8 style, const LLFontGL::ShadowType shadow, @@ -47,10 +48,11 @@ void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, const bool orthographic) { LLWString wstr(utf8str_to_wstring(str)); - hud_render_text(wstr, pos_agent, font, style, shadow, x_offset, y_offset, color, orthographic); + hud_render_text(wstr, pos_agent, font_buffer, font, style, shadow, x_offset, y_offset, color, orthographic); } void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, + LLFontVertexBuffer *font_buffer, const LLFontGL &font, const U8 style, const LLFontGL::ShadowType shadow, @@ -138,7 +140,14 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); F32 right_x; - font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); + if (font_buffer) + { + font_buffer->render(&font, wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); + } + else + { + font.render(wstr, 0, 0, 1, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, static_cast<S32>(wstr.length()), 1000, &right_x, /*use_ellipses*/false, /*use_color*/true); + } LLUI::popMatrix(); gGL.popMatrix(); diff --git a/indra/newview/llhudrender.h b/indra/newview/llhudrender.h index eb8f07e4d4..be9fc7f084 100644 --- a/indra/newview/llhudrender.h +++ b/indra/newview/llhudrender.h @@ -28,6 +28,7 @@ #define LL_LLHUDRENDER_H #include "llfontgl.h" +#include "llfontvertexbuffer.h" class LLVector3; class LLFontGL; @@ -35,6 +36,7 @@ class LLFontGL; // Utility classes for rendering HUD elements void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, + LLFontVertexBuffer *font_buffer, const LLFontGL &font, const U8 style, const LLFontGL::ShadowType, @@ -46,9 +48,10 @@ void hud_render_text(const LLWString &wstr, // Legacy, slower void hud_render_utf8text(const std::string &str, const LLVector3 &pos_agent, + LLFontVertexBuffer *font_buffer, const LLFontGL &font, const U8 style, - const LLFontGL::ShadowType, + const LLFontGL::ShadowType, const F32 x_offset, const F32 y_offset, const LLColor4& color, diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index fd0d8b696f..92f09c34a0 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -231,7 +231,7 @@ void LLHUDText::renderText() } text_color.mV[VALPHA] *= alpha_factor; - hud_render_text(segment_iter->getText(), render_position, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); + hud_render_text(segment_iter->getText(), render_position, &mFontBuffer, *fontp, style, shadow, x_offset, y_offset, text_color, mOnHUDAttachment); } } /// Reset the default color to white. The renderer expects this to be the default. diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index a81fdebb17..224677736c 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -35,6 +35,7 @@ #include "v2math.h" #include "llrect.h" #include "llfontgl.h" +#include "llfontvertexbuffer.h" #include <set> #include <vector> @@ -161,6 +162,7 @@ private: ETextAlignment mTextAlignment; EVertAlignment mVertAlignment; bool mHidden; + LLFontVertexBuffer mFontBuffer; static bool sDisplayText ; static std::set<LLPointer<LLHUDText> > sTextObjects; diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 0d617753c8..9a0b1bfcd6 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -519,9 +519,9 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons LLColor4 shadow_color = LLColor4::black; shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f; gViewerWindow->setup3DViewport(1, -1); - hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + hud_render_utf8text(text, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); gViewerWindow->setup3DViewport(); - hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); + hud_render_utf8text(text, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); gGL.popMatrix(); } @@ -581,12 +581,12 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string { fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str()); - hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); - hud_render_utf8text(fraction_string, render_pos, *small_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, 1.f, 3.f, color, hud_selection); + hud_render_utf8text(val_string, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -1.f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); + hud_render_utf8text(fraction_string, render_pos, nullptr, *small_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, 1.f, 3.f, color, hud_selection); } else { - hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); + hud_render_utf8text(val_string, render_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); } } gGL.popMatrix(); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 5bdf3f81b5..0d80b8d8ba 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -1169,10 +1169,10 @@ void LLManipRotate::renderSnapGuides() std::string help_text = LLTrans::getString("manip_hint1"); LLColor4 help_text_color = LLColor4::white; help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); help_text = LLTrans::getString("manip_hint2"); help_text_pos -= offset_dir * mRadiusMeters * 0.4f; - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); } } } diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index ffb66dc6cc..19868f3c3e 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -1865,10 +1865,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) std::string help_text = LLTrans::getString("manip_hint1"); LLColor4 help_text_color = LLColor4::white; help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f); - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); help_text = LLTrans::getString("manip_hint2"); help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapRegimeOffset * 0.4f; - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); } } } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index c11a98be50..c9c7d26d33 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1449,10 +1449,10 @@ void LLManipTranslate::renderSnapGuides() std::string help_text = LLTrans::getString("manip_hint1"); LLColor4 help_text_color = LLColor4::white; help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f); - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); help_text = LLTrans::getString("manip_hint2"); help_text_pos -= LLViewerCamera::getInstance()->getUpAxis() * mSnapOffsetMeters * 0.2f; - hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); + hud_render_utf8text(help_text, help_text_pos, nullptr, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, false); } } } diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp index 35961da579..d10e12d3a8 100644 --- a/indra/newview/llpanelmarketplaceinbox.cpp +++ b/indra/newview/llpanelmarketplaceinbox.cpp @@ -52,6 +52,8 @@ LLPanelMarketplaceInbox::LLPanelMarketplaceInbox(const Params& p) , mInboxButton(NULL) , mInventoryPanel(NULL) , mSavedFolderState(NULL) + , mLastItemCount(-1) + , mLastFreshItemCount(-1) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(false); @@ -253,28 +255,40 @@ void LLPanelMarketplaceInbox::draw() llassert(mFreshCountCtrl != NULL); - if (item_count > 0) + if (mLastItemCount != item_count) { - std::string item_count_str = llformat("%d", item_count); - - LLStringUtil::format_map_t args; - args["[NUM]"] = item_count_str; - mInboxButton->setLabel(getString("InboxLabelWithArg", args)); - - // set green text to fresh item count - U32 fresh_item_count = getFreshItemCount(); - mFreshCountCtrl->setVisible((fresh_item_count > 0)); + mLastItemCount = item_count; + if (item_count > 0) + { + std::string item_count_str = llformat("%d", item_count); - if (fresh_item_count > 0) + LLStringUtil::format_map_t args; + args["[NUM]"] = item_count_str; + // setLabel is expensive, causes buffer regeneration + mInboxButton->setLabel(getString("InboxLabelWithArg", args)); + } + else { - mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count)); + mInboxButton->setLabel(getString("InboxLabelNoArg")); + + mFreshCountCtrl->setVisible(false); } } - else + + if (item_count > 0) { - mInboxButton->setLabel(getString("InboxLabelNoArg")); + // set green text to fresh item count + U32 fresh_item_count = getFreshItemCount(); + if (mLastFreshItemCount != fresh_item_count) + { + mLastFreshItemCount = fresh_item_count; + mFreshCountCtrl->setVisible((fresh_item_count > 0)); - mFreshCountCtrl->setVisible(false); + if (fresh_item_count > 0) + { + mFreshCountCtrl->setTextArg("[NUM]", llformat("%d", fresh_item_count)); + } + } } LLPanel::draw(); diff --git a/indra/newview/llpanelmarketplaceinbox.h b/indra/newview/llpanelmarketplaceinbox.h index e711bb5e5c..493801b96c 100644 --- a/indra/newview/llpanelmarketplaceinbox.h +++ b/indra/newview/llpanelmarketplaceinbox.h @@ -75,6 +75,8 @@ private: LLButton * mInboxButton; LLInventoryPanel * mInventoryPanel; LLSaveFolderState* mSavedFolderState; + S32 mLastItemCount; + S32 mLastFreshItemCount; }; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3b1da8668b..7b8739c7df 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7871,7 +7871,6 @@ void LLPipeline::renderFinalize() renderDoF(&mPostMap, &mRT->screen); LLRenderTarget* finalBuffer = &mRT->screen; - static LLCachedControl<U32> aa_type(gSavedSettings, "RenderFSAAType", 2U); if (RenderFSAAType == 1) { applyFXAA(&mRT->screen, &mPostMap); @@ -7880,7 +7879,6 @@ void LLPipeline::renderFinalize() if (RenderBufferVisualization > -1) { - finalBuffer = &mPostMap; switch (RenderBufferVisualization) { case 0: @@ -7891,6 +7889,7 @@ void LLPipeline::renderFinalize() break; case 4: visualizeBuffers(&mLuminanceMap, finalBuffer, 0); + break; case 5: { if (RenderFSAAType > 0) |