diff --git a/src/cpp/web-ifc/geometry/IfcGeometryProcessor.cpp b/src/cpp/web-ifc/geometry/IfcGeometryProcessor.cpp index a1b559f8..14dbe492 100644 --- a/src/cpp/web-ifc/geometry/IfcGeometryProcessor.cpp +++ b/src/cpp/web-ifc/geometry/IfcGeometryProcessor.cpp @@ -290,6 +290,21 @@ namespace webifc::geometry resultMesh.hasColor = false; } + + // Sometimes, a geometric item like IFCEXTRUDEDAREASOLID has a color assigned. + // With flatten() and BoolProcess, that color gets lost. Restore it here: + if (!mesh.hasGeometry && mesh.children.size() > 0) + { + auto geometricItem = mesh.children.front(); + std::optional geometricItemColor = geometricItem.GetColor(); + if (geometricItemColor.has_value()) + { + glm::dvec4 colorValue = geometricItemColor.value(); + resultMesh.color = colorValue; + resultMesh.hasColor = true; + } + } + return resultMesh; } else