I was critically damp once. It was okay.

This commit is contained in:
Shyotl
2017-03-14 01:44:26 -05:00
parent 7dd616357f
commit 4a9ff22eeb
32 changed files with 174 additions and 116 deletions

View File

@@ -240,7 +240,7 @@ BOOL LLEditingMotion::onUpdate(F32 time, U8* joint_mask)
mIKSolver.solve(); mIKSolver.solve();
// use blending... // use blending...
F32 slerp_amt = LLCriticalDamp::getInterpolant(TARGET_LAG_HALF_LIFE); F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TARGET_LAG_HALF_LIFE);
shoulderRot = slerp(slerp_amt, mShoulderJoint.getRotation(), shoulderRot); shoulderRot = slerp(slerp_amt, mShoulderJoint.getRotation(), shoulderRot);
elbowRot = slerp(slerp_amt, mElbowJoint.getRotation(), elbowRot); elbowRot = slerp(slerp_amt, mElbowJoint.getRotation(), elbowRot);

View File

@@ -181,8 +181,8 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
LLQuaternion currentRootRotWorld = mRootJoint->getWorldRotation(); LLQuaternion currentRootRotWorld = mRootJoint->getWorldRotation();
LLQuaternion currentInvRootRotWorld = ~currentRootRotWorld; LLQuaternion currentInvRootRotWorld = ~currentRootRotWorld;
F32 head_slerp_amt = LLCriticalDamp::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE); F32 head_slerp_amt = LLSmoothInterpolation::getInterpolant(HEAD_LOOKAT_LAG_HALF_LIFE);
F32 torso_slerp_amt = LLCriticalDamp::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE); F32 torso_slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_LOOKAT_LAG_HALF_LIFE);
LLVector3* targetPos = (LLVector3*)mCharacter->getAnimationData("LookAtPoint"); LLVector3* targetPos = (LLVector3*)mCharacter->getAnimationData("LookAtPoint");

View File

@@ -1101,11 +1101,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
if (constraint->mSharedData->mChainLength != 0 && if (constraint->mSharedData->mChainLength != 0 &&
dist_vec_squared(root_pos, target_pos) * 0.95f > constraint->mTotalLength * constraint->mTotalLength) 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, LLSmoothInterpolation::getInterpolant(0.1f));
} }
else else
{ {
constraint->mWeight = lerp(constraint->mWeight, 1.f, LLCriticalDamp::getInterpolant(0.3f)); constraint->mWeight = lerp(constraint->mWeight, 1.f, LLSmoothInterpolation::getInterpolant(0.3f));
} }
F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f : F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f :
@@ -1152,9 +1152,9 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
// convert intermediate joint positions to world coordinates // convert intermediate joint positions to world coordinates
positions[joint_num] = ( constraint->mPositions[joint_num] * mPelvisp->getWorldRotation()) + mPelvisp->getWorldPosition(); positions[joint_num] = ( constraint->mPositions[joint_num] * mPelvisp->getWorldRotation()) + mPelvisp->getWorldPosition();
F32 time_constant = 1.f / clamp_rescale(constraint->mFixupDistanceRMS, 0.f, 0.5f, 0.2f, 8.f); F32 time_constant = 1.f / clamp_rescale(constraint->mFixupDistanceRMS, 0.f, 0.5f, 0.2f, 8.f);
// LL_INFOS() << "Interpolant " << LLCriticalDamp::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; // LL_INFOS() << "Interpolant " << LLSmoothInterpolation::getInterpolant(time_constant, FALSE) << " and fixup distance " << constraint->mFixupDistanceRMS << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL;
positions[joint_num] = lerp(positions[joint_num], kinematic_position, positions[joint_num] = lerp(positions[joint_num], kinematic_position,
LLCriticalDamp::getInterpolant(time_constant, FALSE)); LLSmoothInterpolation::getInterpolant(time_constant, FALSE));
} }
S32 iteration_count; S32 iteration_count;

View File

