diff options
author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-07-05 16:55:05 +0300 |
---|---|---|
committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-07-05 16:55:05 +0300 |
commit | 510958f6c4f4f1c1377fec0e484d7ef4d1d95030 (patch) | |
tree | de0cf19126d32f23e05e0c2909a90ce49f34eaf2 /indra/newview/llagentcamera.cpp | |
parent | 863e6ea4035683610e35bfa90171b7a35b9dce64 (diff) | |
parent | 3de5be44adb91d3a7e1ff3ca8b415964a722ce49 (diff) |
Merge from default branch
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llagentcamera.cpp')
-rw-r--r-- | indra/newview/llagentcamera.cpp | 87 |
1 files changed, 25 insertions, 62 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index e1a0162441..ec3c7452e5 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -85,7 +85,7 @@ const F32 MAX_CAMERA_SMOOTH_DISTANCE = 50.0f; const F32 HEAD_BUFFER_SIZE = 0.3f; -const F32 CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP = 0.2f; +const F32 CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP = 0.1f; const F32 LAND_MIN_ZOOM = 0.15f; @@ -2169,12 +2169,7 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate) // unpause avatar animation gAgent.unpauseAnimation(); - const U32 old_flags = gAgent.getControlFlags(); gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != gAgent.getControlFlags()) - { - gAgent.setFlagsDirty(); - } if (animate) { @@ -2233,13 +2228,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) } updateLastCamera(); mCameraMode = CAMERA_MODE_THIRD_PERSON; - const U32 old_flags = gAgent.getControlFlags(); gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != gAgent.getControlFlags()) - { - gAgent.setFlagsDirty(); - } - } // Remove any pitch from the avatar @@ -2274,7 +2263,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate) //----------------------------------------------------------------------------- // changeCameraToCustomizeAvatar() //----------------------------------------------------------------------------- -void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_animate) +void LLAgentCamera::changeCameraToCustomizeAvatar() { if (LLViewerJoystick::getInstance()->getOverrideCamera()) { @@ -2289,44 +2278,21 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); } - if (camera_animate) - { - startCameraAnimation(); - } + startCameraAnimation(); if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR) { updateLastCamera(); mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR; - const U32 old_flags = gAgent.getControlFlags(); gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK); - if (old_flags != gAgent.getControlFlags()) - { - gAgent.setFlagsDirty(); - } gFocusMgr.setKeyboardFocus( NULL ); gFocusMgr.setMouseCapture( NULL ); LLVOAvatarSelf::onCustomizeStart(); - } - - - // default focus point for customize avatar - LLVector3 focus_target; - if (isAgentAvatarValid()) - { - focus_target = gAgentAvatarp->mHeadp->getWorldPosition(); - } - else - { - focus_target = gAgent.getPositionAgent(); - } - if (isAgentAvatarValid()) - { - if(avatar_animate) - { + if (isAgentAvatarValid()) + { // Remove any pitch or rotation from the avatar LLVector3 at = gAgent.getAtAxis(); at.mV[VZ] = 0.f; @@ -2340,33 +2306,30 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came if (turn_motion) { + // delay camera animation long enough to play through turn animation setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP); - - } - else - { - setAnimationDuration(gSavedSettings.getF32("ZoomTime")); } + + gAgentAvatarp->updateMeshTextures(); } + } - LLVector3 agent_at = gAgent.getAtAxis(); - agent_at.mV[VZ] = 0.f; - agent_at.normalize(); + LLVector3 agent_at = gAgent.getAtAxis(); + agent_at.mV[VZ] = 0.f; + agent_at.normalize(); - LLVector3d camera_offset(agent_at * -1.0); - // push camera up and out from avatar - camera_offset.mdV[VZ] = 0.1f; - camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST; - LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); - setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID()); - - gAgentAvatarp->updateMeshTextures(); - } - else - { - mCameraAnimating = FALSE; - gAgent.endAnimationUpdateUI(); - } + // default focus point for customize avatar + LLVector3 focus_target = isAgentAvatarValid() + ? gAgentAvatarp->mHeadp->getWorldPosition() + : gAgent.getPositionAgent(); + + LLVector3d camera_offset(agent_at * -1.0); + // push camera up and out from avatar + camera_offset.mdV[VZ] = 0.1f; + camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST; + LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); + setAnimationDuration(gSavedSettings.getF32("ZoomTime")); + setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID()); } @@ -2550,7 +2513,7 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object //----------------------------------------------------------------------------- void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLVector3d& focus, const LLUUID &object_id) { - LLVector3d old_focus = mFocusTargetGlobal; + LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal; F64 focus_delta_squared = (old_focus - focus).magVecSquared(); const F64 ANIM_EPSILON_SQUARED = 0.0001; |