mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 10:33:20 +00:00
ifcviewer-web: streaming loading bar (metadata → geometry progress)
Users had no feedback during the seconds before/while a model streams. Add a top progress strip + caption driven by the streaming state: - "Loading model… N MB" while the critical metadata downloads (no chunks yet), - "Loading geometry — R / T chunks · N MB" as chunks go resident, - "Loaded — T chunks · N MB", then it hides. ViewportCore::streamingProgress(resident, total) sums chunk residency across models; main_web exports ifcv_chunks_resident_c / ifcv_chunks_total_c for shell.html to poll each RAF. The EM_JS range reader accumulates Module.__ifcvBytesLoaded so the caption can show MB downloaded. Shown only for streamed loads (?model= URL / picked file), not the embedded sample. 6/6 web smoke pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3219,7 +3219,10 @@ EM_JS(double, ifcvFileSize, (void), {
|
||||
// works (just without the bandwidth saving).
|
||||
EM_JS(void, ifcvReadRangeInto, (int reqId, double offset, double size, void* dst), {
|
||||
var deliver = function(ok, buf) {
|
||||
if (ok && buf) HEAPU8.set(new Uint8Array(buf), dst);
|
||||
if (ok && buf) {
|
||||
HEAPU8.set(new Uint8Array(buf), dst);
|
||||
Module["__ifcvBytesLoaded"] = (Module["__ifcvBytesLoaded"] || 0) + buf.byteLength;
|
||||
}
|
||||
Module["_ifcv_on_range_done"](reqId, ok ? 1 : 0);
|
||||
};
|
||||
var f = Module["__ifcvFile"];
|
||||
@@ -3608,6 +3611,17 @@ void ViewportCore::loadDeferredMetadataWeb(std::uint32_t model_id,
|
||||
}
|
||||
#endif // __EMSCRIPTEN__
|
||||
|
||||
void ViewportCore::streamingProgress(int& resident_chunks, int& total_chunks) const {
|
||||
resident_chunks = 0;
|
||||
total_chunks = 0;
|
||||
for (const auto& [mid, m] : models_gpu_) {
|
||||
for (const auto& c : m.chunks) {
|
||||
++total_chunks;
|
||||
if (c.is_resident) ++resident_chunks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportCore::finalizeModel(std::uint32_t model_id) {
|
||||
auto it = pending_direct_loads_.find(model_id);
|
||||
if (it == pending_direct_loads_.end()) {
|
||||
|
||||
Reference in New Issue
Block a user