From d4d292258e31eee6d639106147758f39deae63e3 Mon Sep 17 00:00:00 2001 From: Ricky Curtice Date: Thu, 10 Mar 2011 22:07:06 -0800 Subject: Squared all dist_vec() based comparisons and other dist_vec() operations where sensible. Not all instances of dist_vec() were squared, only those where it wouldn't (hopefully) change the functionality. --- indra/newview/llhudeffectpointat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llhudeffectpointat.cpp') diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index bfb0f150b3..562d7cd4ed 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -244,7 +244,7 @@ BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob BOOL targetTypeChanged = (target_type != mTargetType) || (object != mTargetObject); - BOOL targetPosChanged = (dist_vec(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE) && + BOOL targetPosChanged = (dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE * MIN_DELTAPOS_FOR_UPDATE) && ((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC)); if (targetTypeChanged || targetPosChanged) -- cgit v1.2.3 From 9bac314ba0d8b6bd35c8d2e27ce99a28b924dea6 Mon Sep 17 00:00:00 2001 From: Ricky Curtice Date: Sat, 12 Mar 2011 23:39:10 -0800 Subject: Switched to using *_SQUARED constants instead of multiplied constants, and cleaned up a few other minor issues noted during review. --- indra/newview/llhudeffectpointat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llhudeffectpointat.cpp') diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index 562d7cd4ed..28fe8e1c01 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -48,7 +48,7 @@ const S32 PKT_SIZE = 57; // throttle const F32 MAX_SENDS_PER_SEC = 4.f; -const F32 MIN_DELTAPOS_FOR_UPDATE = 0.05f; +const F32 MIN_DELTAPOS_FOR_UPDATE_SQUARED = 0.05f * 0.05f; // timeouts // can't use actual F32_MAX, because we add this to the current frametime @@ -244,7 +244,7 @@ BOOL LLHUDEffectPointAt::setPointAt(EPointAtType target_type, LLViewerObject *ob BOOL targetTypeChanged = (target_type != mTargetType) || (object != mTargetObject); - BOOL targetPosChanged = (dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE * MIN_DELTAPOS_FOR_UPDATE) && + BOOL targetPosChanged = (dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) && ((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC)); if (targetTypeChanged || targetPosChanged) -- cgit v1.2.3