From e8dfa28697c177e8ed08ff76a9b81f920805a92f Mon Sep 17 00:00:00 2001
From: "Graham Madarasz (Graham Linden)" <graham@lindenlab.com>
Date: Thu, 14 Mar 2013 14:12:26 -0700
Subject: Rollback Maestro interp changes

---
 indra/llcharacter/lleditingmotion.cpp      |   4 +-
 indra/llcharacter/llheadrotmotion.cpp      |   4 +-
 indra/llcharacter/llkeyframemotion.cpp     |   6 +-
 indra/llcharacter/llkeyframewalkmotion.cpp |   6 +-
 indra/llcharacter/llmotion.cpp             |   4 +-
 indra/llcharacter/lltargetingmotion.cpp    |   2 +-
 indra/llcommon/llcriticaldamp.cpp          |  50 +++++++++-----
 indra/llcommon/llcriticaldamp.h            |  82 +----------------------
 indra/llui/llbutton.cpp                    |   5 +-
 indra/llui/lllayoutstack.cpp               |  12 ++--
 indra/llui/llmenugl.cpp                    |   2 +-
 indra/llui/llscrollbar.cpp                 |   5 +-
 indra/llui/lltabcontainer.cpp              |   3 +-
 indra/newview/llagentcamera.cpp            |  23 +++----
 indra/newview/lldrawable.cpp               | 104 ++++++++++++++++-------------
 indra/newview/llfasttimerview.cpp          |   4 +-
 indra/newview/llfloatercolorpicker.cpp     |   5 +-
 indra/newview/llfloatersnapshot.cpp        |   5 +-
 indra/newview/llfolderviewitem.cpp         |   7 +-
 indra/newview/llfollowcam.cpp              |  17 ++---
 indra/newview/llhudnametag.cpp             |   3 +-
 indra/newview/llmaniprotate.cpp            |  18 ++---
 indra/newview/llmanipscale.cpp             |   5 +-
 indra/newview/llmaniptranslate.cpp         |  13 ++--
 indra/newview/llnetmap.cpp                 |   3 +-
 indra/newview/llselectmgr.cpp              |   9 ---
 indra/newview/lltexturectrl.cpp            |   4 +-
 indra/newview/llviewerdisplay.cpp          |   3 +-
 indra/newview/llvoavatar.cpp               |  12 ++--
 indra/newview/llworldmapview.cpp           |   4 +-
 30 files changed, 179 insertions(+), 245 deletions(-)

(limited to 'indra')

diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp
index 35508e0a87..4e8c3268c5 100644
--- a/indra/llcharacter/lleditingmotion.cpp
+++ b/indra/llcharacter/lleditingmotion.cpp
@@ -38,6 +38,8 @@
 // Constants
 //-----------------------------------------------------------------------------
 const LLQuaternion EDIT_MOTION_WRIST_ROTATION(F_PI_BY_TWO * 0.7f, LLVector3(1.0f, 0.0f, 0.0f));
+const F32 TARGET_LAG_HALF_LIFE	= 0.1f;		// half-life of IK targeting
+const F32 TORSO_LAG_HALF_LIFE = 0.2f;
 const F32 MAX_TIME_DELTA = 2.f; //max two seconds a frame for calculating interpolation
 
 S32 LLEditingMotion::sHandPose = LLHandMotion::HAND_POSE_RELAXED_R;
@@ -230,7 +232,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)
 		mIKSolver.solve();
 
 		// use blending...
-		F32 slerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaTargetLagHalfLife);
+		F32 slerp_amt = LLCriticalDamp::getInterpolant(TARGET_LAG_HALF_LIFE);
 		shoulderRot = slerp(slerp_amt, mShoulderJoint.getRotation(), shoulderRot);
 		elbowRot = slerp(slerp_amt, mElbowJoint.getRotation(), elbowRot);
 
diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp
index 1eddd0f449..2b1aa194a9 100644
--- a/indra/llcharacter/llheadrotmotion.cpp
+++ b/indra/llcharacter/llheadrotmotion.cpp
@@ -182,8 +182,8 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
 	LLQuaternion	currentRootRotWorld = mRootJoint->getWorldRotation();
 	LLQuaternion	currentInvRootRotWorld = ~currentRootRotWorld;
 
-	F32 head_slerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaHeadLookAtLagHalfLife);
-	F32 torso_slerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaTorsoLookAtLagHalfLife);
+	F32 head_slerp_amt = LLCriticalDamp::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE);
+	F32 torso_slerp_amt = LLCriticalDamp::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE);
 
 	LLVector3* targetPos = (LLVector3*)mCharacter->getAnimationData("LookAtPoint");
 
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index f394cf2635..905d1c2d26 100644
--- a/indra/llcharacter/llkeyframemotion.cpp
+++ b/indra/llcharacter/llkeyframemotion.cpp
@@ -1031,11 +1031,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
 	if (constraint->mSharedData->mChainLength != 0 &&
 		dist_vec_squared(root_pos, target_pos) * 0.95f > constraint->mTotalLength * constraint->mTotalLength)
 	{
-		constraint->mWeight = lerp(constraint->mWeight, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
+		constraint->mWeight = lerp(constraint->mWeight, 0.f, LLCriticalDamp::getInterpolant(0.1f));
 	}
 	else
 	{
-		constraint->mWeight = lerp(constraint->mWeight, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaSmallish));
+		constraint->mWeight = lerp(constraint->mWeight, 1.f, LLCriticalDamp::getInterpolant(0.3f));
 	}
 
 	F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f : 
