本文整理汇总了C++中LLDataPacker::packU16方法的典型用法代码示例。如果您正苦于以下问题:C++ LLDataPacker::packU16方法的具体用法?C++ LLDataPacker::packU16怎么用?C++ LLDataPacker::packU16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLDataPacker
的用法示例。
在下文中一共展示了LLDataPacker::packU16方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: packProfileParams
bool LLVolumeMessage::packProfileParams(
const LLProfileParams* params,
LLDataPacker &dp)
{
// Default to cylinder
static LLProfileParams defaultparams(LL_PCODE_PROFILE_CIRCLE, U16(0), U16(0), U16(0));
if (!params)
params = &defaultparams;
U8 tempU8;
U16 tempU16;
tempU8 = params->getCurveType();
dp.packU8(tempU8, "Curve");
tempU16 = (U16) ll_round( params->getBegin() / CUT_QUANTA);
dp.packU16(tempU16, "Begin");
tempU16 = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA);
dp.packU16(tempU16, "End");
tempU16 = (U16) ll_round(params->getHollow() / HOLLOW_QUANTA);
dp.packU16(tempU16, "Hollow");
return true;
}
示例2: packPathParams
bool LLVolumeMessage::packPathParams(
const LLPathParams* params,
LLDataPacker &dp)
{
// Default to cylinder with no cut, top same size as bottom, no shear, no twist
static LLPathParams defaultparams(LL_PCODE_PATH_LINE, U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), U8(0), 0);
if (!params)
params = &defaultparams;
U8 curve = params->getCurveType();
dp.packU8(curve, "Curve");
U16 begin = (U16) ll_round(params->getBegin() / CUT_QUANTA);
dp.packU16(begin, "Begin");
U16 end = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA);
dp.packU16(end, "End");
// Avoid truncation problem with direct F32->U8 cast.
// (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50.
U8 pack_scale_x = 200 - (U8) ll_round(params->getScaleX() / SCALE_QUANTA);
dp.packU8(pack_scale_x, "ScaleX");
U8 pack_scale_y = 200 - (U8) ll_round(params->getScaleY() / SCALE_QUANTA);
dp.packU8(pack_scale_y, "ScaleY");
S8 pack_shear_x = (S8) ll_round(params->getShearX() / SHEAR_QUANTA);
dp.packU8(*(U8 *)&pack_shear_x, "ShearX");
S8 pack_shear_y = (S8) ll_round(params->getShearY() / SHEAR_QUANTA);
dp.packU8(*(U8 *)&pack_shear_y, "ShearY");
S8 twist = (S8) ll_round(params->getTwist() / SCALE_QUANTA);
dp.packU8(*(U8 *)&twist, "Twist");
S8 twist_begin = (S8) ll_round(params->getTwistBegin() / SCALE_QUANTA);
dp.packU8(*(U8 *)&twist_begin, "TwistBegin");
S8 radius_offset = (S8) ll_round(params->getRadiusOffset() / SCALE_QUANTA);
dp.packU8(*(U8 *)&radius_offset, "RadiusOffset");
S8 taper_x = (S8) ll_round(params->getTaperX() / TAPER_QUANTA);
dp.packU8(*(U8 *)&taper_x, "TaperX");
S8 taper_y = (S8) ll_round(params->getTaperY() / TAPER_QUANTA);
dp.packU8(*(U8 *)&taper_y, "TaperY");
U8 revolutions = (U8) ll_round( (params->getRevolutions() - 1.0f) / REV_QUANTA);
dp.packU8(*(U8 *)&revolutions, "Revolutions");
S8 skew = (S8) ll_round(params->getSkew() / SCALE_QUANTA);
dp.packU8(*(U8 *)&skew, "Skew");
return true;
}
示例3: serialize
// writes contents to datapacker
BOOL LLBVHLoader::serialize(LLDataPacker& dp)
{
JointVector::iterator ji;
KeyVector::iterator ki;
F32 time;
// count number of non-ignored joints
S32 numJoints = 0;
for (ji=mJoints.begin(); ji!=mJoints.end(); ++ji)
{
Joint *joint = *ji;
if ( ! joint->mIgnore )
numJoints++;
}
// print header
dp.packU16(KEYFRAME_MOTION_VERSION, "version");
dp.packU16(KEYFRAME_MOTION_SUBVERSION, "sub_version");
dp.packS32(mPriority, "base_priority");
dp.packF32(mDuration, "duration");
dp.packString(mEmoteName, "emote_name");
dp.packF32(mLoopInPoint, "loop_in_point");
dp.packF32(mLoopOutPoint, "loop_out_point");
dp.packS32(mLoop, "loop");
dp.packF32(mEaseIn, "ease_in_duration");
dp.packF32(mEaseOut, "ease_out_duration");
dp.packU32(mHand, "hand_pose");
dp.packU32(numJoints, "num_joints");
for ( ji = mJoints.begin();
ji != mJoints.end();
++ji )
{
Joint *joint = *ji;
// if ignored, skip it
if ( joint->mIgnore )
continue;
LLQuaternion first_frame_rot;
LLQuaternion fixup_rot;
dp.packString(joint->mOutName, "joint_name");
dp.packS32(joint->mPriority, "joint_priority");
// compute coordinate frame rotation
LLQuaternion frameRot( joint->mFrameMatrix );
LLQuaternion frameRotInv = ~frameRot;
LLQuaternion offsetRot( joint->mOffsetMatrix );
// find mergechild and mergeparent joints, if specified
LLQuaternion mergeParentRot;
LLQuaternion mergeChildRot;
Joint *mergeParent = NULL;
Joint *mergeChild = NULL;
JointVector::iterator mji;
for (mji=mJoints.begin(); mji!=mJoints.end(); ++mji)
{
Joint *mjoint = *mji;
if ( !joint->mMergeParentName.empty() && (mjoint->mName == joint->mMergeParentName) )
{
mergeParent = *mji;
}
if ( !joint->mMergeChildName.empty() && (mjoint->mName == joint->mMergeChildName) )
{
mergeChild = *mji;
}
}
dp.packS32(joint->mNumRotKeys, "num_rot_keys");
LLQuaternion::Order order = bvhStringToOrder( joint->mOrder );
S32 outcount = 0;
S32 frame = 1;
for ( ki = joint->mKeys.begin();
ki != joint->mKeys.end();
++ki )
{
if ((frame == 1) && joint->mRelativeRotationKey)
{
first_frame_rot = mayaQ( ki->mRot[0], ki->mRot[1], ki->mRot[2], order);
fixup_rot.shortestArc(LLVector3::z_axis * first_frame_rot * frameRot, LLVector3::z_axis);
}
if (ki->mIgnoreRot)
{
frame++;
continue;
}
time = (F32)frame * mFrameTime;
if (mergeParent)
{
mergeParentRot = mayaQ( mergeParent->mKeys[frame-1].mRot[0],
mergeParent->mKeys[frame-1].mRot[1],
mergeParent->mKeys[frame-1].mRot[2],
//.........这里部分代码省略.........