summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-04-11 21:59:38 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-04-11 21:59:38 +0200
commitd0102af56d3b1d5b1d9bf3c8eb9aeea77028b70e (patch)
treee31cee85f651a874c4b6edc7491efa0cb2ec93d5 /indra/newview/llvoavatar.cpp
parent17e1f3692c5c1e9cbc6ba6895b312a8baae9aec2 (diff)
parentda9a1dcb55548a249ff7a1255f3e518696b81245 (diff)
Merge branch 'main' of https://github.com/secondlife/viewer into DRTVWR-600-maint-A
# Conflicts: # indra/llcommon/llapp.cpp # indra/llcommon/llapp.h # indra/llimage/llimageworker.cpp # indra/llui/llcontainerview.cpp # indra/llui/llcontainerview.h # indra/llui/llkeywords.cpp # indra/llui/lltabcontainer.cpp # indra/llui/lltextbase.cpp # indra/newview/llappviewer.cpp # indra/newview/llfavoritesbar.cpp # indra/newview/llfavoritesbar.h # indra/newview/llfloaterimnearbychathandler.cpp # indra/newview/llfloaterpreference.cpp # indra/newview/llhudnametag.h # indra/newview/llinventorypanel.cpp # indra/newview/llinventorypanel.h # indra/newview/llmeshrepository.cpp # indra/newview/lloutfitgallery.cpp # indra/newview/lloutfitslist.cpp # indra/newview/llpaneleditwearable.cpp # indra/newview/llpanelprofilepicks.cpp # indra/newview/llpanelvoicedevicesettings.h # indra/newview/llpreviewscript.cpp # indra/newview/llpreviewscript.h # indra/newview/llselectmgr.cpp # indra/newview/lltranslate.cpp # indra/newview/llviewerassetupload.cpp # indra/newview/llviewermessage.cpp
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp60
1 files changed, 34 insertions, 26 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index a9852ba9f8..fd99491eb7 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2573,7 +2573,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
{
if (!mIsControlAvatar)
{
- idleUpdateNameTag( mLastRootPos );
+ idleUpdateNameTag(idleCalcNameTagPosition(mLastRootPos));
}
return;
}
@@ -2657,7 +2657,9 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
bool voice_enabled = (visualizers_in_calls || LLVoiceClient::getInstance()->inProximalChannel()) &&
LLVoiceClient::getInstance()->getVoiceEnabled(mID);
- idleUpdateVoiceVisualizer( voice_enabled );
+ LLVector3 hud_name_pos = idleCalcNameTagPosition(mLastRootPos);
+
+ idleUpdateVoiceVisualizer(voice_enabled, hud_name_pos);
idleUpdateMisc( detailed_update );
idleUpdateAppearanceAnimation();
if (detailed_update)
@@ -2668,7 +2670,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
idleUpdateWindEffect();
}
- idleUpdateNameTag( mLastRootPos );
+ idleUpdateNameTag(hud_name_pos);
// Complexity has stale mechanics, but updates still can be very rapid
// so spread avatar complexity calculations over frames to lesen load from
@@ -2708,7 +2710,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
idleUpdateDebugInfo();
}
-void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
+void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled, const LLVector3 &position)
{
bool render_visualizer = voice_enabled;
@@ -2797,24 +2799,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
}
}
}
-
- //--------------------------------------------------------------------------------------------
- // here we get the approximate head position and set as sound source for the voice symbol
- // (the following version uses a tweak of "mHeadOffset" which handle sitting vs. standing)
- //--------------------------------------------------------------------------------------------
-
- if ( isSitting() )
- {
- LLVector3 headOffset = LLVector3( 0.0f, 0.0f, mHeadOffset.mV[2] );
- mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot->getWorldPosition() + headOffset );
- }
- else
- {
- LLVector3 tagPos = mRoot->getWorldPosition();
- tagPos[VZ] -= mPelvisToFoot;
- tagPos[VZ] += ( mBodySize[VZ] + 0.125f ); // does not need mAvatarOffset -Nyx
- mVoiceVisualizer->setVoiceSourceWorldPosition( tagPos );
- }
+ mVoiceVisualizer->setPositionAgent(position);
}//if ( voiceEnabled )
}
@@ -3330,7 +3315,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
new_name = true;
}
- idleUpdateNameTagPosition(root_pos_last);
+ mNameText->setPositionAgent(root_pos_last);
+
idleUpdateNameTagText(new_name);
idleUpdateNameTagAlpha(new_name, alpha);
}
@@ -3607,7 +3593,7 @@ void LLVOAvatar::invalidateNameTags()
}
// Compute name tag position during idle update
-void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last)
+LLVector3 LLVOAvatar::idleCalcNameTagPosition(const LLVector3 &root_pos_last)
{
LLQuaternion root_rot = mRoot->getWorldRotation();
LLQuaternion inv_root_rot = ~root_rot;
@@ -3621,7 +3607,6 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last)
local_camera_up.normalize();
local_camera_up = local_camera_up * inv_root_rot;
-
// position is based on head position, does not require mAvatarOffset here. - Nyx
LLVector3 avatar_ellipsoid(mBodySize.mV[VX] * 0.4f,
mBodySize.mV[VY] * 0.4f,
@@ -3643,7 +3628,26 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last)
name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av));
name_position += pixel_up_vec * NAMETAG_VERTICAL_SCREEN_OFFSET;
- mNameText->setPositionAgent(name_position);
+ const F32 water_height = getRegion()->getWaterHeight();
+ static const F32 WATER_HEIGHT_DELTA = 0.25f;
+ if (name_position[VZ] < water_height + WATER_HEIGHT_DELTA)
+ {
+ if (LLViewerCamera::getInstance()->getOrigin()[VZ] >= water_height)
+ {
+ name_position[VZ] = water_height;
+ }
+ else if (mNameText) // both camera and HUD are below watermark
+ {
+ F32 name_world_height = mNameText->getWorldHeight();
+ F32 max_z_position = water_height - name_world_height;
+ if (name_position[VZ] > max_z_position)
+ {
+ name_position[VZ] = max_z_position;
+ }
+ }
+ }
+
+ return name_position;
}
void LLVOAvatar::idleUpdateNameTagAlpha(bool new_name, F32 alpha)
@@ -3738,6 +3742,10 @@ bool LLVOAvatar::isVisuallyMuted()
{
muted = true;
}
+ else if (mIsControlAvatar)
+ {
+ muted = isTooSlow();
+ }
else
{
muted = isTooComplex() || isTooSlow();