diff options
author | Mark Palange <palange@lindenlab.com> | 2008-10-08 00:22:32 +0000 |
---|---|---|
committer | Mark Palange <palange@lindenlab.com> | 2008-10-08 00:22:32 +0000 |
commit | b807e3df990e6fad25cd0bca94d2959dac042b13 (patch) | |
tree | aa8b185cac406abe412d76d90a903b450191d84d /indra/newview/lltoolgrab.cpp | |
parent | 4296542cd062af425d7744c88d6dd2bd00daf532 (diff) |
merge r97380-98701 branches/viewer/viewer_1-21 (Viewer RC5 and security fixes) merge to trunk (for real)
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 { |