diff --git a/include/lsWriteVisualizationMesh.hpp b/include/lsWriteVisualizationMesh.hpp index 765d861e..8990009a 100644 --- a/include/lsWriteVisualizationMesh.hpp +++ b/include/lsWriteVisualizationMesh.hpp @@ -513,8 +513,9 @@ template class lsWriteVisualizationMesh { } #endif + const bool useMaterialMap = materialMap != nullptr; materialMeshes.push_back(clipper->GetOutput()); - materialIds.push_back(0); + materialIds.push_back(useMaterialMap ? materialMap->getMaterialId(0) : 0); #ifdef LS_TO_VISUALIZATION_DEBUG { @@ -526,7 +527,6 @@ template class lsWriteVisualizationMesh { #endif unsigned counter = 1; - const bool useMaterialMap = materialMap != nullptr; // now cut large volume mesh with all the smaller ones for (typename LevelSetsType::const_reverse_iterator it =