Part: Use materialIndex.setValuesPointer() only if the new values are different

This commit is contained in:
Rexbas
2023-12-02 13:43:15 +01:00
committed by wwmayer
parent 056cbef618
commit 6f16be76de

View File

@@ -643,9 +643,6 @@ void SoBrepFaceSet::GLRender(SoGLRenderAction *action)
}
if(pushed) {
SbBool notify = enableNotify(FALSE);
materialIndex.setNum(0);
if(notify) enableNotify(notify);
state->pop();
}else if(action->isRenderingDelayedPaths()) {
renderSelection(action,ctx);
@@ -836,9 +833,12 @@ bool SoBrepFaceSet::overrideMaterialBinding(SoGLRenderAction *action, SelContext
}
}
SbBool notify = enableNotify(FALSE);
materialIndex.setValuesPointer(matIndex.size(),&matIndex[0]);
if(notify) enableNotify(notify);
size_t num = materialIndex.getNum();
if (num != matIndex.size() || materialIndex.getValues(0) != &matIndex[0]) {
SbBool notify = enableNotify(FALSE);
materialIndex.setValuesPointer(matIndex.size(), &matIndex[0]);
if (notify) enableNotify(notify);
}
SoMaterialBindingElement::set(state, this, SoMaterialBindingElement::PER_PART_INDEXED);
SoLazyElement::setPacked(state, this, packedColors.size(), &packedColors[0], hasTransparency);