MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ add_perception()

template<typename T >
std::shared_ptr< Perception< T > > MayaFlux::Nexus::Expanse::add_perception ( typename Perception< T >::Source  source)
inline

Add a perception of any type over the entities inside, with as many targets as are wanted.

Template Parameters
TType the source returns; whatever the targets take.
Parameters
sourceReads the value from a PerceptionContext whose position and radius are the region's centre and reach, and whose spatial results are the occupants: entity id and squared distance from the centre.
Returns
The perception, to add its targets with Perception::add_target.

Runs once per evaluate for each Fabric, before the crossing actions.

Definition at line 260 of file Expanse.hpp.

261 {
262 auto perception = std::make_shared<Perception<T>>(std::move(source));
263 m_perceptions.emplace_back(perception,
264 [perception](const PerceptionContext& ctx) { perception->invoke(ctx); });
265 return perception;
266 }
std::vector< std::pair< std::shared_ptr< void >, PerceptionFn > > m_perceptions
Definition Expanse.hpp:349