guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::systems::HandRaySystem< InteractionType, EventType > Class Template Referenceabstract

Base of the hand input systems that point at an entity: a gesture counts for the entity the hand ray hits. More...

#include <headers/guillaume/systems/hand_event_system.hpp>

Inheritance diagram for guillaume::systems::HandRaySystem< InteractionType, EventType >:
Collaboration diagram for guillaume::systems::HandRaySystem< InteractionType, EventType >:

Public Member Functions

void update (const ecs::Entity::Identifier &entityIdentifier) override
 Test the hand ray of the current event against one entity, store the result with setEngaged() and call the event handler of the interaction component on a hit.
Public Member Functions inherited from guillaume::systems::HandEventSystem< InteractionType, EventType >
 HandEventSystem (event::EventBus &eventBus)
 Create the system, in the Event phase, and subscribe it to events of type EventType.
 ~HandEventSystem (void) override=default
 Default destructor.
void prepare (void) override
 Take the next pending event, once per frame.
void cleanup (void) override
 Does nothing.
Public Member Functions inherited from guillaume::ecs::SystemFiller< InteractionType, components::Transform, components::Bound >
 SystemFiller (Phase phase)
 Create the system and set its signature from ComponentTypes.
virtual ~SystemFiller (void)=default
 Virtual destructor.
Public Member Functions inherited from guillaume::ecs::System
 System (Phase phase)
 Create a system that runs in a given phase, with an empty signature.
virtual ~System (void)=default
 Virtual destructor.
Phase getPhase (void) const noexcept
 Get the phase of the frame in which the system runs.
Entity::Signature getSignature (void) const noexcept
 Get the component types an entity must declare to be visited by this system.
void routine (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry, const ecs::EntityTreeTraveler &traveler)
 Run the system once over a scene: prepare(), update() on each matching entity, cleanup().
void bindComponentRegistry (ecs::ComponentRegistry &componentRegistry)
 Bind a component registry so update() can be called directly, without routine().
void unbindComponentRegistry (void)
 Drop the binding made by bindComponentRegistry().
Public Member Functions inherited from guillaume::event::EventManager< EventType >
 EventManager (EventBus &eventBus)
 Subscribe to a bus; events of type EventType published after this call are queued.
virtual ~EventManager (void)=default
 Virtual destructor.
bool hasPendingEvents (void) const
 Tell whether at least one event is queued, waiting for consumeNextEvent().

Protected Member Functions

virtual void setEngaged (InteractionType &interaction, bool engaged)=0
 Write the result of the hit test on the interaction component. Called for every visited entity, hit or not.
Protected Member Functions inherited from guillaume::ecs::System
template<InheritFromComponent... ComponentTypes>
void setSignature (void)
 Replace the signature by the one made of the given component types.
ecs::EntityRegistry & getEntityRegistry (void)
 Get the entity registry of the scene being processed.
const ecs::EntityRegistry & getEntityRegistry (void) const
 Get the entity registry of the scene being processed, read-only.
ecs::ComponentRegistry & getComponentRegistry (void)
 Get the component registry of the scene being processed.
const ecs::ComponentRegistry & getComponentRegistry (void) const
 Get the component registry of the scene being processed, read-only.
template<InheritFromComponent ComponentType>
bool hasComponent (const ecs::Entity::Identifier &entityIdentifier) const
 Tell whether an entity has a component, in the bound registry.
template<InheritFromComponent ComponentType>
ComponentType & getComponent (const ecs::Entity::Identifier &entityIdentifier)
 Get a component of an entity from the bound registry, to read or modify it.
template<InheritFromComponent ComponentType>
const ComponentType & getComponent (const ecs::Entity::Identifier &entityIdentifier) const
 Get a component of an entity from the bound registry, read-only.
template<InheritFromComponent ComponentType>
bool requireComponent (const ecs::Entity::Identifier &entityIdentifier)
 Tell whether an entity has a component, and log a warning naming the entity and the component when it does not.
Protected Member Functions inherited from guillaume::event::EventManager< EventType >
void consumeNextEvent (void)
 Take the oldest queued event and make it the last event.
std::shared_ptr< EventType > getLastEvent (void)
 Get the event taken by the most recent consumeNextEvent() that found one.

Detailed Description

template<ecs::InheritFromComponent InteractionType, utility::event::InheritFromEvent EventType>
class guillaume::systems::HandRaySystem< InteractionType, EventType >

Base of the hand input systems that point at an entity: a gesture counts for the entity the hand ray hits.

For each visited entity, a ray is cast from the hand position of the current event along the forward axis of the hand pose and tested against the rectangle of the entity, grown by its accessibility margin (a disabled entity is never hit). The result is stored on the interaction component through setEngaged(), and on a hit the component's event handler is called. Nothing happens until a first event has been received.

systems::HandPinch and systems::HandPoke derive from it and only say which flag setEngaged() writes.

Template Parameters
InteractionTypeThe interaction component an entity must have to be visited. It must provide getOnEventHandler().
EventTypeThe hand event the system subscribes to. It must provide the hand pose through getPose().
See also
systems::hitTest

Definition at line 126 of file hand_event_system.hpp.

Member Function Documentation

◆ setEngaged()

template<ecs::InheritFromComponent InteractionType, utility::event::InheritFromEvent EventType>
virtual void guillaume::systems::HandRaySystem< InteractionType, EventType >::setEngaged ( InteractionType & interaction,
bool engaged )
protectedpure virtual

Write the result of the hit test on the interaction component. Called for every visited entity, hit or not.

Parameters
interactionThe interaction component of the entity.
engagedTrue when the hand ray of the current event hits the entity.

◆ update()

template<ecs::InheritFromComponent InteractionType, utility::event::InheritFromEvent EventType>
void guillaume::systems::HandRaySystem< InteractionType, EventType >::update ( const ecs::Entity::Identifier & entityIdentifier)
overridevirtual

Test the hand ray of the current event against one entity, store the result with setEngaged() and call the event handler of the interaction component on a hit.

Parameters
entityIdentifierThe entity holding the interaction component.

Reimplemented from guillaume::systems::HandEventSystem< InteractionType, EventType >.


The documentation for this class was generated from the following file: