diff options
author | Logan Dethrow <log@lindenlab.com> | 2011-05-06 15:25:12 -0400 |
---|---|---|
committer | Logan Dethrow <log@lindenlab.com> | 2011-05-06 15:25:12 -0400 |
commit | 39ad3f1d880a26dcf8189cad2501002c189a7ac2 (patch) | |
tree | a843d0c5843ca5e6a5fcbdfc6929bc2b21b960d6 /indra/newview/llmanipscale.cpp | |
parent | 5c7a906b44aa950ec3c8b786fec6516b51f9d66c (diff) | |
parent | def9f9290e661e6a35b7b255eb71b6e2767fdea0 (diff) |
merge
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 { |