ifcviewer: reorder sidecar by Morton in the offline bake path

SidecarBuilder::build (the one-shot bake used by the models-panel export
command in bonsaiviewer) never called reorderSidecarByMorton, unlike the
live streaming loader. The chunk table was therefore left empty, so the
exported .ifcview had its geometry laid out non-contiguously and only the
metadata blocks compressed. Reorder before writeSidecar to match the
loader so exported sidecars stream correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-07-24 17:22:31 +10:00
parent 466df653b7
commit 4972bb7a81
+8
View File
@@ -22,6 +22,7 @@
#include "Federation.h"
#include "LodBuilder.h"
#include "SidecarCache.h"
#include "SidecarLayout.h"
#include "VertexQuantization.h"
#include <QEventLoop>
@@ -205,6 +206,13 @@ bool SidecarBuilder::build(const QString& ifc_path,
SidecarData data = finalize(georef, streamer.drainElements());
// Match the live loader (SceneLoader::onStreamerFinished): reorder into the
// chunk-contiguous layout, which populates the chunk table so writeSidecar
// actually compresses the geometry. Without it this offline bake path (used
// by the models-panel export command) writes a sidecar whose geometry was
// never laid out contiguously, with only the metadata blocks compressed.
reorderSidecarByMorton(data);
if (!writeSidecar(anchor_path.toStdString(), data)) {
last_error_ = "writeSidecar failed";
return false;