@@ -1084,7 +1084,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
 			F32 time_constant = 1.f / clamp_rescale(constraint->mFixupDistanceRMS, 0.f, 0.5f, 0.2f, 8.f);
 //			llinfos << "Interpolant " << LLCriticalDamp::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << llendl;
 			positions[joint_num] = lerp(positions[joint_num], kinematic_position, 
-				LLCriticalDamp::getInterpolant(time_constant));
+				LLCriticalDamp::getInterpolant(time_constant, FALSE));
 		}
 
 		S32 iteration_count;
diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp
index d17c123e54..8422553beb 100644
--- a/indra/llcharacter/llkeyframewalkmotion.cpp
+++ b/indra/llcharacter/llkeyframewalkmotion.cpp
@@ -287,7 +287,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
 		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(InterpDeltaSpeedAdjustTime));
+		F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(SPEED_ADJUST_TIME_CONSTANT));
 
 		// limit that rate at which the speed adjustment changes
 		F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time);
@@ -305,8 +305,8 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
 	{	// standing/turning
 
 		// damp out speed adjustment to 0
-		mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaSmall));
-		//mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(InterpDeltaSmall));
+		mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(0.2f));
+		//mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(0.2f));
 	}
 
 	// broadcast walk speed change
diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp
index d4db0d84c9..a07f9f4d2e 100644
--- a/indra/llcharacter/llmotion.cpp
+++ b/indra/llcharacter/llmotion.cpp
@@ -73,7 +73,7 @@ void LLMotion::fadeOut()
 {
 	if (mFadeWeight > 0.01f)
 	{
-		mFadeWeight = lerp(mFadeWeight, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaFadeWeight));
+		mFadeWeight = lerp(mFadeWeight, 0.f, LLCriticalDamp::getInterpolant(0.15f));
 	}
 	else
 	{
@@ -88,7 +88,7 @@ void LLMotion::fadeIn()
 {
 	if (mFadeWeight < 0.99f)
 	{
-		mFadeWeight = lerp(mFadeWeight, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaFadeWeight));
+		mFadeWeight = lerp(mFadeWeight, 1.f, LLCriticalDamp::getInterpolant(0.15f));
 	}
 	else
 	{
diff --git a/indra/llcharacter/lltargetingmotion.cpp b/indra/llcharacter/lltargetingmotion.cpp
index 6ce6ce31d6..fa5f06328e 100644
--- a/indra/llcharacter/lltargetingmotion.cpp
+++ b/indra/llcharacter/lltargetingmotion.cpp
@@ -106,7 +106,7 @@ BOOL LLTargetingMotion::onActivate()
 //-----------------------------------------------------------------------------
 BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask)
 {
-	F32 slerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaTorsoTargetLagHalfLife);
+	F32 slerp_amt = LLCriticalDamp::getInterpolant(TORSO_TARGET_HALF_LIFE);
 
 	LLVector3 target;
 	LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint");
diff --git a/indra/llcommon/llcriticaldamp.cpp b/indra/llcommon/llcriticaldamp.cpp
index 27fef0e6dc..49aac9ce75 100644
--- a/indra/llcommon/llcriticaldamp.cpp
+++ b/indra/llcommon/llcriticaldamp.cpp
@@ -32,9 +32,8 @@
 // static members
 //-----------------------------------------------------------------------------
 LLFrameTimer LLCriticalDamp::sInternalTimer;
+std::map<F32, F32> LLCriticalDamp::sInterpolants;
 F32 LLCriticalDamp::sTimeDelta;
-F32	LLCriticalDamp::sInterpolants[kNumCachedInterpolants];
-F32 LLCriticalDamp::sInterpolatedValues[kNumCachedInterpolants];
 
 //-----------------------------------------------------------------------------
 // LLCriticalDamp()
@@ -42,17 +41,6 @@ F32 LLCriticalDamp::sInterpolatedValues[kNumCachedInterpolants];
 LLCriticalDamp::LLCriticalDamp()
 {
 	sTimeDelta = 0.f;
-
-	// Init the core interpolant values (to which many, many enums map)
-	//
-	setInterpolantConstant(InterpDelta_0_025, 0.025f);
-	setInterpolantConstant(InterpDelta_0_05,  0.05f );
-	setInterpolantConstant(InterpDelta_0_06,  0.06f);
-	setInterpolantConstant(InterpDelta_0_10,  0.10f);
-	setInterpolantConstant(InterpDelta_0_15,  0.15f);
-	setInterpolantConstant(InterpDelta_0_20,  0.20f);
-	setInterpolantConstant(InterpDelta_0_25,  0.25f);
-	setInterpolantConstant(InterpDelta_0_30,  0.30f);
 }
 
 // static
@@ -63,10 +51,40 @@ void LLCriticalDamp::updateInterpolants()
 {
 	sTimeDelta = sInternalTimer.getElapsedTimeAndResetF32();
 
-	U32 i;
-	for (i = 0; i < kNumCachedInterpolants; i++)
+	F32 time_constant;
+
+	for (std::map<F32, F32>::iterator iter = sInterpolants.begin();
+		 iter != sInterpolants.end(); iter++)
+	{
+		time_constant = iter->first;
+		F32 new_interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant);
+		new_interpolant = llclamp(new_interpolant, 0.f, 1.f);
+		sInterpolants[time_constant] = new_interpolant;
+	}
+} 
+
+//-----------------------------------------------------------------------------
+// getInterpolant()
+//-----------------------------------------------------------------------------
+F32 LLCriticalDamp::getInterpolant(const F32 time_constant, BOOL use_cache)
+{
+	if (time_constant == 0.f)
+	{
+		return 1.f;
+	}
+
+	if (use_cache && sInterpolants.count(time_constant))
 	{
-		sInterpolatedValues[i] = llclamp(sTimeDelta / sInterpolants[ i], 0.0f, 1.0f);
+		return sInterpolants[time_constant];
 	}
+	
+	F32 interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant);
+	interpolant = llclamp(interpolant, 0.f, 1.f);
+	if (use_cache)
+	{
+		sInterpolants[time_constant] = interpolant;
+	}
+
+	return interpolant;
 }
 
