Skip to content

Commit d714eca

Browse files
author
Cristian Ritter
committed
replacing diffuse to get_color method
1 parent cd3df94 commit d714eca

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/ifcgeom/IfcGeomRepresentation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ IfcGeom::Representation::Serialization::Serialization(const BRep& brep)
149149
int sid = -1;
150150

151151
if (it->hasStyle()) {
152-
const auto& clr = it->Style().diffuse.ccomponents();
152+
const auto& clr = it->Style().get_color().ccomponents();
153153
surface_styles_.push_back(clr(0));
154154
surface_styles_.push_back(clr(1));
155155
surface_styles_.push_back(clr(2));

src/ifcgeom/SurfaceStyle.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ void IfcGeom::set_default_style_file(const std::string& json_file) {
8989
boost::optional<pt::ptree&> diffuse = material.get_child_optional("diffuse");
9090
default_materials[name]->diffuse = read_colour_component(diffuse);
9191

92+
// @todo Is it necessary to get the surface too?
93+
// boost::optional<pt::ptree&> surface = material.get_child_optional("surface");
94+
// default_materials[name]->surface = read_colour_component(surface);
95+
9296
boost::optional<pt::ptree&> specular = material.get_child_optional("specular");
9397
default_materials[name]->specular = read_colour_component(specular);
9498

src/ifcgeomserver/IfcGeomServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ class Entity : public Command {
354354
std::vector<boost::optional<std::array<float, 4> > > diffuse_color_array;
355355
for (auto it = geom->geometry().materials().begin(); it != geom->geometry().materials().end(); ++it) {
356356
const auto& mat = **it;
357-
if (mat.diffuse) {
358-
const auto& color = mat.diffuse.ccomponents();
357+
if (mat.get_color()) {
358+
const auto& color = mat.get_color().ccomponents();
359359
diffuse_color_array.push_back(std::array<float, 4>{
360360
static_cast<float>(color(0)),
361361
static_cast<float>(color(1)),

src/serializers/WavefrontObjSerializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void WaveFrontOBJSerializer::writeMaterial(const ifcopenshell::geometry::taxonom
6767
mtl_stream.stream << "newmtl " << material_name << "\n";
6868

6969
{
70-
auto& diffuse = style.diffuse.ccomponents();
70+
auto& diffuse = style.get_color().ccomponents();
7171
mtl_stream.stream << "Kd " << diffuse(0) << " " << diffuse(1) << " " << diffuse(2) << "\n";
7272
}
7373
if (style.specular) {

0 commit comments

Comments
 (0)