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
+9
View File
@@ -29,6 +29,7 @@
#include <QVector3D>
#include <vector>
#include <unordered_set>
#include <cstdint>
#include <mutex>
@@ -39,6 +40,7 @@ struct MaterialInfo {
struct ObjectDrawInfo {
uint32_t index_offset; // byte offset into EBO
uint32_t index_count; // number of indices
uint32_t model_id; // which model this object belongs to
float aabb_min[3]; // world-space AABB
float aabb_max[3];
};
@@ -51,6 +53,7 @@ struct UploadChunk {
std::vector<float> vertices;
std::vector<uint32_t> indices; // local to this chunk's vertices
uint32_t object_id = 0;
uint32_t model_id = 0;
};
class ViewportWindow : public QWindow {
@@ -62,6 +65,10 @@ public:
void uploadChunk(const UploadChunk& chunk);
void resetScene();
void hideModel(uint32_t model_id);
void showModel(uint32_t model_id);
void removeModel(uint32_t model_id);
void setSelectedObjectId(uint32_t id);
uint32_t pickObjectAt(int x, int y);
@@ -136,6 +143,8 @@ private:
// Per-object draw metadata for frustum culling.
std::vector<ObjectDrawInfo> object_draw_info_;
std::unordered_set<uint32_t> hidden_models_;
std::unordered_set<uint32_t> removed_models_;
uint32_t total_index_count_ = 0;
std::mutex upload_mutex_;