mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-07 21:06:25 +00:00
ifcviewer: move composeInstanceFromPlacement into ViewportCore (#84-d)
First method-body migration. composeInstanceFromPlacement composes the
federated-false-origin × model-transformation × coordinate-operation ×
placement chain and re-derives the world AABB; it's a small,
self-contained method that only reads scene state and one matrix.
Moved:
Eigen::Matrix4d federated_false_origin_meters_ (storage → core_)
void composeInstanceFromPlacement(InstanceCpu&, ...) (body → core_)
ViewportWindow keeps:
- alias reference to federated_false_origin_meters_ (existing
setFederatedFalseOrigin call site still writes through it)
- no method declaration — internal callers route through core_
Internal caller (recomposeAndUploadModel) now invokes
core_.composeInstanceFromPlacement; once recomposeAndUploadModel
itself moves into ViewportCore the call shortens back.
Pattern for the rest of #84: state moves, then method body moves,
then internal callers update. Each commit leaves desktop / bonsai /
web green and tests 100/100. This is one of many such steps.
This commit is contained in:
@@ -35,10 +35,13 @@
|
||||
|
||||
#include <webgpu/webgpu.h>
|
||||
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "BufferPool.h"
|
||||
#include "InstancedGeometry.h"
|
||||
#include "ModelGpuData.h"
|
||||
#include "StreamingThread.h"
|
||||
#include "ViewportHost.h"
|
||||
@@ -53,6 +56,18 @@ public:
|
||||
|
||||
ViewportHost* host() const { return host_; }
|
||||
|
||||
// ---- Scene-mutation methods --------------------------------------------
|
||||
//
|
||||
// composeInstanceFromPlacement composes the per-instance
|
||||
// transform = federated_false_origin × model_transformation
|
||||
// × coordinate_operation × placement
|
||||
// (all in metres, double precision) and rebakes the world AABB
|
||||
// from the mesh-local one. Used by the per-model recompose path
|
||||
// after any of the four federation matrices change. Pure scene
|
||||
// math — no GPU touch.
|
||||
void composeInstanceFromPlacement(InstanceCpu& inst,
|
||||
const ModelGpuData& m) 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
|
||||
@@ -129,6 +144,11 @@ private:
|
||||
// the sidecar's local object_ids by base_object_id_so_far so picks
|
||||
// are unambiguous across models.
|
||||
uint32_t next_object_id_ = 1;
|
||||
|
||||
// Federation false origin (metres, double precision). Applied to
|
||||
// every instance composition so geometry rebased through a large
|
||||
// model offset doesn't lose float32 precision near the GPU origin.
|
||||
Eigen::Matrix4d federated_false_origin_meters_ = Eigen::Matrix4d::Identity();
|
||||
};
|
||||
|
||||
#endif // VIEWPORTCORE_H
|
||||
|
||||
Reference in New Issue
Block a user