From 58f0e78cb491833440d85e105593bccc2d2aa4ab Mon Sep 17 00:00:00 2001 From: Dave SIMmONs Date: Tue, 12 Oct 2010 13:50:17 -0700 Subject: Initial work on viewer motion interpolation. Changes include: * InterpolationTime and InterpolationPhaseOut values in settings.xml to control new object interpolation code. Use zero to revert to old logic * Viewer motion interpolation lasts InterpolationTime and will start to phase out after InterpolationPhaseOut seconds * Changed LLWorld::getMinAllowedZ() to take a world-position as a parameter * Added LLVOAvatarSelf::resetRegionCrossingTimer() * Actually reset LLVOAvatarSelf::mRegionCrossingTimer so we get sensible timing data for region crossings * LLVOAvatarSelf::updateRegion() will update position value due to region changes Code reviewed by Ambroff * --- indra/newview/app_settings/settings.xml | 22 ++++ indra/newview/llmaniptranslate.cpp | 2 +- indra/newview/llpanelobject.cpp | 4 +- indra/newview/llviewermessage.cpp | 1 + indra/newview/llviewerobject.cpp | 177 ++++++++++++++++++++++++++------ indra/newview/llviewerobject.h | 19 +++- indra/newview/llviewerobjectlist.cpp | 19 +++- indra/newview/llvoavatar.cpp | 1 + indra/newview/llvoavatarself.cpp | 21 ++++ indra/newview/llvoavatarself.h | 2 + indra/newview/llworld.cpp | 5 +- indra/newview/llworld.h | 2 +- 12 files changed, 232 insertions(+), 43 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 742a20a849..d4dd654bbc 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11245,6 +11245,28 @@ Value 1 + InterpolationTime + + Comment + How long to extrapolate object motion after last packet received + Persist + 1 + Type + F32 + Value + 3.0 + + InterpolationPhaseOut + + Comment + Seconds to phase out interpolated motion + Persist + 1 + Type + F32 + Value + 1.0 + VerboseLogs Comment diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 5eb3b789f2..f871df0c36 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -726,7 +726,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask) LLVector3d new_position_global = selectNode->mSavedPositionGlobal + clamped_relative_move; // Don't let object centers go too far underground - F64 min_height = LLWorld::getInstance()->getMinAllowedZ(object); + F64 min_height = LLWorld::getInstance()->getMinAllowedZ(object, object->getPositionGlobal()); if (new_position_global.mdV[VZ] < min_height) { new_position_global.mdV[VZ] = min_height; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index d756a1b931..a0c320ba19 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -1695,10 +1695,10 @@ void LLPanelObject::sendPosition(BOOL btn_down) LLVector3 newpos(mCtrlPosX->get(), mCtrlPosY->get(), mCtrlPosZ->get()); LLViewerRegion* regionp = mObject->getRegion(); - + // Clamp the Z height const F32 height = newpos.mV[VZ]; - const F32 min_height = LLWorld::getInstance()->getMinAllowedZ(mObject); + const F32 min_height = LLWorld::getInstance()->getMinAllowedZ(mObject, mObject->getPositionGlobal()); const F32 max_height = LLWorld::getInstance()->getRegionMaxHeight(); if (!mObject->isAttachment()) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 26b7e0fb6d..8120c37874 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3722,6 +3722,7 @@ void process_crossed_region(LLMessageSystem* msg, void**) return; } LL_INFOS("Messaging") << "process_crossed_region()" << LL_ENDL; + gAgentAvatarp->resetRegionCrossingTimer(); U32 sim_ip; msg->getIPAddrFast(_PREHASH_RegionData, _PREHASH_SimIP, sim_ip); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index fd3e80d755..63bf9a9c46 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -102,8 +102,8 @@ //#define DEBUG_UPDATE_TYPE -BOOL gVelocityInterpolate = TRUE; -BOOL gPingInterpolate = TRUE; +BOOL LLViewerObject::sVelocityInterpolate = TRUE; +BOOL LLViewerObject::sPingInterpolate = TRUE; U32 LLViewerObject::sNumZombieObjects = 0; S32 LLViewerObject::sNumObjects = 0; @@ -114,6 +114,11 @@ S32 LLViewerObject::sAxisArrowLength(50); 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 + + static LLFastTimer::DeclareTimer FTM_CREATE_OBJECT("Create Object"); // static @@ -1838,7 +1843,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, new_rot.normQuat(); - if (gPingInterpolate) + if (sPingInterpolate) { LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit(mesgsys->getSender()); if (cdp) @@ -1859,6 +1864,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // // + // WTF? If we're going to skip this message, why are we + // doing all the parenting, etc above? U32 packet_id = mesgsys->getCurrentRecvPacketID(); if (packet_id < mLatestRecvPacketID && mLatestRecvPacketID - packet_id < 65536) @@ -1999,7 +2006,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // U32 ping_delay = mesgsys->mCircuitInfo.getPingDelay(); mLastInterpUpdateSecs = LLFrameTimer::getElapsedSeconds(); - mLastMessageUpdateSecs = LLFrameTimer::getElapsedSeconds(); + mLastMessageUpdateSecs = mLastInterpUpdateSecs; if (mDrawable.notNull()) { // Don't clear invisibility flag on update if still orphaned! @@ -2026,6 +2033,8 @@ BOOL LLViewerObject::isActive() const return TRUE; } + + BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { static LLFastTimer::DeclareTimer ftm("Viewer Object"); @@ -2039,7 +2048,7 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // CRO - don't velocity interp linked objects! // Leviathan - but DO velocity interp joints - if (!mStatic && gVelocityInterpolate && !isSelected()) + if (!mStatic && sVelocityInterpolate && !isSelected()) { // calculate dt from last update F32 dt_raw = (F32)(time - mLastInterpUpdateSecs); @@ -2129,33 +2138,8 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) return TRUE; } else - { - // linear motion - // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object - // updates represents the average velocity of the last timestep, rather than the final velocity. - // the time dilation above should guarantee that dt is never less than PHYSICS_TIMESTEP, theoretically - // - // There is a problem here if dt is negative. . . - - // *TODO: should also wrap linear accel/velocity in check - // to see if object is selected, instead of explicitly - // zeroing it out - LLVector3 accel = getAcceleration(); - LLVector3 vel = getVelocity(); - - if (!(accel.isExactlyZero() && vel.isExactlyZero())) - { - LLVector3 pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt; - - // region local - setPositionRegion(pos + getPositionRegion()); - setVelocity(vel + accel*dt); - - // for objects that are spinning but not translating, make sure to flag them as having moved - setChanged(MOVED | SILHOUETTE); - } - - mLastInterpUpdateSecs = time; + { // Move object based on it's velocity and rotation + interpolateLinearMotion(time, dt); } } @@ -2171,6 +2155,121 @@ BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) } +// Move an object due to idle-time viewer side updates by iterpolating motion +void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) +{ + // linear motion + // PHYSICS_TIMESTEP is used below to correct for the fact that the velocity in object + // updates represents the average velocity of the last timestep, rather than the final velocity. + // the time dilation above should guarantee that dt is never less than PHYSICS_TIMESTEP, theoretically + // + // *TODO: should also wrap linear accel/velocity in check + // 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) + { + return; + } + + LLVector3 accel = getAcceleration(); + LLVector3 vel = getVelocity(); + + if (sMaxUpdateInterpolationTime <= 0.0) + { // Old code path ... unbounded, simple interpolation + if (!(accel.isExactlyZero() && vel.isExactlyZero())) + { + LLVector3 pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt; + + // region local + setPositionRegion(pos + getPositionRegion()); + setVelocity(vel + accel*dt); + + // for objects that are spinning but not translating, make sure to flag them as having moved + setChanged(MOVED | SILHOUETTE); + } + } + else if ((!accel.isExactlyZero() || !vel.isExactlyZero()) && // object is moving and + (time_since_last_update < sMaxUpdateInterpolationTime)) // we should interpolate motion + { // Object is moving, and hasn't been too long since we got an update from the server + + // Calculate predicted position and velocity + LLVector3 new_pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt; + LLVector3 new_v = accel * dt; + + if (time_since_last_update > sPhaseOutUpdateInterpolationTime) + { // Start to reduce motion interpolation since we haven't seen a server update in a while + F64 time_since_last_interpolation = time - mLastInterpUpdateSecs; + F64 phase_out = 1.0; + if (mLastInterpUpdateSecs - mLastMessageUpdateSecs > sPhaseOutUpdateInterpolationTime) + { // Last update was already phased out a bit + phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / + (sMaxUpdateInterpolationTime - time_since_last_interpolation); + //llinfos << "Continuing motion phase out of " << (F32) phase_out << llendl; + } + else + { // Phase out from full value + phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / + (sMaxUpdateInterpolationTime - sPhaseOutUpdateInterpolationTime); + //llinfos << "Starting motion phase out of " << (F32) phase_out << llendl; + } + phase_out = llclamp(phase_out, 0.0, 1.0); + + new_pos = new_pos * ((F32) phase_out); + new_v = new_v * ((F32) phase_out); + } + + new_pos = new_pos + getPositionRegion(); + new_v = new_v + vel; + + + // Clamp interpolated position to minimum underground and maximum region height + LLVector3d new_pos_global = mRegionp->getPosGlobalFromRegion(new_pos); + F32 min_height = LLWorld::getInstance()->getMinAllowedZ(this, new_pos_global); + new_pos.mV[VZ] = llmax(min_height, new_pos.mV[VZ]); + new_pos.mV[VZ] = llmin(LLWorld::getInstance()->getRegionMaxHeight(), new_pos.mV[VZ]); + + // Check to see if it's going off the region + LLVector3 temp(new_pos); + if (temp.clamp(0.f, mRegionp->getWidth())) + { // Going off this region, so see if we might end up on another region + LLVector3d old_pos_global = mRegionp->getPosGlobalFromRegion(getPositionRegion()); + new_pos_global = mRegionp->getPosGlobalFromRegion(new_pos); // Re-fetch in case it got clipped above + + // Clip the positions to known regions + LLVector3d clip_pos_global = LLWorld::getInstance()->clipToVisibleRegions(old_pos_global, new_pos_global); + if (clip_pos_global != new_pos_global) + { // Was clipped, so this means we hit a edge where there is no region to enter + + //llinfos << "Hit empty region edge, clipped predicted position to " << mRegionp->getPosRegionFromGlobal(clip_pos_global) + // << " from " << new_pos << llendl; + new_pos = mRegionp->getPosRegionFromGlobal(clip_pos_global); + + // Stop motion and get server update for bouncing on the edge + new_v.clear(); + setAcceleration(LLVector3::zero); + } + else + { // Let predicted movement cross into another region + //llinfos << "Predicting region crossing to " << new_pos << llendl; + } + } + + // Set new position and velocity + setPositionRegion(new_pos); + setVelocity(new_v); + + // for objects that are spinning but not translating, make sure to flag them as having moved + setChanged(MOVED | SILHOUETTE); + } + + // Update the last time we did anything + mLastInterpUpdateSecs = time; +} + + + BOOL LLViewerObject::setData(const U8 *datap, const U32 data_size) { LLMemType mt(LLMemType::MTYPE_OBJECT); @@ -4971,6 +5070,20 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp) updateDrawable(FALSE); } +// virtual +void LLViewerObject::updateRegion(LLViewerRegion *regionp) +{ +// if (regionp) +// { +// F64 now = LLFrameTimer::getElapsedSeconds(); +// llinfos << "Updating to region " << regionp->getName() +// << ", ms since last update message: " << (F32)((now - mLastMessageUpdateSecs) * 1000.0) +// << ", ms since last interpolation: " << (F32)((now - mLastInterpUpdateSecs) * 1000.0) +// << llendl; +// } +} + + bool LLViewerObject::specialHoverCursor() const { return (mFlags & FLAGS_USE_PHYSICS) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index bcc2cb164f..77c34101ba 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -464,7 +464,7 @@ public: bool specialHoverCursor() const; // does it have a special hover cursor? void setRegion(LLViewerRegion *regionp); - virtual void updateRegion(LLViewerRegion *regionp) {} + virtual void updateRegion(LLViewerRegion *regionp); void updateFlags(); BOOL setFlags(U32 flag, BOOL state); @@ -510,6 +510,9 @@ private: // and the update wasn't due to this agent's last action. U32 checkMediaURL(const std::string &media_url); + // Motion prediction between updates + void interpolateLinearMotion(const F64 & time, const F32 & dt); + public: // // Viewer-side only types - use the LL_PCODE_APP mask. @@ -669,9 +672,21 @@ protected: mutable LLVector3 mPositionRegion; mutable LLVector3 mPositionAgent; + static void setPhaseOutUpdateInterpolationTime(F32 value) { sPhaseOutUpdateInterpolationTime = (F64) value; } + static void setMaxUpdateInterpolationTime(F32 value) { sMaxUpdateInterpolationTime = (F64) value; } + + static void setVelocityInterpolate(BOOL value) { sVelocityInterpolate = value; } + static void setPingInterpolate(BOOL value) { sPingInterpolate = value; } + private: static S32 sNumObjects; + static F64 sPhaseOutUpdateInterpolationTime; // For motion interpolation + static F64 sMaxUpdateInterpolationTime; // For motion interpolation + + static BOOL sVelocityInterpolate; + static BOOL sPingInterpolate; + //-------------------------------------------------------------------- // For objects that are attachments //-------------------------------------------------------------------- @@ -742,7 +757,5 @@ public: virtual void updateDrawable(BOOL force_damped); }; -extern BOOL gVelocityInterpolate; -extern BOOL gPingInterpolate; #endif diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 05695193a5..fa9e51c152 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -654,9 +654,24 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent) void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) { LLMemType mt(LLMemType::MTYPE_OBJECT); + // Update globals - gVelocityInterpolate = gSavedSettings.getBOOL("VelocityInterpolate"); - gPingInterpolate = gSavedSettings.getBOOL("PingInterpolate"); + LLViewerObject::setVelocityInterpolate( gSavedSettings.getBOOL("VelocityInterpolate") ); + LLViewerObject::setPingInterpolate( gSavedSettings.getBOOL("PingInterpolate") ); + + F32 interp_time = gSavedSettings.getF32("InterpolationTime"); + F32 phase_out_time = gSavedSettings.getF32("InterpolationPhaseOut"); + if (interp_time < 0.0 || + phase_out_time < 0.0 || + phase_out_time > interp_time) + { + llwarns << "Invalid values for InterpolationTime or InterpolationPhaseOut, resetting to defaults" << llendl; + interp_time = 3.0f; + phase_out_time = 1.0f; + } + LLViewerObject::setPhaseOutUpdateInterpolationTime( interp_time ); + LLViewerObject::setMaxUpdateInterpolationTime( phase_out_time ); + gAnimateTextures = gSavedSettings.getBOOL("AnimateTextures"); // update global timer diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c31714de5a..119380f759 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7727,6 +7727,7 @@ BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMorphNodes(LLXmlTreeNode* root) //virtual void LLVOAvatar::updateRegion(LLViewerRegion *regionp) { + LLViewerObject::updateRegion(regionp); } std::string LLVOAvatar::getFullname() const diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e5cbf65682..0250627d1b 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -806,7 +806,24 @@ void LLVOAvatarSelf::removeMissingBakedTextures() //virtual void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) { + // Save the global position + LLVector3d global_pos_from_old_region = getPositionGlobal(); + + // Change the region setRegion(regionp); + + if (regionp) + { // Set correct region-relative position from global coordinates + setPositionGlobal(global_pos_from_old_region); + + // Diagnostic info + //LLVector3d pos_from_new_region = getPositionGlobal(); + //llinfos << "pos_from_old_region is " << global_pos_from_old_region + // << " while pos_from_new_region is " << pos_from_new_region + // << llendl; + } + + if (!regionp || (regionp->getHandle() != mLastRegionHandle)) { if (mLastRegionHandle != 0) @@ -820,6 +837,9 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX); max = llmax(delta, max); LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); + + // Diagnostics + llinfos << "Region crossing took " << (F32)(delta * 1000.0) << " ms " << llendl; } if (regionp) { @@ -827,6 +847,7 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) } } mRegionCrossingTimer.reset(); + LLViewerObject::updateRegion(regionp); } //-------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 23a799ea3a..d13cf5ba38 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -123,6 +123,8 @@ public: //-------------------------------------------------------------------- // Region state //-------------------------------------------------------------------- + void resetRegionCrossingTimer() { mRegionCrossingTimer.reset(); } + private: U64 mLastRegionHandle; LLFrameTimer mRegionCrossingTimer; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 5760d04a08..2793a33401 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -423,14 +423,15 @@ BOOL LLWorld::positionRegionValidGlobal(const LLVector3d &pos_global) // Allow objects to go up to their radius underground. -F32 LLWorld::getMinAllowedZ(LLViewerObject* object) +F32 LLWorld::getMinAllowedZ(LLViewerObject* object, const LLVector3d &global_pos) { - F32 land_height = resolveLandHeightGlobal(object->getPositionGlobal()); + F32 land_height = resolveLandHeightGlobal(global_pos); F32 radius = 0.5f * object->getScale().length(); return land_height - radius; } + LLViewerRegion* LLWorld::resolveRegionGlobal(LLVector3 &pos_region, const LLVector3d &pos_global) { LLViewerRegion *regionp = getRegionFromPosGlobal(pos_global); diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index 4465fde210..d4f4d8d8df 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -89,7 +89,7 @@ public: // Return the lowest allowed Z point to prevent objects from being moved // underground. - F32 getMinAllowedZ(LLViewerObject* object); + F32 getMinAllowedZ(LLViewerObject* object, const LLVector3d &global_pos); // takes a line segment defined by point_a and point_b, then // determines the closest (to point_a) point of intersection that is -- cgit v1.2.3 From d5d4a065275d1db1093111222f29942ee171f81c Mon Sep 17 00:00:00 2001 From: Dave SIMmONs Date: Tue, 12 Oct 2010 17:15:29 -0700 Subject: Adjust viewer object interpolation code so that tapering off only occurs if the simulator stops sending data. Reviewed by Ambroff --- indra/newview/llviewerobject.cpp | 65 +++++++++++++++++++++++++++------------- indra/newview/llviewerobject.h | 2 ++ 2 files changed, 47 insertions(+), 20 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 63bf9a9c46..c54d47ece6 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -207,6 +207,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mLastInterpUpdateSecs(0.f), mLastMessageUpdateSecs(0.f), mLatestRecvPacketID(0), + mCircuitPacketCount(0), mData(NULL), mAudioSourcep(NULL), mAudioGain(1.f), @@ -1875,6 +1876,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } mLatestRecvPacketID = packet_id; + mCircuitPacketCount = 0; // Set the change flags for scale if (new_scale != getScale()) @@ -2190,8 +2192,7 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) setChanged(MOVED | SILHOUETTE); } } - else if ((!accel.isExactlyZero() || !vel.isExactlyZero()) && // object is moving and - (time_since_last_update < sMaxUpdateInterpolationTime)) // we should interpolate motion + else if (!accel.isExactlyZero() || !vel.isExactlyZero()) // object is moving { // Object is moving, and hasn't been too long since we got an update from the server // Calculate predicted position and velocity @@ -2199,25 +2200,48 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt) LLVector3 new_v = accel * dt; if (time_since_last_update > sPhaseOutUpdateInterpolationTime) - { // Start to reduce motion interpolation since we haven't seen a server update in a while - F64 time_since_last_interpolation = time - mLastInterpUpdateSecs; - F64 phase_out = 1.0; - if (mLastInterpUpdateSecs - mLastMessageUpdateSecs > sPhaseOutUpdateInterpolationTime) - { // Last update was already phased out a bit - phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / - (sMaxUpdateInterpolationTime - time_since_last_interpolation); - //llinfos << "Continuing motion phase out of " << (F32) phase_out << llendl; - } - else - { // Phase out from full value - phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / - (sMaxUpdateInterpolationTime - sPhaseOutUpdateInterpolationTime); - //llinfos << "Starting motion phase out of " << (F32) phase_out << llendl; - } - phase_out = llclamp(phase_out, 0.0, 1.0); + { // Haven't seen a viewer update in a while, check to see if the ciruit 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 + // So check to see if the circuit is blocked, which means the sim is likely in a long lag + LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit( mRegionp->getHost() ); + if (cdp) + { + if (!cdp->isAlive() || // Circuit is dead or blocked + cdp->isBlocked() || // or doesn't seem to be getting any packets + (mCircuitPacketCount > 0 && mCircuitPacketCount == cdp->getPacketsIn())) + { + // Start to reduce motion interpolation since we haven't seen a server update in a while + F64 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 + phase_out = 0.0; + //llinfos << "Motion phase out to zero" << llendl; + } + else if (mLastInterpUpdateSecs - mLastMessageUpdateSecs > sPhaseOutUpdateInterpolationTime) + { // Last update was already phased out a bit + phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / + (sMaxUpdateInterpolationTime - time_since_last_interpolation); + //llinfos << "Continuing motion phase out of " << (F32) phase_out << llendl; + } + else + { // Phase out from full value + phase_out = (sMaxUpdateInterpolationTime - time_since_last_update) / + (sMaxUpdateInterpolationTime - sPhaseOutUpdateInterpolationTime); + //llinfos << "Starting motion phase out of " << (F32) phase_out << llendl; + } + phase_out = llclamp(phase_out, 0.0, 1.0); + + new_pos = new_pos * ((F32) phase_out); + new_v = new_v * ((F32) phase_out); + } - new_pos = new_pos * ((F32) phase_out); - new_v = new_v * ((F32) phase_out); + // Save current circuit packet count to see if it changes + mCircuitPacketCount = cdp->getPacketsIn(); + } + } } new_pos = new_pos + getPositionRegion(); @@ -5058,6 +5082,7 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp) } mLatestRecvPacketID = 0; + mCircuitPacketCount = 0; mRegionp = regionp; for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 77c34101ba..0cba4e05f9 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -615,6 +615,8 @@ protected: F64 mLastInterpUpdateSecs; // Last update for purposes of interpolation F64 mLastMessageUpdateSecs; // Last update from a message from the simulator TPACKETID mLatestRecvPacketID; // Latest time stamp on message from simulator + U32 mCircuitPacketCount; // Packet tracking for early detection of a stopped simulator circuit + // extra data sent from the sim...currently only used for tree species info U8* mData; -- cgit v1.2.3 From 7c89e565b373803b64cabaac3695ac3e93469962 Mon Sep 17 00:00:00 2001 From: Wolfpup Lowenhar Date: Tue, 26 Oct 2010 20:02:07 -0400 Subject: This is the setting of the core file name date stamp code and settings files for Chat, Group and IM Logs. --HG-- branch : storm-102 --- .../newview/app_settings/settings_per_account.xml | 12 ++++- indra/newview/llfloaterpreference.cpp | 2 +- indra/newview/lllogchat.cpp | 62 ++++++++++++++++++++-- indra/newview/lllogchat.h | 5 ++ .../default/xui/en/panel_preferences_privacy.xml | 12 ++++- 5 files changed, 87 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index dc76a4e518..ab702e49e1 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -110,7 +110,17 @@ Value 00000000-0000-0000-0000-000000000000 - + LogFileNamewithDate + + Comment + Add Date Stamp to chat and IM Logs with format chat-YYYY-MM-DD and 'IM file name'-YYYY-MM. To view old logs goto ..\Second Life\[login name] + Persist + 1 + Type + Boolean + Value + 1 + + + (People and/or Objects you have blocked) + -- cgit v1.2.3 From 5894a6a593a0a948815d925dabfb2a4bc78e9d3f Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 11 Nov 2010 14:59:51 +0200 Subject: STORM-582 FIXED Moved movement and camera control preferences from Advanced to the new Move & View tab. In addition to moving existing controls, created stub checkbox and radiobuttons for double-click behavior. Logic will be hooked up to them in STORM-576. --- .../default/xui/en/panel_preferences_move.xml | 194 +++++++++++++++++++++ 1 file changed, 194 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_move.xml b/indra/newview/skins/default/xui/en/panel_preferences_move.xml index 2d6dddfc8c..ec80efe188 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_move.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_move.xml @@ -9,4 +9,198 @@ name="move_panel" top="1" width="517"> + + + + + Automatic position for: + + + + + + + + Mouselook mouse sensitivity: + + + + + + + + + + -- cgit v1.2.3 From d358feff7ad732b28d8e914e44cdb08761207346 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 11 Nov 2010 15:06:51 +0200 Subject: STORM-586 FIXED Layout cleanup in the Setup tab of Preferences - Deleted Mouselook settings - Increased vertical padding between "Cache size" and "Cache location" controls --- .../default/xui/en/panel_preferences_setup.xml | 49 +--------------------- 1 file changed, 2 insertions(+), 47 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml index 140d16e37f..14aa38c5d3 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -9,51 +9,6 @@ name="Input panel" top="1" width="517"> - - Mouselook: - - - Mouse sensitivity - - - Network: @@ -187,7 +142,7 @@ layout="topleft" left="80" name="Cache location" - top_delta="20" + top_delta="40" width="300"> Cache location: -- cgit v1.2.3 From 5821631c2e3527d248d6190e342e241acdc38dd7 Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Thu, 11 Nov 2010 15:15:04 +0200 Subject: STORM-583 ADDITIONAL_FIX Fixed top_pad of topmost control in "Colors" so that it is consistent with other preferences tab. --- indra/newview/skins/default/xui/en/panel_preferences_colors.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml index 06e8ee80b5..036730a646 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml @@ -17,7 +17,7 @@ layout="topleft" left="30" name="effects_color_textbox" - top_pad="15" + top_pad="10" width="200"> My effects (selection beam): -- cgit v1.2.3 From 51e38dff76fce7f0fe5b665f8707931435e2ff99 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 11 Nov 2010 16:45:35 +0200 Subject: STORM-587 FIXED Layout cleanup in the Advanced tab of Preferences - According to the specification deleted all controls except: 1. "UI Size" slider 2. "Show script errors in" radio group - According to the specification: 1. "Allow Multiple Viewer" checkbox 2. "Show Grid Selection at login" checkbox 3. "Show Advanced Manu" checkbox 4. "Show Developer Menu" checkbox --- .../default/xui/en/panel_preferences_advanced.xml | 259 +++------------------ 1 file changed, 32 insertions(+), 227 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index e17d4768d4..6f4beea43a 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -17,188 +17,17 @@ name="middle_mouse"> Middle Mouse - - - - -Automatic position for: - - - - - - - - - - - - - - - - UI size + width="100"> + UI size: + width="250" /> - - + - - - + height="15" + label="Show Developer Menu" + layout="topleft" + left="30" + name="push_to_talk_toggle_check" + top_pad="5" + width="237"/> -- cgit v1.2.3 From 2287f7612ce0e2cbc439c4ce048edcb2df3b3d40 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 11 Nov 2010 18:49:55 +0200 Subject: STORM-587 ADDITIONAL FIX Layout cleanup in the Advanced tab of Preferences - Temporary restored controls: 1. "Move avatar lips when speaking" checkbox 2. "Toggle speak on/off when I press:" checkbox 3. "Push-to-Speak trigger" lineeditor 4. "set_voice_hotkey_button" button 5. "set_voice_middlemouse_button" button They should be moved to the Sound&Media panel of floater Preferences. But the specification for the Sound&Media panel is not ready yet. As specification will be ready, these controls will be moved to the Sound&Media panel. --- .../default/xui/en/panel_preferences_advanced.xml | 64 +++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 6f4beea43a..6a9ea5afb6 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -103,7 +103,7 @@ + + + + + + + -- cgit v1.2.3 From 4077e6bb52f73a3ccd7f560788fc2fda21d7d9e7 Mon Sep 17 00:00:00 2001 From: Wolfpup Lowenhar Date: Thu, 11 Nov 2010 22:50:14 -0500 Subject: STORM-102 : STORM-143 :Made needed changes to code to improve searching for previous logs and also changed the name used for P2P IM log file names. The latter change is going to temporarely break personal content for those that are saving conversation logs as P2P IM logs will now be useinf the user name and not the legacy name. --- indra/newview/llimview.cpp | 5 +++-- indra/newview/lllogchat.cpp | 53 +++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 28 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 857c27be63..14a29b7e0f 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -537,7 +537,8 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline() void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) { - if (av_name.mLegacyFirstName.empty()) + mHistoryFileName = av_name.mUsername; + /*if (av_name.mLegacyFirstName.empty()) { // if mLegacyFirstName is empty it means display names is off and the // data came from the gCacheName, mDisplayName will be the legacy name @@ -546,7 +547,7 @@ void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LL else { mHistoryFileName = LLCacheName::cleanFullName(av_name.getLegacyName()); - } + }*/ } void LLIMModel::LLIMSession::buildHistoryFileName() diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 4f80472330..2fb5ba82ba 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -206,7 +206,7 @@ std::string LLLogChat::makeLogFileName(std::string filename) std::string LLLogChat::cleanFileName(std::string filename) { - std::string invalidChars = "\"\'\\/?*:<>|"; + std::string invalidChars = "\"\'\\/?*:.<>|"; std::string::size_type position = filename.find_first_of(invalidChars); while (position != filename.npos) { @@ -370,8 +370,8 @@ void LLLogChat::loadAllHistory(const std::string& file_name, std::list& me llwarns << "Session name is Empty!" << llendl; return ; } - LL_INFOS("") << "Loading:" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ - LL_INFOS("") << "Current:" << makeLogFileName(file_name) << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ + //LL_INFOS("") << "Loading:" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ + //LL_INFOS("") << "Current:" << makeLogFileName(file_name) << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ LLFILE* fptr = LLFile::fopen(makeLogFileName(file_name), "r");/*Flawfinder: ignore*/ if (!fptr) { @@ -569,31 +569,32 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im) im[IM_TEXT] = name_and_text[IDX_TEXT]; return true; //parsed name and message text, maybe have a timestamp too } -std::string LLLogChat::oldLogFileName(std::string filename) -{ +std::string LLLogChat::oldLogFileName(std::string filename) +{ std::string scanResult; std::string directory = gDirUtilp->getPerAccountChatLogsDir();/* get Users log directory */ directory += gDirUtilp->getDirDelimiter();/* add final OS dependent delimiter */ - std::string pattern = (cleanFileName(filename)+(( filename == "chat" ) ? "-???\?-?\?-??.txt" : "-???\?-??.txt"));/* create search pattern*/ - LL_INFOS("") << "Checking:" << directory << " for " << pattern << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ - std::vector allfiles; - - while (gDirUtilp->getNextFileInDir(directory, pattern, scanResult)) + filename=cleanFileName(filename);/* lest make shure the file name has no invalad charecters befor making the pattern */ + std::string pattern = (filename+(( filename == "chat" ) ? "-???\?-?\?-??.txt" : "-???\?-??.txt"));/* create search pattern*/ + //LL_INFOS("") << "Checking:" << directory << " for " << pattern << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ + std::vector allfiles; + + while (gDirUtilp->getNextFileInDir(directory, pattern, scanResult)) + { + //LL_INFOS("") << "Found :" << scanResult << LL_ENDL; + allfiles.push_back(scanResult); + } + + if (allfiles.size() == 0) // if no result from date search, return generic filename + { + scanResult = directory + filename + ".txt"; + } + else { - //LL_INFOS("") << "Found :" << scanResult << LL_ENDL; - allfiles.push_back(scanResult); - } - - if (allfiles.size() == 0) // if no result from date search, return generic filename - { - scanResult = directory + filename + ".txt"; - } - else - { - std::sort(allfiles.begin(), allfiles.end()); - scanResult = directory + allfiles.back(); - // thisfile is now the most recent version of the file. - } - LL_INFOS("") << "Reading:" << scanResult << LL_ENDL; - return scanResult; + std::sort(allfiles.begin(), allfiles.end()); + scanResult = directory + allfiles.back(); + // thisfile is now the most recent version of the file. + } + //LL_INFOS("") << "Reading:" << scanResult << LL_ENDL;/* uncomment if you want to verify step, delete on commit */ + return scanResult; } -- cgit v1.2.3 From 5c18ab7aceabc01fdcf01e86e364621241132966 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Fri, 12 Nov 2010 15:35:42 +0200 Subject: STORM-587 ADDITIONAL FIX Layout cleanup in the Advanced tab of Preferences - Removed controls: 1. "Move avatar lips when speaking" checkbox 2. "Toggle speak on/off when I press:" checkbox 3. "Push-to-Speak trigger" lineeditor 4. "set_voice_hotkey_button" button 5. "set_voice_middlemouse_button" button - Set proper names for checkboxes According to the specification these controls are in the Sound&Media panel now. --- .../default/xui/en/panel_preferences_advanced.xml | 70 ++-------------------- 1 file changed, 4 insertions(+), 66 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 6a9ea5afb6..c1fb0243b7 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -88,7 +88,7 @@ label="Allow Multiple Viewer" layout="topleft" left="30" - name="push_to_talk_toggle_check" + name="allow_multiple_viewer_check" top_pad="20" width="237"/> - - - - - - - -- cgit v1.2.3 From 2632565bbced3002eb9912270b1f7303c48a0b44 Mon Sep 17 00:00:00 2001 From: Wolfpup Lowenhar Date: Fri, 12 Nov 2010 09:09:41 -0500 Subject: STORM-102 : STORM-143 :Removed unneeded code in llimview. --- indra/newview/llimview.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 14a29b7e0f..cc48226052 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -538,16 +538,6 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline() void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) { mHistoryFileName = av_name.mUsername; - /*if (av_name.mLegacyFirstName.empty()) - { - // if mLegacyFirstName is empty it means display names is off and the - // data came from the gCacheName, mDisplayName will be the legacy name - mHistoryFileName = LLCacheName::cleanFullName(av_name.mDisplayName); - } - else - { - mHistoryFileName = LLCacheName::cleanFullName(av_name.getLegacyName()); - }*/ } void LLIMModel::LLIMSession::buildHistoryFileName() -- cgit v1.2.3 From 29a36c21db57729ff86785745c90ffbf93875edb Mon Sep 17 00:00:00 2001 From: Andrew Productengine Date: Fri, 12 Nov 2010 18:18:44 +0200 Subject: STORM-571 FIXED Moved voice prefs from advanced to Sound&Media and changed layout accordingly. This changeset also covers STORM-572 (note that design in this fix differs a little from the one proposed in there because there was not enough space to make it that way). --- .../default/xui/en/panel_preferences_advanced.xml | 4 - .../default/xui/en/panel_preferences_sound.xml | 140 +++++++++++++++------ 2 files changed, 104 insertions(+), 40 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index c1fb0243b7..15d1222d00 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -13,10 +13,6 @@ name="aspect_ratio_text"> [NUM]:[DEN] - - Middle Mouse - + + Middle Mouse + + left="25" + width="230"/> + + width="180" + top_pad="10"> Voice Chat Settings + width="102"> Listen from: + top_delta="0" /> + + + + @@ -396,14 +464,14 @@ visiblity_control="ShowDeviceSettings" border="false" follows="top|left" - height="120" + height="100" label="Device Settings" layout="topleft" - left="0" + left_delta="-2" name="device_settings_panel" class="panel_voice_device_settings" - width="501" - top="285"> + width="470" + top_pad="0"> Default @@ -419,7 +487,7 @@ + width="70"> Input My volume: @@ -465,11 +533,11 @@ increment="0.025" initial_value="1.0" layout="topleft" - left="160" + left_delta="-6" max_val="2" name="mic_volume_slider" tool_tip="Change the volume using this slider" - top_pad="-2" + top_pad="-1" width="220" /> Please wait @@ -489,7 +557,7 @@ layout="topleft" left_delta="0" name="bar0" - top_delta="0" + top_delta="-2" width="20" /> + width="70"> Output -- cgit v1.2.3 From e3677f9ee2223cc13d12456e1eee4f7f9a90c474 Mon Sep 17 00:00:00 2001 From: Dave SIMmONs Date: Fri, 12 Nov 2010 12:18:18 -0800 Subject: Revert change for ER-301 to make merging easier. We'll get this in another pass --- indra/newview/llviewerthrottle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerthrottle.cpp b/indra/newview/llviewerthrottle.cpp index 5147272122..b614ccdbc2 100644 --- a/indra/newview/llviewerthrottle.cpp +++ b/indra/newview/llviewerthrottle.cpp @@ -46,7 +46,7 @@ const F32 MAX_FRACTIONAL = 1.5f; const F32 MIN_FRACTIONAL = 0.2f; const F32 MIN_BANDWIDTH = 50.f; -const F32 MAX_BANDWIDTH = 3000.f; +const F32 MAX_BANDWIDTH = 1500.f; const F32 STEP_FRACTIONAL = 0.1f; const F32 TIGHTEN_THROTTLE_THRESHOLD = 3.0f; // packet loss % per s const F32 EASE_THROTTLE_THRESHOLD = 0.5f; // packet loss % per s -- cgit v1.2.3