25#include <utility/graphic/pose.hpp>
26#include <utility/graphic/ray.hpp>
27#include <utility/math/vector.hpp>
29#include "guillaume/components/bound.hpp"
30#include "guillaume/components/hand_hover_interaction.hpp"
31#include "guillaume/components/mouse_hover_interaction.hpp"
32#include "guillaume/components/style_state.hpp"
33#include "guillaume/ecs/component_registry.hpp"
34#include "guillaume/ecs/entity.hpp"
83 inline utility::math::Vector2F
93 .getAccessibilityMargin();
94 return utility::math::Vector2F(
95 {
static_cast<float>(margin.getWidth()),
96 static_cast<float>(margin.getHeight()) });
104 .getAccessibilityMargin();
105 return utility::math::Vector2F(
106 {
static_cast<float>(margin.getWidth()),
107 static_cast<float>(margin.getHeight()) });
109 return utility::math::Vector2F({ 0.0f, 0.0f });
138 inline bool hitTest(
const utility::graphic::RayF &ray,
139 const utility::graphic::PoseF &pose,
141 const utility::math::Vector2F &margin)
144 utility::math::Vector2F({ bound.getWidth() + 2.0f * margin[0],
145 bound.getHeight() + 2.0f * margin[1] });
151 const auto &orientation = pose.getOrientation();
152 utility::graphic::PositionF position = pose.getPosition();
154 utility::graphic::PositionF(-(orientation.getRight() * margin[0])
155 + (orientation.getUp() * margin[1])
156 - (orientation.getUp() * size[1])));
158 return ray.intersectRectangle(
159 utility::graphic::PoseF(position, orientation), size);
Size of an entity: the width and height, in dp, of the rectangle that starts at the position of its c...
Whether an XR hand (controller) aims at an entity, what to call when the aim enters or leaves,...
Whether the mouse pointer is over an entity, what to call when it enters or leaves,...
The interaction state of an entity in one place: enabled or disabled, and whether it is hovered,...
bool isEnabled(void) const
Check whether the entity accepts interaction.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
ComponentType & getComponent(const Entity::Identifier &entityIdentifier)
Get a component of an entity, to read or modify it.
bool hasComponent(const Entity::Identifier &entityIdentifier) const
Tell whether an entity has a component of a given type.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
Rules. Every class here runs each frame on the entities that have the components it declares.
bool hitTest(const utility::graphic::RayF &ray, const utility::graphic::PoseF &pose, const components::Bound &bound, const utility::math::Vector2F &margin)
Whether a ray crosses the rectangle of an entity, grown by a margin.
utility::math::Vector2F hitMargin(const ecs::ComponentRegistry ®istry, const ecs::Entity::Identifier &entityIdentifier)
Extra hit area of an entity around its Bound, in dp.
bool isInteractive(const ecs::ComponentRegistry ®istry, const ecs::Entity::Identifier &entityIdentifier)
Whether an entity accepts input.