diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2023-08-28 12:22:11 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2023-08-28 12:22:11 +0300 |
commit | d9cefb2890b0a0ff74089e65a296f5cdf097996a (patch) | |
tree | d81a00b4c4503016271a8a0baf12bf096c8d4b9d /indra | |
parent | 57d784f80728f9ecd75f8dbc989cd75cf328c353 (diff) |
SL-20171 use nametag position to draw voice indication dot
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 5 | ||||
-rw-r--r-- | indra/newview/llvoicevisualizer.cpp | 3 |
3 files changed, 16 insertions, 28 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 250366dbea..2bb032ed1a 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2568,7 +2568,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) { if (!mIsControlAvatar) { - idleUpdateNameTag( mLastRootPos ); + idleUpdateNameTag(idleCalcNameTagPosition(mLastRootPos)); } return; } @@ -2652,7 +2652,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) @@ -2663,7 +2665,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 @@ -2699,7 +2701,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; @@ -2788,24 +2790,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 ) } @@ -3321,7 +3306,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); } @@ -3598,7 +3584,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; @@ -3652,7 +3638,7 @@ void LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last) } } - mNameText->setPositionAgent(name_position); + return name_position; } void LLVOAvatar::idleUpdateNameTagAlpha(bool new_name, F32 alpha) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 970ca523a5..b3f4b8e41e 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -275,7 +275,7 @@ public: void updateTimeStep(); void updateRootPositionAndRotation(LLAgent &agent, F32 speed, bool was_sit_ground_constrained); - void idleUpdateVoiceVisualizer(bool voice_enabled); + void idleUpdateVoiceVisualizer(bool voice_enabled, const LLVector3 &position); void idleUpdateMisc(bool detailed_update); virtual void idleUpdateAppearanceAnimation(); void idleUpdateLipSync(bool voice_enabled); @@ -283,7 +283,6 @@ public: void idleUpdateWindEffect(); void idleUpdateNameTag(const LLVector3& root_pos_last); void idleUpdateNameTagText(bool new_name); - void idleUpdateNameTagPosition(const LLVector3& root_pos_last); void idleUpdateNameTagAlpha(bool new_name, F32 alpha); LLColor4 getNameTagColor(bool is_friend); void clearNameTag(); @@ -317,6 +316,8 @@ public: static void updateNearbyAvatarCount(); + LLVector3 idleCalcNameTagPosition(const LLVector3 &root_pos_last); + //-------------------------------------------------------------------- // Static preferences (controlled by user settings/menus) //-------------------------------------------------------------------- diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 6e08a2ff12..4a140524e6 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -40,6 +40,7 @@ #include "llviewertexturelist.h" #include "llvoiceclient.h" #include "llrender.h" +#include "llagent.h" //brent's wave image //29de489d-0491-fb00-7dab-f9e686d31e83 @@ -349,7 +350,7 @@ void LLVoiceVisualizer::render() //--------------------------------------------------------------- // set the sound symbol position over the source (avatar's head) //--------------------------------------------------------------- - mSoundSymbol.mPosition = mVoiceSourceWorldPosition + WORLD_UPWARD_DIRECTION * HEIGHT_ABOVE_HEAD; + mSoundSymbol.mPosition = gAgent.getPosAgentFromGlobal(mPositionGlobal) + WORLD_UPWARD_DIRECTION * HEIGHT_ABOVE_HEAD; //--------------------------------------------------------------- // some gl state |