diff --git a/indra/llcommon/llcriticaldamp.h b/indra/llcommon/llcriticaldamp.h
index 19a2ddb77a..52f052ae25 100644
--- a/indra/llcommon/llcriticaldamp.h
+++ b/indra/llcommon/llcriticaldamp.h
@@ -32,98 +32,22 @@
 
 #include "llframetimer.h"
 
-// These enums each represent one fixed-time delta value
-// that we interpolate once given the actual sTimeDelta time
-// that has passed. This allows us to calculate the interp portion
-// of those values once and then look them up repeatedly per frame.
-//
-enum InterpDelta
-{	
-	InterpDelta_0_025,		// 0.025
-	InterpDeltaTeenier					= InterpDelta_0_025,
-	InterpDeltaFolderOpenTime			= InterpDelta_0_025,
-	InterpDeltaFolderCloseTime			= InterpDelta_0_025,
-	InterpDeltaCameraFocusHalfLife		= InterpDelta_0_025,	// USED TO BE ZERO....
-
-	InterpDelta_0_05,		// 0.05
-	InterpDeltaTeeny		= InterpDelta_0_05,
-
-	InterpDelta_0_06,		// 0.06
-	InterpDeltaObjectDampingConstant	= InterpDelta_0_06,	
-	InterpDeltaCameraZoomHalfLife		= InterpDelta_0_06,
-	InterpDeltaFovZoomHalfLife			= InterpDelta_0_06,
-	InterpDeltaManipulatorScaleHalfLife	= InterpDelta_0_06,
-	InterpDeltaContextFadeTime			= InterpDelta_0_06,
-
-	InterpDelta_0_10,		// 0.10
-	InterpDeltaSmaller					= InterpDelta_0_10,
-	InterpDeltaTargetLagHalfLife		= InterpDelta_0_10,
-	InterpDeltaSpeedAdjustTime			= InterpDelta_0_10,
-
-	InterpDelta_0_15,		// 0.15
-	InterpDeltaFadeWeight				= InterpDelta_0_15,
-	InterpDeltaHeadLookAtLagHalfLife	= InterpDelta_0_15,
-
-	InterpDelta_0_20,		// 0.20
-	InterpDeltaSmall					= InterpDelta_0_20,
-	InterpDeltaTorsoLagHalfLife			= InterpDelta_0_20,
-	InterpDeltaPositionDampingTC		= InterpDelta_0_20,
-
-	InterpDelta_0_25,		// 0.25
-	InterpDeltaCameraLagHalfLife		= InterpDelta_0_25,
-	InterpDeltaTorsoTargetLagHalfLife	= InterpDelta_0_25,
-	InterpDeltaTorsoLookAtLagHalfLife	= InterpDelta_0_25,
-
-	InterpDelta_0_30,		// 0.3
-	InterpDeltaSmallish		= InterpDelta_0_30,
-
-	// Dynamically set interpolants which use setInterpolantConstant
-	//
-	InterpDeltaCameraSmoothingHalfLife,	
-	InterpDeltaBehindnessLag,
-	InterpDeltaFocusLag,
-	InterpDeltaPositionLag,
-	InterpDeltaOpenTime,
-	InterpDeltaCloseTime,		
-
-	kNumCachedInterpolants
-};
-
 class LL_COMMON_API LLCriticalDamp 
 {
 public:
 	LLCriticalDamp();
 
-	// Updates all the known interp delta values for fast lookup in calls to getInterpolant(InterpDelta)
-	//
+	// MANIPULATORS
 	static void updateInterpolants();
 
-	static inline void setInterpolantConstant(InterpDelta whichDelta, const F32 time_constant)
-	{
-		llassert(whichDelta < kNumCachedInterpolants);
-		sInterpolants[whichDelta] = time_constant;
-	}
-
 	// ACCESSORS
-	static inline F32 getInterpolant(InterpDelta whichDelta)
-	{
-		llassert(whichDelta < kNumCachedInterpolants);
-		return sInterpolatedValues[whichDelta];
-	}
-
-	static inline F32 getInterpolant(const F32 time_constant)
-	{
-		return llclamp((sTimeDelta / time_constant), 0.0f, 1.0f);
-	}
+	static F32 getInterpolant(const F32 time_constant, BOOL use_cache = TRUE);
 
 protected:	
 	static LLFrameTimer sInternalTimer;	// frame timer for calculating deltas
 
-	//static std::map<F32, F32> 	sInterpolants;
-	static F32					sInterpolants[kNumCachedInterpolants];
-	static F32					sInterpolatedValues[kNumCachedInterpolants];
+	static std::map<F32, F32> 	sInterpolants;
 	static F32					sTimeDelta;
 };
 
 #endif  // LL_LLCRITICALDAMP_H
-
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 3dfcb3ffa1..705fe16559 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -758,11 +758,11 @@ void LLButton::draw()
 		mCurGlowStrength = lerp(mCurGlowStrength,
 					mFlashing ? (flash? 1.0 : 0.0)
 					: mHoverGlowStrength,
-					LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
+					LLCriticalDamp::getInterpolant(0.05f));
 	}
 	else
 	{
-		mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
+		mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
 	}
 
 	// Draw button image, if available.
