2#include "Systems/Core/TransformSystem.h"
4#include "PotreeSystem.h"
8 if (!ignoreVisibility && !poComp.isVisible())
return false;
16 poSystem->updateOcttreeFrame(context, *poData, poComp);
18 const glm::vec3& tbmin = poData->octtreeFrame.tightBBoxMin;
19 const glm::vec3& tbmax = poData->octtreeFrame.tightBBoxMax;
20 if (poData->state == PotreeState::Running && tbmin.x < tbmax.x) {
22 glm::vec3 min_ws = bounds.min;
23 glm::vec3 max_ws = bounds.max;
25 const glm::mat4& worldFromOcttreeFrame = poData->worldFromOcttreeFrame;
26 for (
unsigned i = 0; i < 8; i++) {
27 glm::vec4 p = worldFromOcttreeFrame * glm::vec4(((i >> 0) & 1) ? tbmin.x : tbmax.x,
28 ((i >> 1) & 1) ? tbmin.y : tbmax.y,
29 ((i >> 2) & 1) ? tbmin.z : tbmax.z,
31 const glm::vec3 q = (1.f / p.w) * glm::vec3(p);
32 min_ws = glm::min(min_ws, q);
33 max_ws = glm::max(max_ws, q);
36 bounds.min = glm::min(bounds.min, min_ws);
37 bounds.max = glm::max(bounds.max, max_ws);
46 CpuInstrumentationScope(SCOPE_POTREE,
"getBounds");
49 for (
auto& poComp : poSystem->pool) {
50 getBounds(context, poComp, bounds,
false);
57 if (!poCompPtr)
return false;
58 return getBounds(context, *poCompPtr, bounds, ignoreVisibility);
Container for components, providing composition of dynamic entities.
T * getComponent() const
Get a pointer to the first component implementing the given type in the entity.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
void getBounds(Context *context, Cogs::Geometry::BoundingBox &bounds) override
Expand bounds including bounds of all entities in this system in world coordinates.
Component for Point Cloud Display.