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/llmanipscale.cpp | |
parent | 929bde3ed08f9a1d2a8f4c9821b0d51c11d895e9 (diff) | |
parent | 89216a6c213c126b8ab6dacaeb21340fa8f7a001 (diff) |
merge changes for vwr-25126
Diffstat (limited to 'indra/newview/llmanipscale.cpp')
-rw-r--r-- | indra/newview/llmanipscale.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 060677f9f3..9cdc092257 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -217,8 +217,6 @@ void LLManipScale::render() LLVector3 center_agent = gAgent.getPosAgentFromGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal()); - F32 range; - F32 range_from_agent; if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { mBoxHandleSize = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); @@ -226,25 +224,25 @@ void LLManipScale::render() } else { - range = dist_vec(gAgentCamera.getCameraPositionAgent(), center_agent); - range_from_agent = dist_vec(gAgent.getPositionAgent(), center_agent); + F32 range_squared = dist_vec_squared(gAgentCamera.getCameraPositionAgent(), center_agent); + F32 range_from_agent_squared = dist_vec_squared(gAgent.getPositionAgent(), center_agent); // Don't draw manip if object too far away if (gSavedSettings.getBOOL("LimitSelectDistance")) { F32 max_select_distance = gSavedSettings.getF32("MaxSelectDistance"); - if (range_from_agent > max_select_distance) + if (range_from_agent_squared > max_select_distance * max_select_distance) { return; } } - if (range > 0.001f) + if (range_squared > 0.001f * 0.001f) { // range != zero F32 fraction_of_fov = BOX_HANDLE_BASE_SIZE / (F32) LLViewerCamera::getInstance()->getViewHeightInPixels(); F32 apparent_angle = fraction_of_fov * LLViewerCamera::getInstance()->getView(); // radians - mBoxHandleSize = range * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR; + mBoxHandleSize = fsqrtf(range_squared) * tan(apparent_angle) * BOX_HANDLE_BASE_FACTOR; } else { |