@@ -1247,4 +1247,3 @@ BOOL LLButton::handleDoubleClick(S32 x, S32 y, MASK mask)
 	// just treat a double click as a second click
 	return handleMouseDown(x, y, mask);
 }
-
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 32383b1f1d..3adc1a6c70 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -229,10 +229,7 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p)
 	mOpenTimeConstant(p.open_time_constant),
 	mCloseTimeConstant(p.close_time_constant),
 	mResizeBarOverlap(p.resize_bar_overlap)
-{
-	LLCriticalDamp::setInterpolantConstant(InterpDeltaCloseTime, mCloseTimeConstant);
-	LLCriticalDamp::setInterpolantConstant(InterpDeltaOpenTime,  mOpenTimeConstant);
-}
+{}
 
 LLLayoutStack::~LLLayoutStack()
 {
@@ -595,7 +592,7 @@ bool LLLayoutStack::animatePanels()
 			{
 				if (!mAnimatedThisFrame)
 				{
-					panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaOpenTime));
+					panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
 					if (panelp->mVisibleAmt > 0.99f)
 					{
 						panelp->mVisibleAmt = 1.f;
@@ -620,7 +617,7 @@ bool LLLayoutStack::animatePanels()
 			{
 				if (!mAnimatedThisFrame)
 				{
-					panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaCloseTime));
+					panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
 					if (panelp->mVisibleAmt < 0.001f)
 					{
 						panelp->mVisibleAmt = 0.f;
@@ -647,7 +644,7 @@ bool LLLayoutStack::animatePanels()
 			{
 				if (!mAnimatedThisFrame)
 				{
-					panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(InterpDeltaCloseTime));
+					panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
 				}
 			
 				if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
@@ -858,4 +855,3 @@ void LLLayoutStack::updateResizeBarLimits()
 		previous_visible_panelp = visible_panelp;
 	}
 }
-
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index f142be885d..cd6cc6a75e 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3673,7 +3673,7 @@ void LLTearOffMenu::draw()
 	if (getRect().getHeight() != mTargetHeight)
 	{
 		// animate towards target height
-		reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(InterpDeltaTeeny))));
+		reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f))));
 	}
 	LLFloater::draw();
 }
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index d65b4431a8..5d3bf7a670 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -493,11 +493,11 @@ void LLScrollbar::draw()
 	BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
 	if (hovered)
 	{
-		mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
+		mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f));
 	}
 	else
 	{
-		mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
+		mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
 	}
 
 	// Draw background and thumb.
@@ -642,4 +642,3 @@ void LLScrollbar::onLineDownBtnPressed( const LLSD& data )
 {
 	changeLine( mStepSize, TRUE );
 }
-
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 1e64cd0df8..5fc2cc350d 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -406,7 +406,7 @@ void LLTabContainer::draw()
 		}
 	}
 
-	setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(InterpDeltaTeeny)));
+	setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
 
 	BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0));
 	if (!mIsVertical)
@@ -2046,4 +2046,3 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y)
 		}
 	}
 }
-
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index a40d9cd318..9025c7af8b 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -179,7 +179,7 @@ LLAgentCamera::LLAgentCamera() :
 
 	clearGeneralKeys();
 	clearOrbitKeys();
-	clearPanKeys();	
+	clearPanKeys();
 }
 
 // Requires gSavedSettings to be initialized.
@@ -192,9 +192,6 @@ void LLAgentCamera::init()
 
 	mDrawDistance = gSavedSettings.getF32("RenderFarClip");
 
-	const F32 SMOOTHING_HALF_LIFE = 0.02f;
-	LLCriticalDamp::setInterpolantConstant(InterpDeltaCameraSmoothingHalfLife, gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE);
-
 	LLViewerCamera::getInstance()->setView(DEFAULT_FIELD_OF_VIEW);
 	// Leave at 0.1 meters until we have real near clip management
 	LLViewerCamera::getInstance()->setNear(0.1f);
@@ -340,7 +337,7 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera)
 			LLVector3 agent_at_axis = gAgent.getAtAxis();
 			agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector());
 			agent_at_axis.normalize();
-			gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(InterpDeltaSmall)));
+			gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(0.3f)));
 		}
 
 		setFocusOnAvatar(TRUE, ANIMATE);
@@ -1249,7 +1246,7 @@ void LLAgentCamera::updateCamera()
 	gAgentCamera.clearPanKeys();
 
 	// lerp camera focus offset
-	mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(InterpDeltaCameraFocusHalfLife));
+	mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(CAMERA_FOCUS_HALF_LIFE));
 
 	if ( mCameraMode == CAMERA_MODE_FOLLOW )
 	{
@@ -1364,8 +1361,10 @@ void LLAgentCamera::updateCamera()
 		mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode;
 		
 		if (cameraThirdPerson() && !mCameraSmoothingStop)
-		{			
-			F32 smoothing = LLCriticalDamp::getInterpolant(InterpDeltaCameraSmoothingHalfLife);
+		{
+			const F32 SMOOTHING_HALF_LIFE = 0.02f;
+			
+			F32 smoothing = LLCriticalDamp::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE);
 					
 			if (!mFocusObject)  // we differentiate on avatar mode 
 			{
@@ -1395,7 +1394,7 @@ void LLAgentCamera::updateCamera()
 	}
 
 	
-	mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(InterpDeltaFovZoomHalfLife));
+	mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(FOV_ZOOM_HALF_LIFE));
 
 //	llinfos << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << llendl;
 
@@ -1810,7 +1809,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 
 			if (mTargetCameraDistance != mCurrentCameraDistance)
 			{
-				F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaCameraZoomHalfLife);
+				F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(CAMERA_ZOOM_HALF_LIFE);
 
 				mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt);
 			}
@@ -1828,7 +1827,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 			if (isAgentAvatarValid())
 			{
 				LLVector3d camera_lag_d;
-				F32 lag_interp = LLCriticalDamp::getInterpolant(InterpDeltaCameraLagHalfLife);
+				F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE);
 				LLVector3 target_lag;
 				LLVector3 vel = gAgent.getVelocity();
 
@@ -1873,7 +1872,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 				}
 				else
 				{
-					mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(InterpDeltaCameraLagHalfLife));
+					mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(0.15f));
 				}
 
 				camera_lag_d.setVec(mCameraLag);
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 235da41998..d29181a3ce 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -492,83 +492,97 @@ F32 LLDrawable::updateXform(BOOL undamped)
 	BOOL damped = !undamped;
 
 	// Position
-	LLVector3 old_pos	 = mXform.getPosition();
-
-	// get agent position or parent-relative position as appropriate
-	//
-	LLVector3 target_pos = mXform.isRoot() ? mVObjp->getPositionAgent() : mVObjp->getPosition();
-
+	LLVector3 old_pos(mXform.getPosition());
+	LLVector3 target_pos;
+	if (mXform.isRoot())
+	{
+		// get root position in your agent's region
+		target_pos = mVObjp->getPositionAgent();
+	}
+	else
+	{
+		// parent-relative position
+		target_pos = mVObjp->getPosition();
+	}
+	
 	// Rotation
 	LLQuaternion old_rot(mXform.getRotation());
 	LLQuaternion target_rot = mVObjp->getRotation();
-
 	//scaling
 	LLVector3 target_scale = mVObjp->getScale();
 	LLVector3 old_scale = mCurrentScale;
 	LLVector3 dest_scale = target_scale;
-	LLVector3 scale_vec = old_scale-target_scale;
-
-	static const F32 dot_threshold = 1.0f - FLT_EPSILON;
-
-	F32 dist_squared = dist_vec_squared(old_pos, target_pos);
-
-	bool translated  = dist_squared > 0.0f;
-	bool rotated     = !mVObjp->getAngularVelocity().isExactlyZero() || (dot(old_rot, target_rot) < dot_threshold);
-	bool scaled		 = (scale_vec * scale_vec) > MIN_INTERPOLATE_DISTANCE_SQUARED;
 	
-	// Damping	
+	// Damping
+	F32 dist_squared = 0.f;
+	F32 camdist2 = (mDistanceWRTCamera * mDistanceWRTCamera);
+
 	if (damped && isVisible())
 	{
-		F32 lerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaObjectDampingConstant);
+		F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f);
 		LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt);
-		dist_squared = dist_vec_squared(new_pos, old_pos);
+		dist_squared = dist_vec_squared(new_pos, target_pos);
 
 		LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot);
-		dist_squared += fabs(1.f - dot(new_rot, old_rot)) * 10.f;
+		// FIXME: This can be negative! It is be possible for some rots to 'cancel out' pos or size changes.
+		dist_squared += (1.f - dot(new_rot, target_rot)) * 10.f;
 
 		LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt);
-		dist_squared += dist_vec_squared(new_scale, old_scale);
+		dist_squared += dist_vec_squared(new_scale, target_scale);
 
-		// If our lerp isn't moving too far, substitue the lerp'd pos for our target for this frame
-		//
-		if (dist_squared <= MAX_INTERPOLATE_DISTANCE_SQUARED)
+		if ((dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED * camdist2) &&
+			(dist_squared <= MAX_INTERPOLATE_DISTANCE_SQUARED))
 		{
 			// interpolate
 			target_pos = new_pos;
 			target_rot = new_rot;
 			target_scale = new_scale;
 		}
-		else
+		else if (mVObjp->getAngularVelocity().isExactlyZero())
 		{
-			llinfos << "skipping update due to overly large lerp" << llendl;
+			// snap to final position (only if no target omega is applied)
+			dist_squared = 0.0f;
+			if (getVOVolume() && !isRoot())
+			{ //child prim snapping to some position, needs a rebuild
+				gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
+			}
 		}
 	}
+	else
+	{
+		// The following fixes MAINT-1742 but breaks vehicles similar to MAINT-2275
+		// dist_squared = dist_vec_squared(old_pos, target_pos);
 
-	if (translated || rotated || scaled)
-	{ 
-		if (scaled)
-		{
-			mCurrentScale = target_scale;
-		}
+		// The following fixes MAINT-2247 but causes MAINT-2275
+		//dist_squared += (1.f - dot(old_rot, target_rot)) * 10.f;
+		//dist_squared += dist_vec_squared(old_scale, target_scale);
+	}
 
+	LLVector3 vec = mCurrentScale-target_scale;
+	
+	if (vec*vec > MIN_INTERPOLATE_DISTANCE_SQUARED)
+	{ //scale change requires immediate rebuild
+		mCurrentScale = target_scale;
+		gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
+	}
+	else if (!isRoot() && 
+		 (!mVObjp->getAngularVelocity().isExactlyZero() ||
+			dist_squared > 0.f))
+	{ //child prim moving relative to parent, tag as needing to be rendered atomically and rebuild
 		dist_squared = 1.f; //keep this object on the move list
-
-		//child prim moving relative to parent, tag as needing to be rendered atomically
-		//
-		if (!isRoot() && !isState(LLDrawable::ANIMATED_CHILD))
+		if (!isState(LLDrawable::ANIMATED_CHILD))
 		{			
 			setState(LLDrawable::ANIMATED_CHILD);
-		}
-
-		// Mark any components that need to be rebuilt based on what change transpired
-		//
-		if (!rotated && !scaled)
-			gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
-		else
 			gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE);
-
-		mVObjp->dirtySpatialGroup();
+			mVObjp->dirtySpatialGroup();
+		}
 	}
