IFC file successfully parsed and loaded in Qt OpenGL widget

This commit is contained in:
dushyant basson
2023-09-12 12:57:40 +05:30
committed by Thomas Krijnen
parent c8c08439b2
commit 7b92b5c7e2
9 changed files with 246 additions and 136 deletions
+30 -1
View File
@@ -4,14 +4,43 @@
#include <QObject>
#include <QString>
#include <string>
#include <vector>
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
#include "osg/Material"
#include "osg/ref_ptr"
#include "osg/Geometry"
struct VertexWithNormal {
osg::Vec3 vertex;
osg::Vec3 normal;
};
struct Triangle {
VertexWithNormal vn1;
VertexWithNormal vn2;
VertexWithNormal vn3;
};
class ParseIfcFile : public QObject
{
public:
ParseIfcFile();
~ParseIfcFile();
void Parse(const std::string& filePath);
bool Parse(
const std::string& filePath,
std::vector<osg::ref_ptr<osg::Geometry>>& geometries
);
private:
std::vector<Triangle> createTriangles(
const std::vector<int>& elemFaces,
const std::vector<double>& elemVertices,
const std::vector<double>& elemNormals
);
osg::Vec4 getDefaultOsgDiffuseColor();
osg::ref_ptr<osg::Material> getOsgMaterial(const IfcGeom::Material& material);
};
#endif // PARSEIFCFILE_H