MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Nexus::Hull Class Reference

An Expanse whose region is the bounds of a buffer that already exists. More...

#include <Hull.hpp>

+ Inheritance diagram for MayaFlux::Nexus::Hull:
+ Collaboration diagram for MayaFlux::Nexus::Hull:

Public Member Functions

bool contains (const glm::vec3 &p) const override
 Test whether a world position lies within the buffer's bounds as drawn.
 
 Hull (std::shared_ptr< Buffers::VKBuffer > buf, CrossingFn on_enter={}, CrossingFn on_exit={}, std::optional< uint32_t > collection=std::nullopt)
 Build from a buffer.
 
void refit ()
 Read the buffer's geometry again and take its bounds.
 
- Public Member Functions inherited from MayaFlux::Nexus::Expanse
template<typename T >
std::shared_ptr< Influence< T, CrossingContext > > add_entry (typename Influence< T, CrossingContext >::Producer producer)
 Add an action of any type that runs when an entity enters.
 
template<typename T >
std::shared_ptr< Influence< T, CrossingContext > > add_exit (typename Influence< T, CrossingContext >::Producer producer)
 Add an action of any type that runs when an entity leaves.
 
template<typename T >
std::shared_ptr< Influence< T, CrossingContext > > add_inside (typename Influence< T, CrossingContext >::Producer producer)
 Add an action of any type that runs on every commit for each entity inside.
 
template<typename T >
std::shared_ptr< Perception< T > > add_perception (typename Perception< T >::Source source)
 Add a perception of any type over the entities inside, with as many targets as are wanted.
 
const std::optional< Kinesis::AABB3D > & bounds () const
 The box, if set.
 
void clear_bounds ()
 Remove the box, leaving the predicate.
 
void clear_crossings ()
 Stop every typed action.
 
void clear_perceptions ()
 Stop every perception added with add_perception().
 
void evaluate (uint32_t fabric_id, std::span< const std::pair< uint32_t, glm::vec3 > > snapshot)
 Evaluate a spatial snapshot from one Fabric against this Expanse.
 
void evict (uint32_t fabric_id)
 Fire the exit actions for everything inside for fabric_id and forget it.
 
 Expanse (const Kinesis::AABB3D &bounds, CrossingFn on_enter={}, CrossingFn on_exit={})
 Construct as a box.
 
 Expanse (ContainsFn contains)
 Construct with a containment predicate only, for an Expanse whose behaviour comes from typed actions.
 
 Expanse (ContainsFn contains, CrossingFn on_enter, CrossingFn on_exit)
 Construct with a containment predicate and crossing actions.
 
 Expanse (std::string fn_name, ContainsFn contains, CrossingFn on_enter, CrossingFn on_exit)
 Construct with a named containment predicate and crossing actions.
 
 Expanse (std::string fn_name, std::string on_enter_fn_name, std::string on_exit_fn_name, ContainsFn contains, CrossingFn on_enter, CrossingFn on_exit)
 Construct with named containment predicate and named crossing actions.
 
const std::string & fn_name () const
 Identifier assigned to the containment predicate, empty if anonymous.
 
uint32_t id () const
 Id assigned at construction.
 
const std::unordered_set< uint32_t > * occupants (uint32_t fabric_id) const
 Entity ids inside this Expanse for fabric_id, or nullptr if that fabric has no occupants.
 
std::vector< uint32_t > occupied_fabrics () const
 All fabric ids that currently have at least one occupant inside this Expanse.
 
const std::string & on_enter_fn_name () const
 Identifier assigned to the on_enter callable, empty if anonymous.
 
const std::string & on_exit_fn_name () const
 Identifier assigned to the on_exit callable, empty if anonymous.
 
template<typename T >
void remove_crossing (const std::shared_ptr< Influence< T, CrossingContext > > &action)
 Stop an action added with add_entry(), add_exit() or add_inside().
 
template<typename T >
void remove_perception (const std::shared_ptr< Perception< T > > &perception)
 Stop a perception added with add_perception().
 
virtual void set_bounds (const Kinesis::AABB3D &bounds)
 Set or replace the box.
 
void set_fn_name (std::string name)
 Set or replace the predicate identifier.
 
void set_on_enter_fn_name (std::string name)
 Set or replace the on_enter callable identifier.
 
void set_on_exit_fn_name (std::string name)
 Set or replace the on_exit callable identifier.
 
virtual ~Expanse ()=default
 

Protected Member Functions

std::pair< glm::vec3, float > reach () const override
 The centre of the bounds as drawn, and the distance to their farthest corner.
 
- Protected Member Functions inherited from MayaFlux::Nexus::Expanse
virtual void begin_evaluate ()
 Called at the start of every evaluate(), before any position is tested.
 

Private Attributes

std::shared_ptr< Buffers::VKBuffer > m_buf
 
std::optional< uint32_t > m_collection
 
std::optional< Kinesis::AABB3D > m_local
 

Friends

class StateEncoder
 

Additional Inherited Members

- Public Types inherited from MayaFlux::Nexus::Expanse
using ContainsFn = std::function< bool(const glm::vec3 &)>
 
using CrossingFn = std::function< void(uint32_t)>
 

Detailed Description

An Expanse whose region is the bounds of a buffer that already exists.

The buffer's geometry is read once, when the Hull is built and on refit(), and the box is kept in the buffer's stored coordinates. Containment takes a world position back through the transform the buffer is drawn with, so the region follows the buffer wherever it is placed, for example by an Agent attached to it, and stays an exact box under rotation and scale. The buffer is neither registered nor written to, and nothing is encoded for a Hull.

Only the buffer's primary render processor is read. A buffer whose geometry cannot be read contains nothing. Reading a buffer that a GpuFieldOperator drives downloads it from the device, so refit() belongs on a FRAME_ACCURATE metro.

Definition at line 28 of file Hull.hpp.


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