summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Madarasz (Graham) <graham@lindenlab.com>2013-03-08 15:31:37 -0800
committerGraham Madarasz (Graham) <graham@lindenlab.com>2013-03-08 15:31:37 -0800
commitf061b2b90e34d74b9c6db3606babb0402473a24d (patch)
treefeae72bd1acefaa7437250035ec0c32be02c731c
parent4b67d34c7e31e7dcc8185061e4a0b02c5da6560a (diff)
Optimize interp code to elim hundreds of divides per frame and fix jitter bugs.
-rw-r--r--doc/contributions.txt1
-rw-r--r--indra/llcharacter/lleditingmotion.cpp5
-rw-r--r--indra/llcharacter/llheadrotmotion.cpp5
-rw-r--r--indra/llcharacter/llkeyframemotion.cpp7
-rw-r--r--indra/llcharacter/llkeyframewalkmotion.cpp9
-rw-r--r--indra/llcharacter/llmotion.cpp5
-rw-r--r--indra/llcharacter/lltargetingmotion.cpp3
-rw-r--r--indra/llcommon/llcriticaldamp.cpp51
-rw-r--r--indra/llcommon/llcriticaldamp.h82
-rw-r--r--indra/llui/llbutton.cpp5
-rw-r--r--indra/llui/lllayoutstack.cpp12
-rw-r--r--indra/llui/llmenugl.cpp2
-rw-r--r--indra/llui/llscrollbar.cpp5
-rw-r--r--indra/llui/lltabcontainer.cpp3
-rw-r--r--indra/newview/llagentcamera.cpp23
-rw-r--r--indra/newview/lldrawable.cpp106
-rw-r--r--indra/newview/llfasttimerview.cpp4
-rw-r--r--indra/newview/llfloatercolorpicker.cpp5
-rw-r--r--indra/newview/llfloatersnapshot.cpp5
-rw-r--r--indra/newview/llfolderviewitem.cpp7
-rw-r--r--indra/newview/llfollowcam.cpp17
-rw-r--r--indra/newview/llhudnametag.cpp3
-rw-r--r--indra/newview/llmaniprotate.cpp18
-rw-r--r--indra/newview/llmanipscale.cpp5
-rw-r--r--indra/newview/llmaniptranslate.cpp13
-rw-r--r--indra/newview/llnetmap.cpp3
-rw-r--r--indra/newview/llselectmgr.cpp9
-rw-r--r--indra/newview/lltexturectrl.cpp4
-rw-r--r--indra/newview/llviewerdisplay.cpp3
-rwxr-xr-xindra/newview/llvoavatar.cpp12
-rw-r--r--indra/newview/llvovolume.cpp5
-rw-r--r--indra/newview/llworldmapview.cpp6
32 files changed, 260 insertions, 183 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt
index 8611331722..0cd4067527 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -901,6 +901,7 @@ Nicky Dasmijn
MAINT-873
STORM-1935
STORM-1936
+ STORM-1937
Nicky Perian
OPEN-1
STORM-1087
diff --git a/indra/llcharacter/lleditingmotion.cpp b/indra/llcharacter/lleditingmotion.cpp
index 0d0b85ba60..35508e0a87 100644
--- a/indra/llcharacter/lleditingmotion.cpp
+++ b/indra/llcharacter/lleditingmotion.cpp
@@ -38,8 +38,6 @@
// 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;
@@ -232,7 +230,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)
mIKSolver.solve();
// use blending...
- F32 slerp_amt = LLCriticalDamp::getInterpolant(TARGET_LAG_HALF_LIFE);
+ F32 slerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaTargetLagHalfLife);
shoulderRot = slerp(slerp_amt, mShoulderJoint.getRotation(), shoulderRot);
elbowRot = slerp(slerp_amt, mElbowJoint.getRotation(), elbowRot);
@@ -258,3 +256,4 @@ void LLEditingMotion::onDeactivate()
// End
+
diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp
index 15a58a8389..1eddd0f449 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(HEAD_LOOKAT_LAG_HALF_LIFE);
- F32 torso_slerp_amt = LLCriticalDamp::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE);
+ F32 head_slerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaHeadLookAtLagHalfLife);
+ F32 torso_slerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaTorsoLookAtLagHalfLife);
LLVector3* targetPos = (LLVector3*)mCharacter->getAnimationData("LookAtPoint");
@@ -530,3 +530,4 @@ void LLEyeMotion::onDeactivate()
}
// End
+
diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp
index c6f45bffa2..f394cf2635 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(0.1f));
+ constraint->mWeight = lerp(constraint->mWeight, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
}
else
{
- constraint->mWeight = lerp(constraint->mWeight, 1.f, LLCriticalDamp::getInterpolant(0.3f));
+ constraint->mWeight = lerp(constraint->mWeight, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaSmallish));
}
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, FALSE));
+ LLCriticalDamp::getInterpolant(time_constant));
}
S32 iteration_count;
@@ -2304,3 +2304,4 @@ LLKeyframeMotion::JointConstraint::~JointConstraint()
}
// End
+
diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp
index d52eb89a5c..d17c123e54 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(SPEED_ADJUST_TIME_CONSTANT));
+ F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(InterpDeltaSpeedAdjustTime));
// 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(0.2f));
- //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(0.2f));
+ mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaSmall));
+ //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(InterpDeltaSmall));
}
// broadcast walk speed change
@@ -383,10 +383,11 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask)
F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor;
// roll is critically damped interpolation between current roll and angular velocity-derived target roll
- mRoll = lerp(mRoll, target_roll, LLCriticalDamp::getInterpolant(0.1f));
+ mRoll = lerp(mRoll, target_roll, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f));
mPelvisState->setRotation(roll);
return TRUE;
}
+
diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp
index 2551f125d0..d4db0d84c9 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(0.15f));
+ mFadeWeight = lerp(mFadeWeight, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaFadeWeight));
}
else
{
@@ -88,7 +88,7 @@ void LLMotion::fadeIn()
{
if (mFadeWeight < 0.99f)
{
- mFadeWeight = lerp(mFadeWeight, 1.f, LLCriticalDamp::getInterpolant(0.15f));
+ mFadeWeight = lerp(mFadeWeight, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaFadeWeight));
}
else
{
@@ -169,3 +169,4 @@ BOOL LLMotion::canDeprecate()
}
// End
+
diff --git a/indra/llcharacter/lltargetingmotion.cpp b/indra/llcharacter/lltargetingmotion.cpp
index 489aef923c..6ce6ce31d6 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(TORSO_TARGET_HALF_LIFE);
+ F32 slerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaTorsoTargetLagHalfLife);
LLVector3 target;
LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint");
@@ -169,3 +169,4 @@ void LLTargetingMotion::onDeactivate()
// End
+
diff --git a/indra/llcommon/llcriticaldamp.cpp b/indra/llcommon/llcriticaldamp.cpp
index 87d79b1ee0..27fef0e6dc 100644
--- a/indra/llcommon/llcriticaldamp.cpp
+++ b/indra/llcommon/llcriticaldamp.cpp
@@ -32,8 +32,9 @@
// static members
//-----------------------------------------------------------------------------
LLFrameTimer LLCriticalDamp::sInternalTimer;
-std::map<F32, F32> LLCriticalDamp::sInterpolants;
F32 LLCriticalDamp::sTimeDelta;
+F32 LLCriticalDamp::sInterpolants[kNumCachedInterpolants];
+F32 LLCriticalDamp::sInterpolatedValues[kNumCachedInterpolants];
//-----------------------------------------------------------------------------
// LLCriticalDamp()
@@ -41,6 +42,17 @@ F32 LLCriticalDamp::sTimeDelta;
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
@@ -51,39 +63,10 @@ void LLCriticalDamp::updateInterpolants()
{
sTimeDelta = sInternalTimer.getElapsedTimeAndResetF32();
- 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)
+ U32 i;
+ for (i = 0; i < kNumCachedInterpolants; i++)
{
- return 1.f;
+ sInterpolatedValues[i] = llclamp(sTimeDelta / sInterpolants[ i], 0.0f, 1.0f);
}
-
- if (use_cache && sInterpolants.count(time_constant))
- {
- 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 52f052ae25..19a2ddb77a 100644
--- a/indra/llcommon/llcriticaldamp.h
+++ b/indra/llcommon/llcriticaldamp.h
@@ -32,22 +32,98 @@
#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();
- // MANIPULATORS
+ // Updates all the known interp delta values for fast lookup in calls to getInterpolant(InterpDelta)
+ //
static void updateInterpolants();
+ static inline void setInterpolantConstant(InterpDelta whichDelta, const F32 time_constant)
+ {
+ llassert(whichDelta < kNumCachedInterpolants);
+ sInterpolants[whichDelta] = time_constant;
+ }
+
// ACCESSORS
- static F32 getInterpolant(const F32 time_constant, BOOL use_cache = TRUE);
+ 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);
+ }
protected:
static LLFrameTimer sInternalTimer; // frame timer for calculating deltas
- static std::map<F32, F32> sInterpolants;
+ //static std::map<F32, F32> sInterpolants;
+ static F32 sInterpolants[kNumCachedInterpolants];
+ static F32 sInterpolatedValues[kNumCachedInterpolants];
static F32 sTimeDelta;
};
#endif // LL_LLCRITICALDAMP_H
+
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 705fe16559..3dfcb3ffa1 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(0.05f));
+ LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
}
else
{
- mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
}
// Draw button image, if available.
@@ -1247,3 +1247,4 @@ 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 4c730286da..c93f538570 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -229,7 +229,10 @@ 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()
{
@@ -592,7 +595,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
+ panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaOpenTime));
if (panelp->mVisibleAmt > 0.99f)
{
panelp->mVisibleAmt = 1.f;
@@ -617,7 +620,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+ panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaCloseTime));
if (panelp->mVisibleAmt < 0.001f)
{
panelp->mVisibleAmt = 0.f;
@@ -644,7 +647,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+ panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(InterpDeltaCloseTime));
}
if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
@@ -855,3 +858,4 @@ void LLLayoutStack::updateResizeBarLimits()
previous_visible_panelp = visible_panelp;
}
}
+
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index cd6cc6a75e..f142be885d 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(0.05f))));
+ reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(InterpDeltaTeeny))));
}
LLFloater::draw();
}
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 5d3bf7a670..d65b4431a8 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(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
}
else
{
- mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
}
// Draw background and thumb.
@@ -642,3 +642,4 @@ void LLScrollbar::onLineDownBtnPressed( const LLSD& data )
{
changeLine( mStepSize, TRUE );
}
+
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 5fc2cc350d..1e64cd0df8 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(0.08f)));
+ setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(InterpDeltaTeeny)));
BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0));
if (!mIsVertical)
@@ -2046,3 +2046,4 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y)
}
}
}
+
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 9025c7af8b..a40d9cd318 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,6 +192,9 @@ 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);
@@ -337,7 +340,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(0.3f)));
+ gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(InterpDeltaSmall)));
}
setFocusOnAvatar(TRUE, ANIMATE);
@@ -1246,7 +1249,7 @@ void LLAgentCamera::updateCamera()
gAgentCamera.clearPanKeys();
// lerp camera focus offset
- mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(CAMERA_FOCUS_HALF_LIFE));
+ mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(InterpDeltaCameraFocusHalfLife));
if ( mCameraMode == CAMERA_MODE_FOLLOW )
{
@@ -1361,10 +1364,8 @@ void LLAgentCamera::updateCamera()
mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode;
if (cameraThirdPerson() && !mCameraSmoothingStop)
- {
- const F32 SMOOTHING_HALF_LIFE = 0.02f;
-
- F32 smoothing = LLCriticalDamp::getInterpolant(gSavedSettings.getF32("CameraPositionSmoothing") * SMOOTHING_HALF_LIFE, FALSE);
+ {
+ F32 smoothing = LLCriticalDamp::getInterpolant(InterpDeltaCameraSmoothingHalfLife);
if (!mFocusObject) // we differentiate on avatar mode
{
@@ -1394,7 +1395,7 @@ void LLAgentCamera::updateCamera()
}
- mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(FOV_ZOOM_HALF_LIFE));
+ mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(InterpDeltaFovZoomHalfLife));
// llinfos << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << llendl;
@@ -1809,7 +1810,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
if (mTargetCameraDistance != mCurrentCameraDistance)
{
- F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(CAMERA_ZOOM_HALF_LIFE);
+ F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaCameraZoomHalfLife);
mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt);
}
@@ -1827,7 +1828,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
if (isAgentAvatarValid())
{
LLVector3d camera_lag_d;
- F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE);
+ F32 lag_interp = LLCriticalDamp::getInterpolant(InterpDeltaCameraLagHalfLife);
LLVector3 target_lag;
LLVector3 vel = gAgent.getVelocity();
@@ -1872,7 +1873,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
}
else
{
- mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(0.15f));
+ mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(InterpDeltaCameraLagHalfLife));
}
camera_lag_d.setVec(mCameraLag);
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index d29181a3ce..dc0e256ebb 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -492,97 +492,83 @@ F32 LLDrawable::updateXform(BOOL undamped)
BOOL damped = !undamped;
// Position
- 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();
- }
-
+ LLVector3 old_pos = mXform.getPosition();
+
+ // get agent position or parent-relative position as appropriate
+ //
+ LLVector3 target_pos = mXform.isRoot() ? mVObjp->getPositionAgent() : 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;
-
- // Damping
- F32 dist_squared = 0.f;
- F32 camdist2 = (mDistanceWRTCamera * mDistanceWRTCamera);
+ 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
if (damped && isVisible())
{
- F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f);
+ F32 lerp_amt = LLCriticalDamp::getInterpolant(InterpDeltaObjectDampingConstant);
LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt);
- dist_squared = dist_vec_squared(new_pos, target_pos);
+ dist_squared = dist_vec_squared(new_pos, old_pos);
LLQuaternion new_rot = nlerp(lerp_amt, old_rot, target_rot);
- // 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;
+ dist_squared += fabs(1.f - dot(new_rot, old_rot)) * 10.f;
LLVector3 new_scale = lerp(old_scale, target_scale, lerp_amt);
- dist_squared += dist_vec_squared(new_scale, target_scale);
+ dist_squared += dist_vec_squared(new_scale, old_scale);
- if ((dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED * camdist2) &&
- (dist_squared <= MAX_INTERPOLATE_DISTANCE_SQUARED))
+ // 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)
{
// interpolate
target_pos = new_pos;
target_rot = new_rot;
target_scale = new_scale;
}
- else if (mVObjp->getAngularVelocity().isExactlyZero())
+ else
{
- // 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);
- }
+ llinfos << "skipping update due to overly large lerp" << llendl;
}
}
- else
- {
- // The following fixes MAINT-1742 but breaks vehicles similar to MAINT-2275
- // dist_squared = dist_vec_squared(old_pos, target_pos);
- // 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);
- }
+ if (translated || rotated || scaled)
+ {
+ if (scaled)
+ {
+ mCurrentScale = 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
- if (!isState(LLDrawable::ANIMATED_CHILD))
+
+ //child prim moving relative to parent, tag as needing to be rendered atomically
+ //
+ if (!isRoot() && !isState(LLDrawable::ANIMATED_CHILD))
{
setState(LLDrawable::ANIMATED_CHILD);
- gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE);
- mVObjp->dirtySpatialGroup();
}
+
+ // 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();
}
- 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();
@@ -781,7 +767,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
}
pos -= camera.getOrigin();
- mDistanceWRTCamera = llround(pos.magVec(), 0.01f);
+ mDistanceWRTCamera = 20.0f;//llround(pos.magVec(), 0.01f);
mVObjp->updateLOD();
}
}
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index e7a3f9b390..643ce63f29 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(0.1f));
+ last_max = (U64) lerp((F32)last_max, (F32) cur_max, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
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(0.1f));
+ alpha_interp = lerp(alpha_interp, alpha_target, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
if (mHoverID != NULL)
{
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index d6ebe44daa..10d31df22c 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(CONTEXT_FADE_TIME));
+ mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(InterpDeltaContextFadeTime));
}
else
{
- mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
+ mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaContextFadeTime));
}
mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
@@ -1113,3 +1113,4 @@ void LLFloaterColorPicker::stopUsingPipette()
LLToolMgr::getInstance()->clearTransientTool();
}
}
+
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index d8d62e5bbb..103eaace88 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(0.02f));
+ mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(InterpDeltaTeenier));
}
else
{
@@ -487,7 +487,7 @@ void LLSnapshotLivePreview::draw()
}
else
{
- mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f));
+ mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaSmallish) * 0.5f);
}
// Draw shining animation if appropriate.
@@ -2500,3 +2500,4 @@ BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask)
}
return TRUE;
}
+
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 3aa16b4413..23241b57c4 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 ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT));
+ mCurHeight = lerp(mCurHeight, mTargetHeight, LLCriticalDamp::getInterpolant(mIsOpen ? InterpDeltaFolderOpenTime : InterpDeltaFolderCloseTime));
requestArrange();
@@ -2538,11 +2538,11 @@ void LLFolderViewFolder::draw()
}
else if (mIsOpen)
{
- mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(0.04f));
+ mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
}
else
{
- mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(0.025f));
+ mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaTeenier));
}
bool possibly_has_children = false;
@@ -2899,3 +2899,4 @@ bool LLInventorySort::operator()(const LLFolderViewItem* const& a, const LLFolde
}
}
}
+
diff --git a/indra/newview/llfollowcam.cpp b/indra/newview/llfollowcam.cpp
index b670af1782..a3c1996512 100644
--- a/indra/newview/llfollowcam.cpp
+++ b/indra/newview/llfollowcam.cpp
@@ -148,14 +148,16 @@ LLFollowCamParams::~LLFollowCamParams() { }
//---------------------------------------------------------
void LLFollowCamParams::setPositionLag( F32 p )
{
- mPositionLag = llclamp(p, FOLLOW_CAM_MIN_POSITION_LAG, FOLLOW_CAM_MAX_POSITION_LAG);
+ mPositionLag = llclamp(p, FOLLOW_CAM_MIN_POSITION_LAG, FOLLOW_CAM_MAX_POSITION_LAG);
+ LLCriticalDamp::setInterpolantConstant(InterpDeltaPositionLag, mPositionLag);
}
//---------------------------------------------------------
void LLFollowCamParams::setFocusLag( F32 f )
{
- mFocusLag = llclamp(f, FOLLOW_CAM_MIN_FOCUS_LAG, FOLLOW_CAM_MAX_FOCUS_LAG);
+ mFocusLag = llclamp(f, FOLLOW_CAM_MIN_FOCUS_LAG, FOLLOW_CAM_MAX_FOCUS_LAG);
+ LLCriticalDamp::setInterpolantConstant(InterpDeltaFocusLag, mFocusLag);
}
@@ -184,6 +186,7 @@ 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);
}
//---------------------------------------------------------
@@ -328,11 +331,11 @@ void LLFollowCam::update()
F32 force = focusOffsetDistance - focusThresholdNormalizedByDistance;
*/
- F32 focusLagLerp = LLCriticalDamp::getInterpolant( mFocusLag );
+ F32 focusLagLerp = LLCriticalDamp::getInterpolant(InterpDeltaFocusLag);
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(0.05f));
+ mRelativeFocus = lerp(mRelativeFocus, (focus_pt_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
}// if focus is not locked ---------------------------------------------
@@ -415,7 +418,7 @@ void LLFollowCam::update()
//-------------------------------------------------------------------------------------------------
if ( distanceFromPositionToIdealPosition > mPositionThreshold )
{
- F32 positionPullLerp = LLCriticalDamp::getInterpolant( mPositionLag );
+ F32 positionPullLerp = LLCriticalDamp::getInterpolant(InterpDeltaPositionLag);
simulated_pos_agent = lerp( simulated_pos_agent, whereCameraPositionWantsToBe, positionPullLerp );
}
@@ -435,7 +438,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(0.05f));
+ mRelativePos = lerp(mRelativePos, (simulated_pos_agent - mSubjectPosition) * ~mSubjectRotation, LLCriticalDamp::getInterpolant(InterpDeltaTeeny));
} // if position is not locked -----------------------------------------------------------
@@ -490,7 +493,7 @@ BOOL LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_pos
if ( cameraOffsetAngle > mBehindnessMaxAngle )
{
- F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLCriticalDamp::getInterpolant(mBehindnessLag);
+ F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLCriticalDamp::getInterpolant(InterpDeltaBehindnessLag);
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 482294c8a6..b94681b340 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(POSITION_DAMPING_TC));
+ (*this_object_it)->mPositionOffset = lerp((*this_object_it)->mPositionOffset, (*this_object_it)->mTargetPositionOffset, LLCriticalDamp::getInterpolant(InterpDeltaPositionDampingTC));
}
}
@@ -1083,3 +1083,4 @@ F32 LLHUDNameTag::LLHUDTextSegment::getWidth(const LLFontGL* font)
return width;
}
}
+
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 826e8d560a..748ac7a16e 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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
}
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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
}
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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, 1.f, SELECTED_MANIPULATOR_SCALE), LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
}
}
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 00a0bf8894..9802d5503e 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(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales[i] = lerp(mManipulatorScales[i], SELECTED_MANIPULATOR_SCALE, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
}
else
{
- mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
+ mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
}
}
@@ -2082,3 +2082,4 @@ BOOL LLManipScale::canAffectSelection()
}
return can_scale;
}
+
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 0228807dc8..9d287e7a03 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(MANIPULATOR_SCALE_HALF_LIFE ));
- mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
+ 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));
}
else if (index == mManipPart - LL_YZ_PLANE || index == mHighlightedPart - LL_YZ_PLANE)
{
- 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 ));
+ 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));
}
else
{
- 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 ));
+ mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
+ mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(InterpDeltaManipulatorScaleHalfLife));
}
}
@@ -2323,3 +2323,4 @@ BOOL LLManipTranslate::canAffectSelection()
}
return can_move;
}
+
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 1bda7640bd..274497f2b5 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(0.1f));
+ mCurPan = lerp(mCurPan, mTargetPan, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
}
// Prepare a scissor region
@@ -987,3 +987,4 @@ 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 343316d30a..cf9d95455e 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -6108,6 +6108,14 @@ 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;
@@ -7547,3 +7555,4 @@ void LLSelectMgr::sendSelectionMove()
//saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
}
+
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index ec36cf48c2..8c5844eca7 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(CONTEXT_FADE_TIME));
+ mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(InterpDeltaContextFadeTime));
}
else
{
- mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME));
+ mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(InterpDeltaContextFadeTime));
}
updateImageStats();
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 9ffc64312d..3f97659c66 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(0.03f));
+ gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLCriticalDamp::getInterpolant(InterpDeltaTeenier));
if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices())
{
@@ -1593,3 +1593,4 @@ void display_cleanup()
{
gDisconnectedImagep = NULL;
}
+
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 4efd59685e..d28da507ea 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(0.02f));
+ mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(InterpDeltaTeenier));
mLastVel = velocity;
LLVector4 wind;
wind.setVec(getRegion()->mWind.getVelocityNoisy(getPositionAgent(), 4.f) - velocity);
@@ -2934,13 +2934,10 @@ void LLVOAvatar::idleUpdateWindEffect()
wind.mV[VW] = llmin(0.025f + (speed * 0.015f) + hover_strength, 0.5f);
F32 interp;
- if (wind.mV[VW] > mWindVec.mV[VW])
+ interp = LLCriticalDamp::getInterpolant(InterpDeltaSmall);
+ if (wind.mV[VW] <= mWindVec.mV[VW])
{
- interp = LLCriticalDamp::getInterpolant(0.2f);
- }
- else
- {
- interp = LLCriticalDamp::getInterpolant(0.4f);
+ interp *= 2.0f;
}
mWindVec = lerp(mWindVec, wind, interp);
@@ -3801,7 +3798,6 @@ 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/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 7adf18b6d0..3c831bafa0 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1268,7 +1268,7 @@ BOOL LLVOVolume::calcLOD()
else
{
distance = mDrawable->mDistanceWRTCamera;
- radius = getVolume()->mLODScaleBias.scaledVec(getScale()).length();
+ radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length();
}
//hold onto unmodified distance for debugging
@@ -2990,7 +2990,8 @@ void LLVOVolume::generateSilhouette(LLSelectNode* nodep, const LLVector3& view_p
//transform view vector into volume space
view_vector -= getRenderPosition();
- mDrawable->mDistanceWRTCamera = view_vector.length();
+ // WTF...why is silhouette generation touching a variable used all over the place?!
+ //mDrawable->mDistanceWRTCamera = view_vector.length();
LLQuaternion worldRot = getRenderRotation();
view_vector = view_vector * ~worldRot;
if (!isVolumeGlobal())
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index ccc513b80d..7c3bc5988c 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(0.1f));
- sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f));
+ sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
+ sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(InterpDeltaSmaller));
const S32 width = getRect().getWidth();
const S32 height = getRect().getHeight();
@@ -1795,3 +1795,5 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
}
return FALSE;
}
+
+