summaryrefslogtreecommitdiff
path: root/indra/llui/llui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llui.cpp')
-rw-r--r--indra/llui/llui.cpp112
1 files changed, 39 insertions, 73 deletions
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 22d3af3e6b..76f07373b4 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -39,7 +39,6 @@
// Linden library includes
#include "v2math.h"
-#include "m3math.h"
#include "v4color.h"
#include "llrender.h"
#include "llrect.h"
@@ -181,19 +180,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.pushUIMatrix();
+ gGL.pushMatrix();
left += LLFontGL::sCurOrigin.mX;
right += LLFontGL::sCurOrigin.mX;
bottom += LLFontGL::sCurOrigin.mY;
top += LLFontGL::sCurOrigin.mY;
- gGL.loadUIIdentity();
+ glLoadIdentity();
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.popUIMatrix();
+ gGL.popMatrix();
}
@@ -509,9 +508,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.pushUIMatrix();
+ gGL.pushMatrix();
{
- gGL.translateUI((F32)x, (F32)y, 0.f);
+ gGL.translatef((F32)x, (F32)y, 0.f);
gGL.getTexUnit(0)->bind(image);
@@ -638,7 +637,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
}
gGL.end();
}
- gGL.popUIMatrix();
+ gGL.popMatrix();
if (solid_color)
{
@@ -661,72 +660,39 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
LLGLSUIDefault gls_ui;
-
- gGL.getTexUnit(0)->bind(image);
-
- gGL.color4fv(color.mV);
-
- if (degrees == 0.f)
+ gGL.pushMatrix();
{
- gGL.pushUIMatrix();
- gGL.translateUI((F32)x, (F32)y, 0.f);
-
- gGL.begin(LLRender::QUADS);
+ gGL.translatef((F32)x, (F32)y, 0.f);
+ if( degrees )
{
- 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);
+ 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.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.vertex2f(v.mV[0], v.mV[1] );
+ gGL.vertex2i(width, height );
- v = LLVector3(-offset_x, offset_y, 0.f) * quat;
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
- gGL.vertex2f(v.mV[0], v.mV[1] );
+ gGL.vertex2i(0, height );
- v = LLVector3(-offset_x, -offset_y, 0.f) * quat;
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
- gGL.vertex2f(v.mV[0], v.mV[1] );
+ gGL.vertex2i(0, 0);
- v = LLVector3(offset_x, -offset_y, 0.f) * quat;
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
- gGL.vertex2f(v.mV[0], v.mV[1] );
+ gGL.vertex2i(width, 0);
}
gGL.end();
- gGL.popUIMatrix();
}
+ gGL.popMatrix();
}
@@ -781,9 +747,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
end_angle += F_TWO_PI;
}
- gGL.pushUIMatrix();
+ gGL.pushMatrix();
{
- gGL.translateUI(center_x, center_y, 0.f);
+ gGL.translatef(center_x, center_y, 0.f);
// Inexact, but reasonably fast.
F32 delta = (end_angle - start_angle) / steps;
@@ -814,15 +780,15 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
}
gGL.end();
}
- gGL.popUIMatrix();
+ gGL.popMatrix();
}
void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled)
{
- gGL.pushUIMatrix();
+ gGL.pushMatrix();
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.translateUI(center_x, center_y, 0.f);
+ gGL.translatef(center_x, center_y, 0.f);
// Inexact, but reasonably fast.
F32 delta = F_TWO_PI / steps;
@@ -853,7 +819,7 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled
}
gGL.end();
}
- gGL.popUIMatrix();
+ gGL.popMatrix();
}
// Renders a ring with sides (tube shape)
@@ -880,9 +846,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.pushUIMatrix();
+ gGL.pushMatrix();
{
- gGL.translateUI(0.f, 0.f, -width / 2);
+ gGL.translatef(0.f, 0.f, -width / 2);
if( render_center )
{
gGL.color4fv(center_color.mV);
@@ -891,11 +857,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.translateUI(0.f, 0.f, width);
+ gGL.translatef(0.f, 0.f, width);
gl_washer_2d(radius - width, radius, steps, side_color, side_color);
}
}
- gGL.popUIMatrix();
+ gGL.popMatrix();
}
// Draw gray and white checkerboard with black border
@@ -1084,9 +1050,9 @@ void gl_segmented_rect_2d_tex(const S32 left,
S32 width = llabs(right - left);
S32 height = llabs(top - bottom);
- gGL.pushUIMatrix();
+ gGL.pushMatrix();
- gGL.translateUI((F32)left, (F32)bottom, 0.f);
+ gGL.translatef((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)
@@ -1227,7 +1193,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
}
gGL.end();
- gGL.popUIMatrix();
+ gGL.popMatrix();
}
void gl_segmented_rect_2d_fragment_tex(const S32 left,
@@ -1244,9 +1210,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
S32 width = llabs(right - left);
S32 height = llabs(top - bottom);
- gGL.pushUIMatrix();
+ gGL.pushMatrix();
- gGL.translateUI((F32)left, (F32)bottom, 0.f);
+ gGL.translatef((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)
@@ -1417,7 +1383,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
}
gGL.end();
- gGL.popUIMatrix();
+ gGL.popMatrix();
}
void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width,
@@ -1625,7 +1591,7 @@ void LLUI::dirtyRect(LLRect rect)
//static
void LLUI::translate(F32 x, F32 y, F32 z)
{
- gGL.translateUI(x,y,z);
+ gGL.translatef(x,y,z);
LLFontGL::sCurOrigin.mX += (S32) x;
LLFontGL::sCurOrigin.mY += (S32) y;
LLFontGL::sCurOrigin.mZ += z;
@@ -1634,14 +1600,14 @@ void LLUI::translate(F32 x, F32 y, F32 z)
//static
void LLUI::pushMatrix()
{
- gGL.pushUIMatrix();
+ gGL.pushMatrix();
LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin);
}
//static
void LLUI::popMatrix()
{
- gGL.popUIMatrix();
+ gGL.popMatrix();
LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin();
LLFontGL::sOriginStack.pop_back();
}
@@ -1649,7 +1615,7 @@ void LLUI::popMatrix()
//static
void LLUI::loadIdentity()
{
- gGL.loadUIIdentity();
+ glLoadIdentity();
LLFontGL::sCurOrigin.mX = 0;
LLFontGL::sCurOrigin.mY = 0;
LLFontGL::sCurOrigin.mZ = 0;