fix:IFC file conversion obj file, some cases will be rotated 90 °
This commit is contained in:
admin
2020-12-10 18:44:23 +08:00
committed by Thomas Krijnen
parent 6976144d80
commit 68767c3656
3 changed files with 18 additions and 3 deletions
+11 -2
View File
@@ -88,7 +88,11 @@ void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement<real_t>*
{
obj_stream << "g " << object_id(o) << "\n";
obj_stream << "s 1" << "\n";
bool isyup = true;
if (settings().get(SerializerSettings::USE_Z_UP) ){ //settings().get(SerializerSettings::USE_Z_UP)
isyup = false;
}
const IfcGeom::Representation::Triangulation<real_t>& mesh = o->geometry();
const int vcount = (int)mesh.verts().size() / 3;
@@ -96,7 +100,12 @@ void WaveFrontOBJSerializer::write(const IfcGeom::TriangulationElement<real_t>*
const real_t x = *(it++);
const real_t y = *(it++);
const real_t z = *(it++);
obj_stream << "v " << x << " " << y << " " << z << "\n";
if(isyup){
obj_stream << "v " << x << " " << y << " " << z << "\n";
}else{
obj_stream << "v " << -x << " " << z << " " << y << "\n";
}
}
for ( std::vector<real_t>::const_iterator it = mesh.normals().begin(); it != mesh.normals().end(); ) {