summaryrefslogtreecommitdiff
path: root/indra/llappearance/llpolyskeletaldistortion.cpp
diff options
context:
space:
mode:
authorFawrsk <45524015+Fawrsk@users.noreply.github.com>2023-01-03 17:08:15 -0400
committerGitHub <noreply@github.com>2023-01-03 23:08:15 +0200
commit74a9280c698b4f88a46549923a2d717b82dd7ee2 (patch)
tree029f57168a5f69cb7eb60b21faddecdeadec0f26 /indra/llappearance/llpolyskeletaldistortion.cpp
parent43496fe04e7dadae230da5b633a389ba0b7c0b0b (diff)
SL-18893 Clean up for loops in llappearance to use C++11 range based for loops (#38)
Diffstat (limited to 'indra/llappearance/llpolyskeletaldistortion.cpp')
-rw-r--r--indra/llappearance/llpolyskeletaldistortion.cpp37
1 files changed, 15 insertions, 22 deletions
diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp
index 360f17508f..e1460b68de 100644
--- a/indra/llappearance/llpolyskeletaldistortion.cpp
+++ b/indra/llappearance/llpolyskeletaldistortion.cpp
@@ -144,37 +144,35 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
setWeight(getDefaultWeight());
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
- for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
+ for (auto& bone_info : getInfo()->mBoneInfoList)
{
- LLPolySkeletalBoneInfo *bone_info = &(*iter);
- LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
+ LLJoint* joint = mAvatar->getJoint(bone_info.mBoneName);
if (!joint)
{
// There's no point continuing after this error - means
// that either the skeleton or lad file is broken.
- LL_WARNS() << "Joint " << bone_info->mBoneName << " not found." << LL_ENDL;
+ LL_WARNS() << "Joint " << bone_info.mBoneName << " not found." << LL_ENDL;
return FALSE;
}
// store it
- mJointScales[joint] = bone_info->mScaleDeformation;
+ mJointScales[joint] = bone_info.mScaleDeformation;
// apply to children that need to inherit it
- for (LLJoint::joints_t::iterator iter = joint->mChildren.begin();
- iter != joint->mChildren.end(); ++iter)
+ for (auto joint : joint->mChildren)
{
- LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
+ LLAvatarJoint* child_joint = (LLAvatarJoint*)joint;
if (child_joint->inheritScale())
{
LLVector3 childDeformation = LLVector3(child_joint->getScale());
- childDeformation.scaleVec(bone_info->mScaleDeformation);
+ childDeformation.scaleVec(bone_info.mScaleDeformation);
mJointScales[child_joint] = childDeformation;
}
}
- if (bone_info->mHasPositionDeformation)
+ if (bone_info.mHasPositionDeformation)
{
- mJointOffsets[joint] = bone_info->mPositionDeformation;
+ mJointOffsets[joint] = bone_info.mPositionDeformation;
}
}
return TRUE;
@@ -195,15 +193,12 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
LLJoint* joint;
- joint_vec_map_t::iterator iter;
- for (iter = mJointScales.begin();
- iter != mJointScales.end();
- iter++)
+ for (auto& scale_pair : mJointScales)
{
- joint = iter->first;
+ joint = scale_pair.first;
LLVector3 newScale = joint->getScale();
- LLVector3 scaleDelta = iter->second;
+ LLVector3 scaleDelta = scale_pair.second;
LLVector3 offset = (effective_weight - mLastWeight) * scaleDelta;
newScale = newScale + offset;
//An aspect of attached mesh objects (which contain joint offsets) that need to be cleaned up when detached
@@ -218,13 +213,11 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex )
joint->setScale(newScale, true);
}
- for (iter = mJointOffsets.begin();
- iter != mJointOffsets.end();
- iter++)
+ for (auto& offset_pair : mJointOffsets)
{
- joint = iter->first;
+ joint = offset_pair.first;
LLVector3 newPosition = joint->getPosition();
- LLVector3 positionDelta = iter->second;
+ LLVector3 positionDelta = offset_pair.second;
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
// SL-315
bool allow_attachment_pos_overrides = true;