SL-11456 Allow scaling of HUD attachments

master
maxim_productengine 2019-07-02 16:52:21 +03:00
parent 8c54233ef9
commit dbb613a2d8
6 changed files with 51 additions and 5 deletions

View File

@ -13133,6 +13133,17 @@
<key>Value</key>
<real>3</real>
</map>
<key>HUDScaleFactor</key>
<map>
<key>Comment</key>
<string>Scale of HUD attachments</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>UIScaleFactor</key>
<map>
<key>Comment</key>

View File

@ -807,6 +807,12 @@ void LLAgentCamera::setCameraZoomFraction(F32 fraction)
startCameraAnimation();
}
F32 LLAgentCamera::getAgentHUDTargetZoom()
{
static LLCachedControl<F32> hud_scale_factor(gSavedSettings, "HUDScaleFactor");
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
return (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD) ? hud_scale_factor*gAgentCamera.mHUDTargetZoom : hud_scale_factor;
}
//-----------------------------------------------------------------------------
// cameraOrbitAround()

View File

@ -266,6 +266,7 @@ public:
F32 getCameraZoomFraction(); // Get camera zoom as fraction of minimum and maximum zoom
void setCameraZoomFraction(F32 fraction); // Set camera zoom as fraction of minimum and maximum zoom
F32 calcCameraFOVZoomFactor();
F32 getAgentHUDTargetZoom();
//--------------------------------------------------------------------
// Pan

View File

@ -6607,8 +6607,7 @@ void LLSelectMgr::updateSelectionCenter()
if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && isAgentAvatarValid())
{
// reset hud ZOOM
gAgentCamera.mHUDTargetZoom = 1.f;
gAgentCamera.mHUDCurZoom = 1.f;
resetAgentHUDZoom();
}
mShowSelection = FALSE;
@ -6981,8 +6980,11 @@ BOOL LLSelectMgr::setForceSelection(BOOL force)
void LLSelectMgr::resetAgentHUDZoom()
{
gAgentCamera.mHUDTargetZoom = 1.f;
gAgentCamera.mHUDCurZoom = 1.f;
if (gAgentCamera.mHUDTargetZoom != 1)
{
gAgentCamera.mHUDTargetZoom = 1.f;
gAgentCamera.mHUDCurZoom = 1.f;
}
}
void LLSelectMgr::getAgentHUDZoom(F32 &target_zoom, F32 &current_zoom) const

View File

@ -1087,7 +1087,7 @@ void render_hud_attachments()
// clamp target zoom level to reasonable values
gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f);
// smoothly interpolate current zoom level
gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLSmoothInterpolation::getInterpolant(0.03f));
gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.getAgentHUDTargetZoom(), LLSmoothInterpolation::getInterpolant(0.03f));
if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices())
{

View File

@ -142,6 +142,32 @@
min_val="0.75"
name="ui_scale_slider"
top_pad="-14"
width="250" />
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
left="33"
name="HUD Size:"
top_pad="20"
width="100">
HUD Scale:
</text>
<slider
control_name="HUDScaleFactor"
decimal_digits="2"
follows="left|top"
height="17"
increment="0.1"
initial_value="1"
layout="topleft"
left_pad="0"
max_val="2.0"
min_val="1.0"
name="ui_scale_slider"
top_pad="-14"
width="250" />
<check_box
control_name="ShowScriptErrors"