diff options
-rw-r--r-- | indra/llrender/llfontgl.cpp | 30 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 106 | ||||
-rw-r--r-- | indra/llrender/llrender.h | 18 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 12 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 112 | ||||
-rw-r--r-- | indra/llui/llviewborder.cpp | 58 | ||||
-rw-r--r-- | indra/llui/llviewborder.h | 3 | ||||
-rw-r--r-- | indra/newview/llhudrender.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llhudtext.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llmediactrl.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llnetmap.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 14 |
12 files changed, 249 insertions, 141 deletions
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index f1f86fd638..768f042e69 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -151,14 +151,16 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons } } - gGL.pushMatrix(); - glLoadIdentity(); - gGL.translatef(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ); + gGL.pushUIMatrix(); + + gGL.loadUIIdentity(); + + gGL.translateUI(floorf(sCurOrigin.mX*sScaleX), floorf(sCurOrigin.mY*sScaleY), sCurOrigin.mZ); // this code snaps the text origin to a pixel grid to start with F32 pixel_offset_x = llround((F32)sCurOrigin.mX) - (sCurOrigin.mX); F32 pixel_offset_y = llround((F32)sCurOrigin.mY) - (sCurOrigin.mY); - gGL.translatef(-pixel_offset_x, -pixel_offset_y, 0.f); + gGL.translateUI(-pixel_offset_x, -pixel_offset_y, 0.f); LLFastTimer t(FTM_RENDER_FONTS); @@ -246,9 +248,6 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons } - // Remember last-used texture to avoid unnecesssary bind calls. - LLImageGL *last_bound_texture = NULL; - const LLFontGlyphInfo* next_glyph = NULL; for (i = begin_offset; i < begin_offset + length; i++) @@ -268,12 +267,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons } // Per-glyph bitmap texture. LLImageGL *image_gl = mFontFreetype->getFontBitmapCache()->getImageGL(fgi->mBitmapNum); - if (last_bound_texture != image_gl) - { - gGL.getTexUnit(0)->bind(image_gl); - last_bound_texture = image_gl; - } - + gGL.getTexUnit(0)->bind(image_gl); + if ((start_x + scaled_max_pixels) < (cur_x + fgi->mXBearing + fgi->mWidth)) { // Not enough room for this character. @@ -338,10 +333,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons // recursively render ellipses at end of string // we've already reserved enough room - gGL.pushMatrix(); - //glLoadIdentity(); - //gGL.translatef(sCurOrigin.mX, sCurOrigin.mY, 0.0f); - //glScalef(sScaleX, sScaleY, 1.f); + gGL.pushUIMatrix(); renderUTF8(std::string("..."), 0, cur_x / sScaleX, (F32)y, @@ -352,10 +344,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons S32_MAX, max_pixels, right_x, FALSE); - gGL.popMatrix(); + gGL.popUIMatrix(); } - gGL.popMatrix(); + gGL.popUIMatrix(); return chars_drawn; } diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 595b8577ff..d2dc1104a8 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -49,6 +49,9 @@ F64 gGLLastProjection[16]; F64 gGLProjection[16]; S32 gGLViewport[4]; +U32 LLRender::sUICalls = 0; +U32 LLRender::sUIVerts = 0; + static const U32 LL_NUM_TEXTURE_LAYERS = 16; static GLenum sGLTextureType[] = @@ -255,10 +258,9 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) return false ; } - gGL.flush(); - if ((mCurrTexture != texture->getTexName()) || forceBind) { + gGL.flush(); activate(); enable(texture->getTarget()); mCurrTexture = texture->getTexName(); @@ -445,6 +447,8 @@ void LLTexUnit::setTextureBlendType(eTextureBlendType type) return; } + gGL.flush(); + activate(); mCurrBlendType = type; S32 scale_amount = 1; @@ -759,6 +763,7 @@ LLRender::LLRender() mCurrAlphaFunc = CF_DEFAULT; mCurrAlphaFuncVal = 0.01f; + mCurrSceneBlendType = BT_ALPHA; } LLRender::~LLRender() @@ -821,6 +826,80 @@ void LLRender::popMatrix() glPopMatrix(); } +void LLRender::translateUI(F32 x, F32 y, F32 z) +{ + if (mUIOffset.empty()) + { + llerrs << "Need to push a UI translation frame before offsetting" << llendl; + } + + mUIOffset.front().mV[0] += x; + mUIOffset.front().mV[1] += y; + mUIOffset.front().mV[2] += z; +} + +void LLRender::scaleUI(F32 x, F32 y, F32 z) +{ + if (mUIScale.empty()) + { + llerrs << "Need to push a UI transformation frame before scaling." << llendl; + } + + mUIScale.front().scaleVec(LLVector3(x,y,z)); +} + +void LLRender::pushUIMatrix() +{ + mUIOffset.push_front(mUIOffset.front()); + if (mUIScale.empty()) + { + mUIScale.push_front(LLVector3(1,1,1)); + } + else + { + mUIScale.push_front(mUIScale.front()); + } +} + +void LLRender::popUIMatrix() +{ + if (mUIOffset.empty()) + { + llerrs << "UI offset stack blown." << llendl; + } + mUIOffset.pop_front(); + mUIScale.pop_front(); +} + +LLVector3 LLRender::getUITranslation() +{ + if (mUIOffset.empty()) + { + llerrs << "UI offset stack empty." << llendl; + } + return mUIOffset.front(); +} + +LLVector3 LLRender::getUIScale() +{ + if (mUIScale.empty()) + { + llerrs << "UI scale stack empty." << llendl; + } + return mUIScale.front(); +} + + +void LLRender::loadUIIdentity() +{ + if (mUIOffset.empty()) + { + llerrs << "Need to push UI translation frame before clearing offset." << llendl; + } + mUIOffset.front().setVec(0,0,0); + mUIScale.front().setVec(1,1,1); +} + void LLRender::setColorMask(bool writeColor, bool writeAlpha) { setColorMask(writeColor, writeColor, writeColor, writeAlpha); @@ -843,6 +922,11 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB void LLRender::setSceneBlendType(eBlendType type) { + if (mCurrSceneBlendType == type) + { + return; + } + flush(); switch (type) { @@ -871,6 +955,7 @@ void LLRender::setSceneBlendType(eBlendType type) llerrs << "Unknown Scene Blend Type: " << type << llendl; break; } + mCurrSceneBlendType = type; } void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value) @@ -1012,6 +1097,12 @@ void LLRender::flush() } #endif + if (!mUIOffset.empty()) + { + sUICalls++; + sUIVerts += mCount; + } + mBuffer->setBuffer(immediate_mask); mBuffer->drawArrays(mMode, 0, mCount); @@ -1031,7 +1122,16 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z) return; } - mVerticesp[mCount] = LLVector3(x,y,z); + if (mUIOffset.empty()) + { + mVerticesp[mCount] = LLVector3(x,y,z); + } + else + { + LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.front()).scaledVec(mUIScale.front()); + mVerticesp[mCount] = vert; + } + mCount++; if (mCount < 4096) { diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 0121a190ee..6e38fac67b 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -286,6 +286,14 @@ public: void pushMatrix(); void popMatrix(); + void translateUI(F32 x, F32 y, F32 z); + void scaleUI(F32 x, F32 y, F32 z); + void pushUIMatrix(); + void popUIMatrix(); + void loadUIIdentity(); + LLVector3 getUITranslation(); + LLVector3 getUIScale(); + void flush(); void begin(const GLuint& mode); @@ -333,7 +341,9 @@ public: }; public: - + static U32 sUICalls; + static U32 sUIVerts; + private: bool mDirty; U32 mCount; @@ -350,7 +360,13 @@ private: std::vector<LLTexUnit*> mTexUnits; LLTexUnit* mDummyTexUnit; + U32 mCurrSceneBlendType; + F32 mMaxAnisotropy; + + std::list<LLVector3> mUIOffset; + std::list<LLVector3> mUIScale; + }; extern F64 gGLModelView[16]; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 46d2f92ad0..cafb7c45f6 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -497,15 +497,15 @@ void LLTabContainer::draw() if( mIsVertical && has_scroll_arrows ) { // Redraw the arrows so that they appears on top. - gGL.pushMatrix(); - gGL.translatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f); + gGL.pushUIMatrix(); + gGL.translateUI((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f); mPrevArrowBtn->draw(); - gGL.popMatrix(); + gGL.popUIMatrix(); - gGL.pushMatrix(); - gGL.translatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f); + gGL.pushUIMatrix(); + gGL.translateUI((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f); mNextArrowBtn->draw(); - gGL.popMatrix(); + gGL.popUIMatrix(); } } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 93c32f531f..2ba4478376 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -39,6 +39,7 @@ // Linden library includes #include "v2math.h" +#include "m3math.h" #include "v4color.h" #include "llrender.h" #include "llrect.h" @@ -180,19 +181,19 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); left += LLFontGL::sCurOrigin.mX; right += LLFontGL::sCurOrigin.mX; bottom += LLFontGL::sCurOrigin.mY; top += LLFontGL::sCurOrigin.mY; - glLoadIdentity(); + gGL.loadUIIdentity(); gl_rect_2d(llfloor((F32)left * LLUI::sGLScaleFactor.mV[VX]) - pixel_offset, llfloor((F32)top * LLUI::sGLScaleFactor.mV[VY]) + pixel_offset, llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset, llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset, filled); - gGL.popMatrix(); + gGL.popUIMatrix(); } @@ -508,9 +509,9 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA); } - gGL.pushMatrix(); + gGL.pushUIMatrix(); { - gGL.translatef((F32)x, (F32)y, 0.f); + gGL.translateUI((F32)x, (F32)y, 0.f); gGL.getTexUnit(0)->bind(image); @@ -637,7 +638,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex } gGL.end(); } - gGL.popMatrix(); + gGL.popUIMatrix(); if (solid_color) { @@ -660,39 +661,72 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre LLGLSUIDefault gls_ui; - gGL.pushMatrix(); + + gGL.getTexUnit(0)->bind(image); + + gGL.color4fv(color.mV); + + if (degrees == 0.f) { - gGL.translatef((F32)x, (F32)y, 0.f); - if( degrees ) + gGL.pushUIMatrix(); + gGL.translateUI((F32)x, (F32)y, 0.f); + + gGL.begin(LLRender::QUADS); { - F32 offset_x = F32(width/2); - F32 offset_y = F32(height/2); - gGL.translatef( offset_x, offset_y, 0.f); - glRotatef( degrees, 0.f, 0.f, 1.f ); - gGL.translatef( -offset_x, -offset_y, 0.f ); + gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); + gGL.vertex2i(width, height ); + + gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); + gGL.vertex2i(0, height ); + + gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); + gGL.vertex2i(0, 0); + + gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); + gGL.vertex2i(width, 0); } + gGL.end(); + gGL.popUIMatrix(); + } + else + { + gGL.pushUIMatrix(); + gGL.translateUI((F32)x, (F32)y, 0.f); + + F32 offset_x = F32(width/2); + F32 offset_y = F32(height/2); + + gGL.translateUI(offset_x, offset_y, 0.f); + LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD); + gGL.getTexUnit(0)->bind(image); gGL.color4fv(color.mV); gGL.begin(LLRender::QUADS); { + LLVector3 v; + + v = LLVector3(offset_x, offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); - gGL.vertex2i(width, height ); + gGL.vertex2i(v.mV[0], v.mV[1] ); + v = LLVector3(-offset_x, offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop); - gGL.vertex2i(0, height ); + gGL.vertex2i(v.mV[0], v.mV[1] ); + v = LLVector3(-offset_x, -offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); - gGL.vertex2i(0, 0); + gGL.vertex2i(v.mV[0], v.mV[1] ); + v = LLVector3(offset_x, -offset_y, 0.f) * quat; gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); - gGL.vertex2i(width, 0); + gGL.vertex2i(v.mV[0], v.mV[1] ); } gGL.end(); + gGL.popUIMatrix(); } - gGL.popMatrix(); } @@ -747,9 +781,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F end_angle += F_TWO_PI; } - gGL.pushMatrix(); + gGL.pushUIMatrix(); { - gGL.translatef(center_x, center_y, 0.f); + gGL.translateUI(center_x, center_y, 0.f); // Inexact, but reasonably fast. F32 delta = (end_angle - start_angle) / steps; @@ -780,15 +814,15 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F } gGL.end(); } - gGL.popMatrix(); + gGL.popUIMatrix(); } void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.translatef(center_x, center_y, 0.f); + gGL.translateUI(center_x, center_y, 0.f); // Inexact, but reasonably fast. F32 delta = F_TWO_PI / steps; @@ -819,7 +853,7 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled } gGL.end(); } - gGL.popMatrix(); + gGL.popUIMatrix(); } // Renders a ring with sides (tube shape) @@ -846,9 +880,9 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps ) void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center ) { - gGL.pushMatrix(); + gGL.pushUIMatrix(); { - gGL.translatef(0.f, 0.f, -width / 2); + gGL.translateUI(0.f, 0.f, -width / 2); if( render_center ) { gGL.color4fv(center_color.mV); @@ -857,11 +891,11 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor else { gl_washer_2d(radius, radius - width, steps, side_color, side_color); - gGL.translatef(0.f, 0.f, width); + gGL.translateUI(0.f, 0.f, width); gl_washer_2d(radius - width, radius, steps, side_color, side_color); } } - gGL.popMatrix(); + gGL.popUIMatrix(); } // Draw gray and white checkerboard with black border @@ -1050,9 +1084,9 @@ void gl_segmented_rect_2d_tex(const S32 left, S32 width = llabs(right - left); S32 height = llabs(top - bottom); - gGL.pushMatrix(); + gGL.pushUIMatrix(); - gGL.translatef((F32)left, (F32)bottom, 0.f); + gGL.translateUI((F32)left, (F32)bottom, 0.f); LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); if (border_uv_scale.mV[VX] > 0.5f) @@ -1193,7 +1227,7 @@ void gl_segmented_rect_2d_tex(const S32 left, } gGL.end(); - gGL.popMatrix(); + gGL.popUIMatrix(); } void gl_segmented_rect_2d_fragment_tex(const S32 left, @@ -1210,9 +1244,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, S32 width = llabs(right - left); S32 height = llabs(top - bottom); - gGL.pushMatrix(); + gGL.pushUIMatrix(); - gGL.translatef((F32)left, (F32)bottom, 0.f); + gGL.translateUI((F32)left, (F32)bottom, 0.f); LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height); if (border_uv_scale.mV[VX] > 0.5f) @@ -1383,7 +1417,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left, } gGL.end(); - gGL.popMatrix(); + gGL.popUIMatrix(); } void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, @@ -1591,7 +1625,7 @@ void LLUI::dirtyRect(LLRect rect) //static void LLUI::translate(F32 x, F32 y, F32 z) { - gGL.translatef(x,y,z); + gGL.translateUI(x,y,z); LLFontGL::sCurOrigin.mX += (S32) x; LLFontGL::sCurOrigin.mY += (S32) y; LLFontGL::sCurOrigin.mZ += z; @@ -1600,14 +1634,14 @@ void LLUI::translate(F32 x, F32 y, F32 z) //static void LLUI::pushMatrix() { - gGL.pushMatrix(); + gGL.pushUIMatrix(); LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin); } //static void LLUI::popMatrix() { - gGL.popMatrix(); + gGL.popUIMatrix(); LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin(); LLFontGL::sOriginStack.pop_back(); } @@ -1615,7 +1649,7 @@ void LLUI::popMatrix() //static void LLUI::loadIdentity() { - glLoadIdentity(); + gGL.loadUIIdentity(); LLFontGL::sCurOrigin.mX = 0; LLFontGL::sCurOrigin.mY = 0; LLFontGL::sCurOrigin.mZ = 0; diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index 30717f87de..bd9c43c97f 100644 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp @@ -125,14 +125,6 @@ void LLViewBorder::draw() llassert( FALSE ); // not implemented } } - else - if( STYLE_TEXTURE == mStyle ) - { - if( mTexture ) - { - drawTextures(); - } - } LLView::draw(); } @@ -255,56 +247,6 @@ void LLViewBorder::drawTwoPixelLines() gl_line_2d(left+1, bottom+1, right-1, bottom+1); } -void LLViewBorder::drawTextures() -{ - //LLGLSUIDefault gls_ui; - - //llassert( FALSE ); // TODO: finish implementing - - //gGL.color4fv(UI_VERTEX_COLOR.mV); - - //gGL.getTexUnit(0)->bind(mTexture); - //gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP); - - //drawTextureTrapezoid( 0.f, mBorderWidth, getRect().getWidth(), 0, 0 ); - //drawTextureTrapezoid( 90.f, mBorderWidth, getRect().getHeight(), (F32)getRect().getWidth(),0 ); - //drawTextureTrapezoid( 180.f, mBorderWidth, getRect().getWidth(), (F32)getRect().getWidth(),(F32)getRect().getHeight() ); - //drawTextureTrapezoid( 270.f, mBorderWidth, getRect().getHeight(), 0, (F32)getRect().getHeight() ); -} - - -void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y ) -{ - gGL.pushMatrix(); - { - gGL.translatef(start_x, start_y, 0.f); - glRotatef( degrees, 0, 0, 1 ); - - gGL.begin(LLRender::QUADS); - { - // width, width /---------\ length-width, width // - // / \ // - // / \ // - // /---------------\ // - // 0,0 length, 0 // - - gGL.texCoord2f( 0, 0 ); - gGL.vertex2i( 0, 0 ); - - gGL.texCoord2f( (GLfloat)length, 0 ); - gGL.vertex2i( length, 0 ); - - gGL.texCoord2f( (GLfloat)(length - width), (GLfloat)width ); - gGL.vertex2i( length - width, width ); - - gGL.texCoord2f( (GLfloat)width, (GLfloat)width ); - gGL.vertex2i( width, width ); - } - gGL.end(); - } - gGL.popMatrix(); -} - BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style) { if (node->hasAttribute("bevel_style")) diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h index 92fd569325..342e84fd93 100644 --- a/indra/llui/llviewborder.h +++ b/indra/llui/llviewborder.h @@ -99,8 +99,7 @@ private: void drawOnePixelLines(); void drawTwoPixelLines(); void drawTextures(); - void drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y ); - + EBevel mBevel; EStyle mStyle; LLUIColor mHighlightLight; diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index a02dc3355b..325c9c260c 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -121,24 +121,24 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); - + gGL.pushMatrix(); LLUI::pushMatrix(); gl_state_for_2d(world_view_rect.getWidth(), world_view_rect.getHeight()); gViewerWindow->setup3DViewport(); - //gViewerWindow->setup2DRender(); - + winX -= world_view_rect.mLeft; winY -= world_view_rect.mBottom; LLUI::loadIdentity(); + glLoadIdentity(); LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); - //glRotatef(angle * RAD_TO_DEG, axis.mV[VX], axis.mV[VY], axis.mV[VZ]); - //glScalef(right_scale, up_scale, 1.f); F32 right_x; font.render(wstr, 0, 0, 0, color, LLFontGL::LEFT, LLFontGL::BASELINE, style, shadow, wstr.length(), 1000, &right_x); + LLUI::popMatrix(); - + gGL.popMatrix(); + glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 8ad94b957d..8d1d27444b 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -555,7 +555,7 @@ void LLHUDText::renderText(BOOL for_select) } } /// Reset the default color to white. The renderer expects this to be the default. - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + gGL.color4f(1.0f, 1.0f, 1.0f, 1.0f); if (for_select) { gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 501a137b42..bf33d8527e 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -724,14 +724,14 @@ void LLMediaCtrl::draw() LLGLSUIDefault gls_ui; LLGLDisable gls_alphaTest( GL_ALPHA_TEST ); - gGL.pushMatrix(); + gGL.pushUIMatrix(); { if (mIgnoreUIScale) { - glLoadIdentity(); + gGL.loadUIIdentity(); // font system stores true screen origin, need to scale this by UI scale factor // to get render origin for this view (with unit scale) - gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), + gGL.translateUI(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), LLFontGL::sCurOrigin.mZ); } @@ -825,7 +825,7 @@ void LLMediaCtrl::draw() gGL.end(); gGL.setSceneBlendType(LLRender::BT_ALPHA); } - gGL.popMatrix(); + gGL.popUIMatrix(); } else diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 234fe13217..05623198ab 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -153,6 +153,18 @@ void LLNetMap::draw() // Prepare a scissor region F32 rotation = 0; + gGL.pushMatrix(); + gGL.pushUIMatrix(); + + LLVector3 offset = gGL.getUITranslation(); + LLVector3 scale = gGL.getUIScale(); + + glLoadIdentity(); + gGL.loadUIIdentity(); + + glScalef(scale.mV[0], scale.mV[1], scale.mV[2]); + gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); + { LLLocalClipRect clip(getLocalRect()); { @@ -435,6 +447,9 @@ void LLNetMap::draw() } } + gGL.popMatrix(); + gGL.popUIMatrix(); + LLUICtrl::draw(); } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 7dd83857b6..f1ec489a20 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -486,6 +486,10 @@ public: } ypos += y_inc; + addText(xpos, ypos, llformat("UI Verts/Calls: %d/%d", LLRender::sUIVerts, LLRender::sUICalls)); + LLRender::sUICalls = LLRender::sUIVerts = 0; + ypos += y_inc; + addText(xpos,ypos, llformat("%d/%d Nodes visible", gPipeline.mNumVisibleNodes, LLSpatialGroup::sNodeCount)); ypos += y_inc; @@ -2006,12 +2010,15 @@ void LLViewerWindow::drawDebugText() { gGL.color4f(1,1,1,1); gGL.pushMatrix(); + gGL.pushUIMatrix(); { // scale view by UI global scale factor and aspect ratio correction factor - glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); + gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); mDebugText->draw(); } + gGL.popUIMatrix(); gGL.popMatrix(); + gGL.flush(); } @@ -2059,9 +2066,11 @@ void LLViewerWindow::draw() // No translation needed, this view is glued to 0,0 gGL.pushMatrix(); + LLUI::pushMatrix(); { + // scale view by UI global scale factor and aspect ratio correction factor - glScalef(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); + gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f); LLVector2 old_scale_factor = LLUI::sGLScaleFactor; // apply camera zoom transform (for high res screenshots) @@ -2127,6 +2136,7 @@ void LLViewerWindow::draw() LLUI::sGLScaleFactor = old_scale_factor; } + LLUI::popMatrix(); gGL.popMatrix(); #if LL_DEBUG |