diff --git a/src/ifcgeom/IfcGeomRepresentation.cpp b/src/ifcgeom/IfcGeomRepresentation.cpp index 89eb2bdd6b..2cf05fd9de 100644 --- a/src/ifcgeom/IfcGeomRepresentation.cpp +++ b/src/ifcgeom/IfcGeomRepresentation.cpp @@ -149,7 +149,7 @@ IfcGeom::Representation::Serialization::Serialization(const BRep& brep) int sid = -1; if (it->hasStyle()) { - const auto& clr = it->Style().diffuse.ccomponents(); + const auto& clr = it->Style().get_color().ccomponents(); surface_styles_.push_back(clr(0)); surface_styles_.push_back(clr(1)); surface_styles_.push_back(clr(2)); diff --git a/src/ifcgeom/SurfaceStyle.cpp b/src/ifcgeom/SurfaceStyle.cpp index 3d862b4825..69310f3929 100644 --- a/src/ifcgeom/SurfaceStyle.cpp +++ b/src/ifcgeom/SurfaceStyle.cpp @@ -89,6 +89,10 @@ void IfcGeom::set_default_style_file(const std::string& json_file) { boost::optional diffuse = material.get_child_optional("diffuse"); default_materials[name]->diffuse = read_colour_component(diffuse); + // @todo Is it necessary to get the surface too? + // boost::optional surface = material.get_child_optional("surface"); + // default_materials[name]->surface = read_colour_component(surface); + boost::optional specular = material.get_child_optional("specular"); default_materials[name]->specular = read_colour_component(specular); diff --git a/src/ifcgeomserver/IfcGeomServer.cpp b/src/ifcgeomserver/IfcGeomServer.cpp index 15cd7e546b..fdb349a0fb 100644 --- a/src/ifcgeomserver/IfcGeomServer.cpp +++ b/src/ifcgeomserver/IfcGeomServer.cpp @@ -354,8 +354,8 @@ protected: std::vector > > diffuse_color_array; for (auto it = geom->geometry().materials().begin(); it != geom->geometry().materials().end(); ++it) { const auto& mat = **it; - if (mat.diffuse) { - const auto& color = mat.diffuse.ccomponents(); + if (mat.get_color()) { + const auto& color = mat.get_color().ccomponents(); diffuse_color_array.push_back(std::array{ static_cast(color(0)), static_cast(color(1)), diff --git a/src/serializers/WavefrontObjSerializer.cpp b/src/serializers/WavefrontObjSerializer.cpp index 0414659b98..300fceeb88 100644 --- a/src/serializers/WavefrontObjSerializer.cpp +++ b/src/serializers/WavefrontObjSerializer.cpp @@ -67,7 +67,7 @@ void WaveFrontOBJSerializer::writeMaterial(const ifcopenshell::geometry::taxonom mtl_stream.stream << "newmtl " << material_name << "\n"; { - auto& diffuse = style.diffuse.ccomponents(); + auto& diffuse = style.get_color().ccomponents(); mtl_stream.stream << "Kd " << diffuse(0) << " " << diffuse(1) << " " << diffuse(2) << "\n"; } if (style.specular) {