@@ -258,7 +258,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
// but this will cause the animation playback rate calculation below to // but this will cause the animation playback rate calculation below to
// kick in too slowly and sometimes start playing the animation in reverse. // kick in too slowly and sometimes start playing the animation in reverse.
//mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLCriticalDamp::getInterpolant(0.1f)); //mPelvisOffset -= PELVIS_COMPENSATION_WIEGHT * (foot_slip_vector * world_to_avatar_rot);//lerp(LLVector3::zero, -1.f * (foot_slip_vector * world_to_avatar_rot), LLSmoothInterpolation::getInterpolant(0.1f));
////F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL * (llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED); ////F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL * (llclamp(speed, 0.f, DRIFT_COMP_MAX_SPEED) / DRIFT_COMP_MAX_SPEED);
//F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL; //F32 drift_comp_max = DRIFT_COMP_MAX_TOTAL;
@@ -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); F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX);
// blend towards new speed adjustment value // 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, LLSmoothInterpolation::getInterpolant(SPEED_ADJUST_TIME_CONSTANT));
// limit that rate at which the speed adjustment changes // 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); 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 { // standing/turning
// damp out speed adjustment to 0 // damp out speed adjustment to 0
mAnimSpeed = lerp(mAnimSpeed, 1.f, LLCriticalDamp::getInterpolant(0.2f)); mAnimSpeed = lerp(mAnimSpeed, 1.f, LLSmoothInterpolation::getInterpolant(0.2f));
//mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLCriticalDamp::getInterpolant(0.2f)); //mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.2f));
} }
// broadcast walk speed change // broadcast walk speed change
@@ -384,7 +384,7 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask)
F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor; 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 // 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, LLSmoothInterpolation::getInterpolant(0.1f));
LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f)); LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f));
mPelvisState->setRotation(roll); mPelvisState->setRotation(roll);

View File

