本文整理汇总了C++中LLQuaternion::packToVector3方法的典型用法代码示例。如果您正苦于以下问题:C++ LLQuaternion::packToVector3方法的具体用法?C++ LLQuaternion::packToVector3怎么用?C++ LLQuaternion::packToVector3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLQuaternion
的用法示例。
在下文中一共展示了LLQuaternion::packToVector3方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wear
void ImportTracker::wear(LLSD &prim)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ObjectAttach);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addU8Fast(_PREHASH_AttachmentPoint, U8(prim["Attachment"].asInteger()));
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addQuatFast(_PREHASH_Rotation, LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f));
msg->sendReliable(gAgent.getRegion()->getHost());
LLVector3 position = prim["attachpos"];
LLSD rot = prim["attachrot"];
LLQuaternion rotq;
rotq.mQ[VX] = (F32)(rot[0].asReal());
rotq.mQ[VY] = (F32)(rot[1].asReal());
rotq.mQ[VZ] = (F32)(rot[2].asReal());
rotq.mQ[VW] = (F32)(rot[3].asReal());
LLVector3 rotation = rotq.packToVector3();
U8 data[256];
LLMessageSystem* msg2 = gMessageSystem;
msg2->newMessageFast(_PREHASH_MultipleObjectUpdate);
msg2->nextBlockFast(_PREHASH_AgentData);
msg2->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg2->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg2->nextBlockFast(_PREHASH_ObjectData);
msg2->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg2->addU8Fast(_PREHASH_Type, U8(0x01 | 0x08));
htonmemcpy(&data[0], &(position.mV), MVT_LLVector3, 12);
msg2->addBinaryDataFast(_PREHASH_Data, data, 12);
msg2->nextBlockFast(_PREHASH_ObjectData);
msg2->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg2->addU8Fast(_PREHASH_Type, U8(0x02 | 0x08));
htonmemcpy(&data[0], &(rotation.mV), MVT_LLQuaternion, 12);
msg2->addBinaryDataFast(_PREHASH_Data, data, 12);
msg2->sendReliable(gAgent.getRegion()->getHost());
llinfos << "POSITIONED, IMPORT COMPLETED" << llendl;
cleanUp();
}
示例2: send_vectors
void ImportTracker::send_vectors(LLSD& prim,int counter)
{
LLVector3 position = ((LLVector3)prim["position"] * rootrot) + root;
LLSD rot = prim["rotation"];
LLQuaternion rotq;
rotq.mQ[VX] = (F32)(rot[0].asReal());
rotq.mQ[VY] = (F32)(rot[1].asReal());
rotq.mQ[VZ] = (F32)(rot[2].asReal());
rotq.mQ[VW] = (F32)(rot[3].asReal());
LLVector3 rotation;
if(counter == 1)
rotation = rotq.packToVector3();
else
rotation = (rotq * rootrot).packToVector3();
LLVector3 scale = prim["scale"];
U8 data[256];
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_MultipleObjectUpdate);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addU8Fast(_PREHASH_Type, U8(0x01));
htonmemcpy(&data[0], &(position.mV), MVT_LLVector3, 12);
msg->addBinaryDataFast(_PREHASH_Data, data, 12);
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addU8Fast(_PREHASH_Type, U8(0x02));
htonmemcpy(&data[0], &(rotation.mV), MVT_LLQuaternion, 12);
msg->addBinaryDataFast(_PREHASH_Data, data, 12);
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, prim["LocalID"].asInteger());
msg->addU8Fast(_PREHASH_Type, U8(0x04));
htonmemcpy(&data[0], &(scale.mV), MVT_LLVector3, 12);
msg->addBinaryDataFast(_PREHASH_Data, data, 12);
msg->sendReliable(gAgent.getRegion()->getHost());
}
示例3: addQuat
void LLTemplateMessageBuilder::addQuat(const char *varname, const LLQuaternion& quat)
{
addData(varname, quat.packToVector3().mV, MVT_LLQuaternion, sizeof(LLVector3));
}
示例4: serialize
//.........这里部分代码省略.........
bvhStringToOrder(mergeParent->mOrder) );
LLQuaternion parentFrameRot( mergeParent->mFrameMatrix );
LLQuaternion parentOffsetRot( mergeParent->mOffsetMatrix );
mergeParentRot = ~parentFrameRot * mergeParentRot * parentFrameRot * parentOffsetRot;
}
else
{
mergeParentRot.loadIdentity();
}
if (mergeChild)
{
mergeChildRot = mayaQ( mergeChild->mKeys[frame-1].mRot[0],
mergeChild->mKeys[frame-1].mRot[1],
mergeChild->mKeys[frame-1].mRot[2],
bvhStringToOrder(mergeChild->mOrder) );
LLQuaternion childFrameRot( mergeChild->mFrameMatrix );
LLQuaternion childOffsetRot( mergeChild->mOffsetMatrix );
mergeChildRot = ~childFrameRot * mergeChildRot * childFrameRot * childOffsetRot;
}
else
{
mergeChildRot.loadIdentity();
}
LLQuaternion inRot = mayaQ( ki->mRot[0], ki->mRot[1], ki->mRot[2], order);
LLQuaternion outRot = frameRotInv* mergeChildRot * inRot * mergeParentRot * ~first_frame_rot * frameRot * offsetRot;
U16 time_short = F32_to_U16(time, 0.f, mDuration);
dp.packU16(time_short, "time");
U16 x, y, z;
LLVector3 rot_vec = outRot.packToVector3();
rot_vec.quantize16(-1.f, 1.f, -1.f, 1.f);
x = F32_to_U16(rot_vec.mV[VX], -1.f, 1.f);
y = F32_to_U16(rot_vec.mV[VY], -1.f, 1.f);
z = F32_to_U16(rot_vec.mV[VZ], -1.f, 1.f);
dp.packU16(x, "rot_angle_x");
dp.packU16(y, "rot_angle_y");
dp.packU16(z, "rot_angle_z");
outcount++;
frame++;
}
// output position keys (only for 1st joint)
if ( ji == mJoints.begin() && !joint->mIgnorePositions )
{
dp.packS32(joint->mNumPosKeys, "num_pos_keys");
LLVector3 relPos = joint->mRelativePosition;
LLVector3 relKey;
frame = 1;
for ( ki = joint->mKeys.begin();
ki != joint->mKeys.end();
++ki )
{
if ((frame == 1) && joint->mRelativePositionKey)
{
relKey.setVec(ki->mPos);
}
if (ki->mIgnorePos)
{
frame++;