1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 16:20:21 +00:00

Avoid copy and deep equality check

This commit is contained in:
AnyOldName3 2021-06-27 01:48:06 +01:00
parent 8a1b4bde8a
commit 0e122b1e3d

View File

@ -275,11 +275,11 @@ namespace Shader
osg::StateSet::AttributeList removedAttributes; osg::StateSet::AttributeList removedAttributes;
if (osg::ref_ptr<osg::StateSet> removedState = getRemovedState(*stateset)) if (osg::ref_ptr<osg::StateSet> removedState = getRemovedState(*stateset))
removedAttributes = removedState->getAttributeList(); removedAttributes = removedState->getAttributeList();
for (const auto& attributeMap : { attributes, removedAttributes }) for (const auto* attributeMap : std::initializer_list<const osg::StateSet::AttributeList*>{ &attributes, &removedAttributes })
{ {
for (osg::StateSet::AttributeList::const_iterator it = attributeMap.begin(); it != attributeMap.end(); ++it) for (osg::StateSet::AttributeList::const_iterator it = attributeMap->begin(); it != attributeMap->end(); ++it)
{ {
if (attributeMap != removedAttributes && removedAttributes.count(it->first)) if (attributeMap != &removedAttributes && removedAttributes.count(it->first))
continue; continue;
if (it->first.first == osg::StateAttribute::MATERIAL) if (it->first.first == osg::StateAttribute::MATERIAL)
{ {