+	else if (!isRoot()
+		&& (   dist_vec_squared(old_pos, target_pos) > 0.f
+			|| (1.f - dot(old_rot, target_rot)) > 0.f))
+        { // update child prims moved from LSL
+                gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
+        }
 	else if (!getVOVolume() && !isAvatar())
 	{
 		movePartition();
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index 643ce63f29..e7a3f9b390 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -940,7 +940,7 @@ void LLFastTimerView::draw()
 			}
 			
 			//interpolate towards new maximum
-			last_max = (U64) lerp((F32)last_max, (F32) cur_max, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
+			last_max = (U64) lerp((F32)last_max, (F32) cur_max, LLCriticalDamp::getInterpolant(0.1f));
 			if (last_max - cur_max <= 1 ||  cur_max - last_max  <= 1)
 			{
 				last_max = cur_max;
@@ -948,7 +948,7 @@ void LLFastTimerView::draw()
 			F32 alpha_target = last_max > cur_max ?
 								llmin((F32) last_max/ (F32) cur_max - 1.f,1.f) :
 								llmin((F32) cur_max/ (F32) last_max - 1.f,1.f);
-			alpha_interp = lerp(alpha_interp, alpha_target, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
+			alpha_interp = lerp(alpha_interp, alpha_target, LLCriticalDamp::getInterpolant(0.1f));
 
 			if (mHoverID != NULL)
 			{
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index 10d31df22c..d6ebe44daa 100644
--- a/indra/newview/llfloatercolorpicker.cpp
+++ b/indra/newview/llfloatercolorpicker.cpp
@@ -525,11 +525,11 @@ void LLFloaterColorPicker::draw()
 
 	if (gFocusMgr.childHasMouseCapture(getDragHandle()))
 	{
-		mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(InterpDeltaContextFadeTime));
+		mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
 	}
 	else
 	{
-		mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaContextFadeTime));
+		mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
 	}
 
 	mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
@@ -1113,4 +1113,3 @@ void LLFloaterColorPicker::stopUsingPipette()
 		LLToolMgr::getInstance()->clearTransientTool();
 	}
 }
-
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 103eaace88..d8d62e5bbb 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -478,7 +478,7 @@ void LLSnapshotLivePreview::draw()
 		{
 			if (mFlashAlpha < 1.f)
 			{
-				mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaTeenier));
+				mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(0.02f));
 			}
 			else
 			{
@@ -487,7 +487,7 @@ void LLSnapshotLivePreview::draw()
 		}
 		else
 		{
-			mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaSmallish) * 0.5f);
+			mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f));
 		}
 
 		// Draw shining animation if appropriate.
@@ -2500,4 +2500,3 @@ BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask)
 	}
 	return TRUE;
 }
-
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 23241b57c4..3aa16b4413 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -1293,7 +1293,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
 	// animate current height towards target height
 	if (llabs(mCurHeight - mTargetHeight) > 1.f)
 	{
-		mCurHeight = lerp(mCurHeight, mTargetHeight, LLCriticalDamp::getInterpolant(mIsOpen ? InterpDeltaFolderOpenTime : InterpDeltaFolderCloseTime));
+		mCurHeight = lerp(mCurHeight, mTargetHeight, LLCriticalDamp::getInterpolant(mIsOpen ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT));
 
 		requestArrange();
 
@@ -2538,11 +2538,11 @@ void LLFolderViewFolder::draw()
 	}
 	else if (mIsOpen)
 	{
-		mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
+		mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(0.04f));
 	}
 	else
 	{
-		mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaTeenier));
+		mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(0.025f));
 	}
 
 	bool possibly_has_children = false;
@@ -2899,4 +2899,3 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde
 		}
 	}
 }
-
diff --git a/indra/newview/llfollowcam.cpp b/indra/newview/llfollowcam.cpp
index a3c1996512..b670af1782 100644
--- a/indra/newview/llfollowcam.cpp
+++ b/indra/newview/llfollowcam.cpp
@@ -148,16 +148,14 @@ LLFollowCamParams::~LLFollowCamParams() { }
 //---------------------------------------------------------
 void LLFollowCamParams::setPositionLag( F32 p ) 
 { 
-	mPositionLag = llclamp(p, FOLLOW_CAM_MIN_POSITION_LAG, FOLLOW_CAM_MAX_POSITION_LAG);
-	LLCriticalDamp::setInterpolantConstant(InterpDeltaPositionLag, mPositionLag);
+	mPositionLag = llclamp(p, FOLLOW_CAM_MIN_POSITION_LAG, FOLLOW_CAM_MAX_POSITION_LAG); 
 }
 
 
 //---------------------------------------------------------
 void LLFollowCamParams::setFocusLag( F32 f ) 
 { 
-	mFocusLag = llclamp(f, FOLLOW_CAM_MIN_FOCUS_LAG, FOLLOW_CAM_MAX_FOCUS_LAG);
-	LLCriticalDamp::setInterpolantConstant(InterpDeltaFocusLag, mFocusLag);
+	mFocusLag = llclamp(f, FOLLOW_CAM_MIN_FOCUS_LAG, FOLLOW_CAM_MAX_FOCUS_LAG); 
 }
 
 
