MCPcopy Create free account
hub / github.com/ThatOpen/engine_web-ifc / StreamMeshes

Function StreamMeshes

src/cpp/wasm/web-ifc-wasm.cpp:94–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void StreamMeshes(uint32_t modelID, const std::vector<uint32_t> &expressIds, emscripten::val callback)
95{
96 if (!manager.IsModelOpen(modelID))
97 return;
98 auto geomLoader = manager.GetGeometryProcessor(modelID);
99 int index = 0;
100 int total = expressIds.size();
101
102 for (const auto &id : expressIds)
103 {
104 // read the mesh from IFC
105 webifc::geometry::IfcFlatMesh mesh = geomLoader->GetFlatMesh(id);
106
107 // prepare the geometry data
108 for (auto &geom : mesh.geometries)
109 {
110 auto &flatGeom = geomLoader->GetGeometry(geom.geometryExpressID);
111 flatGeom.GetVertexData();
112 }
113
114 if (!mesh.geometries.empty())
115 {
116 // transfer control to client, geometry data is alive for the time of the callback
117 callback(mesh, index, total);
118 }
119
120 // clear geometry, freeing memory, client is expected to have consumed the data
121 geomLoader->Clear();
122
123 index++;
124 }
125}
126
127void StreamMeshesWithExpressID(uint32_t modelID, emscripten::val expressIdsVal, emscripten::val callback)
128{

Callers 2

StreamAllMeshesWithTypesFunction · 0.85

Calls 8

callbackFunction · 0.85
GetGeometryProcessorMethod · 0.80
sizeMethod · 0.80
GetGeometryMethod · 0.80
GetVertexDataMethod · 0.65
IsModelOpenMethod · 0.45
GetFlatMeshMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected