diff options
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r-- | indra/newview/llviewerobject.cpp | 91 |
1 files changed, 41 insertions, 50 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index f66172d924..831bef8323 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -237,6 +237,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mTimeDilation(1.f), mRotTime(0.f), mAngularVelocityRot(), + mPreviousRotation(), mState(0), mMedia(NULL), mClickAction(0), @@ -784,7 +785,7 @@ BOOL LLViewerObject::setDrawableParent(LLDrawable* parentp) } LLDrawable* old_parent = mDrawable->mParent; mDrawable->mParent = parentp; - + if (parentp && mDrawable->isActive()) { parentp->makeActive(); @@ -1231,12 +1232,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, coloru.mV[3] = 255 - coloru.mV[3]; mText->setColor(LLColor4(coloru)); mText->setString(temp_string); - - if (mDrawable.notNull()) - { - setChanged(MOVED | SILHOUETTE); - gPipeline.markMoved(mDrawable, FALSE); // undamped - } + + setChanged(MOVED | SILHOUETTE); } else if (mText.notNull()) { @@ -1410,9 +1407,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, #else val = (U16 *) &data[count]; #endif - setAngularVelocity( U16_to_F32(val[VX], -size, size), + new_angv.set(U16_to_F32(val[VX], -size, size), U16_to_F32(val[VY], -size, size), U16_to_F32(val[VZ], -size, size)); + setAngularVelocity(new_angv); break; case 16: @@ -1436,9 +1434,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, new_rot.mQ[VZ] = U8_to_F32(data[11], -1.f, 1.f); new_rot.mQ[VW] = U8_to_F32(data[12], -1.f, 1.f); - setAngularVelocity( U8_to_F32(data[13], -size, size), + new_angv.set(U8_to_F32(data[13], -size, size), U8_to_F32(data[14], -size, size), U8_to_F32(data[15], -size, size) ); + setAngularVelocity(new_angv); break; } @@ -1510,9 +1509,10 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, dp->unpackU16(val[VX], "AccX"); dp->unpackU16(val[VY], "AccY"); dp->unpackU16(val[VZ], "AccZ"); - setAngularVelocity( U16_to_F32(val[VX], -64.f, 64.f), + new_angv.set(U16_to_F32(val[VX], -64.f, 64.f), U16_to_F32(val[VY], -64.f, 64.f), U16_to_F32(val[VZ], -64.f, 64.f)); + setAngularVelocity(new_angv); } break; case OUT_FULL_COMPRESSED: @@ -1556,8 +1556,8 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, if (value & 0x80) { - dp->unpackVector3(vec, "Omega"); - setAngularVelocity(vec); + dp->unpackVector3(new_angv, "Omega"); + setAngularVelocity(new_angv); } if (value & 0x20) @@ -2038,10 +2038,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } } - if (new_rot != getRotation() - || new_angv != old_angv) + if ((new_rot != getRotation()) + || (new_angv != old_angv)) { - if (new_angv != old_angv) + if (new_rot != mPreviousRotation) + { + resetRot(); + } + else if (new_angv != old_angv) { if (flagUsePhysics()) { @@ -2053,12 +2057,14 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } } + // Remember the last rotation value + mPreviousRotation = new_rot; + // Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega) setRotation(new_rot * mAngularVelocityRot); setChanged(ROTATED | SILHOUETTE); } - if ( gShowObjectUpdates ) { LLColor4 color; @@ -2159,28 +2165,28 @@ void LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) 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; + // 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; applyAngularVelocity(dt); - + if (isAttachment()) - { - mLastInterpUpdateSecs = time; + { + mLastInterpUpdateSecs = 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); } } @@ -2860,21 +2866,6 @@ void LLViewerObject::updateInventory( { LLMemType mt(LLMemType::MTYPE_OBJECT); - std::list<LLUUID>::iterator begin = mPendingInventoryItemsIDs.begin(); - std::list<LLUUID>::iterator end = mPendingInventoryItemsIDs.end(); - - bool is_fetching = std::find(begin, end, item->getAssetUUID()) != end; - bool is_fetched = getInventoryItemByAsset(item->getAssetUUID()) != NULL; - - if (is_fetched || is_fetching) - { - return; - } - else - { - mPendingInventoryItemsIDs.push_back(item->getAssetUUID()); - } - // This slices the object into what we're concerned about on the // viewer. The simulator will take the permissions and transfer // ownership. @@ -5401,9 +5392,9 @@ void LLViewerObject::setPhysicsShapeType(U8 type) mPhysicsShapeUnknown = false; if (type != mPhysicsShapeType) { - mPhysicsShapeType = type; - mCostStale = true; - } + mPhysicsShapeType = type; + mCostStale = true; +} } void LLViewerObject::setPhysicsGravity(F32 gravity) |