@@ -186,7 +184,6 @@ void LLFollowCamParams::setPitch( F32 p )
 void LLFollowCamParams::setBehindnessLag( F32 b ) 
 { 
 	mBehindnessLag = llclamp(b, FOLLOW_CAM_MIN_BEHINDNESS_LAG, FOLLOW_CAM_MAX_BEHINDNESS_LAG); 
-	LLCriticalDamp::setInterpolantConstant(InterpDeltaBehindnessLag, mBehindnessLag);
 }
 
 //---------------------------------------------------------
@@ -331,11 +328,11 @@ void LLFollowCam::update()
 				F32 force = focusOffsetDistance - focusThresholdNormalizedByDistance;
 			*/
 
-			F32 focusLagLerp = LLCriticalDamp::getInterpolant(InterpDeltaFocusLag);
+			F32 focusLagLerp = LLCriticalDamp::getInterpolant( mFocusLag );
 			focus_pt_agent = lerp( focus_pt_agent, whereFocusWantsToBe, focusLagLerp );
 			mSimulatedFocusGlobal = gAgent.getPosGlobalFromAgent(focus_pt_agent);
 		}
-		mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
+		mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(0.05f));
 	}// if focus is not locked ---------------------------------------------
 
 
@@ -418,7 +415,7 @@ void LLFollowCam::update()
 		//-------------------------------------------------------------------------------------------------
 		if ( distanceFromPositionToIdealPosition > mPositionThreshold )
 		{
-			F32 positionPullLerp = LLCriticalDamp::getInterpolant(InterpDeltaPositionLag);
+			F32 positionPullLerp = LLCriticalDamp::getInterpolant( mPositionLag );
 			simulated_pos_agent = lerp( simulated_pos_agent, whereCameraPositionWantsToBe, positionPullLerp );
 		}
 
@@ -438,7 +435,7 @@ void LLFollowCam::update()
 		updateBehindnessConstraint(gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal), simulated_pos_agent);
 		mSimulatedPositionGlobal = gAgent.getPosGlobalFromAgent(simulated_pos_agent);
 
-		mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
+		mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(0.05f));
 	} // if position is not locked -----------------------------------------------------------
 
 
@@ -493,7 +490,7 @@ BOOL LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_pos
 
 		if ( cameraOffsetAngle > mBehindnessMaxAngle )
 		{
-			F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLCriticalDamp::getInterpolant(InterpDeltaBehindnessLag);
+			F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLCriticalDamp::getInterpolant(mBehindnessLag);
 			cam_position = focus + horizontalSubjectBack * (slerp(fraction, camera_offset_rotation, LLQuaternion::DEFAULT));
 			cam_position.mV[VZ] = cameraZ; // clamp z value back to what it was before we started messing with it
 			constraint_active = TRUE;
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index b94681b340..482294c8a6 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -980,7 +980,7 @@ void LLHUDNameTag::updateAll()
 //		{
 //			continue;
 //		}
-		(*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLCriticalDamp::getInterpolant(InterpDeltaPositionDampingTC));
+		(*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLCriticalDamp::getInterpolant(POSITION_DAMPING_TC));
 	}
 }
 
@@ -1083,4 +1083,3 @@ F32 LLHUDNameTag::LLHUDTextSegment::getWidth(const LLFontGL* font)
 		return width;
 	}
 }
-
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 748ac7a16e..826e8d560a 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -240,7 +240,7 @@ void LLManipRotate::render()
 
 		if (mManipPart == LL_ROT_Z)
 		{
-			mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+			mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 			gGL.pushMatrix();
 			{
 				// selected part
@@ -251,7 +251,7 @@ void LLManipRotate::render()
 		}
 		else if (mManipPart == LL_ROT_Y)
 		{
-			mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+			mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 			gGL.pushMatrix();
 			{
 				gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
@@ -262,7 +262,7 @@ void LLManipRotate::render()
 		}
 		else if (mManipPart == LL_ROT_X)
 		{
-			mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+			mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 			gGL.pushMatrix();
 			{
 				gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
@@ -273,13 +273,13 @@ void LLManipRotate::render()
 		}
 		else if (mManipPart == LL_ROT_ROLL)
 		{
-			mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+			mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 		}
 		else if (mManipPart == LL_NO_PART)
 		{
 			if (mHighlightedPart == LL_NO_PART)
 			{
-				mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+				mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 			}
 
 			LLGLEnable cull_face(GL_CULL_FACE);
@@ -294,7 +294,7 @@ void LLManipRotate::render()
 				{
 					if (mHighlightedPart == LL_ROT_Z)
 					{
-						mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+						mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 						gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
 						// hovering over part
 						gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i);
@@ -312,7 +312,7 @@ void LLManipRotate::render()
 					gGL.rotatef( 90.f, 1.f, 0.f, 0.f );
 					if (mHighlightedPart == LL_ROT_Y)
 					{
-						mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+						mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 						gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
 						// hovering over part
 						gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i);
@@ -330,7 +330,7 @@ void LLManipRotate::render()
 					gGL.rotatef( 90.f, 0.f, 1.f, 0.f );
 					if (mHighlightedPart == LL_ROT_X)
 					{
-						mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+						mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 						gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
 	
 						// hovering over part
@@ -346,7 +346,7 @@ void LLManipRotate::render()
 
 				if (mHighlightedPart == LL_ROT_ROLL)
 				{
-					mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+					mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 				}
 				
 			}
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 9802d5503e..00a0bf8894 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -535,11 +535,11 @@ void LLManipScale::highlightManipulators(S32 x, S32 y)
 	{
 		if (mHighlightedPart == MANIPULATOR_IDS[i])
 		{
-			mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+			mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 		}
 		else
 		{
-			mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+			mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
 		}
 	}
 
@@ -2082,4 +2082,3 @@ BOOL LLManipScale::canAffectSelection()
 	}
 	return can_scale;
 }
-
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 9d287e7a03..0228807dc8 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1922,18 +1922,18 @@ void LLManipTranslate::renderTranslationHandles()
 			{
 				if (index == mManipPart - LL_X_ARROW || index == mHighlightedPart - LL_X_ARROW)
 				{
-					mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
-					mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+					mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+					mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
 				}
 				else if (index == mManipPart - LL_YZ_PLANE || index == mHighlightedPart - LL_YZ_PLANE)
 				{
-					mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
-					mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+					mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+					mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
 				}
 				else
 				{
-					mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
-					mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+					mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+					mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
 				}
 			}
 
@@ -2323,4 +2323,3 @@ BOOL LLManipTranslate::canAffectSelection()
 	}
 	return can_move;
 }
-
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 274497f2b5..1bda7640bd 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -162,7 +162,7 @@ void LLNetMap::draw()
 	static LLUICachedControl<bool> auto_center("MiniMapAutoCenter", true);
 	if (auto_center)
 	{
-		mCurPan = lerp(mCurPan, mTargetPan, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
+		mCurPan = lerp(mCurPan, mTargetPan, LLCriticalDamp::getInterpolant(0.1f));
 	}
 
 	// Prepare a scissor region
@@ -987,4 +987,3 @@ void LLNetMap::handleStopTracking (const LLSD& userdata)
 		LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL));
 	}
 }
