Add an option, in beacons floater, to show chat range spheres (whisper, say, shout) in 3D world around avatar

Signed-off-by: PanteraPolnocy <panterapolnocy@gmail.com>
master
PanteraPolnocy 2025-12-13 19:00:37 +01:00
parent ace3433d4b
commit c4305eba15
4 changed files with 80 additions and 2 deletions

View File

@ -26271,6 +26271,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key> <key>Value</key>
<integer>1</integer> <integer>1</integer>
</map> </map>
<key>FSShowChatRangeSpheres</key>
<map>
<key>Comment</key>
<string>Show chat range spheres (whisper, say, shout) in 3D world around avatar</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>FSUseReadOfflineMsgsCap</key> <key>FSUseReadOfflineMsgsCap</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@ -96,6 +96,12 @@
#include "llpresetsmanager.h" #include "llpresetsmanager.h"
#include "fsdata.h" #include "fsdata.h"
// <FS:PP> Render chat range spheres in 3D world
#include "lfsimfeaturehandler.h"
#include "llrendersphere.h"
#include "lluicolortable.h"
// </FS:PP>
#include <filesystem> #include <filesystem>
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
@ -1767,6 +1773,55 @@ void draw_axes()
gGL.popMatrix(); gGL.popMatrix();
} }
// <FS:PP> Render chat range spheres in 3D world
static void renderChatRangeSphere(const LLVector3& center, F32 radius, const LLColor4& color)
{
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
{
gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]);
gDebugProgram.bind();
LLGLEnable blend(GL_BLEND);
LLGLDepthTest depth(GL_TRUE, GL_TRUE);
gGL.color4fv(color.mV);
gGL.diffuseColor4fv(color.mV);
gGL.pushMatrix();
{
gGL.scalef(radius, radius, radius);
glCullFace(GL_FRONT);
gSphere.render();
glCullFace(GL_BACK);
gSphere.render();
}
gGL.popMatrix();
gUIProgram.bind();
}
gGL.popMatrix();
}
static void drawChatRangeSpheres()
{
static LLCachedControl<bool> show_spheres(gSavedSettings, "FSShowChatRangeSpheres", false);
if (!show_spheres() || !isAgentAvatarValid())
{
return;
}
LFSimFeatureHandler& simfeatures = LFSimFeatureHandler::instance();
F32 whisper_range = (F32)simfeatures.whisperRange();
F32 say_range = (F32)simfeatures.sayRange();
F32 shout_range = (F32)simfeatures.shoutRange();
LLVector3 avatar_pos = gAgent.getPositionAgent();
static LLUIColor whisper_color = LLUIColorTable::instance().getColor("MapWhisperRingColor", LLColor4::blue);
static LLUIColor say_color = LLUIColorTable::instance().getColor("MapChatRingColor", LLColor4::yellow);
static LLUIColor shout_color = LLUIColorTable::instance().getColor("MapShoutRingColor", LLColor4::red);
renderChatRangeSphere(avatar_pos, whisper_range, whisper_color);
renderChatRangeSphere(avatar_pos, say_range, say_color);
renderChatRangeSphere(avatar_pos, shout_range, shout_color);
}
// </FS:PP>
void render_ui_3d() void render_ui_3d()
{ {
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
@ -1799,6 +1854,10 @@ void render_ui_3d()
draw_axes(); draw_axes();
} }
// <FS:PP> Render chat range spheres in 3D world
drawChatRangeSpheres();
// </FS:PP>
gViewerWindow->renderSelections(false, false, true); // Non HUD call in render_hud_elements gViewerWindow->renderSelections(false, false, true); // Non HUD call in render_hud_elements
if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<floater <floater
legacy_header_height="18" legacy_header_height="18"
height="363" height="381"
layout="topleft" layout="topleft"
name="beacons" name="beacons"
help_topic="beacons" help_topic="beacons"
@ -12,7 +12,7 @@
width="240"> width="240">
<panel <panel
follows="left|top|right|bottom" follows="left|top|right|bottom"
height="358" height="376"
layout="topleft" layout="topleft"
left="10" left="10"
name="beacons_panel" name="beacons_panel"
@ -49,6 +49,13 @@
<check_box.commit_callback <check_box.commit_callback
function="Beacons.UICheck" /> function="Beacons.UICheck" />
</check_box> </check_box>
<check_box
control_name="FSShowChatRangeSpheres"
top_pad="2"
height="16"
layout="topleft"
label="Chat range spheres"
name="FSShowChatRangeSpheres" />
<view_border <view_border
bevel_style="in" bevel_style="in"
height="0" height="0"

View File

@ -6,6 +6,7 @@
</text> </text>
<check_box label="Bryły brzegowe świateł sceny" name="lights_bounding_boxes"/> <check_box label="Bryły brzegowe świateł sceny" name="lights_bounding_boxes"/>
<check_box label="Narożniki regionu" name="fsregioncornerbeacons" /> <check_box label="Narożniki regionu" name="fsregioncornerbeacons" />
<check_box label="Sfery zasięgu czatu" name="FSShowChatRangeSpheres" />
<check_box label="Emitery" name="beacons"/> <check_box label="Emitery" name="beacons"/>
<check_box label="Podświetlenia" name="highlights"/> <check_box label="Podświetlenia" name="highlights"/>
<check_box label="Pokazuj objaśnienia emiterów" name="FSRenderBeaconText"/> <check_box label="Pokazuj objaśnienia emiterów" name="FSRenderBeaconText"/>