@@ -199,7 +199,7 @@ void LLMotion::fadeOut()
{ {
if (mFadeWeight > 0.01f) if (mFadeWeight > 0.01f)
{ {
mFadeWeight = lerp(mFadeWeight, 0.f, LLCriticalDamp::getInterpolant(0.15f)); mFadeWeight = lerp(mFadeWeight, 0.f, LLSmoothInterpolation::getInterpolant(0.15f));
} }
else else
{ {
@@ -214,7 +214,7 @@ void LLMotion::fadeIn()
{ {
if (mFadeWeight < 0.99f) if (mFadeWeight < 0.99f)
{ {
mFadeWeight = lerp(mFadeWeight, 1.f, LLCriticalDamp::getInterpolant(0.15f)); mFadeWeight = lerp(mFadeWeight, 1.f, LLSmoothInterpolation::getInterpolant(0.15f));
} }
else else
{ {

View File

@@ -104,7 +104,7 @@ LLMotion::LLMotionInitStatus LLTargetingMotion::onInitialize(LLCharacter *charac
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask)
{ {
F32 slerp_amt = LLCriticalDamp::getInterpolant(TORSO_TARGET_HALF_LIFE); F32 slerp_amt = LLSmoothInterpolation::getInterpolant(TORSO_TARGET_HALF_LIFE);
LLVector3 target; LLVector3 target;
LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint"); LLVector3* lookAtPoint = (LLVector3*)mCharacter->getAnimationData("LookAtPoint");

View File

@@ -33,63 +33,105 @@
#include "linden_common.h" #include "linden_common.h"
#include "llcriticaldamp.h" #include "llcriticaldamp.h"
#include <algorithm>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// static members // static members
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLFrameTimer LLCriticalDamp::sInternalTimer; LLFrameTimer LLSmoothInterpolation::sInternalTimer;
std::map<F32, F32> LLCriticalDamp::sInterpolants; std::vector<LLSmoothInterpolation::Interpolant> LLSmoothInterpolation::sInterpolants;
F32 LLCriticalDamp::sTimeDelta; F32 LLSmoothInterpolation::sTimeDelta;
std::pair<F32, F32> sCachedEntry;
// helper functors
struct LLSmoothInterpolation::CompareTimeConstants
{
bool operator()(const F32& a, const LLSmoothInterpolation::Interpolant& b) const
{
return a < b.mTimeScale;
}
bool operator()(const LLSmoothInterpolation::Interpolant& a, const F32& b) const
{
return a.mTimeScale < b; // bottom of a is higher than bottom of b
}
bool operator()(const LLSmoothInterpolation::Interpolant& a, const LLSmoothInterpolation::Interpolant& b) const
{
return a.mTimeScale < b.mTimeScale; // bottom of a is higher than bottom of b
}
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LLCriticalDamp() // LLSmoothInterpolation()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
LLCriticalDamp::LLCriticalDamp() LLSmoothInterpolation::LLSmoothInterpolation()
{ {
sTimeDelta = 0.f; sTimeDelta = 0.f;
sCachedEntry = std::pair<F32, F32>(-1.f, -1.f);
} }
// static // static
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// updateInterpolants() // updateInterpolants()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void LLCriticalDamp::updateInterpolants() void LLSmoothInterpolation::updateInterpolants()
{ {
sTimeDelta = sInternalTimer.getElapsedTimeAndResetF32(); sTimeDelta = sInternalTimer.getElapsedTimeAndResetF32();
F32 time_constant; for (size_t i = 0; i < sInterpolants.size(); i++)
for (std::map<F32, F32>::iterator iter = sInterpolants.begin();
iter != sInterpolants.end(); iter++)
{ {
time_constant = iter->first; Interpolant& interp = sInterpolants[i];
F32 new_interpolant = 1.f - pow(2.f, -sTimeDelta / time_constant); interp.mInterpolant = calcInterpolant(interp.mTimeScale);
new_interpolant = llclamp(new_interpolant, 0.f, 1.f); if (sCachedEntry.first == interp.mTimeScale)
sInterpolants[time_constant] = new_interpolant; {
sCachedEntry.second = interp.mInterpolant;
}
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// getInterpolant() // getInterpolant()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
F32 LLCriticalDamp::getInterpolant(const F32 time_constant, BOOL use_cache) F32 LLSmoothInterpolation::getInterpolant(F32SecondsImplicit time_constant, bool use_cache)
{ {
if (time_constant == 0.f) if (time_constant == 0.f)
{ {
return 1.f; return 1.f;
} }
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) if (use_cache)
{ {
sInterpolants[time_constant] = interpolant; if (sCachedEntry.first == time_constant)
{
return sCachedEntry.second;
}
interpolant_vec_t::iterator find_it = std::lower_bound(sInterpolants.begin(), sInterpolants.end(), time_constant.value(), CompareTimeConstants());
if (find_it != sInterpolants.end() && find_it->mTimeScale == time_constant)
{
sCachedEntry = std::make_pair(time_constant.value(), find_it->mInterpolant);
return find_it->mInterpolant;
}
else
{
Interpolant interp;
interp.mTimeScale = time_constant.value();
interp.mInterpolant = calcInterpolant(time_constant.value());
sInterpolants.insert(find_it, interp);
sCachedEntry = std::make_pair(time_constant.value(), interp.mInterpolant);
return interp.mInterpolant;
}
}
else
{
return calcInterpolant(time_constant.value());
} }
}
return interpolant;
//-----------------------------------------------------------------------------
// calcInterpolant()
//-----------------------------------------------------------------------------
F32 LLSmoothInterpolation::calcInterpolant(F32 time_constant)
{
return llclamp(1.f - powf(2.f, -sTimeDelta / time_constant), 0.f, 1.f);
} }

View File

@@ -34,26 +34,46 @@
#ifndef LL_LLCRITICALDAMP_H #ifndef LL_LLCRITICALDAMP_H
#define LL_LLCRITICALDAMP_H #define LL_LLCRITICALDAMP_H
#include <map> #include <vector>
#include "llframetimer.h" #include "llframetimer.h"
#include "llunits.h"
class LL_COMMON_API LLCriticalDamp class LL_COMMON_API LLSmoothInterpolation
{ {
public: public:
LLCriticalDamp(); LLSmoothInterpolation();
// MANIPULATORS // MANIPULATORS
static void updateInterpolants(); static void updateInterpolants();
// ACCESSORS // ACCESSORS
static F32 getInterpolant(const F32 time_constant, BOOL use_cache = TRUE); static F32 getInterpolant(F32SecondsImplicit time_constant, bool use_cache = true);
template<typename T>
static T lerp(T a, T b, F32SecondsImplicit time_constant, bool use_cache = true)
{
F32 interpolant = getInterpolant(time_constant, use_cache);
return ((a * (1.f - interpolant))
+ (b * interpolant));
}
protected: protected:
static F32 calcInterpolant(F32 time_constant);
struct CompareTimeConstants;
static LLFrameTimer sInternalTimer; // frame timer for calculating deltas static LLFrameTimer sInternalTimer; // frame timer for calculating deltas
static std::map<F32, F32> sInterpolants; struct Interpolant
{
F32 mTimeScale;
F32 mInterpolant;
};
typedef std::vector<Interpolant> interpolant_vec_t;
static interpolant_vec_t sInterpolants;
static F32 sTimeDelta; static F32 sTimeDelta;
}; };
typedef LLSmoothInterpolation LLCriticalDamp;
#endif // LL_LLCRITICALDAMP_H #endif // LL_LLCRITICALDAMP_H

View File

@@ -2135,12 +2135,8 @@ void LLRender::end()
} }
} }
extern bool countFlushes;
extern unsigned int flushCount;
void LLRender::flush() void LLRender::flush()
{ {
if (countFlushes) ++flushCount;
if (mCount > 0) if (mCount > 0)
{ {
#if 0 #if 0

View File

@@ -704,11 +704,11 @@ void LLButton::draw()
mCurGlowStrength = lerp(mCurGlowStrength, mCurGlowStrength = lerp(mCurGlowStrength,
mFlashing ? (flash? 1.0 : 0.0) mFlashing ? (flash? 1.0 : 0.0)
: mHoverGlowStrength, : mHoverGlowStrength,
LLCriticalDamp::getInterpolant(0.05f)); LLSmoothInterpolation::getInterpolant(0.05f));
} }
else else
{ {
mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f)); mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
} }
// Draw button image, if available. // Draw button image, if available.

View File

@@ -621,7 +621,7 @@ bool LLLayoutStack::animatePanels()
{ {
if (!mAnimatedThisFrame) if (!mAnimatedThisFrame)
{ {
panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant)); panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLSmoothInterpolation::getInterpolant(mOpenTimeConstant));
if (panelp->mVisibleAmt > 0.99f) if (panelp->mVisibleAmt > 0.99f)
{ {
panelp->mVisibleAmt = 1.f; panelp->mVisibleAmt = 1.f;
@@ -646,7 +646,7 @@ bool LLLayoutStack::animatePanels()
{ {
if (!mAnimatedThisFrame) if (!mAnimatedThisFrame)
{ {
panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
if (panelp->mVisibleAmt < 0.001f) if (panelp->mVisibleAmt < 0.001f)
{ {
panelp->mVisibleAmt = 0.f; panelp->mVisibleAmt = 0.f;
@@ -673,7 +673,7 @@ bool LLLayoutStack::animatePanels()
{ {
if (!mAnimatedThisFrame) if (!mAnimatedThisFrame)
{ {
panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant)); panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
} }
if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f) if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)

View File

@@ -4509,7 +4509,7 @@ void LLTearOffMenu::draw()
if (getRect().getHeight() != mTargetHeight) if (getRect().getHeight() != mTargetHeight)
{ {
// animate towards target height // 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, LLSmoothInterpolation::getInterpolant(0.05f))));
} }
LLFloater::draw(); LLFloater::draw();
} }

View File

@@ -502,11 +502,11 @@ void LLScrollbar::draw()
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y)); BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
if (hovered) if (hovered)
{ {
mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f));
} }
else else
{ {
mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f)); mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
} }

View File

@@ -215,7 +215,7 @@ void LLTabContainer::draw()
} }
} }
setScrollPosPixels(mIsVertical ? target_pixel_scroll : lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f))); setScrollPosPixels(mIsVertical ? target_pixel_scroll : lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f)));
BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0)); BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0));
if (!mIsVertical) if (!mIsVertical)

