shared_ptr styles all over #4833

This commit is contained in:
Thomas Krijnen
2024-06-10 20:11:24 +02:00
parent f2074d95fd
commit c01263d721
13 changed files with 97 additions and 93 deletions
+6 -5
View File
@@ -59,8 +59,9 @@ void WaveFrontOBJSerializer::writeHeader() {
mtl_stream.stream << "# File generated by IfcOpenShell " << IFCOPENSHELL_VERSION << "\n";
}
void WaveFrontOBJSerializer::writeMaterial(const ifcopenshell::geometry::taxonomy::style& style)
void WaveFrontOBJSerializer::writeMaterial(const ifcopenshell::geometry::taxonomy::style::ptr styleptr)
{
auto& style = *styleptr;
std::string material_name = style.name;
IfcUtil::sanitate_material_name(material_name);
mtl_stream.stream << "newmtl " << material_name << "\n";
@@ -127,8 +128,8 @@ void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement* o)
const int material_id = *(material_it++);
if (material_id != previous_material_id) {
const ifcopenshell::geometry::taxonomy::style& material = mesh.materials()[material_id];
std::string material_name = material.name;
const ifcopenshell::geometry::taxonomy::style::ptr material = mesh.materials()[material_id];
std::string material_name = material->name;
IfcUtil::sanitate_material_name(material_name);
obj_stream.stream << "usemtl " << material_name << "\n";
if (materials.find(material_name) == materials.end()) {
@@ -170,8 +171,8 @@ void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement* o)
const int material_id = *(material_it++);
if (material_id != previous_material_id) {
const ifcopenshell::geometry::taxonomy::style& material = mesh.materials()[material_id];
std::string material_name = material.name;
const ifcopenshell::geometry::taxonomy::style::ptr material = mesh.materials()[material_id];
std::string material_name = material->name;
IfcUtil::sanitate_material_name(material_name);
obj_stream.stream << "usemtl " << material_name << "\n";
if (materials.find(material_name) == materials.end()) {