diff options
Diffstat (limited to 'indra/llappearance')
-rw-r--r-- | indra/llappearance/llavatarappearance.cpp | 136 | ||||
-rw-r--r-- | indra/llappearance/llavatarappearance.h | 5 | ||||
-rw-r--r-- | indra/llappearance/llavatarappearancedefines.cpp | 11 | ||||
-rw-r--r-- | indra/llappearance/llavatarjoint.cpp | 45 | ||||
-rw-r--r-- | indra/llappearance/llavatarjointmesh.cpp | 5 | ||||
-rw-r--r-- | indra/llappearance/lldriverparam.cpp | 85 | ||||
-rw-r--r-- | indra/llappearance/lllocaltextureobject.cpp | 3 | ||||
-rw-r--r-- | indra/llappearance/llpolymesh.cpp | 19 | ||||
-rw-r--r-- | indra/llappearance/llpolymorph.cpp | 32 | ||||
-rw-r--r-- | indra/llappearance/llpolyskeletaldistortion.cpp | 38 | ||||
-rw-r--r-- | indra/llappearance/lltexglobalcolor.cpp | 6 | ||||
-rw-r--r-- | indra/llappearance/lltexlayer.cpp | 139 | ||||
-rw-r--r-- | indra/llappearance/lltexlayerparams.cpp | 4 | ||||
-rw-r--r-- | indra/llappearance/llwearable.cpp | 84 |
14 files changed, 218 insertions, 394 deletions
diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index c1336fd612..7946a3e705 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -214,12 +214,10 @@ void LLAvatarAppearance::initInstance() mRoot = createAvatarJoint(); mRoot->setName( "mRoot" ); - for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = sAvatarDictionary->getMeshEntries().begin(); - iter != sAvatarDictionary->getMeshEntries().end(); - ++iter) + for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries()) { - const EMeshIndex mesh_index = iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; + const EMeshIndex mesh_index = mesh_pair.first; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second; LLAvatarJoint* joint = createAvatarJoint(); joint->setName(mesh_dict->mName); joint->setMeshID(mesh_index); @@ -260,21 +258,16 @@ void LLAvatarAppearance::initInstance() //------------------------------------------------------------------------- // associate baked textures with meshes //------------------------------------------------------------------------- - for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator iter = sAvatarDictionary->getMeshEntries().begin(); - iter != sAvatarDictionary->getMeshEntries().end(); - ++iter) + for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries()) { - const EMeshIndex mesh_index = iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = iter->second; + const EMeshIndex mesh_index = mesh_pair.first; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second; const EBakedTextureIndex baked_texture_index = mesh_dict->mBakedID; // Skip it if there's no associated baked texture. if (baked_texture_index == BAKED_NUM_INDICES) continue; - for (avatar_joint_mesh_list_t::iterator iter = mMeshLOD[mesh_index]->mMeshParts.begin(); - iter != mMeshLOD[mesh_index]->mMeshParts.end(); - ++iter) + for (LLAvatarJointMesh* mesh : mMeshLOD[mesh_index]->mMeshParts) { - LLAvatarJointMesh* mesh = (*iter); mBakedTextureDatas[(S32)baked_texture_index].mJointMeshes.push_back(mesh); } } @@ -297,10 +290,8 @@ LLAvatarAppearance::~LLAvatarAppearance() delete_and_clear(mBakedTextureDatas[i].mTexLayerSet); mBakedTextureDatas[i].mJointMeshes.clear(); - for (morph_list_t::iterator iter2 = mBakedTextureDatas[i].mMaskedMorphs.begin(); - iter2 != mBakedTextureDatas[i].mMaskedMorphs.end(); iter2++) + for (LLMaskedMorph* masked_morph : mBakedTextureDatas[i].mMaskedMorphs) { - LLMaskedMorph* masked_morph = (*iter2); delete masked_morph; } } @@ -319,11 +310,8 @@ LLAvatarAppearance::~LLAvatarAppearance() std::for_each(mPolyMeshes.begin(), mPolyMeshes.end(), DeletePairedPointer()); mPolyMeshes.clear(); - for (avatar_joint_list_t::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); - ++jointIter) + for (LLAvatarJoint* joint : mMeshLOD) { - LLAvatarJoint* joint = *jointIter; std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer()); joint->mMeshParts.clear(); } @@ -477,10 +465,9 @@ void LLAvatarAppearance::compareJointStateMaps(joint_state_map_t& last_state, if (!last_state.empty() && (last_state != curr_state)) { S32 diff_count = 0; - joint_state_map_t::iterator it; - for (it=last_state.begin(); it != last_state.end(); ++it) + for (joint_state_map_t::value_type& pair : last_state) { - const std::string& key = it->first; + const std::string& key = pair.first; if (last_state[key] != curr_state[key]) { LL_DEBUGS("AvatarBodySize") << "BodySize change " << key << " " << last_state[key] << "->" << curr_state[key] << LL_ENDL; @@ -690,10 +677,8 @@ BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent // setup children - LLAvatarBoneInfo::bones_t::const_iterator iter; - for (iter = info->mChildren.begin(); iter != info->mChildren.end(); ++iter) + for (LLAvatarBoneInfo* child_info : info->mChildren) { - LLAvatarBoneInfo *child_info = *iter; if (!setupBone(child_info, joint, volume_num, joint_num)) { return FALSE; @@ -745,10 +730,8 @@ BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) S32 current_joint_num = 0; S32 current_volume_num = 0; - LLAvatarSkeletonInfo::bone_info_list_t::const_iterator iter; - for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); ++iter) + for (LLAvatarBoneInfo* bone_info : info->mBoneInfoList) { - LLAvatarBoneInfo *bone_info = *iter; if (!setupBone(bone_info, NULL, current_volume_num, current_joint_num)) { LL_ERRS() << "Error parsing bone in skeleton file" << LL_ENDL; @@ -826,14 +809,10 @@ void LLAvatarAppearance::buildCharacter() //------------------------------------------------------------------------- // clear mesh data //------------------------------------------------------------------------- - for (avatar_joint_list_t::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); ++jointIter) + for (LLAvatarJoint* joint : mMeshLOD) { - LLAvatarJoint* joint = *jointIter; - for (avatar_joint_mesh_list_t::iterator meshIter = joint->mMeshParts.begin(); - meshIter != joint->mMeshParts.end(); ++meshIter) + for (LLAvatarJointMesh* mesh : joint->mMeshParts) { - LLAvatarJointMesh * mesh = *meshIter; mesh->setMesh(NULL); } } @@ -1007,12 +986,8 @@ BOOL LLAvatarAppearance::loadAvatar() } // avatar_lad.xml : <morph_masks> - for (LLAvatarXmlInfo::morph_info_list_t::iterator iter = sAvatarXmlInfo->mMorphMaskInfoList.begin(); - iter != sAvatarXmlInfo->mMorphMaskInfoList.end(); - ++iter) + for (LLAvatarXmlInfo::LLAvatarMorphInfo* info : sAvatarXmlInfo->mMorphMaskInfoList) { - LLAvatarXmlInfo::LLAvatarMorphInfo *info = *iter; - EBakedTextureIndex baked = sAvatarDictionary->findBakedByRegionName(info->mRegion); if (baked != BAKED_NUM_INDICES) { @@ -1031,11 +1006,8 @@ BOOL LLAvatarAppearance::loadAvatar() loadLayersets(); // avatar_lad.xml : <driver_parameters> - for (LLAvatarXmlInfo::driver_info_list_t::iterator iter = sAvatarXmlInfo->mDriverInfoList.begin(); - iter != sAvatarXmlInfo->mDriverInfoList.end(); - ++iter) + for (LLDriverParamInfo* info : sAvatarXmlInfo->mDriverInfoList) { - LLDriverParamInfo *info = *iter; LLDriverParam* driver_param = new LLDriverParam( this ); if (driver_param->setInfo(info)) { @@ -1067,11 +1039,8 @@ BOOL LLAvatarAppearance::loadSkeletonNode () mRoot->addChild( mSkeleton[0] ); // make meshes children before calling parent version of the function - for (avatar_joint_list_t::iterator iter = mMeshLOD.begin(); - iter != mMeshLOD.end(); - ++iter) + for (LLAvatarJoint* joint : mMeshLOD) { - LLAvatarJoint *joint = *iter; joint->mUpdateXform = FALSE; joint->setMeshesToChildren(); } @@ -1103,12 +1072,9 @@ BOOL LLAvatarAppearance::loadSkeletonNode () // SKELETAL DISTORTIONS { - LLAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter; - for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin(); - iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end(); - ++iter) + for (LLViewerVisualParamInfo* visual_param_info : sAvatarXmlInfo->mSkeletalDistortionInfoList) { - LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)*iter; + LLPolySkeletalDistortionInfo *info = (LLPolySkeletalDistortionInfo*)visual_param_info; LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this); if (!param->setInfo(info)) { @@ -1132,11 +1098,8 @@ BOOL LLAvatarAppearance::loadSkeletonNode () //----------------------------------------------------------------------------- BOOL LLAvatarAppearance::loadMeshNodes() { - for (LLAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin(); - meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end(); - ++meshinfo_iter) + for (const LLAvatarXmlInfo::LLAvatarMeshInfo* info : sAvatarXmlInfo->mMeshInfoList) { - const LLAvatarXmlInfo::LLAvatarMeshInfo *info = *meshinfo_iter; const std::string &type = info->mType; S32 lod = info->mLOD; @@ -1148,12 +1111,10 @@ BOOL LLAvatarAppearance::loadMeshNodes() switch(lod) case 0: mesh = &mHairMesh0; */ - for (LLAvatarAppearanceDictionary::MeshEntries::const_iterator mesh_iter = sAvatarDictionary->getMeshEntries().begin(); - mesh_iter != sAvatarDictionary->getMeshEntries().end(); - ++mesh_iter) + for (const LLAvatarAppearanceDictionary::MeshEntries::value_type& mesh_pair : sAvatarDictionary->getMeshEntries()) { - const EMeshIndex mesh_index = mesh_iter->first; - const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_iter->second; + const EMeshIndex mesh_index = mesh_pair.first; + const LLAvatarAppearanceDictionary::MeshEntry *mesh_dict = mesh_pair.second; if (type.compare(mesh_dict->mName) == 0) { mesh_id = mesh_index; @@ -1221,20 +1182,17 @@ BOOL LLAvatarAppearance::loadMeshNodes() mesh->setMesh( poly_mesh ); mesh->setLOD( info->mMinPixelArea ); - for (LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin(); - xmlinfo_iter != info->mPolyMorphTargetInfoList.end(); - ++xmlinfo_iter) + for (const LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_pair_t& info_pair : info->mPolyMorphTargetInfoList) { - const LLAvatarXmlInfo::LLAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter); LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh()); - if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair->first)) + if (!param->setInfo((LLPolyMorphTargetInfo*)info_pair.first)) { delete param; return FALSE; } else { - if (info_pair->second) + if (info_pair.second) { addSharedVisualParam(param); param->setParamLocation(isSelf() ? LOC_AV_SELF : LOC_AV_OTHER); @@ -1257,11 +1215,8 @@ BOOL LLAvatarAppearance::loadMeshNodes() BOOL LLAvatarAppearance::loadLayersets() { BOOL success = TRUE; - for (LLAvatarXmlInfo::layer_info_list_t::const_iterator layerset_iter = sAvatarXmlInfo->mLayerInfoList.begin(); - layerset_iter != sAvatarXmlInfo->mLayerInfoList.end(); - ++layerset_iter) + for (LLTexLayerSetInfo* layerset_info : sAvatarXmlInfo->mLayerInfoList) { - LLTexLayerSetInfo *layerset_info = *layerset_iter; if (isSelf()) { // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. @@ -1277,14 +1232,12 @@ BOOL LLAvatarAppearance::loadLayersets() // scan baked textures and associate the layerset with the appropriate one EBakedTextureIndex baked_index = BAKED_NUM_INDICES; - for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = sAvatarDictionary->getBakedTextures().begin(); - baked_iter != sAvatarDictionary->getBakedTextures().end(); - ++baked_iter) + for (const LLAvatarAppearanceDictionary::BakedTextures::value_type& baked_pair : sAvatarDictionary->getBakedTextures()) { - const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_pair.second; if (layer_set->isBodyRegion(baked_dict->mName)) { - baked_index = baked_iter->first; + baked_index = baked_pair.first; // ensure both structures are aware of each other mBakedTextureDatas[baked_index].mTexLayerSet = layer_set; layer_set->setBakedTexIndex(baked_index); @@ -1300,11 +1253,8 @@ BOOL LLAvatarAppearance::loadLayersets() } // scan morph masks and let any affected layers know they have an associated morph - for (LLAvatarAppearance::morph_list_t::const_iterator morph_iter = mBakedTextureDatas[baked_index].mMaskedMorphs.begin(); - morph_iter != mBakedTextureDatas[baked_index].mMaskedMorphs.end(); - ++morph_iter) + for (LLMaskedMorph* morph : mBakedTextureDatas[baked_index].mMaskedMorphs) { - LLMaskedMorph *morph = *morph_iter; LLTexLayerInterface* layer = layer_set->findLayerByName(morph->mLayer); if (layer) { @@ -1320,7 +1270,6 @@ BOOL LLAvatarAppearance::loadLayersets() else // !isSelf() { // Construct a layerset for each one specified in avatar_lad.xml and initialize it as such. - LLTexLayerSetInfo *layerset_info = *layerset_iter; layerset_info->createVisualParams(this); } } @@ -1747,13 +1696,13 @@ void LLAvatarAppearance::makeJointAliases(LLAvatarBoneInfo *bone_info) boost::char_separator<char> sep(" "); boost::tokenizer<boost::char_separator<char> > tok(aliases, sep); - for(boost::tokenizer<boost::char_separator<char> >::iterator i = tok.begin(); i != tok.end(); ++i) + for(const std::string& i : tok) { - if ( mJointAliasMap.find(*i) != mJointAliasMap.end() ) + if ( mJointAliasMap.find(i) != mJointAliasMap.end() ) { - LL_WARNS() << "avatar skeleton: Joint alias \"" << *i << "\" remapped from " << mJointAliasMap[*i] << " to " << bone_name << LL_ENDL; + LL_WARNS() << "avatar skeleton: Joint alias \"" << i << "\" remapped from " << mJointAliasMap[i] << " to " << bone_name << LL_ENDL; } - mJointAliasMap[*i] = bone_name; + mJointAliasMap[i] = bone_name; } for (LLAvatarBoneInfo* bone : bone_info->mChildren) @@ -1768,21 +1717,14 @@ const LLAvatarAppearance::joint_alias_map_t& LLAvatarAppearance::getJointAliases if (mJointAliasMap.empty()) { - LLAvatarSkeletonInfo::bone_info_list_t::const_iterator iter; - for (iter = sAvatarSkeletonInfo->mBoneInfoList.begin(); - iter != sAvatarSkeletonInfo->mBoneInfoList.end(); - ++iter) + for (LLAvatarBoneInfo* bone_info : sAvatarSkeletonInfo->mBoneInfoList) { //LLAvatarBoneInfo *bone_info = *iter; - makeJointAliases( *iter ); + makeJointAliases(bone_info); } - LLAvatarXmlInfo::attachment_info_list_t::iterator attach_iter; - for (attach_iter = sAvatarXmlInfo->mAttachmentInfoList.begin(); - attach_iter != sAvatarXmlInfo->mAttachmentInfoList.end(); - ++attach_iter) + for (LLAvatarXmlInfo::LLAvatarAttachmentInfo* info : sAvatarXmlInfo->mAttachmentInfoList) { - LLAvatarXmlInfo::LLAvatarAttachmentInfo *info = *attach_iter; std::string bone_name = info->mName; // Also accept the name with spaces substituted with diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h index b1c70f9064..e3444efcf6 100644 --- a/indra/llappearance/llavatarappearance.h +++ b/indra/llappearance/llavatarappearance.h @@ -387,10 +387,9 @@ protected: LLAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {} ~LLAvatarMeshInfo() { - morph_info_list_t::iterator iter; - for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++) + for (morph_info_list_t::value_type& pair : mPolyMorphTargetInfoList) { - delete iter->first; + delete pair.first; } mPolyMorphTargetInfoList.clear(); } diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp index 2bcfd06c40..8759c387e8 100644 --- a/indra/llappearance/llavatarappearancedefines.cpp +++ b/indra/llappearance/llavatarappearancedefines.cpp @@ -183,18 +183,15 @@ LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary() // map it to the baked texture. void LLAvatarAppearanceDictionary::createAssociations() { - for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++) + for (BakedTextures::value_type& baked_pair : mBakedTextures) { - const EBakedTextureIndex baked_index = (iter->first); - const BakedEntry *dict = (iter->second); + const EBakedTextureIndex baked_index = baked_pair.first; + const BakedEntry *dict = baked_pair.second; // For each texture that this baked texture index affects, associate those textures // with this baked texture index. - for (texture_vec_t::const_iterator local_texture_iter = dict->mLocalTextures.begin(); - local_texture_iter != dict->mLocalTextures.end(); - local_texture_iter++) + for (const ETextureIndex local_texture_index : dict->mLocalTextures) { - const ETextureIndex local_texture_index = (ETextureIndex) *local_texture_iter; mTextures[local_texture_index]->mIsUsedByBakedTexture = true; mTextures[local_texture_index]->mBakedTextureIndex = baked_index; } diff --git a/indra/llappearance/llavatarjoint.cpp b/indra/llappearance/llavatarjoint.cpp index a1d4fe6423..9300b08b7b 100644 --- a/indra/llappearance/llavatarjoint.cpp +++ b/indra/llappearance/llavatarjoint.cpp @@ -100,10 +100,9 @@ void LLAvatarJoint::setValid( BOOL valid, BOOL recursive ) //---------------------------------------------------------------- if (recursive) { - for (joints_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) + for (LLJoint* child : mChildren) { - LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter); + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); joint->setValid(valid, TRUE); } } @@ -118,10 +117,9 @@ void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive ) mComponents = comp; if (recursive) { - for (joints_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) + for (auto child : mChildren) { - LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter); + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); joint->setSkeletonComponents(comp, recursive); } } @@ -133,10 +131,9 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive) if (recursive) { - for (joints_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) + for (LLJoint* child : mChildren) { - LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter); + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); joint->setVisible(visible, recursive); } } @@ -144,30 +141,27 @@ void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive) void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area) { - for (joints_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) + for (LLJoint* child : mChildren) { - LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter); + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); joint->updateFaceSizes(num_vertices, num_indices, pixel_area); } } void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) { - for (joints_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) + for (LLJoint* child : mChildren) { - LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter); + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); joint->updateFaceData(face, pixel_area, damp_wind, terse_update); } } void LLAvatarJoint::updateJointGeometry() { - for (joints_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) + for (LLJoint* child : mChildren) { - LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter); + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); joint->updateJointGeometry(); } } @@ -178,10 +172,9 @@ BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate) BOOL lod_changed = FALSE; BOOL found_lod = FALSE; - for (joints_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) + for (LLJoint* child : mChildren) { - LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter); + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); F32 jointLOD = joint->getLOD(); if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD) @@ -207,10 +200,9 @@ BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate) void LLAvatarJoint::dump() { - for (joints_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) + for (LLJoint* child : mChildren) { - LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(*iter); + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(child); joint->dump(); } } @@ -219,10 +211,9 @@ void LLAvatarJoint::dump() void LLAvatarJoint::setMeshesToChildren() { removeAllChildren(); - for (avatar_joint_mesh_list_t::iterator iter = mMeshParts.begin(); - iter != mMeshParts.end(); iter++) + for (LLAvatarJointMesh* mesh : mMeshParts) { - addChild((*iter)); + addChild(mesh); } } //----------------------------------------------------------------------------- diff --git a/indra/llappearance/llavatarjointmesh.cpp b/indra/llappearance/llavatarjointmesh.cpp index 0a23b1fda3..ed39f78d28 100644 --- a/indra/llappearance/llavatarjointmesh.cpp +++ b/indra/llappearance/llavatarjointmesh.cpp @@ -379,10 +379,9 @@ void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint) } // depth-first traversal - for (LLJoint::joints_t::iterator iter = current_joint->mChildren.begin(); - iter != current_joint->mChildren.end(); ++iter) + for (LLJoint* joint : current_joint->mChildren) { - LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter); + LLAvatarJoint* child_joint = (LLAvatarJoint*)joint; setupJoint(child_joint); } } diff --git a/indra/llappearance/lldriverparam.cpp b/indra/llappearance/lldriverparam.cpp index 05d26fbe7a..f46d0324a5 100644 --- a/indra/llappearance/lldriverparam.cpp +++ b/indra/llappearance/lldriverparam.cpp @@ -102,9 +102,8 @@ void LLDriverParamInfo::toStream(std::ostream &out) LLViewerVisualParamInfo::toStream(out); out << "driver" << "\t"; out << mDrivenInfoList.size() << "\t"; - for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++) + for (LLDrivenEntryInfo& driven : mDrivenInfoList) { - LLDrivenEntryInfo driven = *iter; out << driven.mDrivenID << "\t"; } @@ -121,9 +120,8 @@ void LLDriverParamInfo::toStream(std::ostream &out) if(mDriverParam && mDriverParam->getAvatarAppearance()->isSelf() && mDriverParam->getAvatarAppearance()->isValid()) { - for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++) + for (LLDrivenEntryInfo& driven : mDrivenInfoList) { - LLDrivenEntryInfo driven = *iter; LLViewerVisualParam *param = (LLViewerVisualParam*)mDriverParam->getAvatarAppearance()->getVisualParam(driven.mDrivenID); if (param) @@ -232,19 +230,19 @@ void LLDriverParam::setWeight(F32 weight) //-------|----|-------|----|-------> driver // | min1 max1 max2 min2 - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - LLDrivenEntryInfo* info = driven->mInfo; + LLDrivenEntry* drivenp = &driven; + LLDrivenEntryInfo* info = drivenp->mInfo; F32 driven_weight = 0.f; - F32 driven_min = driven->mParam->getMinWeight(); - F32 driven_max = driven->mParam->getMaxWeight(); + F32 driven_min = drivenp->mParam->getMinWeight(); + F32 driven_max = drivenp->mParam->getMaxWeight(); if (mIsAnimating) { // driven param doesn't interpolate (textures, for example) - if (!driven->mParam->getAnimating()) + if (!drivenp->mParam->getAnimating()) { continue; } @@ -268,7 +266,7 @@ void LLDriverParam::setWeight(F32 weight) driven_weight = driven_min; } - setDrivenWeight(driven,driven_weight); + setDrivenWeight(drivenp,driven_weight); continue; } else @@ -292,23 +290,22 @@ void LLDriverParam::setWeight(F32 weight) driven_weight = driven_min; } - setDrivenWeight(driven,driven_weight); + setDrivenWeight(drivenp,driven_weight); continue; } } - driven_weight = getDrivenWeight(driven, mCurWeight); - setDrivenWeight(driven,driven_weight); + driven_weight = getDrivenWeight(drivenp, mCurWeight); + setDrivenWeight(drivenp,driven_weight); } } F32 LLDriverParam::getTotalDistortion() { F32 sum = 0.f; - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - sum += driven->mParam->getTotalDistortion(); + sum += driven.mParam->getTotalDistortion(); } return sum; @@ -320,10 +317,9 @@ const LLVector4a &LLDriverParam::getAvgDistortion() LLVector4a sum; sum.clear(); S32 count = 0; - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - sum.add(driven->mParam->getAvgDistortion()); + sum.add(driven.mParam->getAvgDistortion()); count++; } sum.mul( 1.f/(F32)count); @@ -335,10 +331,9 @@ const LLVector4a &LLDriverParam::getAvgDistortion() F32 LLDriverParam::getMaxDistortion() { F32 max = 0.f; - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - F32 param_max = driven->mParam->getMaxDistortion(); + F32 param_max = driven.mParam->getMaxDistortion(); if( param_max > max ) { max = param_max; @@ -353,10 +348,9 @@ LLVector4a LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) { LLVector4a sum; sum.clear(); - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - sum.add(driven->mParam->getVertexDistortion( index, poly_mesh )); + sum.add(driven.mParam->getVertexDistortion(index, poly_mesh)); } return sum; } @@ -365,13 +359,12 @@ const LLVector4a* LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **pol { mCurrentDistortionParam = NULL; const LLVector4a* v = NULL; - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - v = driven->mParam->getFirstDistortion( index, poly_mesh ); + v = driven.mParam->getFirstDistortion(index, poly_mesh); if( v ) { - mCurrentDistortionParam = driven->mParam; + mCurrentDistortionParam = driven.mParam; break; } } @@ -415,7 +408,7 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly for( iter++; iter != mDriven.end(); iter++ ) { driven = &(*iter); - v = driven->mParam->getFirstDistortion( index, poly_mesh ); + v = driven->mParam->getFirstDistortion(index, poly_mesh); if( v ) { mCurrentDistortionParam = driven->mParam; @@ -448,14 +441,14 @@ void LLDriverParam::setAnimationTarget( F32 target_value) { LLVisualParam::setAnimationTarget(target_value); - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - F32 driven_weight = getDrivenWeight(driven, mTargetWeight); + LLDrivenEntry* drivenp = &driven; + F32 driven_weight = getDrivenWeight(drivenp, mTargetWeight); // this isn't normally necessary, as driver params handle interpolation of their driven params // but texture params need to know to assume their final value at beginning of interpolation - driven->mParam->setAnimationTarget(driven_weight); + drivenp->mParam->setAnimationTarget(driven_weight); } } @@ -466,10 +459,9 @@ void LLDriverParam::stopAnimating() { LLVisualParam::stopAnimating(); - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - driven->mParam->setAnimating(FALSE); + driven.mParam->setAnimating(FALSE); } } @@ -477,17 +469,15 @@ void LLDriverParam::stopAnimating() BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross_params) { BOOL success = TRUE; - LLDriverParamInfo::entry_info_list_t::iterator iter; - for (iter = getInfo()->mDrivenInfoList.begin(); iter != getInfo()->mDrivenInfoList.end(); ++iter) + for (LLDrivenEntryInfo& driven_info : getInfo()->mDrivenInfoList) { - LLDrivenEntryInfo *driven_info = &(*iter); - S32 driven_id = driven_info->mDrivenID; + S32 driven_id = driven_info.mDrivenID; // check for already existing links. Do not overwrite. BOOL found = FALSE; - for (entry_list_t::iterator driven_iter = mDriven.begin(); driven_iter != mDriven.end() && !found; ++driven_iter) + for (auto& driven : mDriven) { - if (driven_iter->mInfo->mDrivenID == driven_id) + if (driven.mInfo->mDrivenID == driven_id) { found = TRUE; } @@ -500,7 +490,7 @@ BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross bool push = param && (!only_cross_params || param->getCrossWearable()); if (push) { - mDriven.push_back(LLDrivenEntry( param, driven_info )); + mDriven.push_back(LLDrivenEntry( param, &driven_info )); } else { @@ -523,10 +513,9 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type) bool needs_update = (getWearableType()==driven_type); // if the driver has a driven entry for the passed-in wearable type, we need to refresh the value - for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ ) + for(LLDrivenEntry& driven : mDriven) { - LLDrivenEntry* driven = &(*iter); - if (driven && driven->mParam && driven->mParam->getCrossWearable() && driven->mParam->getWearableType() == driven_type) + if (driven.mParam && driven.mParam->getCrossWearable() && driven.mParam->getWearableType() == driven_type) { needs_update = true; } diff --git a/indra/llappearance/lllocaltextureobject.cpp b/indra/llappearance/lllocaltextureobject.cpp index 0481326e9e..ab50db3a5a 100644 --- a/indra/llappearance/lllocaltextureobject.cpp +++ b/indra/llappearance/lllocaltextureobject.cpp @@ -96,9 +96,8 @@ LLTexLayer* LLLocalTextureObject::getTexLayer(U32 index) const LLTexLayer* LLLocalTextureObject::getTexLayer(const std::string &name) { - for( tex_layer_vec_t::iterator iter = mTexLayers.begin(); iter != mTexLayers.end(); iter++) + for(LLTexLayer* layer : mTexLayers) { - LLTexLayer *layer = *iter; if (layer->getName().compare(name) == 0) { return layer; diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp index 3892e4ce43..dab14851c8 100644 --- a/indra/llappearance/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -890,11 +890,10 @@ void LLPolyMesh::dumpDiagInfo() LL_INFOS() << "-----------------------------------------------------" << LL_ENDL; // print each loaded mesh, and it's memory usage - for(LLPolyMeshSharedDataTable::iterator iter = sGlobalSharedMeshList.begin(); - iter != sGlobalSharedMeshList.end(); ++iter) + for(const LLPolyMeshSharedDataTable::value_type& mesh_pair : sGlobalSharedMeshList) { - const std::string& mesh_name = iter->first; - LLPolyMeshSharedData* mesh = iter->second; + const std::string& mesh_name = mesh_pair.first; + LLPolyMeshSharedData* mesh = mesh_pair.second; S32 num_verts = mesh->mNumVertices; S32 num_faces = mesh->mNumFaces; @@ -997,14 +996,12 @@ LLPolyMorphData* LLPolyMesh::getMorphData(const std::string& morph_name) { if (!mSharedData) return NULL; - for (LLPolyMeshSharedData::morphdata_list_t::iterator iter = mSharedData->mMorphData.begin(); - iter != mSharedData->mMorphData.end(); ++iter) + for (LLPolyMorphData* morph_data : mSharedData->mMorphData) { - LLPolyMorphData *morph_data = *iter; - if (morph_data->getName() == morph_name) - { - return morph_data; - } + if (morph_data->getName() == morph_name) + { + return morph_data; + } } return NULL; } diff --git a/indra/llappearance/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp index 84dd6156a9..965b999bd4 100644 --- a/indra/llappearance/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -363,18 +363,16 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) setWeight(getDefaultWeight()); LLAvatarAppearance* avatarp = mMesh->getAvatar(); - LLPolyMorphTargetInfo::volume_info_list_t::iterator iter; - for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++) + for (LLPolyVolumeMorphInfo& volume_info : getInfo()->mVolumeInfoList) { - LLPolyVolumeMorphInfo *volume_info = &(*iter); for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++) { - if (avatarp->mCollisionVolumes[i].getName() == volume_info->mName) + if (avatarp->mCollisionVolumes[i].getName() == volume_info.mName) { mVolumeMorphs.push_back( LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i], - volume_info->mScale, - volume_info->mPos)); + volume_info.mScale, + volume_info.mPos)); break; } } @@ -641,15 +639,14 @@ void LLPolyMorphTarget::apply( ESex avatar_sex ) } // now apply volume changes - for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ ) + for(LLPolyVolumeMorph& volume_morph : mVolumeMorphs) { - LLPolyVolumeMorph* volume_morph = &(*iter); - LLVector3 scale_delta = volume_morph->mScale * delta_weight; - LLVector3 pos_delta = volume_morph->mPos * delta_weight; + LLVector3 scale_delta = volume_morph.mScale * delta_weight; + LLVector3 pos_delta = volume_morph.mPos * delta_weight; - volume_morph->mVolume->setScale(volume_morph->mVolume->getScale() + scale_delta); + volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta); // SL-315 - volume_morph->mVolume->setPosition(volume_morph->mVolume->getPosition() + pos_delta); + volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta); } } @@ -735,15 +732,14 @@ void LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S3 void LLPolyMorphTarget::applyVolumeChanges(F32 delta_weight) { // now apply volume changes - for( volume_list_t::iterator iter = mVolumeMorphs.begin(); iter != mVolumeMorphs.end(); iter++ ) + for(LLPolyVolumeMorph& volume_morph : mVolumeMorphs) { - LLPolyVolumeMorph* volume_morph = &(*iter); - LLVector3 scale_delta = volume_morph->mScale * delta_weight; - LLVector3 pos_delta = volume_morph->mPos * delta_weight; + LLVector3 scale_delta = volume_morph.mScale * delta_weight; + LLVector3 pos_delta = volume_morph.mPos * delta_weight; - volume_morph->mVolume->setScale(volume_morph->mVolume->getScale() + scale_delta); + volume_morph.mVolume->setScale(volume_morph.mVolume->getScale() + scale_delta); // SL-315 - volume_morph->mVolume->setPosition(volume_morph->mVolume->getPosition() + pos_delta); + volume_morph.mVolume->setPosition(volume_morph.mVolume->getPosition() + pos_delta); } } diff --git a/indra/llappearance/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp index 360f17508f..586e631ded 100644 --- a/indra/llappearance/llpolyskeletaldistortion.cpp +++ b/indra/llappearance/llpolyskeletaldistortion.cpp @@ -143,38 +143,35 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) mID = info->mID; setWeight(getDefaultWeight()); - LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter; - for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++) + for (LLPolySkeletalBoneInfo& 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 (LLJoint* 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 +192,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 (joint_vec_map_t::value_type& 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 +212,11 @@ void LLPolySkeletalDistortion::apply( ESex avatar_sex ) joint->setScale(newScale, true); } - for (iter = mJointOffsets.begin(); - iter != mJointOffsets.end(); - iter++) + for (joint_vec_map_t::value_type& 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; diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp index 3df2254b14..75815482c9 100644 --- a/indra/llappearance/lltexglobalcolor.cpp +++ b/indra/llappearance/lltexglobalcolor.cpp @@ -55,12 +55,10 @@ BOOL LLTexGlobalColor::setInfo(LLTexGlobalColorInfo *info) //mID = info->mID; // No ID mParamGlobalColorList.reserve(mInfo->mParamColorInfoList.size()); - for (param_color_info_list_t::iterator iter = mInfo->mParamColorInfoList.begin(); - iter != mInfo->mParamColorInfoList.end(); - iter++) + for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList) { LLTexParamGlobalColor* param_color = new LLTexParamGlobalColor(this); - if (!param_color->setInfo(*iter, TRUE)) + if (!param_color->setInfo(color_info, TRUE)) { mInfo = NULL; return FALSE; diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 3430a25536..6f23b2e04c 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -241,11 +241,8 @@ BOOL LLTexLayerSetInfo::parseXml(LLXmlTreeNode* node) void LLTexLayerSetInfo::createVisualParams(LLAvatarAppearance *appearance) { //layer_info_list_t mLayerInfoList; - for (layer_info_list_t::iterator layer_iter = mLayerInfoList.begin(); - layer_iter != mLayerInfoList.end(); - layer_iter++) + for (LLTexLayerInfo* layer_info : mLayerInfoList) { - LLTexLayerInfo *layer_info = *layer_iter; layer_info->createVisualParams(appearance); } } @@ -287,12 +284,10 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) //mID = info->mID; // No ID mLayerList.reserve(info->mLayerInfoList.size()); - for (LLTexLayerSetInfo::layer_info_list_t::const_iterator iter = info->mLayerInfoList.begin(); - iter != info->mLayerInfoList.end(); - iter++) + for (LLTexLayerInfo* layer_info : info->mLayerInfoList) { LLTexLayerInterface *layer = NULL; - if ( (*iter)->isUserSettable() ) + if (layer_info->isUserSettable()) { layer = new LLTexLayerTemplate( this, getAvatarAppearance() ); } @@ -301,7 +296,7 @@ BOOL LLTexLayerSet::setInfo(const LLTexLayerSetInfo *info) layer = new LLTexLayer(this); } // this is the first time this layer (of either type) is being created - make sure you add the parameters to the avatar appearance - if (!layer->setInfo(*iter, NULL)) + if (!layer->setInfo(layer_info, NULL)) { mInfo = NULL; return FALSE; @@ -348,14 +343,12 @@ BOOL LLTexLayerSet::parseData(LLXmlTreeNode* node) void LLTexLayerSet::deleteCaches() { - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for(LLTexLayerInterface* layer : mLayerList) { - LLTexLayerInterface* layer = *iter; layer->deleteCaches(); } - for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) + for (LLTexLayerInterface* layer : mMaskLayerList) { - LLTexLayerInterface* layer = *iter; layer->deleteCaches(); } } @@ -368,9 +361,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* if (mMaskLayerList.size() > 0) { - for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) + for (LLTexLayerInterface* layer : mMaskLayerList) { - LLTexLayerInterface* layer = *iter; if (layer->isInvisibleAlphaMask()) { mIsVisible = FALSE; @@ -399,9 +391,8 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* if (mIsVisible) { // composite color layers - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for(LLTexLayerInterface* layer : mLayerList) { - LLTexLayerInterface* layer = *iter; if (layer->getRenderPass() == LLTexLayer::RP_COLOR) { gGL.flush(); @@ -473,9 +464,8 @@ void LLTexLayerSet::gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S LL_PROFILE_ZONE_SCOPED; memset(data, 255, width * height); - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for(LLTexLayerInterface* layer : mLayerList) { - LLTexLayerInterface* layer = *iter; layer->gatherAlphaMasks(data, origin_x, origin_y, width, height, bound_target); } @@ -526,9 +516,8 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, if (mMaskLayerList.size() > 0) { gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA); - for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) + for (LLTexLayerInterface* layer : mMaskLayerList) { - LLTexLayerInterface* layer = *iter; gGL.flush(); layer->blendAlphaTexture(x,y,width, height); gGL.flush(); @@ -549,9 +538,8 @@ void LLTexLayerSet::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_ BOOL LLTexLayerSet::isMorphValid() const { - for(layer_list_t::const_iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for(const LLTexLayerInterface* layer : mLayerList) { - const LLTexLayerInterface* layer = *iter; if (layer && !layer->isMorphValid()) { return FALSE; @@ -562,9 +550,8 @@ BOOL LLTexLayerSet::isMorphValid() const void LLTexLayerSet::invalidateMorphMasks() { - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for(LLTexLayerInterface* layer : mLayerList) { - LLTexLayerInterface* layer = *iter; if (layer) { layer->invalidateMorphMasks(); @@ -661,14 +648,12 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) /* if ("upper_shirt" == local_texture_name) mLocalTexture = TEX_UPPER_SHIRT; */ mLocalTexture = TEX_NUM_INDICES; - for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearance::getDictionary()->getTextures().begin(); - iter != LLAvatarAppearance::getDictionary()->getTextures().end(); - iter++) + for (const LLAvatarAppearanceDictionary::Textures::value_type& dict_pair : LLAvatarAppearance::getDictionary()->getTextures()) { - const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = dict_pair.second; if (local_texture_name == texture_dict->mName) { - mLocalTexture = iter->first; + mLocalTexture = dict_pair.first; break; } } @@ -735,11 +720,8 @@ BOOL LLTexLayerInfo::parseXml(LLXmlTreeNode* node) BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance) { BOOL success = TRUE; - for (param_color_info_list_t::iterator color_info_iter = mParamColorInfoList.begin(); - color_info_iter != mParamColorInfoList.end(); - color_info_iter++) + for (LLTexLayerParamColorInfo* color_info : mParamColorInfoList) { - LLTexLayerParamColorInfo * color_info = *color_info_iter; LLTexLayerParamColor* param_color = new LLTexLayerParamColor(appearance); if (!param_color->setInfo(color_info, TRUE)) { @@ -749,11 +731,8 @@ BOOL LLTexLayerInfo::createVisualParams(LLAvatarAppearance *appearance) } } - for (param_alpha_info_list_t::iterator alpha_info_iter = mParamAlphaInfoList.begin(); - alpha_info_iter != mParamAlphaInfoList.end(); - alpha_info_iter++) + for (LLTexLayerParamAlphaInfo* alpha_info : mParamAlphaInfoList) { - LLTexLayerParamAlphaInfo * alpha_info = *alpha_info_iter; LLTexLayerParamAlpha* param_alpha = new LLTexLayerParamAlpha(appearance); if (!param_alpha->setInfo(alpha_info, TRUE)) { @@ -796,15 +775,13 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab //mID = info->mID; // No ID mParamColorList.reserve(mInfo->mParamColorInfoList.size()); - for (param_color_info_list_t::const_iterator iter = mInfo->mParamColorInfoList.begin(); - iter != mInfo->mParamColorInfoList.end(); - iter++) + for (LLTexLayerParamColorInfo* color_info : mInfo->mParamColorInfoList) { LLTexLayerParamColor* param_color; if (!wearable) { param_color = new LLTexLayerParamColor(this); - if (!param_color->setInfo(*iter, TRUE)) + if (!param_color->setInfo(color_info, TRUE)) { mInfo = NULL; return FALSE; @@ -812,7 +789,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab } else { - param_color = (LLTexLayerParamColor*)wearable->getVisualParam((*iter)->getID()); + param_color = (LLTexLayerParamColor*)wearable->getVisualParam(color_info->getID()); if (!param_color) { mInfo = NULL; @@ -823,15 +800,13 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab } mParamAlphaList.reserve(mInfo->mParamAlphaInfoList.size()); - for (param_alpha_info_list_t::const_iterator iter = mInfo->mParamAlphaInfoList.begin(); - iter != mInfo->mParamAlphaInfoList.end(); - iter++) + for (LLTexLayerParamAlphaInfo* alpha_info : mInfo->mParamAlphaInfoList) { LLTexLayerParamAlpha* param_alpha; if (!wearable) { param_alpha = new LLTexLayerParamAlpha( this ); - if (!param_alpha->setInfo(*iter, TRUE)) + if (!param_alpha->setInfo(alpha_info, TRUE)) { mInfo = NULL; return FALSE; @@ -839,7 +814,7 @@ BOOL LLTexLayerInterface::setInfo(const LLTexLayerInfo *info, LLWearable* wearab } else { - param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam((*iter)->getID()); + param_alpha = (LLTexLayerParamAlpha*) wearable->getVisualParam(alpha_info->getID()); if (!param_alpha) { mInfo = NULL; @@ -873,12 +848,9 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const if (TEX_INVALID == te) { LLWearableType::EType type = LLWearableType::WT_INVALID; - param_color_list_t::const_iterator color_iter = mParamColorList.begin(); - param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin(); - for (; color_iter != mParamColorList.end(); color_iter++) + for (LLTexLayerParamColor* param : mParamColorList) { - LLTexLayerParamColor* param = *color_iter; if (param) { LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType(); @@ -893,9 +865,8 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const } } - for (; alpha_iter != mParamAlphaList.end(); alpha_iter++) + for (LLTexLayerParamAlpha* param : mParamAlphaList) { - LLTexLayerParamAlpha* param = *alpha_iter; if (param) { LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType(); @@ -938,18 +909,18 @@ void LLTexLayerInterface::invalidateMorphMasks() LLViewerVisualParam* LLTexLayerInterface::getVisualParamPtr(S32 index) const { LLViewerVisualParam *result = NULL; - for (param_color_list_t::const_iterator color_iter = mParamColorList.begin(); color_iter != mParamColorList.end() && !result; ++color_iter) + for (LLTexLayerParamColor* param : mParamColorList) { - if ((*color_iter)->getID() == index) + if (param->getID() == index) { - result = *color_iter; + result = param; } } - for (param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin(); alpha_iter != mParamAlphaList.end() && !result; ++alpha_iter) + for (LLTexLayerParamAlpha* param : mParamAlphaList) { - if ((*alpha_iter)->getID() == index) + if (param->getID() == index) { - result = *alpha_iter; + result = param; } } @@ -994,10 +965,9 @@ LLTexLayer::~LLTexLayer() //std::for_each(mParamAlphaList.begin(), mParamAlphaList.end(), DeletePointer()); //std::for_each(mParamColorList.begin(), mParamColorList.end(), DeletePointer()); - for( alpha_cache_t::iterator iter = mAlphaCache.begin(); - iter != mAlphaCache.end(); iter++ ) + for (alpha_cache_t::value_type& alpha_pair : mAlphaCache) { - U8* alpha_data = iter->second; + U8* alpha_data = alpha_pair.second; ll_aligned_free_32(alpha_data); } @@ -1021,10 +991,8 @@ BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable ) //static void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color) { - for (param_color_list_t::const_iterator iter = param_list.begin(); - iter != param_list.end(); iter++) + for (const LLTexLayerParamColor* param : param_list) { - const LLTexLayerParamColor* param = *iter; LLColor4 param_net = param->getNetColor(); const LLTexLayerParamColorInfo *info = (LLTexLayerParamColorInfo *)param->getInfo(); switch(info->getOperation()) @@ -1049,10 +1017,8 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LL /*virtual*/ void LLTexLayer::deleteCaches() { // Only need to delete caches for alpha params. Color params don't hold extra memory - for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); - iter != mParamAlphaList.end(); iter++ ) + for (LLTexLayerParamAlpha* param : mParamAlphaList) { - LLTexLayerParamAlpha* param = *iter; param->deleteCaches(); } } @@ -1226,9 +1192,8 @@ const U8* LLTexLayer::getAlphaData() const const LLUUID& uuid = getUUID(); alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES); - for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) + for (const LLTexLayerParamAlpha* param : mParamAlphaList) { - const LLTexLayerParamAlpha* param = *iter; // MULTI-WEARABLE: verify visual parameters used here F32 param_weight = param->getWeight(); alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32)); @@ -1365,9 +1330,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC // Accumulate alphas LLGLSNoAlphaTest gls_no_alpha_test; gGL.color4f( 1.f, 1.f, 1.f, 1.f ); - for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) + for (LLTexLayerParamAlpha* param : mParamAlphaList) { - LLTexLayerParamAlpha* param = *iter; success &= param->render( x, y, width, height ); if (!success && !force_render) { @@ -1441,9 +1405,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC const LLUUID& uuid = getUUID(); alpha_mask_crc.update((U8*)(&uuid.mData), UUID_BYTES); - for (param_alpha_list_t::const_iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) + for (const LLTexLayerParamAlpha* param : mParamAlphaList) { - const LLTexLayerParamAlpha* param = *iter; F32 param_weight = param->getWeight(); alpha_mask_crc.update((U8*)¶m_weight, sizeof(F32)); } @@ -1683,12 +1646,10 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const BOOL success = TRUE; updateWearableCache(); - for (wearable_cache_t::const_iterator iter = mWearableCache.begin(); iter!= mWearableCache.end(); iter++) + for (LLWearable* wearable : mWearableCache) { - LLWearable* wearable = NULL; LLLocalTextureObject *lto = NULL; LLTexLayer *layer = NULL; - wearable = *iter; if (wearable) { lto = wearable->getLocalTextureObject(mInfo->mLocalTexture); @@ -1785,17 +1746,15 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) const //----------------------------------------------------------------------------- LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name) { - for (layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for (LLTexLayerInterface* layer : mLayerList) { - LLTexLayerInterface* layer = *iter; if (layer->getName() == name) { return layer; } } - for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ ) + for (LLTexLayerInterface* layer : mMaskLayerList) { - LLTexLayerInterface* layer = *iter; if (layer->getName() == name) { return layer; @@ -1807,20 +1766,20 @@ LLTexLayerInterface* LLTexLayerSet::findLayerByName(const std::string& name) void LLTexLayerSet::cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable *wearable) { // initialize all texlayers with this texture type for this LTO - for( LLTexLayerSet::layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + for(LLTexLayerInterface* layer : mLayerList) { - LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter; - if (layer->getInfo()->getLocalTexture() == (S32) tex_index) + LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer; + if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index) { - lto->addTexLayer(layer, wearable); + lto->addTexLayer(layer_template, wearable); } } - for( LLTexLayerSet::layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++ ) + for(LLTexLayerInterface* layer : mMaskLayerList) { - LLTexLayerTemplate* layer = (LLTexLayerTemplate*)*iter; - if (layer->getInfo()->getLocalTexture() == (S32) tex_index) + LLTexLayerTemplate* layer_template = (LLTexLayerTemplate*)layer; + if (layer_template->getInfo()->getLocalTexture() == (S32)tex_index) { - lto->addTexLayer(layer, wearable); + lto->addTexLayer(layer_template, wearable); } } } diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp index ce5c7142d5..a288c8955a 100644 --- a/indra/llappearance/lltexlayerparams.cpp +++ b/indra/llappearance/lltexlayerparams.cpp @@ -103,10 +103,8 @@ void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes) { *gl_bytes = 0; - for (param_alpha_ptr_list_t::iterator iter = sInstances.begin(); - iter != sInstances.end(); iter++) + for (LLTexLayerParamAlpha* instance : sInstances) { - LLTexLayerParamAlpha* instance = *iter; LLGLTexture* tex = instance->mCachedProcessedTexture; if (tex) { diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index e4bc8ff427..10d668d0af 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -60,12 +60,12 @@ LLWearable::LLWearable() // virtual LLWearable::~LLWearable() { - for (visual_param_index_map_t::iterator vpIter = mVisualParamIndexMap.begin(); vpIter != mVisualParamIndexMap.end(); ++vpIter) + for (visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap) { - LLVisualParam* vp = vpIter->second; + LLVisualParam* vp = vp_pair.second; vp->clearNextParam(); delete vp; - vpIter->second = NULL; + vp_pair.second = NULL; } destroyTextures(); @@ -122,12 +122,10 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const // parameters output_stream << "parameters " << mVisualParamIndexMap.size() << "\n"; - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); - iter != mVisualParamIndexMap.end(); - ++iter) + for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap) { - S32 param_id = iter->first; - const LLVisualParam* param = iter->second; + S32 param_id = vp_pair.first; + const LLVisualParam* param = vp_pair.second; F32 param_weight = param->getWeight(); output_stream << param_id << " " << terse_F32_to_string( param_weight ) << "\n"; } @@ -135,11 +133,11 @@ BOOL LLWearable::exportStream( std::ostream& output_stream ) const // texture entries output_stream << "textures " << mTEMap.size() << "\n"; - for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter) + for (const te_map_t::value_type& te_pair : mTEMap) { - S32 te = iter->first; - const LLUUID& image_id = iter->second->getID(); - output_stream << te << " " << image_id << "\n"; + S32 te = te_pair.first; + const LLUUID& image_id = te_pair.second->getID(); + output_stream << te << " " << image_id << "\n"; } return TRUE; } @@ -160,11 +158,9 @@ void LLWearable::createVisualParams(LLAvatarAppearance *avatarp) } // resync driver parameters to point to the newly cloned driven parameters - for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin(); - param_iter != mVisualParamIndexMap.end(); - ++param_iter) + for (visual_param_index_map_t::value_type& param_pair : mVisualParamIndexMap) { - LLVisualParam* param = param_iter->second; + LLVisualParam* param = param_pair.second; LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam; // need this line to disambiguate between versions of LLCharacter::getVisualParam() LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam; @@ -523,10 +519,9 @@ std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq() { std::vector<LLLocalTextureObject*> result; - for(te_map_t::const_iterator iter = mTEMap.begin(); - iter != mTEMap.end(); iter++) + for(te_map_t::value_type& te_pair : mTEMap) { - LLLocalTextureObject* lto = iter->second; + LLLocalTextureObject* lto = te_pair.second; result.push_back(lto); } @@ -547,37 +542,15 @@ void LLWearable::revertValues() // FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance. //update saved settings so wearable is no longer dirty - // non-driver params first - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - F32 value = iter->second; - LLVisualParam *param = getVisualParam(id); - if(param && !dynamic_cast<LLDriverParam*>(param) ) - { - setVisualParamWeight(id, value); - } - } - - //then driver params - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) + // One loop should be necessary here + for (param_map_t::value_type& vp_pair : mSavedVisualParamMap) { - S32 id = iter->first; - F32 value = iter->second; + S32 id = vp_pair.first; LLVisualParam *param = getVisualParam(id); - if(param && dynamic_cast<LLDriverParam*>(param) ) + if(param) { + F32 value = vp_pair.second; setVisualParamWeight(id, value); - } - } - - // make sure that saved values are sane - for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++) - { - S32 id = iter->first; - LLVisualParam *param = getVisualParam(id); - if( param ) - { mSavedVisualParamMap[id] = param->getWeight(); } } @@ -589,10 +562,10 @@ void LLWearable::saveValues() { //update saved settings so wearable is no longer dirty mSavedVisualParamMap.clear(); - for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter) + for (const visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap) { - S32 id = iter->first; - LLVisualParam *wearable_param = iter->second; + S32 id = vp_pair.first; + LLVisualParam *wearable_param = vp_pair.second; F32 value = wearable_param->getWeight(); mSavedVisualParamMap[id] = value; } @@ -706,23 +679,18 @@ LLVisualParam* LLWearable::getVisualParam(S32 index) const void LLWearable::getVisualParams(visual_param_vec_t &list) { - visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin(); - visual_param_index_map_t::iterator end = mVisualParamIndexMap.end(); - // add all visual params to the passed-in vector - for( ; iter != end; ++iter ) + for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap) { - list.push_back(iter->second); + list.push_back(vp_pair.second); } } void LLWearable::animateParams(F32 delta) { - for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin(); - iter != mVisualParamIndexMap.end(); - ++iter) + for(visual_param_index_map_t::value_type& vp_pair : mVisualParamIndexMap) { - LLVisualParam *param = (LLVisualParam*) iter->second; + LLVisualParam *param = (LLVisualParam*)vp_pair.second; param->animate(delta); } } |