Multi-model project support with sequential loading

Introduce ModelHandle and per-model GeometryStreamers so multiple IFC
files can be loaded simultaneously. Object IDs are globally unique
(monotonically increasing across models). File picker is now multiselect.
Each model gets a top-level tree node. Property lookup uses the correct
model's ifcopenshell::file. ViewportWindow supports hide/show/remove
per model via model_id filtering in the frustum cull pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-04-11 20:49:39 +10:00
parent 6f6bebf387
commit 83a3131276
7 changed files with 167 additions and 47 deletions
+22
View File
@@ -427,6 +427,7 @@ void ViewportWindow::uploadChunk(const UploadChunk& chunk) {
ObjectDrawInfo info;
info.index_offset = static_cast<uint32_t>(ebo_used_);
info.index_count = static_cast<uint32_t>(chunk.indices.size());
info.model_id = chunk.model_id;
const size_t num_verts = chunk.vertices.size() / VERTEX_STRIDE;
if (num_verts > 0) {
@@ -467,6 +468,23 @@ void ViewportWindow::resetScene() {
total_triangles_ = 0;
selected_object_id_ = 0;
object_draw_info_.clear();
hidden_models_.clear();
removed_models_.clear();
}
void ViewportWindow::hideModel(uint32_t model_id) {
std::lock_guard<std::mutex> lock(upload_mutex_);
hidden_models_.insert(model_id);
}
void ViewportWindow::showModel(uint32_t model_id) {
std::lock_guard<std::mutex> lock(upload_mutex_);
hidden_models_.erase(model_id);
}
void ViewportWindow::removeModel(uint32_t model_id) {
std::lock_guard<std::mutex> lock(upload_mutex_);
removed_models_.insert(model_id);
}
void ViewportWindow::setSelectedObjectId(uint32_t id) {
@@ -567,6 +585,10 @@ void ViewportWindow::buildVisibleList(const QMatrix4x4& vp) {
visible_offsets_.reserve(object_draw_info_.size());
for (const auto& obj : object_draw_info_) {
// Skip hidden or removed models.
if (hidden_models_.count(obj.model_id) || removed_models_.count(obj.model_id))
continue;
bool visible = true;
for (int p = 0; p < 6; ++p) {
// p-vertex: the AABB corner most in the direction of the plane normal.