From 85a0424caa3fe2745a73b288a2f7884c500688a3 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Mon, 25 Apr 2022 22:47:04 -0400 Subject: [PATCH] Minimap enhancement from cinder --- indra/newview/app_settings/settings.xml | 46 +++++++++- indra/newview/llviewerobjectlist.cpp | 107 ++++++++++++++++++++---- 2 files changed, 134 insertions(+), 19 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bf56bc3cee8..b54ea41fa6f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -7164,7 +7164,51 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>64.0</real> + <real>16.0</real> + </map> + <key>MiniMapPrimMaxVertDistance</key> + <map> + <key>Comment</key> + <string>Max height difference between avatar and prim to be shown on the MiniMap. Set to 0.0 to disable.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>256.0</real> + </map> + <key>MiniMapPrimScripted</key> + <map> + <key>Comment</key> + <string>Accent scripted objects on netmap in different colors.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>MiniMapPrimPhysical</key> + <map> + <key>Comment</key> + <string>Accent physical objects on netmap in different colors.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>MiniMapPrimTempOnRez</key> + <map> + <key>Comment</key> + <string>Accent temporary objects on netmap in different colors.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> </map> <key>MiniMapRotate</key> <map> diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 70acc31f8bd..133a44c6255 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1807,18 +1807,37 @@ void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp) void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { - static const LLUIColor above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" ); - static const LLUIColor below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" ); + static const LLUIColor above_water_color = + LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" ); + static const LLUIColor below_water_color = + LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" ); static const LLUIColor you_own_above_water_color = - LLUIColorTable::instance().getColor( "NetMapYouOwnAboveWater" ); + LLUIColorTable::instance().getColor( "NetMapYouOwnAboveWater" ); static const LLUIColor you_own_below_water_color = - LLUIColorTable::instance().getColor( "NetMapYouOwnBelowWater" ); + LLUIColorTable::instance().getColor( "NetMapYouOwnBelowWater" ); static const LLUIColor group_own_above_water_color = - LLUIColorTable::instance().getColor( "NetMapGroupOwnAboveWater" ); + LLUIColorTable::instance().getColor( "NetMapGroupOwnAboveWater" ); static const LLUIColor group_own_below_water_color = - LLUIColorTable::instance().getColor( "NetMapGroupOwnBelowWater" ); - - static const LLCachedControl<F32> max_radius(gSavedSettings, "MiniMapPrimMaxRadius"); + LLUIColorTable::instance().getColor( "NetMapGroupOwnBelowWater" ); + static const LLUIColor you_own_physical_color = + LLUIColorTable::instance().getColor("NetMapYouPhysical", LLColor4::red); + static const LLUIColor group_own_physical_color = + LLUIColorTable::instance().getColor("NetMapGroupPhysical", LLColor4::green); + static const LLUIColor other_own_physical_color = + LLUIColorTable::instance().getColor("NetMapOtherPhysical", LLColor4::green); + static const LLUIColor scripted_object_color = + LLUIColorTable::instance().getColor("NetMapScripted", LLColor4::orange); + static const LLUIColor temp_on_rez_object_color = + LLUIColorTable::instance().getColor("NetMapTempOnRez", LLColor4::orange); + + const F32 MIN_RADIUS_FOR_ACCENTED_OBJECTS = 2.f; + + static const LLCachedControl max_radius(gSavedSettings, "MiniMapPrimMaxRadius", 16.f); + static const LLCachedControl max_zdistance_from_avatar(gSavedSettings, "MiniMapPrimMaxVertDistance", 256.f); + static const LLCachedControl netmap_scripted(gSavedSettings, "MiniMapPrimScripted", false); + static const LLCachedControl netmap_physical(gSavedSettings, "MiniMapPrimPhysical", true); + static const LLCachedControl netmap_temp_on_rez(gSavedSettings, "MiniMapPrimTempOnRez", false); + static const LLCachedControl netmap_phantom_opacity(gSavedSettings, "MiniMapPrimPhantomOpacity", 100U); for (LLViewerObject* objectp : mMapObjects) { @@ -1834,7 +1853,16 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) const LLVector3& scale = objectp->getScale(); const LLVector3d pos = objectp->getPositionGlobal(); const F64 water_height = F64( objectp->getRegion()->getWaterHeight() ); - // LLWorld::getInstance()->getWaterHeight(); + + // Skip all objects that are more than MiniMapPrimMaxVertDistance above or below the avatar + if (max_zdistance_from_avatar > 0.0) + { + F64 zdistance = pos.mdV[VZ] - gAgent.getPositionGlobal().mdV[VZ]; + if (zdistance < (-max_zdistance_from_avatar) || zdistance > max_zdistance_from_avatar) + { + continue; + } + } F32 approx_radius = (scale.mV[VX] + scale.mV[VY]) * 0.5f * 0.5f * 1.3f; // 1.3 is a fudge @@ -1844,17 +1872,17 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) approx_radius = llmin<F32>(approx_radius, max_radius); LLColor4 color = above_water_color; - if( objectp->permYouOwner() ) + if (objectp->permYouOwner()) { const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f; - if( approx_radius < MIN_RADIUS_FOR_OWNED_OBJECTS ) + if (approx_radius < MIN_RADIUS_FOR_OWNED_OBJECTS) { approx_radius = MIN_RADIUS_FOR_OWNED_OBJECTS; } - if( pos.mdV[VZ] >= water_height ) + if (pos.mdV[VZ] >= water_height) { - if ( objectp->permGroupOwner() ) + if (objectp->permGroupOwner()) { color = group_own_above_water_color; } @@ -1865,21 +1893,64 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) } else { - if ( objectp->permGroupOwner() ) + if (objectp->permGroupOwner()) { color = group_own_below_water_color; } + else + { + color = you_own_below_water_color; + } + } + } + else if (pos.mdV[VZ] < water_height) + { + color = below_water_color; + } + + if (netmap_scripted && objectp->flagScripted()) + { + color = scripted_object_color; + if( approx_radius < MIN_RADIUS_FOR_ACCENTED_OBJECTS ) + { + approx_radius = MIN_RADIUS_FOR_ACCENTED_OBJECTS; + } + } + + if (netmap_physical && objectp->flagUsePhysics()) + { + if (objectp->permYouOwner()) + { + color = you_own_physical_color; + } + else if (objectp->permGroupOwner()) + { + color = group_own_physical_color; + } else { - color = you_own_below_water_color; + color = other_own_physical_color; + } + if( approx_radius < MIN_RADIUS_FOR_ACCENTED_OBJECTS ) + { + approx_radius = MIN_RADIUS_FOR_ACCENTED_OBJECTS; } } + + if (netmap_temp_on_rez && objectp->flagTemporaryOnRez()) + { + color = temp_on_rez_object_color; + if( approx_radius < MIN_RADIUS_FOR_ACCENTED_OBJECTS ) + { + approx_radius = MIN_RADIUS_FOR_ACCENTED_OBJECTS; + } } - else if( pos.mdV[VZ] < water_height ) + + if (objectp->flagPhantom()) { - color = below_water_color; + color.setAlpha(llclampb(netmap_phantom_opacity())); } - + netmap.renderScaledPointGlobal( pos, color, -- GitLab