2026-06-04 19:34:51 +10:00
|
|
|
/********************************************************************************
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of IfcOpenShell. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the Lesser GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* IfcOpenShell is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* Lesser GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the Lesser GNU General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
* *
|
|
|
|
|
********************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "ViewportCore.h"
|
|
|
|
|
|
2026-06-05 13:32:19 +10:00
|
|
|
#include "InstanceCompose.h"
|
|
|
|
|
|
2026-06-04 19:34:51 +10:00
|
|
|
ViewportCore::ViewportCore(ViewportHost* host) : host_(host) {}
|
|
|
|
|
ViewportCore::~ViewportCore() = default;
|
2026-06-05 13:32:19 +10:00
|
|
|
|
|
|
|
|
void ViewportCore::composeInstanceFromPlacement(InstanceCpu& inst,
|
|
|
|
|
const ModelGpuData& m) const {
|
|
|
|
|
if (inst.mesh_id < m.meshes.size()) {
|
|
|
|
|
const MeshInfo& mi = m.meshes[inst.mesh_id];
|
|
|
|
|
InstanceCompose::composeInstance(
|
|
|
|
|
inst.placement_transformation,
|
|
|
|
|
federated_false_origin_meters_,
|
|
|
|
|
m.model_transformation_meters,
|
|
|
|
|
m.coordinate_operation_meters,
|
|
|
|
|
mi.local_aabb_min, mi.local_aabb_max,
|
|
|
|
|
inst.transform,
|
|
|
|
|
inst.world_aabb_min, inst.world_aabb_max);
|
|
|
|
|
} else {
|
|
|
|
|
// Unknown mesh id: still compose the transform (downstream may
|
|
|
|
|
// use it for picking / readback even without geometry), but
|
|
|
|
|
// emit a degenerate world AABB so cull doesn't pick this up.
|
|
|
|
|
const float zero[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
|
InstanceCompose::composeInstance(
|
|
|
|
|
inst.placement_transformation,
|
|
|
|
|
federated_false_origin_meters_,
|
|
|
|
|
m.model_transformation_meters,
|
|
|
|
|
m.coordinate_operation_meters,
|
|
|
|
|
zero, zero,
|
|
|
|
|
inst.transform,
|
|
|
|
|
inst.world_aabb_min, inst.world_aabb_max);
|
|
|
|
|
for (int a = 0; a < 3; ++a) {
|
|
|
|
|
inst.world_aabb_min[a] = 0.0f;
|
|
|
|
|
inst.world_aabb_max[a] = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|