summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-09-20 19:43:54 -0700
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-09-20 19:43:54 -0700
commitc6a2ac0489859111276421d620abd156339c607d (patch)
tree1bfbeb5d0ddcedd77854e5e5c8b6ad675ed6ef3c /indra/newview/llviewerobject.cpp
parentae127dc01ab10d407cf165ae2ad74060f65c1832 (diff)
parent29cdf94e95d0a4365bd18860c4759f9a6a13f45a (diff)
Pull and merge from ssh://hg@bitbucket.org/stinson_linden/viewer-beta-drtvwr-179.
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp71
1 files changed, 41 insertions, 30 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 444bbb2776..2bc7430e06 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();
@@ -1410,9 +1411,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 +1438,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 +1513,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 +1560,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,12 +2042,16 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
}
}
- if (new_rot != getRotation()
- || new_angv != old_angv)
+ if ((new_rot != getRotation())
+ || (new_angv != old_angv))
+ {
+ if (new_rot != mPreviousRotation)
{
- if (new_angv != old_angv)
+ resetRot();
+ }
+ else if (new_angv != old_angv)
{
- if (flagUsePhysics())
+ if (flagUsePhysics() || new_angv.isExactlyZero())
{
resetRot();
}
@@ -2053,6 +2061,9 @@ 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);
@@ -2159,29 +2170,29 @@ 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);
- }
}
-
- updateDrawable(FALSE);
+ else
+ { // Move object based on it's velocity and rotation
+ interpolateLinearMotion(time, dt);
+ }
}
+
+ updateDrawable(FALSE);
+}
}
@@ -5384,9 +5395,9 @@ void LLViewerObject::setPhysicsShapeType(U8 type)
mPhysicsShapeUnknown = false;
if (type != mPhysicsShapeType)
{
- mPhysicsShapeType = type;
- mCostStale = true;
- }
+ mPhysicsShapeType = type;
+ mCostStale = true;
+}
}
void LLViewerObject::setPhysicsGravity(F32 gravity)