View File

@@ -352,7 +352,7 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera)
LLVector3 agent_at_axis = gAgent.getAtAxis(); LLVector3 agent_at_axis = gAgent.getAtAxis();
agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector()); agent_at_axis -= projected_vec(agent_at_axis, gAgent.getReferenceUpVector());
agent_at_axis.normalize(); agent_at_axis.normalize();
gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLCriticalDamp::getInterpolant(0.3f))); gAgent.resetAxes(lerp(gAgent.getAtAxis(), agent_at_axis, LLSmoothInterpolation::getInterpolant(0.3f)));
} }
setFocusOnAvatar(TRUE, ANIMATE); setFocusOnAvatar(TRUE, ANIMATE);
@@ -1299,7 +1299,7 @@ void LLAgentCamera::updateCamera()
gAgentCamera.clearPanKeys(); gAgentCamera.clearPanKeys();
// lerp camera focus offset // lerp camera focus offset
mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(CAMERA_FOCUS_HALF_LIFE)); mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLSmoothInterpolation::getInterpolant(CAMERA_FOCUS_HALF_LIFE));
if ( mCameraMode == CAMERA_MODE_FOLLOW ) if ( mCameraMode == CAMERA_MODE_FOLLOW )
{ {
@@ -1418,7 +1418,7 @@ void LLAgentCamera::updateCamera()
const F32 SMOOTHING_HALF_LIFE = 0.02f; const F32 SMOOTHING_HALF_LIFE = 0.02f;
static const LLCachedControl<F32> camera_position_smoothing("CameraPositionSmoothing"); static const LLCachedControl<F32> camera_position_smoothing("CameraPositionSmoothing");
F32 smoothing = LLCriticalDamp::getInterpolant(camera_position_smoothing * SMOOTHING_HALF_LIFE, FALSE); F32 smoothing = LLSmoothInterpolation::getInterpolant(camera_position_smoothing * SMOOTHING_HALF_LIFE, FALSE);
if (!mFocusObject) // we differentiate on avatar mode if (!mFocusObject) // we differentiate on avatar mode
{ {
@@ -1448,7 +1448,7 @@ void LLAgentCamera::updateCamera()
} }
mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLCriticalDamp::getInterpolant(FOV_ZOOM_HALF_LIFE)); mCameraCurrentFOVZoomFactor = lerp(mCameraCurrentFOVZoomFactor, mCameraFOVZoomFactor, LLSmoothInterpolation::getInterpolant(FOV_ZOOM_HALF_LIFE));
// LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL; // LL_INFOS() << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << LL_ENDL;
@@ -1615,7 +1615,7 @@ F32 LLAgentCamera::calcCustomizeAvatarUIOffset( const LLVector3d& camera_pos_glo
} }
} }
F32 range = (F32)dist_vec(camera_pos_global, gAgentCamera.getFocusGlobal()); F32 range = (F32)dist_vec(camera_pos_global, gAgentCamera.getFocusGlobal());
mUIOffset = lerp(mUIOffset, ui_offset, LLCriticalDamp::getInterpolant(0.05f)); mUIOffset = lerp(mUIOffset, ui_offset, LLSmoothInterpolation::getInterpolant(0.05f));
return mUIOffset * range; return mUIOffset * range;
} }
@@ -1924,7 +1924,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
if (mTargetCameraDistance != mCurrentCameraDistance) if (mTargetCameraDistance != mCurrentCameraDistance)
{ {
F32 camera_lerp_amt = LLCriticalDamp::getInterpolant(CAMERA_ZOOM_HALF_LIFE); F32 camera_lerp_amt = LLSmoothInterpolation::getInterpolant(CAMERA_ZOOM_HALF_LIFE);
mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt); mCurrentCameraDistance = lerp(mCurrentCameraDistance, mTargetCameraDistance, camera_lerp_amt);
} }
@@ -1941,7 +1941,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
if (isAgentAvatarValid()) if (isAgentAvatarValid())
{ {
LLVector3d camera_lag_d; LLVector3d camera_lag_d;
F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE); F32 lag_interp = LLSmoothInterpolation::getInterpolant(CAMERA_LAG_HALF_LIFE);
LLVector3 target_lag; LLVector3 target_lag;
LLVector3 vel = gAgent.getVelocity(); LLVector3 vel = gAgent.getVelocity();
@@ -1987,7 +1987,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
} }
else else
{ {
mCameraLag = lerp(mCameraLag, LLVector3::zero, LLCriticalDamp::getInterpolant(0.15f)); mCameraLag = lerp(mCameraLag, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.15f));
} }
camera_lag_d.setVec(mCameraLag); camera_lag_d.setVec(mCameraLag);

View File

@@ -3775,8 +3775,8 @@ void LLAppViewer::idle()
LLEventTimer::updateClass(); LLEventTimer::updateClass();
} }
{ {
LAZY_FT("LLCriticalDamp::updateInterpolants"); LAZY_FT("LLSmoothInterpolation::updateInterpolants");
LLCriticalDamp::updateInterpolants(); LLSmoothInterpolation::updateInterpolants();
} }
{ {
LAZY_FT("LLMortician::updateClass"); LAZY_FT("LLMortician::updateClass");

View File

@@ -581,7 +581,7 @@ F32 LLDrawable::updateXform(BOOL undamped)
if (damped && isVisible()) if (damped && isVisible())
{ {
F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f); F32 lerp_amt = llclamp(LLSmoothInterpolation::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f);
LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt); 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, target_pos);

View File

@@ -1026,7 +1026,7 @@ void LLFastTimerView::draw()
} }
//interpolate towards new maximum //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, LLSmoothInterpolation::getInterpolant(0.1f));
if (last_max - cur_max <= 1 || cur_max - last_max <= 1) if (last_max - cur_max <= 1 || cur_max - last_max <= 1)
{ {
last_max = cur_max; last_max = cur_max;
@@ -1034,7 +1034,7 @@ void LLFastTimerView::draw()
F32 alpha_target = last_max > cur_max ? F32 alpha_target = last_max > cur_max ?
llmin((F32) last_max/ (F32) cur_max - 1.f,1.f) : llmin((F32) last_max/ (F32) cur_max - 1.f,1.f) :
llmin((F32) cur_max/ (F32) last_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, LLSmoothInterpolation::getInterpolant(0.1f));
if (mHoverID != NULL) if (mHoverID != NULL)
{ {

View File

@@ -425,11 +425,11 @@ void LLFloaterAvatarPicker::drawFrustum()
if (gFocusMgr.childHasMouseCapture(getDragHandle())) if (gFocusMgr.childHasMouseCapture(getDragHandle()))
{ {
mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(mContextConeFadeTime)); mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(mContextConeFadeTime));
} }
else else
{ {
mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(mContextConeFadeTime)); mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(mContextConeFadeTime));
} }
} }
} }

View File

@@ -532,11 +532,11 @@ void LLFloaterColorPicker::draw()
if (gFocusMgr.childHasMouseCapture(getDragHandle())) if (gFocusMgr.childHasMouseCapture(getDragHandle()))
{ {
mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME));
} }
else else
{ {
mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME));
} }
mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); mPipetteBtn->setToggleState(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());

View File

@@ -607,7 +607,7 @@ void LLSnapshotLivePreview::draw()
{ {
if (mFlashAlpha < 1.f) if (mFlashAlpha < 1.f)
{ {
mFlashAlpha = lerp(mFlashAlpha, 1.f, LLCriticalDamp::getInterpolant(0.02f)); mFlashAlpha = lerp(mFlashAlpha, 1.f, LLSmoothInterpolation::getInterpolant(0.02f));
} }
else else
{ {
@@ -616,7 +616,7 @@ void LLSnapshotLivePreview::draw()
} }
else else
{ {
mFlashAlpha = lerp(mFlashAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f)); mFlashAlpha = lerp(mFlashAlpha, 0.f, LLSmoothInterpolation::getInterpolant(0.15f));
} }
if (mShineCountdown > 0) if (mShineCountdown > 0)

View File

@@ -1280,7 +1280,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation)
// animate current height towards target height // animate current height towards target height
if (llabs(mCurHeight - mTargetHeight) > 1.f) 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, LLSmoothInterpolation::getInterpolant(mIsOpen ? FOLDER_OPEN_TIME_CONSTANT : FOLDER_CLOSE_TIME_CONSTANT));
requestArrange(); requestArrange();
@@ -2521,11 +2521,11 @@ void LLFolderViewFolder::draw()
} }
else if (mIsOpen) else if (mIsOpen)
{ {
mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLCriticalDamp::getInterpolant(0.04f)); mControlLabelRotation = lerp(mControlLabelRotation, -90.f, LLSmoothInterpolation::getInterpolant(0.04f));
} }
else else
{ {
mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLCriticalDamp::getInterpolant(0.025f)); mControlLabelRotation = lerp(mControlLabelRotation, 0.f, LLSmoothInterpolation::getInterpolant(0.025f));
} }
bool possibly_has_children = false; bool possibly_has_children = false;

View File

@@ -334,11 +334,11 @@ void LLFollowCam::update()
F32 force = focusOffsetDistance - focusThresholdNormalizedByDistance; F32 force = focusOffsetDistance - focusThresholdNormalizedByDistance;
*/ */
F32 focusLagLerp = LLCriticalDamp::getInterpolant( mFocusLag ); F32 focusLagLerp = LLSmoothInterpolation::getInterpolant( mFocusLag );
focus_pt_agent = lerp( focus_pt_agent, whereFocusWantsToBe, focusLagLerp ); focus_pt_agent = lerp( focus_pt_agent, whereFocusWantsToBe, focusLagLerp );
mSimulatedFocusGlobal = gAgent.getPosGlobalFromAgent(focus_pt_agent); 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, LLSmoothInterpolation::getInterpolant(0.05f));
}// if focus is not locked --------------------------------------------- }// if focus is not locked ---------------------------------------------
@@ -421,7 +421,7 @@ void LLFollowCam::update()
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
if ( distanceFromPositionToIdealPosition > mPositionThreshold ) if ( distanceFromPositionToIdealPosition > mPositionThreshold )
{ {
F32 positionPullLerp = LLCriticalDamp::getInterpolant( mPositionLag ); F32 positionPullLerp = LLSmoothInterpolation::getInterpolant( mPositionLag );
simulated_pos_agent = lerp( simulated_pos_agent, whereCameraPositionWantsToBe, positionPullLerp ); simulated_pos_agent = lerp( simulated_pos_agent, whereCameraPositionWantsToBe, positionPullLerp );
} }
@@ -441,7 +441,7 @@ void LLFollowCam::update()
updateBehindnessConstraint(gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal), simulated_pos_agent); updateBehindnessConstraint(gAgent.getPosAgentFromGlobal(mSimulatedFocusGlobal), simulated_pos_agent);
mSimulatedPositionGlobal = gAgent.getPosGlobalFromAgent(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, LLSmoothInterpolation::getInterpolant(0.05f));
} // if position is not locked ----------------------------------------------------------- } // if position is not locked -----------------------------------------------------------
@@ -496,7 +496,7 @@ BOOL LLFollowCam::updateBehindnessConstraint(LLVector3 focus, LLVector3& cam_pos
if ( cameraOffsetAngle > mBehindnessMaxAngle ) if ( cameraOffsetAngle > mBehindnessMaxAngle )
{ {
F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLCriticalDamp::getInterpolant(mBehindnessLag); F32 fraction = ((cameraOffsetAngle - mBehindnessMaxAngle) / cameraOffsetAngle) * LLSmoothInterpolation::getInterpolant(mBehindnessLag);
cam_position = focus + horizontalSubjectBack * (slerp(fraction, camera_offset_rotation, LLQuaternion::DEFAULT)); 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 cam_position.mV[VZ] = cameraZ; // clamp z value back to what it was before we started messing with it
constraint_active = TRUE; constraint_active = TRUE;

View File

@@ -965,7 +965,7 @@ void LLHUDNameTag::updateAll()
// { // {
// continue; // 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, LLSmoothInterpolation::getInterpolant(POSITION_DAMPING_TC));
} }
} }

View File

