本文整理汇总了C++中LLMessageSystem::addVector3方法的典型用法代码示例。如果您正苦于以下问题:C++ LLMessageSystem::addVector3方法的具体用法?C++ LLMessageSystem::addVector3怎么用?C++ LLMessageSystem::addVector3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLMessageSystem
的用法示例。
在下文中一共展示了LLMessageSystem::addVector3方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_ObjectGrab_message
void send_ObjectGrab_message(LLViewerObject* object, const LLPickInfo & pick, const LLVector3 &grab_offset)
{
if (!object) return;
LLMessageSystem *msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectGrab);
msg->nextBlockFast( _PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast( _PREHASH_ObjectData);
msg->addU32Fast( _PREHASH_LocalID, object->mLocalID);
msg->addVector3Fast(_PREHASH_GrabOffset, grab_offset);
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( object->getRegion()->getHost());
/* Diagnostic code
llinfos << "mUVCoords: " << pick.mUVCoords
<< ", mSTCoords: " << pick.mSTCoords
<< ", mObjectFace: " << pick.mObjectFace
<< ", mIntersection: " << pick.mIntersection
<< ", mNormal: " << pick.mNormal
<< ", mBinormal: " << pick.mBinormal
<< llendl;
llinfos << "Avatar pos: " << gAgent.getPositionAgent() << llendl;
llinfos << "Object pos: " << object->getPosition() << llendl;
*/
}
示例2: stopGrab
void LLToolGrab::stopGrab()
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp)
{
return;
}
LLPickInfo pick = mGrabPick;
if (mMode == GRAB_NONPHYSICAL)
{
// for non-physical (touch) grabs,
// gather surface info for this degrab (mouse-up)
S32 x = gViewerWindow->getCurrentMouseX();
S32 y = gViewerWindow->getCurrentMouseY();
pick.mMousePt = LLCoordGL(x, y);
pick.getSurfaceInfo();
}
// Next, send messages to simulator
LLMessageSystem *msg = gMessageSystem;
switch(mMode)
{
case GRAB_ACTIVE_CENTER:
case GRAB_NONPHYSICAL:
case GRAB_LOCKED:
msg->newMessageFast(_PREHASH_ObjectDeGrab);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID, objectp->mLocalID);
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());
mVerticalDragging = FALSE;
break;
case GRAB_NOOBJECT:
case GRAB_INACTIVE:
default:
// do nothing
break;
}
mHideBuildHighlight = FALSE;
}
示例3: startGrab
void LLToolGrab::startGrab()
{
// Compute grab_offset in the OBJECT's root's coordinate frame
// (sometimes root == object)
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp)
{
return;
}
LLViewerObject *root = (LLViewerObject *)objectp->getRoot();
// drag from center
LLVector3d grab_start_global = root->getPositionGlobal();
// Where the grab starts, relative to the center of the root object of the set.
// JC - This code looks wonky, but I believe it does the right thing.
// Otherwise, when you grab a linked object set, it "pops" on the start
// of the drag.
LLVector3d grab_offsetd = root->getPositionGlobal() - objectp->getPositionGlobal();
LLVector3 grab_offset;
grab_offset.setVec(grab_offsetd);
LLQuaternion rotation = root->getRotation();
rotation.conjQuat();
grab_offset = grab_offset * rotation;
// This planar drag starts at the grab point
mDragStartPointGlobal = grab_start_global;
mDragStartFromCamera = grab_start_global - gAgent.getCameraPositionGlobal();
LLMessageSystem *msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectGrab);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID, objectp->mLocalID);
msg->addVector3Fast(_PREHASH_GrabOffset, grab_offset );
msg->nextBlock("SurfaceInfo");
msg->addVector3("UVCoord", LLVector3(mGrabPick.mUVCoords));
msg->addVector3("STCoord", LLVector3(mGrabPick.mSTCoords));
msg->addS32Fast(_PREHASH_FaceIndex, mGrabPick.mObjectFace);
msg->addVector3("Position", mGrabPick.mIntersection);
msg->addVector3("Normal", mGrabPick.mNormal);
msg->addVector3("Binormal", mGrabPick.mBinormal);
msg->sendMessage( objectp->getRegion()->getHost());
mGrabOffsetFromCenterInitial = grab_offset;
mGrabHiddenOffsetFromCamera = mDragStartFromCamera;
mGrabTimer.reset();
}
示例4: send_ObjectDeGrab_message
void send_ObjectDeGrab_message(LLViewerObject* object, const LLPickInfo & pick)
{
if (!object) return;
LLMessageSystem *msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectDeGrab);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
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(object->getRegion()->getHost());
}
示例5: LuaTouch
void LuaTouch(const LLUUID& id)
{
LLViewerObject* object = gObjectList.findObject(id);
if(!object)
{
LuaError("No Object Found");
return;
}
LLMessageSystem *msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectGrab);
msg->nextBlockFast( _PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast( _PREHASH_ObjectData);
msg->addU32Fast( _PREHASH_LocalID, object->mLocalID);
msg->addVector3Fast(_PREHASH_GrabOffset, LLVector3::zero );
msg->nextBlock("SurfaceInfo");
msg->addVector3("UVCoord", LLVector3::zero);
msg->addVector3("STCoord", LLVector3::zero);
msg->addS32Fast(_PREHASH_FaceIndex, 0);
msg->addVector3("Position", LLVector3::zero);
msg->addVector3("Normal", LLVector3::zero);
msg->addVector3("Binormal", LLVector3::zero);
msg->sendMessage( object->getRegion()->getHost());
// *NOTE: Hope the packets arrive safely and in order or else
// there will be some problems.
// *TODO: Just fix this bad assumption.
msg->newMessageFast(_PREHASH_ObjectDeGrab);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
msg->nextBlock("SurfaceInfo");
msg->addVector3("UVCoord", LLVector3::zero);
msg->addVector3("STCoord", LLVector3::zero);
msg->addS32Fast(_PREHASH_FaceIndex, 0);
msg->addVector3("Position", LLVector3::zero);
msg->addVector3("Normal", LLVector3::zero);
msg->addVector3("Binormal", LLVector3::zero);
msg->sendMessage(object->getRegion()->getHost());
}
示例6: handleHoverNonPhysical
void LLToolGrab::handleHoverNonPhysical(S32 x, S32 y, MASK mask)
{
LLViewerObject* objectp = mGrabPick.getObject();
if (!objectp || !hasMouseCapture() ) return;
if (objectp->isDead())
{
// Bail out of drag because object has been killed
setMouseCapture(FALSE);
return;
}
LLPickInfo pick = mGrabPick;
pick.mMousePt = LLCoordGL(x, y);
pick.getSurfaceInfo();
// compute elapsed time
F32 dt = mGrabTimer.getElapsedTimeAndResetF32();
U32 dt_milliseconds = (U32) (1000.f * dt);
// i'm not a big fan of the following code - it's been culled from the physical grab case.
// ideally these two would be nicely integrated - but the code in that method is a serious
// mess of spaghetti. so here we go:
LLVector3 grab_pos_region(0,0,0);
const BOOL SUPPORT_LLDETECTED_GRAB = TRUE;
if (SUPPORT_LLDETECTED_GRAB)
{
//--------------------------------------------------
// Toggle vertical dragging
//--------------------------------------------------
if (mVerticalDragging && !(mask == MASK_VERTICAL) && !gGrabBtnVertical)
{
mVerticalDragging = FALSE;
}
else if (!mVerticalDragging && (mask == MASK_VERTICAL) )
{
mVerticalDragging = TRUE;
}
S32 dx = x - mLastMouseX;
S32 dy = y - mLastMouseY;
if (dx != 0 || dy != 0)
{
mAccumDeltaX += dx;
mAccumDeltaY += dy;
S32 dist_sq = mAccumDeltaX * mAccumDeltaX + mAccumDeltaY * mAccumDeltaY;
if (dist_sq > SLOP_DIST_SQ)
{
mOutsideSlop = TRUE;
}
// mouse has moved
mHasMoved = TRUE;
//------------------------------------------------------
// Handle grabbing
//------------------------------------------------------
LLVector3d x_part;
x_part.setVec(LLViewerCamera::getInstance()->getLeftAxis());
x_part.mdV[VZ] = 0.0;
x_part.normVec();
LLVector3d y_part;
if( mVerticalDragging )
{
y_part.setVec(LLViewerCamera::getInstance()->getUpAxis());
// y_part.setVec(0.f, 0.f, 1.f);
}
else
{
// drag toward camera
y_part = x_part % LLVector3d::z_axis;
y_part.mdV[VZ] = 0.0;
y_part.normVec();
}
mGrabHiddenOffsetFromCamera = mGrabHiddenOffsetFromCamera
+ (x_part * (-dx * GRAB_SENSITIVITY_X))
+ (y_part * ( dy * GRAB_SENSITIVITY_Y));
}
// need to return offset from mGrabStartPoint
LLVector3d grab_point_global = gAgent.getCameraPositionGlobal() + mGrabHiddenOffsetFromCamera;
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 );
//.........这里部分代码省略.........
示例7: handleHoverActive
//.........这里部分代码省略.........
// For safety, cap heights where objects can be dragged
if (grab_point_global.mdV[VZ] > MAX_OBJECT_Z)
{
grab_point_global.mdV[VZ] = MAX_OBJECT_Z;
}
grab_point_global = LLWorld::getInstance()->clipToVisibleRegions(mDragStartPointGlobal, grab_point_global);
// propagate constrained grab point back to grab offset
mGrabHiddenOffsetFromCamera = grab_point_global - gAgent.getCameraPositionGlobal();
// Handle auto-rotation at screen edge.
LLVector3 grab_pos_agent = gAgent.getPosAgentFromGlobal( grab_point_global );
LLCoordGL grab_center_gl( gViewerWindow->getWindowWidth() / 2, gViewerWindow->getWindowHeight() / 2);
LLViewerCamera::getInstance()->projectPosAgentToScreen(grab_pos_agent, grab_center_gl);
const S32 ROTATE_H_MARGIN = gViewerWindow->getWindowWidth() / 20;
const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
// ...build mode moves camera about focus point
if (grab_center_gl.mX < ROTATE_H_MARGIN)
{
if (gAgent.getFocusOnAvatar())
{
gAgent.yaw(rotate_angle);
}
else
{
gAgent.cameraOrbitAround(rotate_angle);
}
}
else if (grab_center_gl.mX > gViewerWindow->getWindowWidth() - ROTATE_H_MARGIN)
{
if (gAgent.getFocusOnAvatar())
{
gAgent.yaw(-rotate_angle);
}
else
{
gAgent.cameraOrbitAround(-rotate_angle);
}
}
// Don't move above top of screen or below bottom
if ((grab_center_gl.mY < gViewerWindow->getWindowHeight() - 6)
&& (grab_center_gl.mY > 24))
{
// Transmit update to simulator
LLVector3 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(mGrabPick.mUVCoords));
msg->addVector3("STCoord", LLVector3(mGrabPick.mSTCoords));
msg->addS32Fast(_PREHASH_FaceIndex, mGrabPick.mObjectFace);
msg->addVector3("Position", mGrabPick.mIntersection);
msg->addVector3("Normal", mGrabPick.mNormal);
msg->addVector3("Binormal", mGrabPick.mBinormal);
msg->sendMessage( objectp->getRegion()->getHost() );
}
}
gViewerWindow->moveCursorToCenter();
LLSelectMgr::getInstance()->updateSelectionCenter();
}
// once we've initiated a drag, lock the camera down
if (mHasMoved)
{
if (!gAgent.cameraMouselook() &&
!objectp->isHUDAttachment() &&
objectp->getRoot() == gAgent.getAvatarObject()->getRoot())
{
// force focus to point in space where we were looking previously
gAgent.setFocusGlobal(gAgent.calcFocusPositionTargetGlobal(), LLUUID::null);
gAgent.setFocusOnAvatar(FALSE, ANIMATE);
}
else
{
gAgent.clearFocusObject();
}
}
// HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden.
gViewerWindow->setCursor(UI_CURSOR_ARROW);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGrab (active) [cursor hidden]" << llendl;
}