mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-15 18:14:08 +00:00
wgpu backend: load .ifcview sidecars onto GPU buffers
Stage 2 of the wgpu port. WgpuViewportWindow gains a queueLoadSidecar API (called from the minimal driver before init) and an applyCachedModel that runs after init: reads via SidecarCache::readSidecar, allocates four wgpu buffers per model (vertex storage, index, mesh-quant storage, instance storage), uploads via wgpuQueueWriteBuffer, retains a CPU mirror of the MeshInfo/InstanceCpu arrays for the cull and picking paths that arrive in later stages. MeshGpu (the per-mesh quantization basis) is derived from MeshInfo on the fly; InstanceGpu (transform + ids) is derived from InstanceCpu and uses the cached float transform — composing from placement_transformation against federation-stage matrices lands when stage 5 wires those. SidecarCache.cpp is compiled into IfcViewerWgpu directly: it's pure C++ with no Qt/OCCT/IFC-parse deps, so dragging in the IfcViewer static lib for one source file would be wasteful. This duplication goes away once src/ifcviewer-core/ is extracted (task #12). Verified on a synthesised v13 sidecar (4 verts, 6 indices, 1 mesh, 1 instance) and a multi-sidecar load that assigns successive model_ids. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -36,8 +36,11 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(
|
||||
"IfcOpenShell minimal wgpu IFC viewer (stage 1: clear-color smoke test)");
|
||||
"IfcOpenShell minimal wgpu IFC viewer (stage 2: sidecar load, no draw)");
|
||||
parser.addHelpOption();
|
||||
parser.addPositionalArgument("files",
|
||||
"Sidecar (.ifcview) files to load. Stem-based: foo.ifc resolves to foo.ifcview.",
|
||||
"[files...]");
|
||||
parser.process(app);
|
||||
|
||||
auto* viewport = new WgpuViewportWindow;
|
||||
@@ -47,10 +50,16 @@ int main(int argc, char* argv[]) {
|
||||
container->setMinimumSize(320, 240);
|
||||
|
||||
QMainWindow main_window;
|
||||
main_window.setWindowTitle("IfcViewer (wgpu) — stage 1");
|
||||
main_window.setWindowTitle("IfcViewer (wgpu) — stage 2");
|
||||
main_window.setCentralWidget(container);
|
||||
main_window.resize(1280, 800);
|
||||
main_window.show();
|
||||
|
||||
// Queue sidecars; they're loaded after wgpu init completes in
|
||||
// exposeEvent. Ordering matches the command line.
|
||||
for (const QString& path : parser.positionalArguments()) {
|
||||
viewport->queueLoadSidecar(path);
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user