ifcviewer: move camera math into ViewportCore (#84-h)

Move the three camera-math methods that compute view/projection
matrices, scene bounds, and per-chunk screen footprint for the
streaming priority signal:

  void  buildViewProj(Eigen::Matrix4f&, Eigen::Matrix4f&) const
  bool  computeSceneAabb(float[3], float[3]) const
  float chunkScreenAreaPx(const ModelGpuData::Chunk&,
                          const Eigen::Matrix4f&) const

Plus the orbitEye helper (anonymous namespace in ViewportCore.cpp;
the qDegreesToRadians dep got swapped for an inline M_PI/180 constant).

ViewportWindow.cpp's 9 internal callers (cull, streaming, pick,
render, debug) updated to use core_.buildViewProj() etc. The
buildViewProj forwarder stays out of ViewportWindow.h since no
external caller needs it — bonsai/minimal both go through
public API methods like viewAll which still wrap core_ access
on the VW side.

Builds: desktop / bonsai / web all green. Tests 100/100.
This commit is contained in:
Dion Moult
2026-06-05 14:43:25 +10:00
parent a0db182d2b
commit 14e7c9fc42
4 changed files with 159 additions and 142 deletions
+15
View File
@@ -109,6 +109,21 @@ public:
// completed.
void recomposeAndUploadModel(uint32_t model_id);
// ---- Camera math --------------------------------------------------------
//
// buildViewProj feeds every cull, streaming, pick and render path
// — keep it as a single helper so the projection_ortho_ toggle
// and the near-vertical up-vector switch can't drift between
// call sites. computeSceneAabb folds every visible model's
// world AABBs into one — used by viewAll and the bench camera.
// chunkScreenAreaPx projects one chunk's world AABB through a
// VP into 2D pixels — the streaming loader's priority signal.
void buildViewProj(Eigen::Matrix4f& view_out,
Eigen::Matrix4f& proj_out) const;
bool computeSceneAabb(float mn[3], float mx[3]) const;
float chunkScreenAreaPx(const ModelGpuData::Chunk& c,
const Eigen::Matrix4f& vp_mat) const;
// Friend access for ViewportWindow's reference proxies. As each
// render method moves into ViewportCore it stops needing these
// (it touches the fields directly); once everything has migrated