1#include "Components/Core/SceneComponent.h"
2#include "Components/Core/TransformComponent.h"
3#include "Systems/Core/TransformSystem.h"
6#include "Systems/OctSystem.h"
11 for (
const auto & octComp : octSystem->
pool) {
12 const auto & octtreeData = octSystem->getData(&octComp);
14 if (octtreeData.nodes.empty())
return;
17 if (sceneComp->visible ==
false)
return;
20 auto & worldMatrix = context->transformSystem->getLocalToWorld(transComp);
22 const auto & apex = octtreeData.nodes.back();
24 const auto s = 1 << apex.ix4.w;
25 for (
unsigned i = 0; i < 8; i++) {
26 auto r = glm::vec3(octtreeData.alignMinToZeroShift.x + s*
int(apex.ix4.x + (i & 1)),
27 octtreeData.alignMinToZeroShift.y + s*
int(apex.ix4.y + ((i >> 1) & 1)),
28 octtreeData.alignMinToZeroShift.z + s*
int(apex.ix4.z + ((i >> 2) & 1)));
30 auto q = octComp.blockExtent * r + octComp.blockShift;
31 auto p = worldMatrix * glm::vec4(q, 1.f);
32 auto l = (1.f / p.w)*glm::vec3(p.x, p.y, p.z);
ComponentType * getComponent() const
ComponentPool< ComponentType > pool
Pool of components managed by the system.
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Contains information on how the entity behaves in the scene.
void getBounds(Context *context, Cogs::Geometry::BoundingBox &bounds) override
Expand bounds including bounds of all entities in this system in world coordinates.