ifcviewer-web: load many models from the URL + per-model loading panel

Query string: auto-load a whole federation, not one model. Accepts repeated
params (?model=a&model=b&…) and/or a comma list (?models=a,b,c); each becomes
its own streamed byte-source, clearing the embedded sample once then streaming
concurrently into one scene. A failed URL is reported without aborting the rest.

Loading UI: the bare aggregate chunk count didn't reveal the federation state,
so surface per-model progress. ViewportCore::streamingModelCount() +
streamingModelProgress(idx,…) (ordered by model_id = load order) feed
main_web's ifcv_model_count_c / ifcv_model_{resident,total}_c. shell.html draws
a panel: "Loading N models — X done · Y streaming · Z waiting · N MB" plus one
segment per model (blue fill while streaming, green when resident, grey while
its metadata is still pending) — so parallel loading and how many remain are
visible at a glance.

Verified: 10 models from a 10x ?model= query stream in parallel; the panel
steps 10 waiting → streaming → all done. 111/111 unit + 6/6 web smoke pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-07-01 14:11:02 +10:00
parent 4c38e52741
commit 10ab982032
5 changed files with 135 additions and 40 deletions
+23
View File
@@ -3599,6 +3599,29 @@ void ViewportCore::streamingProgress(int& resident_chunks, int& total_chunks) co
}
}
int ViewportCore::streamingModelCount() const {
return int(models_gpu_.size());
}
void ViewportCore::streamingModelProgress(int idx, int& resident_chunks,
int& total_chunks) const {
resident_chunks = 0;
total_chunks = 0;
if (idx < 0 || idx >= int(models_gpu_.size())) return;
// Order by model_id (= load order) so a model keeps the same UI slot as it
// streams, instead of hopping with unordered_map iteration order.
std::vector<std::uint32_t> ids;
ids.reserve(models_gpu_.size());
for (const auto& [mid, m] : models_gpu_) ids.push_back(mid);
std::sort(ids.begin(), ids.end());
auto it = models_gpu_.find(ids[std::size_t(idx)]);
if (it == models_gpu_.end()) return;
for (const auto& c : it->second.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()) {