From 12e23a3cb8aadfc74f2ba469c671df51552c557b Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 27 Feb 2017 09:48:08 -0500 Subject: VOICE-44: correct AtOrientation delta check so that facing is reported correctly --- indra/newview/llvoicevivox.cpp | 45 +++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 5ba0bfaff0..842ad9ca6b 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -101,7 +101,8 @@ namespace { const F32 PROVISION_RETRY_TIMEOUT = 2.0; // Cosine of a "trivially" small angle - const F32 MINUSCULE_ANGLE_COS = 0.999f; + const F32 FOUR_DEGREES = 4.0f * (F_PI / 180.0f); + const F32 MINUSCULE_ANGLE_COS = (F32) cos(0.5f * FOUR_DEGREES); const F32 SESSION_JOIN_TIMEOUT = 10.0f; @@ -2678,12 +2679,13 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void) << "" << u.mV[VY] << "" << "" << u.mV[VZ] << "" << "" - << "" - << "" << l.mV [VX] << "" - << "" << l.mV [VY] << "" - << "" << l.mV [VZ] << "" - << ""; - + << "" + << "" << l.mV [VX] << "" + << "" << l.mV [VY] << "" + << "" << l.mV [VZ] << "" + << "" + ; + stream << ""; stream << ""; @@ -2721,7 +2723,6 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void) pos = earPosition; vel = earVelocity; -// LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL; oldSDKTransform(l, u, a, pos, vel); @@ -2754,12 +2755,12 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void) << "" << u.mV[VY] << "" << "" << u.mV[VZ] << "" << "" - << "" - << "" << l.mV [VX] << "" - << "" << l.mV [VY] << "" - << "" << l.mV [VZ] << "" - << ""; - + << "" + << "" << l.mV [VX] << "" + << "" << l.mV [VY] << "" + << "" << l.mV [VZ] << "" + << "" + ; stream << ""; @@ -2833,10 +2834,11 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void) } //sendLocalAudioUpdates(); obsolete, used to send volume setting on position updates - - if(!stream.str().empty()) + std::string update(stream.str()); + if(!update.empty()) { - writeString(stream.str()); + LL_DEBUGS("VoiceUpdate") << "sending update " << update << LL_ENDL; + writeString(update); } } @@ -4838,9 +4840,12 @@ void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLV mSpatialCoordsDirty = true; } - if ((mAvatarRot != rot) && (llabs(dot(mAvatarRot, rot)) > MINUSCULE_ANGLE_COS)) - { // if the two rotations are not exactly equal test their dot product - // to get the cos of the angle between them. If it is minuscule don't update. + // If the two rotations are not exactly equal test their dot product + // to get the cos of the angle between them. + // If it is too small, don't update. + F32 rot_cos_diff = llabs(dot(mAvatarRot, rot)); + if ((mAvatarRot != rot) && (rot_cos_diff < MINUSCULE_ANGLE_COS)) + { mAvatarRot = rot; mSpatialCoordsDirty = true; } -- cgit v1.2.3