diff options
author | Ricky Curtice <kf6kjg+hg@gmail.com> | 2011-03-10 22:07:06 -0800 |
---|---|---|
committer | Ricky Curtice <kf6kjg+hg@gmail.com> | 2011-03-10 22:07:06 -0800 |
commit | d4d292258e31eee6d639106147758f39deae63e3 (patch) | |
tree | 577571cc2d4cdef5aa24706520b790f56b875c1c /indra/newview/llviewerchat.cpp | |
parent | 1426765e82549ec9d17a0f90d902f25c0e785bbd (diff) |
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.
Diffstat (limited to 'indra/newview/llviewerchat.cpp')
-rw-r--r-- | indra/newview/llviewerchat.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 0af850a46b..7cce2831c9 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -87,8 +87,9 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color) if (!chat.mPosAgent.isExactlyZero()) { LLVector3 pos_agent = gAgent.getPositionAgent(); - F32 distance = dist_vec(pos_agent, chat.mPosAgent); - if (distance > gAgent.getNearChatRadius()) + F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent); + F32 dist_near_chat = gAgent.getNearChatRadius(); + if (distance_squared > dist_near_chat * dist_near_chat) { // diminish far-off chat r_color.mV[VALPHA] = 0.8f; @@ -152,8 +153,9 @@ void LLViewerChat::getChatColor(const LLChat& chat, std::string& r_color_name, F if (!chat.mPosAgent.isExactlyZero()) { LLVector3 pos_agent = gAgent.getPositionAgent(); - F32 distance = dist_vec(pos_agent, chat.mPosAgent); - if (distance > gAgent.getNearChatRadius()) + F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent); + F32 dist_near_chat = gAgent.getNearChatRadius(); + if (distance_squared > dist_near_chat * dist_near_chat) { // diminish far-off chat r_color_alpha = 0.8f; |