diff options
author | Mark Palange <palange@lindenlab.com> | 2008-10-07 22:43:15 +0000 |
---|---|---|
committer | Mark Palange <palange@lindenlab.com> | 2008-10-07 22:43:15 +0000 |
commit | c9be97fdfcc6a4c6b23a8c90916af54a38d60ab0 (patch) | |
tree | b0a7c83b643aff7a50208c3acd5caa4a9df1bbe2 /indra/newview/lltoolgrab.cpp | |
parent | 9d7c56bf16f6c093c7b8d486f943e8d6df4d6a24 (diff) |
merge r97380-98701 branches/viewer/viewer_1-21 (Viewer RC5 and security fixes) merge to trunk
Diffstat (limited to 'indra/newview/lltoolgrab.cpp')
-rw-r--r-- | indra/newview/lltoolgrab.cpp | 72 |
1 files changed, 54 insertions, 18 deletions
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp index f824ce4861..735114567c 100644 --- a/indra/newview/lltoolgrab.cpp +++ b/indra/newview/lltoolgrab.cpp @@ -400,6 +400,14 @@ void LLToolGrab::startGrab() mGrabHiddenOffsetFromCamera = mDragStartFromCamera; mGrabTimer.reset(); + + mLastUVCoords = mGrabPick.mUVCoords; + mLastSTCoords = mGrabPick.mSTCoords; + mLastFace = mGrabPick.mObjectFace; + mLastIntersection = mGrabPick.mIntersection; + mLastNormal = mGrabPick.mNormal; + mLastBinormal = mGrabPick.mBinormal; + mLastGrabPos = LLVector3(-1.f, -1.f, -1.f); } @@ -797,26 +805,54 @@ void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask) grab_pos_region = objectp->getRegion()->getPosRegionFromGlobal( grab_point_global ); } - LLMessageSystem *msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ObjectGrabUpdate); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_ObjectData); - msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() ); - msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial ); - msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region ); - msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds ); - msg->nextBlock("SurfaceInfo"); - msg->addVector3("UVCoord", LLVector3(pick.mUVCoords)); - msg->addVector3("STCoord", LLVector3(pick.mSTCoords)); - msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace); - msg->addVector3("Position", pick.mIntersection); - msg->addVector3("Normal", pick.mNormal); - msg->addVector3("Binormal", pick.mBinormal); - msg->sendMessage( objectp->getRegion()->getHost() ); + // only send message if something has changed since last message + + BOOL changed_since_last_update = FALSE; + + // test if touch data needs to be updated + if ((pick.mObjectFace != mLastFace) || + (pick.mUVCoords != mLastUVCoords) || + (pick.mSTCoords != mLastSTCoords) || + (pick.mIntersection != mLastIntersection) || + (pick.mNormal != mLastNormal) || + (pick.mBinormal != mLastBinormal) || + (grab_pos_region != mLastGrabPos)) + { + changed_since_last_update = TRUE; + } + if (changed_since_last_update) + { + LLMessageSystem *msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ObjectGrabUpdate); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ObjectData); + msg->addUUIDFast(_PREHASH_ObjectID, objectp->getID() ); + msg->addVector3Fast(_PREHASH_GrabOffsetInitial, mGrabOffsetFromCenterInitial ); + msg->addVector3Fast(_PREHASH_GrabPosition, grab_pos_region ); + msg->addU32Fast(_PREHASH_TimeSinceLast, dt_milliseconds ); + msg->nextBlock("SurfaceInfo"); + msg->addVector3("UVCoord", LLVector3(pick.mUVCoords)); + msg->addVector3("STCoord", LLVector3(pick.mSTCoords)); + msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace); + msg->addVector3("Position", pick.mIntersection); + msg->addVector3("Normal", pick.mNormal); + msg->addVector3("Binormal", pick.mBinormal); + + msg->sendMessage( objectp->getRegion()->getHost() ); + + mLastUVCoords = pick.mUVCoords; + mLastSTCoords = pick.mSTCoords; + mLastFace = pick.mObjectFace; + mLastIntersection = pick.mIntersection; + mLastNormal= pick.mNormal; + mLastBinormal= pick.mBinormal; + mLastGrabPos = grab_pos_region; + } + // update point-at / look-at if (pick.mObjectFace != -1) // if the intersection was on the surface of the obejct { |