llmessage merge and further LLUnit usage.

This commit is contained in:
Shyotl
2016-04-07 20:17:30 -05:00
parent 8c946dc706
commit 691a5395ca
43 changed files with 514 additions and 465 deletions

View File

@@ -119,8 +119,8 @@ BOOL LLViewerObject::sPulseEnabled(FALSE);
BOOL LLViewerObject::sUseSharedDrawables(FALSE); // TRUE
// sMaxUpdateInterpolationTime must be greater than sPhaseOutUpdateInterpolationTime
F64 LLViewerObject::sMaxUpdateInterpolationTime = 3.0; // For motion interpolation: after X seconds with no updates, don't predict object motion
F64 LLViewerObject::sPhaseOutUpdateInterpolationTime = 2.0; // For motion interpolation: after Y seconds with no updates, taper off motion prediction
F64Seconds LLViewerObject::sMaxUpdateInterpolationTime(3.0); // For motion interpolation: after X seconds with no updates, don't predict object motion
F64Seconds LLViewerObject::sPhaseOutUpdateInterpolationTime(2.0); // For motion interpolation: after Y seconds with no updates, taper off motion prediction
static LLFastTimer::DeclareTimer FTM_CREATE_OBJECT("Create Object");
@@ -244,7 +244,6 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
mOnMap(FALSE),
mStatic(FALSE),
mNumFaces(0),
mTimeDilation(1.f),
mRotTime(0.f),
mAngularVelocityRot(),
mPreviousRotation(),
@@ -975,11 +974,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
return retval;
}
F32 time_dilation = 1.f;
if(mesgsys != NULL)
{
U16 time_dilation16;
mesgsys->getU16Fast(_PREHASH_RegionData, _PREHASH_TimeDilation, time_dilation16);
F32 time_dilation = ((F32) time_dilation16) / 65535.f;
mTimeDilation = time_dilation;
time_dilation = ((F32) time_dilation16) / 65535.f;
mRegionp->setTimeDilation(time_dilation);
}
// this will be used to determine if we've really changed position
// Use getPosition, not getPositionRegion, since this is what we're comparing directly against.
@@ -1770,7 +1772,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mesgsys->getSender());
if (cdp)
{
F32 ping_delay = 0.5f * mTimeDilation * ( ((F32)cdp->getPingDelay()) * 0.001f + gFrameDTClamped);
F32 ping_delay = 0.5f * time_dilation * ( ((F32)cdp->getPingDelay().valueInUnits<LLUnits::Seconds>()) + gFrameDTClamped);
LLVector3 diff = getVelocity() * ping_delay;
new_pos_parent += diff;
}
@@ -2168,39 +2170,38 @@ BOOL LLViewerObject::isActive() const
void LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
{
//static LLFastTimer::DeclareTimer ftm("Viewer Object");
//LLFastTimer t(ftm);
//static LLTrace::BlockTimerStatHandle ftm("Viewer Object");
//LL_RECORD_BLOCK_TIME(ftm);
if (!mDead)
{
// CRO - don't velocity interp linked objects!
// Leviathan - but DO velocity interp joints
if (!mStatic && sVelocityInterpolate && !isSelected())
{
// calculate dt from last update
F32 dt_raw = (F32)(time - mLastInterpUpdateSecs);
F32 dt = mTimeDilation * dt_raw;
if (!mStatic && sVelocityInterpolate && !isSelected())
{
// calculate dt from last update
F32 time_dilation = mRegionp ? mRegionp->getTimeDilation() : 1.0f;
F32 dt_raw = ((F64Seconds)time - mLastInterpUpdateSecs).value();
F32 dt = time_dilation * dt_raw;
applyAngularVelocity(dt);
if (isAttachment())
{
mLastInterpUpdateSecs = time;
{
mLastInterpUpdateSecs = (F64Seconds)time;
return;
}
else
{ // Move object based on it's velocity and rotation
interpolateLinearMotion(time, dt);
}
}
else
{ // Move object based on it's velocity and rotation
interpolateLinearMotion(time, dt);
}
updateDrawable(FALSE);
}
updateDrawable(FALSE);
}
}
// Move an object due to idle-time viewer side updates by iterpolating motion
void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
// Move an object due to idle-time viewer side updates by interpolating motion
void LLViewerObject::interpolateLinearMotion(const F64SecondsImplicit& time, const F32SecondsImplicit& dt_seconds)
{
// linear motion
// PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object
@@ -2211,8 +2212,9 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
// to see if object is selected, instead of explicitly
// zeroing it out
F64 time_since_last_update = time - mLastMessageUpdateSecs;
if (time_since_last_update <= 0.0 || dt <= 0.f)
F32 dt = dt_seconds;
F64Seconds time_since_last_update = time - mLastMessageUpdateSecs;
if (time_since_last_update <= (F64Seconds)0.0 || dt <= 0.f)
{
return;
}
@@ -2220,7 +2222,7 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
LLVector3 accel = getAcceleration();
LLVector3 vel = getVelocity();
if (sMaxUpdateInterpolationTime <= 0.0)
if (sMaxUpdateInterpolationTime <= (F64Seconds)0.0)
{ // Old code path ... unbounded, simple interpolation
if (!(accel.isExactlyZero() && vel.isExactlyZero()))
{
@@ -2242,8 +2244,8 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
LLVector3 new_v = accel * dt;
if (time_since_last_update > sPhaseOutUpdateInterpolationTime &&
sPhaseOutUpdateInterpolationTime > 0.0)
{ // Haven't seen a viewer update in a while, check to see if the ciruit is still active
sPhaseOutUpdateInterpolationTime > (F64Seconds)0.0)
{ // Haven't seen a viewer update in a while, check to see if the circuit is still active
if (mRegionp)
{ // The simulator will NOT send updates if the object continues normally on the path
// predicted by the velocity and the acceleration (often gravity) sent to the viewer
@@ -2252,14 +2254,14 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
if (cdp)
{
// Find out how many seconds since last packet arrived on the circuit
F64 time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime();
F64Seconds time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime();
if (!cdp->isAlive() || // Circuit is dead or blocked
cdp->isBlocked() || // or doesn't seem to be getting any packets
(time_since_last_packet > sPhaseOutUpdateInterpolationTime))
{
// Start to reduce motion interpolation since we haven't seen a server update in a while
F64 time_since_last_interpolation = time - mLastInterpUpdateSecs;
F64Seconds time_since_last_interpolation = time - mLastInterpUpdateSecs;
F64 phase_out = 1.0;
if (time_since_last_update > sMaxUpdateInterpolationTime)
{ // Past the time limit, so stop the object