-
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index cf9d95455e..343316d30a 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -6108,14 +6108,6 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 			gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
 			gGL.begin(LLRender::LINES);
 			{
-				// Lines require an even number of verts so repeat the first
-				// vert if we don't meet that requirement
-				//
-				if (mSilhouetteVertices.size() & 0x1)
-				{
-					mSilhouetteVertices.push_back(mSilhouetteVertices[0]);
-				}
-
 				for(S32 i = 0; i < mSilhouetteVertices.size(); i += 2)
 				{
 					u_coord += u_divisor * LLSelectMgr::sHighlightUScale;
@@ -7555,4 +7547,3 @@ void LLSelectMgr::sendSelectionMove()
 
 	//saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
 }
-
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 8c5844eca7..ec36cf48c2 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -549,11 +549,11 @@ void LLFloaterTexturePicker::draw()
 
 	if (gFocusMgr.childHasMouseCapture(getDragHandle()))
 	{
-		mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(InterpDeltaContextFadeTime));
+		mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
 	}
 	else
 	{
-		mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaContextFadeTime));
+		mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
 	}
 
 	updateImageStats();
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 3f97659c66..9ffc64312d 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1033,7 +1033,7 @@ void render_hud_attachments()
 	// clamp target zoom level to reasonable values
 	gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, 0.1f, 1.f);
 	// smoothly interpolate current zoom level
-	gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLCriticalDamp::getInterpolant(InterpDeltaTeenier));
+	gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLCriticalDamp::getInterpolant(0.03f));
 
 	if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices())
 	{
@@ -1593,4 +1593,3 @@ void display_cleanup()
 {
 	gDisconnectedImagep = NULL;
 }
-
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index d28da507ea..4efd59685e 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2913,7 +2913,7 @@ void LLVOAvatar::idleUpdateWindEffect()
 		LLVector3 velocity = getVelocity();
 		F32 speed = velocity.length();
 		//RN: velocity varies too much frame to frame for this to work
-		mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(InterpDeltaTeenier));
+		mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(0.02f));
 		mLastVel = velocity;
 		LLVector4 wind;
 		wind.setVec(getRegion()->mWind.getVelocityNoisy(getPositionAgent(), 4.f) - velocity);
@@ -2934,10 +2934,13 @@ void LLVOAvatar::idleUpdateWindEffect()
 
 		wind.mV[VW] = llmin(0.025f + (speed * 0.015f) + hover_strength, 0.5f);
 		F32 interp;
-		interp = LLCriticalDamp::getInterpolant(InterpDeltaSmall);
-		if (wind.mV[VW] <= mWindVec.mV[VW])
+		if (wind.mV[VW] > mWindVec.mV[VW])
 		{
-			interp *= 2.0f;
+			interp = LLCriticalDamp::getInterpolant(0.2f);
+		}
+		else
+		{
+			interp = LLCriticalDamp::getInterpolant(0.4f);
 		}
 		mWindVec = lerp(mWindVec, wind, interp);
 	
@@ -3798,6 +3801,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
 
 			// Set the root rotation, but do so incrementally so that it
 			// lags in time by some fixed amount.
+			//F32 u = LLCriticalDamp::getInterpolant(PELVIS_LAG);
 			F32 pelvis_lag_time = 0.f;
 			if (self_in_mouselook)
 			{
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 7c3bc5988c..eeaa30aafb 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -302,8 +302,8 @@ void LLWorldMapView::draw()
 	mVisibleRegions.clear();
 
 	// animate pan if necessary
-	sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
-	sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
+	sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(0.1f));
+	sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f));
 
 	const S32 width = getRect().getWidth();
 	const S32 height = getRect().getHeight();
-- 
cgit v1.2.3