summaryrefslogtreecommitdiff
path: root/indra/llappearance/lltexlayer.cpp
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2023-05-17 11:17:48 -0700
committerBrad Linden <brad@lindenlab.com>2023-05-17 11:17:48 -0700
commit2f44377b3e98d60f1bd5b1a495c9a3aab9cfa450 (patch)
tree0c9b22edca280d8e2a2ef280360485c139c9b829 /indra/llappearance/lltexlayer.cpp
parent4758355c599d1487c11884d3f700981e011cb7b7 (diff)
parent5a70639b7992842a9f74ec81b11bac56608b8f2e (diff)
Merge remote-tracking branch 'origin/main' into DRTVWR-559
Diffstat (limited to 'indra/llappearance/lltexlayer.cpp')
-rw-r--r--indra/llappearance/lltexlayer.cpp139
1 files changed, 49 insertions, 90 deletions
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 473fd078cd..ff894eeed3 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;
@@ -398,9 +390,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();
@@ -471,9 +462,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);
}
@@ -523,9 +513,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();
@@ -546,9 +535,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;
@@ -559,9 +547,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();
@@ -658,14 +645,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;
}
}
@@ -732,11 +717,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))
{
@@ -746,11 +728,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))
{
@@ -793,15 +772,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;
@@ -809,7 +786,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;
@@ -820,15 +797,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;
@@ -836,7 +811,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;
@@ -870,12 +845,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();
@@ -890,9 +862,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();
@@ -935,18 +906,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;
}
}
@@ -991,10 +962,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);
}
@@ -1018,10 +988,8 @@ BOOL LLTexLayer::setInfo(const LLTexLayerInfo* info, LLWearable* wearable )
//static
void LLTexLayer::calculateTexLayerColor(const param_color_list_t &param_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())
@@ -1046,10 +1014,8 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t &param_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();
}
}
@@ -1220,9 +1186,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*)&param_weight, sizeof(F32));
@@ -1355,9 +1320,8 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
// Accumulate alphas
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)
{
@@ -1428,9 +1392,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*)&param_weight, sizeof(F32));
}
@@ -1677,12 +1640,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);
@@ -1779,17 +1740,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;
@@ -1801,20 +1760,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);
}
}
}