mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-18 19:30:25 +00:00
ifcviewer-web: contribution-cull streaming + combined loaded/needed/total bar
Streaming picked candidates on raw frustum visibility, so viewAll over a big
federation (all models in-frustum) fetched every chunk — even fine chunks that
project to sub-pixel and the renderer never draws. Gate streaming on the SAME
contribution decision the render path already makes.
- New per-chunk contribution_visible_count: instances that passed frustum AND
the contribution cull (projected radius >= min_radius_px), counted BEFORE HiZ
— so it's stable while the camera is still (unlike the HiZ-post counters,
which flip frame-to-frame and would thrash the loader) and shifts only on
navigation, when the working set should. The candidate gate skips chunks with
count 0: the network pulls only what's resolvable now; the rest stream in as
you approach. Verified: fit view needs the geometry, zoomed-out needs 0.
- Loading UI reworked from per-model segments to a combined bar over the whole
federation: dark track = not needed for this view, dim = needed-but-unloaded,
bright = loaded. "loaded / needed" = how done THIS view is; "needed / total" =
how much of the model the view requires — "Loading 45 / 90 MB for this view ·
12% of 718 MB total". Driven by ViewportCore::streamingByteProgress + ifcv_bytes_*.
Two fixes from testing: (1) show a distinct overhead phase while total==0
("Loading model data — X MB · Y/N models ready") so the metadata download
isn't a dead-looking bar; (2) re-assert display:block every active frame so the
bar REAPPEARS when navigation reveals new chunks (was only set in
beginLoadProgress → stayed hidden after the first catch-up). Per-model exports
kept for a future detailed view.
111/111 unit + 6/6 web smoke pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -285,6 +285,25 @@ extern "C" EMSCRIPTEN_KEEPALIVE int ifcv_model_total_c(int idx) {
|
||||
int r = 0, t = 0; g_app->core.streamingModelProgress(idx, r, t); return t;
|
||||
}
|
||||
|
||||
// Combined byte progress for the loading bar: total geometry, bytes the current
|
||||
// view needs (contribution-culled), and how much of that is loaded. Doubles so
|
||||
// JS gets exact byte counts well past 2 GB.
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE double ifcv_bytes_total_c() {
|
||||
if (!g_app) return 0.0;
|
||||
std::uint64_t tot = 0, need = 0, load = 0;
|
||||
g_app->core.streamingByteProgress(tot, need, load); return double(tot);
|
||||
}
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE double ifcv_bytes_needed_c() {
|
||||
if (!g_app) return 0.0;
|
||||
std::uint64_t tot = 0, need = 0, load = 0;
|
||||
g_app->core.streamingByteProgress(tot, need, load); return double(need);
|
||||
}
|
||||
extern "C" EMSCRIPTEN_KEEPALIVE double ifcv_bytes_loaded_c() {
|
||||
if (!g_app) return 0.0;
|
||||
std::uint64_t tot = 0, need = 0, load = 0;
|
||||
g_app->core.streamingByteProgress(tot, need, load); return double(load);
|
||||
}
|
||||
|
||||
int main(int /*argc*/, char** /*argv*/) {
|
||||
Log::info() << "ifcviewer-web: starting";
|
||||
g_app = new AppState();
|
||||
|
||||
Reference in New Issue
Block a user