summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcharacter/llkeyframewalkmotion.cpp3
-rw-r--r--indra/newview/llagentcamera.cpp87
-rw-r--r--indra/newview/llagentcamera.h2
3 files changed, 28 insertions, 64 deletions
diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp
index 0587e5642c..4a1aca62bc 100644
--- a/indra/llcharacter/llkeyframewalkmotion.cpp
+++ b/indra/llcharacter/llkeyframewalkmotion.cpp
@@ -289,7 +289,8 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
F32 foot_speed = speed - ((foot_slip_vector * avatar_movement_dir) / delta_time);
// multiply animation playback rate so that foot speed matches avatar speed
- F32 desired_speed_multiplier = llclamp(speed / foot_speed, 0.f, ANIM_SPEED_MAX);
+ F32 min_speed_multiplier = clamp_rescale(speed, 0.f, 1.f, 0.f, 0.1f);
+ F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX);
// blend towards new speed adjustment value
F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(SPEED_ADJUST_TIME_CONSTANT));
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;
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index fc78fef6d0..6cee21fd8a 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -94,7 +94,7 @@ public:
void changeCameraToDefault();
void changeCameraToMouselook(BOOL animate = TRUE);
void changeCameraToThirdPerson(BOOL animate = TRUE);
- void changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE); // Trigger transition animation
+ void changeCameraToCustomizeAvatar(); // Trigger transition animation
void changeCameraToFollow(BOOL animate = TRUE); // Ventrella
BOOL cameraThirdPerson() const { return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); }
BOOL cameraMouselook() const { return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); }