diff options
author | Oz Linden <oz@lindenlab.com> | 2011-05-02 07:24:15 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-05-02 07:24:15 -0400 |
commit | a32daa0c10b285354e94e0e8bf0cc6c5ffce09a5 (patch) | |
tree | c2ba5f181935b95d2f23406c41917401cd4be963 /indra/newview/llselectmgr.cpp | |
parent | 929bde3ed08f9a1d2a8f4c9821b0d51c11d895e9 (diff) | |
parent | 89216a6c213c126b8ab6dacaeb21340fa8f7a001 (diff) |
merge changes for vwr-25126
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r-- | indra/newview/llselectmgr.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 87a2008e2b..f05892d9b0 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6568,26 +6568,27 @@ bool LLSelectMgr::selectionMove(const LLVector3& displ, if (update_position) { // calculate the distance of the object closest to the camera origin - F32 min_dist = 1e+30f; + F32 min_dist_squared = F32_MAX; // value will be overridden in the loop + LLVector3 obj_pos; for (LLObjectSelection::root_iterator it = getSelection()->root_begin(); it != getSelection()->root_end(); ++it) { obj_pos = (*it)->getObject()->getPositionEdit(); - F32 obj_dist = dist_vec(obj_pos, LLViewerCamera::getInstance()->getOrigin()); - if (obj_dist < min_dist) + F32 obj_dist_squared = dist_vec_squared(obj_pos, LLViewerCamera::getInstance()->getOrigin()); + if (obj_dist_squared < min_dist_squared) { - min_dist = obj_dist; + min_dist_squared = obj_dist_squared; } } - // factor the distance inside the displacement vector. This will get us + // factor the distance into the displacement vector. This will get us // equally visible movements for both close and far away selections. - min_dist = sqrt(min_dist) / 2; - displ_global.setVec(displ.mV[0]*min_dist, - displ.mV[1]*min_dist, - displ.mV[2]*min_dist); + F32 min_dist = sqrt(fsqrtf(min_dist_squared)) / 2; + displ_global.setVec(displ.mV[0] * min_dist, + displ.mV[1] * min_dist, + displ.mV[2] * min_dist); // equates to: Displ_global = Displ * M_cam_axes_in_global_frame displ_global = LLViewerCamera::getInstance()->rotateToAbsolute(displ_global); |