Better Minimap, from Henri
This commit is contained in:
@@ -7444,6 +7444,17 @@
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>UseOldTrackingDots</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Use old T-like tracking dots in mini-map</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>MiniMapScale</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
||||
@@ -80,16 +80,19 @@
|
||||
// [/RLVa:KB]
|
||||
|
||||
const F32 MAP_SCALE_MIN = 32;
|
||||
const F32 MAP_SCALE_MID = 1024;
|
||||
const F32 MAP_SCALE_MID = 256;
|
||||
const F32 MAP_SCALE_MAX = 4096;
|
||||
const F32 MAP_SCALE_INCREMENT = 16;
|
||||
const F32 MAP_SCALE_ZOOM_FACTOR = 1.04f; // Zoom in factor per click of the scroll wheel (4%)
|
||||
const F32 MAP_SCALE_ZOOM_FACTOR = 1.1f; // Zoom in factor per click of the scroll wheel (10%)
|
||||
const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f;
|
||||
const F32 MIN_DOT_RADIUS = 3.5f;
|
||||
const F32 DOT_SCALE = 0.75f;
|
||||
const F32 MIN_PICK_SCALE = 2.f;
|
||||
const S32 MOUSE_DRAG_SLOP = 2; // How far the mouse needs to move before we think it's a drag
|
||||
|
||||
BOOL LLNetMap::sMiniMapRotate = TRUE;
|
||||
S32 LLNetMap::sMiniMapCenter = 1;
|
||||
|
||||
LLNetMap::LLNetMap(const std::string& name) :
|
||||
LLPanel(name),
|
||||
mScale(128.f),
|
||||
@@ -105,6 +108,9 @@ LLNetMap::LLNetMap(const std::string& name) :
|
||||
mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
|
||||
mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
|
||||
|
||||
sMiniMapCenter = gSavedSettings.getS32("MiniMapCenter");
|
||||
sMiniMapRotate = gSavedSettings.getBOOL("MiniMapRotate");
|
||||
|
||||
mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal();
|
||||
|
||||
// Register event listeners for popup menu
|
||||
@@ -198,7 +204,7 @@ void LLNetMap::draw()
|
||||
createObjectImage();
|
||||
}
|
||||
|
||||
if (gSavedSettings.getS32( "MiniMapCenter" ) != MAP_CENTER_NONE)
|
||||
if (sMiniMapCenter != MAP_CENTER_NONE)
|
||||
{
|
||||
mCurPanX = lerp(mCurPanX, mTargetPanX, LLCriticalDamp::getInterpolant(0.1f));
|
||||
mCurPanY = lerp(mCurPanY, mTargetPanY, LLCriticalDamp::getInterpolant(0.1f));
|
||||
@@ -232,8 +238,7 @@ void LLNetMap::draw()
|
||||
|
||||
gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
|
||||
|
||||
BOOL rotate_map = gSavedSettings.getBOOL( "MiniMapRotate" );
|
||||
if( rotate_map )
|
||||
if (sMiniMapRotate)
|
||||
{
|
||||
// rotate subsequent draws to agent rotation
|
||||
rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
|
||||
@@ -309,11 +314,11 @@ void LLNetMap::draw()
|
||||
mUpdateNow = FALSE;
|
||||
|
||||
// Locate the centre of the object layer, accounting for panning
|
||||
LLVector3 new_center = globalPosToView(gAgent.getCameraPositionGlobal(), rotate_map);
|
||||
LLVector3 new_center = globalPosToView(gAgent.getCameraPositionGlobal(), sMiniMapRotate);
|
||||
new_center.mV[0] -= mCurPanX;
|
||||
new_center.mV[1] -= mCurPanY;
|
||||
new_center.mV[2] = 0.f;
|
||||
mObjectImageCenterGlobal = viewPosToGlobal(llround(new_center.mV[0]), llround(new_center.mV[1]), rotate_map);
|
||||
mObjectImageCenterGlobal = viewPosToGlobal(llround(new_center.mV[0]), llround(new_center.mV[1]), sMiniMapRotate);
|
||||
|
||||
// Create the base texture.
|
||||
U8 *default_texture = mObjectRawImagep->getData();
|
||||
@@ -382,7 +387,11 @@ void LLNetMap::draw()
|
||||
LLColor4 avColor = standard_color;
|
||||
// TODO: it'd be very cool to draw these in sorted order from lowest Z to highest.
|
||||
// just be careful to sort the avatar IDs along with the positions. -MG
|
||||
pos_map = globalPosToView(positions[i], rotate_map);
|
||||
pos_map = globalPosToView(positions[i], sMiniMapRotate);
|
||||
if (positions[i].mdV[VZ] == 0.f)
|
||||
{
|
||||
pos_map.mV[VZ] = 16000.f;
|
||||
}
|
||||
std::string avName;
|
||||
|
||||
gCacheName->getFullName(avatar_ids[i], avName);
|
||||
@@ -438,25 +447,25 @@ void LLNetMap::draw()
|
||||
// Draw dot for autopilot target
|
||||
if (gAgent.getAutoPilot())
|
||||
{
|
||||
drawTracking( gAgent.getAutoPilotTargetGlobal(), rotate_map, gTrackColor );
|
||||
drawTracking(gAgent.getAutoPilotTargetGlobal(), sMiniMapRotate, gTrackColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
|
||||
if ( LLTracker::TRACKING_AVATAR == tracking_status )
|
||||
{
|
||||
drawTracking( LLAvatarTracker::instance().getGlobalPos(), rotate_map, gTrackColor );
|
||||
drawTracking(LLAvatarTracker::instance().getGlobalPos(), sMiniMapRotate, gTrackColor);
|
||||
}
|
||||
else if ( LLTracker::TRACKING_LANDMARK == tracking_status
|
||||
|| LLTracker::TRACKING_LOCATION == tracking_status )
|
||||
{
|
||||
drawTracking( LLTracker::getTrackedPositionGlobal(), rotate_map, gTrackColor );
|
||||
drawTracking(LLTracker::getTrackedPositionGlobal(), sMiniMapRotate, gTrackColor);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw dot for self avatar position
|
||||
pos_global = gAgent.getPositionGlobal();
|
||||
pos_map = globalPosToView(pos_global, rotate_map);
|
||||
pos_map = globalPosToView(pos_global, sMiniMapRotate);
|
||||
LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
|
||||
S32 dot_width = llround(mDotRadius * 2.f);
|
||||
you->draw(
|
||||
@@ -481,7 +490,7 @@ void LLNetMap::draw()
|
||||
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
if( rotate_map )
|
||||
if (sMiniMapRotate)
|
||||
{
|
||||
gGL.color4fv(gColors.getColor("NetMapFrustum").mV);
|
||||
|
||||
@@ -529,7 +538,8 @@ void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||
updateMinorDirections();
|
||||
}
|
||||
|
||||
LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos, BOOL rotated ){
|
||||
LLVector3 LLNetMap::globalPosToView(const LLVector3d& global_pos, BOOL rotated)
|
||||
{
|
||||
LLVector3d relative_pos_global = global_pos - gAgent.getCameraPositionGlobal();
|
||||
LLVector3 pos_local;
|
||||
pos_local.setVec(relative_pos_global); // convert to floats from doubles
|
||||
@@ -619,7 +629,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" )) );
|
||||
LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal(viewPosToGlobal(x, y, sMiniMapRotate));
|
||||
if( region )
|
||||
{
|
||||
msg.assign("");
|
||||
@@ -985,7 +995,7 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask )
|
||||
|
||||
BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask )
|
||||
{
|
||||
LLVector3d pos_global = viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" ) );
|
||||
LLVector3d pos_global = viewPosToGlobal(x, y, sMiniMapRotate);
|
||||
BOOL new_target = FALSE;
|
||||
if (!LLTracker::isTracking(NULL))
|
||||
{
|
||||
@@ -1126,6 +1136,21 @@ bool LLNetMap::LLCheckRotateMap::handleEvent(LLPointer<LLEvent> event, const LLS
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLNetMap::LLRotateMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
BOOL rotate = gSavedSettings.getBOOL("MiniMapRotate");
|
||||
gSavedSettings.setBOOL("MiniMapRotate", !rotate);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLNetMap::LLCheckRotateMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLNetMap *self = mPtr;
|
||||
BOOL enabled = gSavedSettings.getBOOL("MiniMapRotate");
|
||||
self->findControl(userdata["control"].asString())->setValue(enabled);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LLNetMap::LLStopTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||
{
|
||||
LLTracker::stopTracking(NULL);
|
||||
|
||||
@@ -69,6 +69,9 @@ public:
|
||||
|
||||
static void mm_setcolor(LLUUID key,LLColor4 col); //moymod
|
||||
|
||||
static S32 sMiniMapCenter;
|
||||
static BOOL sMiniMapRotate;
|
||||
|
||||
private:
|
||||
|
||||
void setScale( F32 scale );
|
||||
@@ -157,6 +160,18 @@ private:
|
||||
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
|
||||
};
|
||||
|
||||
class LLRotateMap : public LLMemberListener<LLNetMap>
|
||||
{
|
||||
public:
|
||||
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
|
||||
};
|
||||
|
||||
class LLCheckRotateMap : public LLMemberListener<LLNetMap>
|
||||
{
|
||||
public:
|
||||
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
|
||||
};
|
||||
|
||||
class LLStopTracking : public LLMemberListener<LLNetMap>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
#include "llappviewer.h"
|
||||
#include "llvosurfacepatch.h"
|
||||
#include "llvowlsky.h"
|
||||
#include "llworldmapview.h"
|
||||
#include "llnetmap.h"
|
||||
#include "llrender.h"
|
||||
#include "llfloaterchat.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
@@ -336,6 +338,23 @@ static bool handleUploadBakedTexOldChanged(const LLSD& newvalue)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handleMiniMapCenterChanged(const LLSD& newvalue)
|
||||
{
|
||||
LLNetMap::sMiniMapCenter = newvalue.asInteger();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handleMiniMapRotateChanged(const LLSD& newvalue)
|
||||
{
|
||||
LLNetMap::sMiniMapRotate = newvalue.asBoolean();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handleUseOldTrackingDotsChanged(const LLSD& newvalue)
|
||||
{
|
||||
LLWorldMapView::sUseOldTrackingDots = newvalue.asBoolean();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool handleNumpadControlChanged(const LLSD& newvalue)
|
||||
{
|
||||
@@ -666,6 +685,9 @@ void settings_setup_listeners()
|
||||
gSavedSettings.getControl("AudioLevelMic")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
|
||||
gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
|
||||
gSavedSettings.getControl("TranslateChat")->getSignal()->connect(boost::bind(&handleTranslateChatPrefsChanged, _1));
|
||||
gSavedSettings.getControl("MiniMapCenter")->getSignal()->connect(boost::bind(&handleMiniMapCenterChanged, _1));
|
||||
gSavedSettings.getControl("MiniMapRotate")->getSignal()->connect(boost::bind(&handleMiniMapRotateChanged, _1));
|
||||
gSavedSettings.getControl("UseOldTrackingDots")->getSignal()->connect(boost::bind(&handleUseOldTrackingDotsChanged, _1));
|
||||
|
||||
gSavedSettings.getControl("CloudsEnabled")->getSignal()->connect(boost::bind(&handleCloudSettingsChanged, _1));
|
||||
gSavedSettings.getControl("SkyUseClassicClouds")->getSignal()->connect(boost::bind(&handleCloudSettingsChanged, _1));
|
||||
|
||||
@@ -71,6 +71,7 @@ const F32 GODLY_TELEPORT_HEIGHT = 200.f;
|
||||
const S32 SCROLL_HINT_WIDTH = 65;
|
||||
const F32 BIG_DOT_RADIUS = 5.f;
|
||||
BOOL LLWorldMapView::sHandledLastClick = FALSE;
|
||||
BOOL LLWorldMapView::sUseOldTrackingDots = FALSE;
|
||||
|
||||
LLUIImagePtr LLWorldMapView::sAvatarSmallImage = NULL;
|
||||
LLUIImagePtr LLWorldMapView::sAvatarYouImage = NULL;
|
||||
@@ -139,6 +140,8 @@ void LLWorldMapView::initClass()
|
||||
|
||||
sStringsMap["loading"] = LLTrans::getString("texture_loading");
|
||||
sStringsMap["offline"] = LLTrans::getString("worldmap_offline");
|
||||
|
||||
sUseOldTrackingDots = gSavedSettings.getBOOL("UseOldTrackingDots");
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -1186,23 +1189,79 @@ void LLWorldMapView::drawAvatar(F32 x_pixels,
|
||||
F32 dot_radius)
|
||||
{
|
||||
const F32 HEIGHT_THRESHOLD = 7.f;
|
||||
LLUIImagePtr dot_image = sAvatarLevelImage;
|
||||
if(relative_z < -HEIGHT_THRESHOLD)
|
||||
LLUIImagePtr dot_image = sAvatarSmallImage;
|
||||
if (sUseOldTrackingDots || relative_z == 16000.f)
|
||||
{
|
||||
F32 left = x_pixels - dot_radius;
|
||||
F32 right = x_pixels + dot_radius;
|
||||
F32 center = (left + right) * 0.5f;
|
||||
F32 top = y_pixels + dot_radius;
|
||||
F32 bottom = y_pixels - dot_radius;
|
||||
|
||||
if (relative_z == 16000.f)
|
||||
{
|
||||
// Unknown altitude (0m or > 1020m)
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
glColor4fv(color.mV);
|
||||
LLUI::setLineWidth(1.5f);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(left, y_pixels);
|
||||
glVertex2f(right, y_pixels);
|
||||
glEnd();
|
||||
LLUI::setLineWidth(1.0f);
|
||||
|
||||
}
|
||||
else if (relative_z > HEIGHT_THRESHOLD)
|
||||
{
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
glColor4fv(color.mV);
|
||||
LLUI::setLineWidth(1.5f);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(left, top);
|
||||
glVertex2f(right, top);
|
||||
glVertex2f(center, top);
|
||||
glVertex2f(center, bottom);
|
||||
glEnd();
|
||||
LLUI::setLineWidth(1.0f);
|
||||
}
|
||||
else if (relative_z > -HEIGHT_THRESHOLD)
|
||||
{
|
||||
dot_image->draw(llround(x_pixels) - dot_image->getWidth()/2,
|
||||
llround(y_pixels) - dot_image->getHeight()/2,
|
||||
color);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
glColor4fv(color.mV);
|
||||
LLUI::setLineWidth(1.5f);
|
||||
glBegin(GL_LINES);
|
||||
glVertex2f(center, top);
|
||||
glVertex2f(center, bottom);
|
||||
glVertex2f(left, bottom);
|
||||
glVertex2f(right, bottom);
|
||||
glEnd();
|
||||
LLUI::setLineWidth(1.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (relative_z < -HEIGHT_THRESHOLD)
|
||||
{
|
||||
dot_image = sAvatarBelowImage;
|
||||
}
|
||||
else if(relative_z > HEIGHT_THRESHOLD)
|
||||
else if (relative_z > HEIGHT_THRESHOLD)
|
||||
{
|
||||
dot_image = sAvatarAboveImage;
|
||||
}
|
||||
|
||||
S32 dot_width = llround(dot_radius * 2.f);
|
||||
dot_image->draw(
|
||||
llround(x_pixels - dot_radius),
|
||||
dot_image->draw(llround(x_pixels - dot_radius),
|
||||
llround(y_pixels - dot_radius),
|
||||
dot_width,
|
||||
dot_width,
|
||||
color);
|
||||
}
|
||||
}
|
||||
|
||||
// Pass relative Z of 0 to draw at same level.
|
||||
|
||||
@@ -186,6 +186,7 @@ public:
|
||||
LLTextBox* mTextBoxScrollHint;
|
||||
|
||||
static BOOL sHandledLastClick;
|
||||
static BOOL sUseOldTrackingDots;
|
||||
S32 mSelectIDStart;
|
||||
|
||||
// Keep the list of regions that are displayed on screen. Avoids iterating through the whole region map after draw().
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
can_tear_off="false" follows="top|right" height="220" min_height="64" min_width="64"
|
||||
name="minimap" rect_control="FloaterMiniMapRect" width="200">
|
||||
<panel bottom="2" follows="left|top|right|bottom" height="216" label="Mini Map"
|
||||
left="2" mouse_opaque="false" name="mini_mapview" tool_tip="(Double-click to open Map, Shift-drag to pan)"
|
||||
left="2" mouse_opaque="false" name="mini_mapview" tool_tip="(Double-click to open the Map, SHIFT-click and drag to pan)"
|
||||
width="196" />
|
||||
</floater>
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
<on_click function="MiniMap.Rotate" userdata="" />
|
||||
<on_check function="MiniMap.CheckRotate" userdata="" />
|
||||
</menu_item_check>
|
||||
<menu_item_check bottom_delta="-18" enabled="true" height="18" label="Rotate with avatar"
|
||||
left="0" mouse_opaque="true" name="Rotate with avatar" width="128">
|
||||
<on_click function="MiniMap.Rotate" userdata="1" />
|
||||
<on_check function="MiniMap.CheckRotate" userdata="1" />
|
||||
</menu_item_check>
|
||||
<menu_item_separator />
|
||||
<menu_item_call bottom_delta="-18" enabled = "false" height="18" label="Stop Tracking"
|
||||
left="0" mouse_opaque="true" name="Stop Tracking" width="128">
|
||||
|
||||
Reference in New Issue
Block a user