diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-04-04 01:22:03 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-04-04 01:22:03 +0000 |
commit | f5e386527c4a74e6e5733f4f1cfa55873851257e (patch) | |
tree | 9973027da0faa63a628aa6a55b2e50a3f7fc74d9 /indra/newview/llagent.cpp | |
parent | 96add52a1c414bae4da030c3ab8604f15bd9c8db (diff) |
QAR-427
merge 3dconnex-merge -r 84010 : 84039 -> release
Diffstat (limited to 'indra/newview/llagent.cpp')
-rw-r--r-- | indra/newview/llagent.cpp | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 2f5589a966..dcea6b2957 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -581,7 +581,7 @@ void LLAgent::unlockView() //----------------------------------------------------------------------------- // moveAt() //----------------------------------------------------------------------------- -void LLAgent::moveAt(S32 direction) +void LLAgent::moveAt(S32 direction, bool reset) { // age chat timer so it fades more quickly when you are intentionally moving ageChat(); @@ -597,7 +597,10 @@ void LLAgent::moveAt(S32 direction) setControlFlags(AGENT_CONTROL_AT_NEG | AGENT_CONTROL_FAST_AT); } - resetView(); + if (reset) + { + resetView(); + } } //----------------------------------------------------------------------------- @@ -691,7 +694,7 @@ void LLAgent::moveUp(S32 direction) //----------------------------------------------------------------------------- // moveYaw() //----------------------------------------------------------------------------- -void LLAgent::moveYaw(F32 mag) +void LLAgent::moveYaw(F32 mag, bool reset_view) { mYawKey = mag; @@ -704,7 +707,10 @@ void LLAgent::moveYaw(F32 mag) setControlFlags(AGENT_CONTROL_YAW_NEG); } - resetView(); + if (reset_view) + { + resetView(); + } } //----------------------------------------------------------------------------- @@ -1216,7 +1222,16 @@ LLVector3 LLAgent::getReferenceUpVector() void LLAgent::pitch(F32 angle) { // don't let user pitch if pointed almost all the way down or up - + mFrameAgent.pitch(clampPitchToLimits(angle)); +} + + +// Radians, positive is forward into ground +//----------------------------------------------------------------------------- +// clampPitchToLimits() +//----------------------------------------------------------------------------- +F32 LLAgent::clampPitchToLimits(F32 angle) +{ // A dot B = mag(A) * mag(B) * cos(angle between A and B) // so... cos(angle between A and B) = A dot B / mag(A) / mag(B) // = A dot B for unit vectors @@ -1246,8 +1261,8 @@ void LLAgent::pitch(F32 angle) { angle = look_up_limit - angle_from_skyward; } - - mFrameAgent.pitch(angle); + + return angle; } @@ -2576,15 +2591,18 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y) LLVector3 headLookAxis; LLCoordFrame frameCamera = *((LLCoordFrame*)LLViewerCamera::getInstance()); - F32 x_from_center = ((F32) mouse_x / (F32) gViewerWindow->getWindowWidth() ) - 0.5f; - F32 y_from_center = ((F32) mouse_y / (F32) gViewerWindow->getWindowHeight() ) - 0.5f; - if (cameraMouselook()) { lookAtType = LOOKAT_TARGET_MOUSELOOK; } else if (cameraThirdPerson()) { + // range from -.5 to .5 + F32 x_from_center = + ((F32) mouse_x / (F32) gViewerWindow->getWindowWidth() ) - 0.5f; + F32 y_from_center = + ((F32) mouse_y / (F32) gViewerWindow->getWindowHeight() ) - 0.5f; + frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD); frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD); lookAtType = LOOKAT_TARGET_FREELOOK; |