Skip to content

Commit

Permalink
Recover streamMeshes
Browse files Browse the repository at this point in the history
  • Loading branch information
QuimMoya committed Apr 4, 2024
1 parent 0502c71 commit 04c7590
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/cpp/web-ifc-wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ void StreamMeshes(uint32_t modelID, const std::vector<uint32_t> & expressIds, em
}
}

void StreamMeshesWithExpressID(uint32_t modelID, emscripten::val expressIdsVal, emscripten::val callback)
{
std::vector<uint32_t> expressIds;

uint32_t size = expressIdsVal["length"].as<uint32_t>();
for (size_t i=0; i < size; i++)
{
emscripten::val expressIdVal = expressIdsVal[std::to_string(i)];

uint32_t expressId = expressIdVal.as<uint32_t>();

expressIds.push_back(expressId);
}

StreamMeshes(modelID, expressIds, callback);
}

void StreamAllMeshesWithTypes(uint32_t modelID, const std::vector<uint32_t>& types, emscripten::val callback)
{
if (!manager.IsModelOpen(modelID)) return;
Expand Down Expand Up @@ -795,6 +812,7 @@ EMSCRIPTEN_BINDINGS(my_module) {
emscripten::function("GetGeometry", &GetGeometry);
emscripten::function("GetFlatMesh", &GetFlatMesh);
emscripten::function("GetCoordinationMatrix", &GetCoordinationMatrix);
emscripten::function("StreamMeshes", &StreamMeshesWithExpressID);
emscripten::function("StreamAllMeshes", &StreamAllMeshes);
emscripten::function("StreamAllMeshesWithTypes", &StreamAllMeshesWithTypesVal);
emscripten::function("GetLine", &GetLine);
Expand Down

0 comments on commit 04c7590

Please sign in to comment.