@@ -242,7 +242,7 @@ void LLManipRotate::render()
if (mManipPart == LL_ROT_Z) 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
gGL.pushMatrix(); gGL.pushMatrix();
{ {
// selected part // selected part
@@ -253,7 +253,7 @@ void LLManipRotate::render()
} }
else if (mManipPart == LL_ROT_Y) 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
gGL.pushMatrix(); gGL.pushMatrix();
{ {
static const LLMatrix4a rot = gGL.genRot( 90.f, 1.f, 0.f, 0.f ); static const LLMatrix4a rot = gGL.genRot( 90.f, 1.f, 0.f, 0.f );
@@ -265,7 +265,7 @@ void LLManipRotate::render()
} }
else if (mManipPart == LL_ROT_X) 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
gGL.pushMatrix(); gGL.pushMatrix();
{ {
static const LLMatrix4a rot = gGL.genRot( 90.f, 0.f, 1.f, 0.f ); static const LLMatrix4a rot = gGL.genRot( 90.f, 0.f, 1.f, 0.f );
@@ -277,13 +277,13 @@ void LLManipRotate::render()
} }
else if (mManipPart == LL_ROT_ROLL) 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
} }
else if (mManipPart == LL_NO_PART) else if (mManipPart == LL_NO_PART)
{ {
if (mHighlightedPart == 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
} }
LLGLEnable cull_face(GL_CULL_FACE); LLGLEnable cull_face(GL_CULL_FACE);
@@ -298,7 +298,7 @@ void LLManipRotate::render()
{ {
if (mHighlightedPart == LL_ROT_Z) 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]); gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]);
// hovering over part // 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); 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);
@@ -317,7 +317,7 @@ void LLManipRotate::render()
gGL.rotatef( rot ); gGL.rotatef( rot );
if (mHighlightedPart == LL_ROT_Y) 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]); gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]);
// hovering over part // 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); 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);
@@ -336,7 +336,7 @@ void LLManipRotate::render()
gGL.rotatef( rot ); gGL.rotatef( rot );
if (mHighlightedPart == LL_ROT_X) 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]); gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]);
// hovering over part // hovering over part
@@ -352,7 +352,7 @@ void LLManipRotate::render()
if (mHighlightedPart == LL_ROT_ROLL) 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), LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
} }
} }

View File

@@ -543,11 +543,11 @@ void LLManipScale::highlightManipulators(S32 x, S32 y)
{ {
if (mHighlightedPart == MANIPULATOR_IDS[i]) 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, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
} }
else else
{ {
mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); mManipulatorScales[i] = lerp(mManipulatorScales[i], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE));
} }
} }

View File

@@ -1925,18 +1925,18 @@ void LLManipTranslate::renderTranslationHandles()
{ {
if (index == mManipPart - LL_X_ARROW || index == mHighlightedPart - LL_X_ARROW) 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 )); mArrowScales.mV[index] = lerp(mArrowScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
} }
else if (index == mManipPart - LL_YZ_PLANE || index == mHighlightedPart - LL_YZ_PLANE) 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 )); mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], SELECTED_ARROW_SCALE, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
} }
else else
{ {
mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); mArrowScales.mV[index] = lerp(mArrowScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE )); mPlaneScales.mV[index] = lerp(mPlaneScales.mV[index], 1.f, LLSmoothInterpolation::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE ));
} }
} }

View File

@@ -262,7 +262,7 @@ void LLNetMap::draw()
static LLUICachedControl<S32> center("MiniMapCenter"); static LLUICachedControl<S32> center("MiniMapCenter");
if (center != MAP_CENTER_NONE) if (center != MAP_CENTER_NONE)
{ {
mCurPan = lerp(mCurPan, mTargetPan, LLCriticalDamp::getInterpolant(0.1f)); mCurPan = lerp(mCurPan, mTargetPan, LLSmoothInterpolation::getInterpolant(0.1f));
} }
// Prepare a scissor region // Prepare a scissor region

View File

@@ -602,11 +602,11 @@ void LLFloaterTexturePicker::draw()
if (gFocusMgr.childHasMouseCapture(getDragHandle())) if (gFocusMgr.childHasMouseCapture(getDragHandle()))
{ {
mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME));
} }
else else
{ {
mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLCriticalDamp::getInterpolant(CONTEXT_FADE_TIME)); mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME));
} }
updateImageStats(); updateImageStats();

View File

@@ -1152,7 +1152,7 @@ void render_hud_attachments()
gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, (!gRlvAttachmentLocks.hasLockedHUD()) ? 0.1f : 0.85f, 1.f); gAgentCamera.mHUDTargetZoom = llclamp(gAgentCamera.mHUDTargetZoom, (!gRlvAttachmentLocks.hasLockedHUD()) ? 0.1f : 0.85f, 1.f);
// [/RLVa:KB] // [/RLVa:KB]
// smoothly interpolate current zoom level // smoothly interpolate current zoom level
gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLCriticalDamp::getInterpolant(0.03f)); gAgentCamera.mHUDCurZoom = lerp(gAgentCamera.mHUDCurZoom, gAgentCamera.mHUDTargetZoom, LLSmoothInterpolation::getInterpolant(0.03f));
if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices()) if (LLPipeline::sShowHUDAttachments && !gDisconnected && setup_hud_matrices())
{ {

View File

@@ -3298,7 +3298,7 @@ void LLVOAvatar::idleUpdateWindEffect()
LLVector3 velocity = getVelocity(); LLVector3 velocity = getVelocity();
F32 speed = velocity.length(); F32 speed = velocity.length();
//RN: velocity varies too much frame to frame for this to work //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, LLSmoothInterpolation::getInterpolant(0.02f));
mLastVel = velocity; mLastVel = velocity;
LLVector4 wind; LLVector4 wind;
wind.setVec(getRegion()->mWind.getVelocityNoisy(getPositionAgent(), 4.f) - velocity); wind.setVec(getRegion()->mWind.getVelocityNoisy(getPositionAgent(), 4.f) - velocity);
@@ -3321,11 +3321,11 @@ void LLVOAvatar::idleUpdateWindEffect()
F32 interp; F32 interp;
if (wind.mV[VW] > mWindVec.mV[VW]) if (wind.mV[VW] > mWindVec.mV[VW])
{ {
interp = LLCriticalDamp::getInterpolant(0.2f); interp = LLSmoothInterpolation::getInterpolant(0.2f);
} }
else else
{ {
interp = LLCriticalDamp::getInterpolant(0.4f); interp = LLSmoothInterpolation::getInterpolant(0.4f);
} }
mWindVec = lerp(mWindVec, wind, interp); mWindVec = lerp(mWindVec, wind, interp);
@@ -4018,7 +4018,7 @@ LLVector3 LLVOAvatar::idleUpdateNameTagPosition(const LLVector3& root_pos_last)
mTargetRootToHeadOffset = head_offset; mTargetRootToHeadOffset = head_offset;
} }
mCurRootToHeadOffset = lerp(mCurRootToHeadOffset, mTargetRootToHeadOffset, LLCriticalDamp::getInterpolant(0.2f)); mCurRootToHeadOffset = lerp(mCurRootToHeadOffset, mTargetRootToHeadOffset, LLSmoothInterpolation::getInterpolant(0.2f));
LLVector3 name_position = mRoot->getLastWorldPosition() + (mCurRootToHeadOffset * root_rot); LLVector3 name_position = mRoot->getLastWorldPosition() + (mCurRootToHeadOffset * root_rot);
name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av)); name_position += (local_camera_up * root_rot) - (projected_vec(local_camera_at * root_rot, camera_to_av));
@@ -4594,7 +4594,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
// Set the root rotation, but do so incrementally so that it // Set the root rotation, but do so incrementally so that it
// lags in time by some fixed amount. // lags in time by some fixed amount.
//F32 u = LLCriticalDamp::getInterpolant(PELVIS_LAG); //F32 u = LLSmoothInterpolation::getInterpolant(PELVIS_LAG);
F32 pelvis_lag_time = 0.f; F32 pelvis_lag_time = 0.f;
if (self_in_mouselook) if (self_in_mouselook)
{ {

View File

@@ -337,8 +337,8 @@ void LLWorldMapView::draw()
mVisibleRegions.clear(); mVisibleRegions.clear();
// animate pan if necessary // animate pan if necessary
sPanX = lerp(sPanX, sTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); sPanX = lerp(sPanX, sTargetPanX, LLSmoothInterpolation::getInterpolant(0.1f));
sPanY = lerp(sPanY, sTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); sPanY = lerp(sPanY, sTargetPanY, LLSmoothInterpolation::getInterpolant(0.1f));
const S32 width = getRect().getWidth(); const S32 width = getRect().getWidth();
const S32 height = getRect().getHeight(); const S32 height = getRect().getHeight();
@@ -905,7 +905,7 @@ F32 LLWorldMapView::drawLegacySimTile(LLSimInfo& sim_info, S32 left, S32 top, S3
if (!sim_drawable || sim_fetching) if (!sim_drawable || sim_fetching)
sim_info.setAlpha( 0.f ); sim_info.setAlpha( 0.f );
else if (llabs(sim_info.getAlpha() - fade_target) > ALPHA_CUTOFF) //This gives us a nice fade when a visible sims texture finishes loading, or visiblity has changed. else if (llabs(sim_info.getAlpha() - fade_target) > ALPHA_CUTOFF) //This gives us a nice fade when a visible sims texture finishes loading, or visiblity has changed.
sim_info.setAlpha(lerp(sim_info.getAlpha(), fade_target, LLCriticalDamp::getInterpolant(0.15f))); sim_info.setAlpha(lerp(sim_info.getAlpha(), fade_target, LLSmoothInterpolation::getInterpolant(0.15f)));
F32 alpha = sim_info.getAlpha(); F32 alpha = sim_info.getAlpha();
//call setKnownDrawSize if image is still loading, or its actually being drawn. //call setKnownDrawSize if image is still loading, or its actually being drawn.