mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-19 19:54:07 +00:00
#1097
fix:IFC file conversion obj file, some cases will be rotated 90 °
This commit is contained in:
@@ -53,8 +53,11 @@ public:
|
||||
/// Use step ids for naming elements.
|
||||
/// Applicable for OBJ, DAE, and SVG output.
|
||||
USE_ELEMENT_STEPIDS = 1 << (IfcGeom::IteratorSettings::NUM_SETTINGS + 6),
|
||||
/// Use step Z UP .
|
||||
/// Applicable for OBJ output.
|
||||
USE_Z_UP = 1 << (IfcGeom::IteratorSettings::NUM_SETTINGS + 7),
|
||||
/// Number of different setting flags.
|
||||
NUM_SETTINGS = 6
|
||||
NUM_SETTINGS = 7
|
||||
};
|
||||
|
||||
SerializerSettings()
|
||||
|
||||
@@ -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(); ) {
|
||||
|
||||
Reference in New Issue
Block a user