Route bonsai through wgpu; delete the GL backend

Bonsai now drives the wgpu viewport for both sidecar and direct-IFC
loads. The GL viewer and its supporting state classes are gone.

SceneLoader rewire:
- Takes WgpuViewportWindow* instead of ViewportWindow*.
- Sidecar path reads metadata only (readSidecarMetadataOnly) and hands
  the StreamingSidecar off to the new applyCachedModel. Field accesses
  inside applySidecarData go through .meta.
- Direct-IFC path uses the wgpu A-path (upload{Mesh,Instance}Chunk +
  finalizeModel). The applyLodExtension call is dropped — wgpu has no
  live LOD1 splice; LOD1 still lands in the on-disk sidecar for the
  next open.

Bonsai migration:
- ViewportWindow → WgpuViewportWindow across MainWindow, Measurement,
  SessionState, and every modules/*/{Commands,Panel,View}.{h,cpp} —
  116 sites total. Same s/OverlayRenderer::/WgpuOverlayRenderer::/
  rename, 12 sites.
- Includes flipped from ../ifcviewer/ViewportWindow.h to
  ../ifcviewer-wgpu/WgpuViewportWindow.h. OverlayRenderer.h include
  dropped (transitively reached via the viewport header).
- BonsaiViewer links IfcViewerWgpu in addition to IfcViewer for the
  duration of the migration; the GL-side IfcViewer also publicly links
  IfcViewerWgpu so SceneLoader can resolve WgpuViewportWindow.

GL backend deletion:
- src/ifcviewer/ViewportWindow.{cpp,h}, BvhAccel.*, OverlayRenderer.*,
  Selection.*, Visibility.* all gone.
- src/ifcviewer-minimal/ removed entirely (MinimalWindow drove the GL
  viewport).
- src/ifcviewer/tests: test_bvh_accel, test_selection, test_visibility
  removed. The first has no replacement (wgpu doesn't use a per-instance
  BVH); the latter two are ported separately. test_lod_builder,
  test_sidecar_cache, test_instanced_geometry, test_federation remain
  (backend-agnostic).
- IfcViewer's CMakeLists drops OpenGL, Qt::OpenGL, Qt::Widgets — none
  of the surviving translation units reach for them.

Build flag plumbing:
- BUILD_BONSAIVIEWER now auto-enables BUILD_BONSAIVIEWER_WGPU since
  SceneLoader requires the wgpu lib for its WgpuViewportWindow* arg.
- The wgpu subprojects add_subdirectory ahead of the GL one so
  IfcViewerWgpu exists when IfcViewer's link evaluates.
- src/ifcviewer-minimal subdir reference removed from cmake/CMakeLists.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-06-01 17:38:33 +10:00
parent 9c067d1d0e
commit 2981500b3b
40 changed files with 208 additions and 8008 deletions
+3 -42
View File
@@ -32,10 +32,6 @@ function(add_ifcviewer_unit_test name)
catch_discover_tests(${name})
endfunction()
add_ifcviewer_unit_test(test_bvh_accel
SOURCES ${IFCVIEWER_SRC}/BvhAccel.cpp
)
if(WITH_MESH_OPTIMIZER)
add_ifcviewer_unit_test(test_lod_builder
SOURCES
@@ -50,11 +46,9 @@ add_ifcviewer_unit_test(test_sidecar_cache
add_ifcviewer_unit_test(test_instanced_geometry)
# Federation, Visibility and Selection are Qt-derived (QObject + signals).
# Unlike the other Tier-1 tests they have to pull Qt6 in directly and enable
# AUTOMOC for the Q_OBJECT moc-generation. OpenGL is needed only by the
# Selection test (Selection.cpp references QOpenGLFunctions_4_5_Core).
find_package(Qt${QT_VERSION} COMPONENTS Core Gui Test OpenGL REQUIRED PATHS ${QT_DIR})
# Federation is Qt-derived (QObject + signals). It has to pull Qt6 in
# directly and enable AUTOMOC for the Q_OBJECT moc-generation.
find_package(Qt${QT_VERSION} COMPONENTS Core Gui Test REQUIRED PATHS ${QT_DIR})
find_package(Eigen3 REQUIRED)
@@ -82,36 +76,3 @@ target_link_libraries(test_federation PRIVATE
IfcParse # Unit.cpp uses express::Base / file APIs
)
catch_discover_tests(test_federation)
# VisibilityState / SelectionState are QObjects (for their changed() signal)
# but their construction + mutation API touch no GL, so the tests exercise
# the pure CPU state machine without ever creating a context. Selection.cpp
# still references QOpenGLFunctions_4_5_Core, so test_selection has to link
# Qt6::OpenGL even though no GL call is reached at runtime.
add_executable(test_visibility
test_visibility.cpp
${IFCVIEWER_SRC}/Visibility.cpp
)
set_target_properties(test_visibility PROPERTIES AUTOMOC ON)
target_include_directories(test_visibility PRIVATE ${IFCVIEWER_SRC})
target_link_libraries(test_visibility PRIVATE
Catch2::Catch2WithMain
Qt${QT_VERSION}::Core
Qt${QT_VERSION}::Test # QSignalSpy
)
catch_discover_tests(test_visibility)
add_executable(test_selection
test_selection.cpp
${IFCVIEWER_SRC}/Selection.cpp
)
set_target_properties(test_selection PROPERTIES AUTOMOC ON)
target_include_directories(test_selection PRIVATE ${IFCVIEWER_SRC})
target_link_libraries(test_selection PRIVATE
Catch2::Catch2WithMain
Qt${QT_VERSION}::Core
Qt${QT_VERSION}::Gui # QtOpenGL depends on QtGui
Qt${QT_VERSION}::OpenGL # Selection.cpp: QOpenGLFunctions_4_5_Core
Qt${QT_VERSION}::Test # QSignalSpy
)
catch_discover_tests(test_selection)