本文整理汇总了C++中LLVector3::clamp方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVector3::clamp方法的具体用法?C++ LLVector3::clamp怎么用?C++ LLVector3::clamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVector3
的用法示例。
在下文中一共展示了LLVector3::clamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
//.........这里部分代码省略.........
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++;
continue;
}
time = (F32)frame * mFrameTime;
LLVector3 inPos = (LLVector3(ki->mPos) - relKey) * ~first_frame_rot;// * fixup_rot;
LLVector3 outPos = inPos * frameRot * offsetRot;
outPos *= INCHES_TO_METERS;
outPos -= relPos;
outPos.clamp(-LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
U16 time_short = F32_to_U16(time, 0.f, mDuration);
dp.packU16(time_short, "time");
U16 x, y, z;
outPos.quantize16(-LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET, -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
x = F32_to_U16(outPos.mV[VX], -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
y = F32_to_U16(outPos.mV[VY], -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
z = F32_to_U16(outPos.mV[VZ], -LL_MAX_PELVIS_OFFSET, LL_MAX_PELVIS_OFFSET);
dp.packU16(x, "pos_x");
dp.packU16(y, "pos_y");
dp.packU16(z, "pos_z");
frame++;
}
}
else
{
dp.packS32(0, "num_pos_keys");
}
}
S32 num_constraints = (S32)mConstraints.size();
dp.packS32(num_constraints, "num_constraints");
for (ConstraintVector::iterator constraint_it = mConstraints.begin();
constraint_it != mConstraints.end();
constraint_it++)
{
U8 byte = constraint_it->mChainLength;
dp.packU8(byte, "chain_lenght");
byte = constraint_it->mConstraintType;
dp.packU8(byte, "constraint_type");
dp.packBinaryDataFixed((U8*)constraint_it->mSourceJointName, 16, "source_volume");
dp.packVector3(constraint_it->mSourceOffset, "source_offset");
dp.packBinaryDataFixed((U8*)constraint_it->mTargetJointName, 16, "target_volume");
dp.packVector3(constraint_it->mTargetOffset, "target_offset");
dp.packVector3(constraint_it->mTargetDir, "target_dir");
dp.packF32(constraint_it->mEaseInStart, "ease_in_start");
dp.packF32(constraint_it->mEaseInStop, "ease_in_stop");
dp.packF32(constraint_it->mEaseOutStart, "ease_out_start");
dp.packF32(constraint_it->mEaseOutStop, "ease_out_stop");
}
return TRUE;
}