1#include "HighlightRegionBounds.h"
2#include "HighlightRegionSystem.h"
3#include "Systems/Core/SceneSystem.h"
4#include "Systems/Core/TransformSystem.h"
13 if (data.boundsMax.x < data.boundsMin.x)
return false;
15 if (!ignoreVisibility) {
17 if (!sceneComp->visible)
return false;
22 glm::mat4 localToWorld = context->transformSystem->getLocalToWorld(trComp);
24 glm::vec3 corners[8] = {
25 glm::vec3(data.boundsMin.x, data.boundsMin.y, data.boundsMin.z),
26 glm::vec3(data.boundsMax.x, data.boundsMin.y, data.boundsMin.z),
27 glm::vec3(data.boundsMin.x, data.boundsMax.y, data.boundsMin.z),
28 glm::vec3(data.boundsMax.x, data.boundsMax.y, data.boundsMin.z),
29 glm::vec3(data.boundsMin.x, data.boundsMin.y, data.boundsMax.z),
30 glm::vec3(data.boundsMax.x, data.boundsMin.y, data.boundsMax.z),
31 glm::vec3(data.boundsMin.x, data.boundsMax.y, data.boundsMax.z),
32 glm::vec3(data.boundsMax.x, data.boundsMax.y, data.boundsMax.z),
34 for (
const glm::vec3& corner : corners) {
35 glm::vec3 p = glm::vec3(localToWorld * glm::vec4(corner, 1));
36 bounds.min = glm::min(bounds.min, p);
37 bounds.max = glm::max(bounds.max, p);
49 adjustBounds(context, hrSystem, bounds, regionComp,
false);
56 return adjustBounds(context, hrSystem, bounds, *regionComp, ignoreVisibility);
ComponentType * getComponent() const
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.
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.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
void getBounds(Context *context, Cogs::Geometry::BoundingBox &bounds) override
Expand bounds including bounds of all entities in this system in world coordinates.