Fixed numerous bugs.

This commit is contained in:
Shyotl
2017-03-09 23:49:56 -06:00
parent 6523cf43be
commit 75c47e96b6
14 changed files with 179 additions and 84 deletions

View File

@@ -268,21 +268,12 @@ void LLNetMap::draw()
// Prepare a scissor region
F32 rotation = 0;
gGL.pushMatrix();
gGL.pushUIMatrix();
LLVector3 offset = gGL.getUITranslation();
LLVector3 scale = gGL.getUIScale();
gGL.loadIdentity();
gGL.loadUIIdentity();
gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]);
gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]);
{
LLLocalClipRect clip(getLocalRect());
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.matrixMode(LLRender::MM_MODELVIEW);
// Draw background rectangle.
if(isBackgroundVisible())
@@ -297,15 +288,16 @@ void LLNetMap::draw()
S32 center_sw_left = getRect().getWidth() / 2 + llfloor(mCurPan.mV[VX]);
S32 center_sw_bottom = getRect().getHeight() / 2 + llfloor(mCurPan.mV[VY]);
gGL.pushMatrix();
gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
gGL.pushUIMatrix();
gGL.translateUI( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
static LLCachedControl<bool> rotate_map("MiniMapRotate", true);
if (rotate_map)
{
// Rotate subsequent draws to agent rotation.
rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f);
LLQuaternion rot(rotation, LLVector3(0.f, 0.f, 1.f));
gGL.rotateUI(rot);
}
// Figure out where agent is.
@@ -537,7 +529,7 @@ void LLNetMap::draw()
}
// [/SL:KB]
gGL.popMatrix();
gGL.popUIMatrix();
// Mouse pointer in local coordinates
S32 local_mouse_x;
@@ -709,14 +701,15 @@ void LLNetMap::draw()
LLColor4 c = rotate_map ? map_frustum_color() : map_frustum_rotating_color();
gGL.pushMatrix();
gGL.pushUIMatrix();
gGL.translatef(ctr_x, ctr_y, 0);
gGL.translateUI(ctr_x, ctr_y, 0);
// If we don't rotate the map, we have to rotate the frustum.
if (!rotate_map)
{
gGL.rotatef(atan2(LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY]) * RAD_TO_DEG, 0.f, 0.f, -1.f);
LLQuaternion rot(atan2(LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY]), LLVector3(0.f, 0.f, -1.f));
gGL.rotateUI(rot);
}
gGL.begin( LLRender::TRIANGLES );
@@ -728,7 +721,7 @@ void LLNetMap::draw()
gGL.vertex2f( -half_width_pixels, far_clip_pixels );
gGL.end();
gGL.popMatrix();
gGL.popUIMatrix();
// <exodus> Draw mouse radius
static const LLCachedControl<LLColor4> map_avatar_rollover_color("ExodusMapRolloverCircleColor");
@@ -737,8 +730,7 @@ void LLNetMap::draw()
gl_circle_2d(local_mouse_x, local_mouse_y, min_pick_dist, 32, true);
// </exodus>
}
gGL.popMatrix();
;
gGL.popUIMatrix();
// Rotation of 0 means that North is up