ifcviewer: move camera mutators + AABB helpers into ViewportCore (#84-i)

Move the cluster of camera-state mutators + per-object AABB helpers
now that the camera fields all live in ViewportCore. CameraState
struct is canonical in core; ViewportWindow keeps a `using` alias
so bonsai's HomeView round-trip (Commands.cpp setHome / restoreHome)
compiles unchanged.

Moved:
  void viewAll()
  void setCamera(...) — pitch + distance clamping included
  void setStandardView(yaw, pitch) — bypasses clamp for ±90°
  void toggleProjection()
  std::string cameraString() const
  CameraState cameraState() const
  void frameAabb(mn, mx, padding)
  bool computeObjectAabb(id, float[3], float[3]) const
  bool computeObjectAabb(id, Eigen::Vector3f&, Eigen::Vector3f&) const

ViewportWindow keeps thin forwarders for the public ones (bonsai
calls them). setCamera additionally flips initial_view_applied_
on the VW side — the auto-viewAll suppression flag isn't in core
yet because the trigger for auto-viewAll lives in the still-in-VW
applyCachedModel path.

The isExposed()+requestUpdate() Qt pattern inside the moved bodies
becomes host_->requestFrame(); two viewAll/toggleProjection diagnostic
prints become fprintf since Log::info() doesn't reach into core.cpp
through the Qt logging surface.

Builds: desktop / bonsai / web all green. Tests 100/100.
This commit is contained in:
Dion Moult
2026-06-05 15:27:39 +10:00
parent 14e7c9fc42
commit 707bb8f5d4
4 changed files with 189 additions and 133 deletions
+5 -8
View File
@@ -174,14 +174,11 @@ public:
bool projectionOrtho() const { return projection_ortho_; }
std::string cameraString() const;
// Snapshot of the orbit camera. Mirrors GL ViewportWindow::CameraState
// so bonsai's "save view" / "restore view" commands port unchanged.
struct CameraState {
Eigen::Vector3f target;
float distance;
float yaw; // degrees
float pitch; // degrees
};
// Snapshot of the orbit camera. Canonical struct now lives in
// ViewportCore so the camera-mutator path stays Qt-free (#84-i);
// the alias keeps bonsai's "save view" / "restore view" callers
// working unchanged.
using CameraState = ViewportCore::CameraState;
CameraState cameraState() const;
// Tool toggles: flip between NoTool and the named tool. Wrappers