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

An Expanse that is a box with a buffer that already exists as its visible body. More...

#include <Mantle.hpp>

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

Public Member Functions

 Mantle (const Kinesis::AABB3D &bounds, std::shared_ptr< Buffers::VKBuffer > buf, Portal::Graphics::FitMode fit=Portal::Graphics::FitMode::STRETCH, CrossingFn on_enter={}, CrossingFn on_exit={})
 Build from a box and a buffer.
 
 Mantle (const Mantle &)=delete
 
 Mantle (Mantle &&)=delete
 
Mantle & operator= (const Mantle &)=delete
 
Mantle & operator= (Mantle &&)=delete
 
void refit ()
 Read the buffer's geometry again and place it to match.
 
void set_bounds (const Kinesis::AABB3D &bounds) override
 Set or replace the box and place the buffer to match.
 
 ~Mantle () override
 
- 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().
 
virtual bool contains (const glm::vec3 &p) const
 Test whether a world position lies within the Expanse.
 
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().
 
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

void begin_evaluate () override
 Called at the start of every evaluate(), before any position is tested.
 
- Protected Member Functions inherited from MayaFlux::Nexus::Expanse
virtual std::pair< glm::vec3, float > reach () const
 Where the region is centred and how far it reaches, for perceptions.
 

Private Member Functions

void refresh ()
 

Private Attributes

Portal::Graphics::FitMode m_fit
 
std::optional< Kinesis::AABB3D > m_local
 
Attachment m_look
 

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 that is a box with a buffer that already exists as its visible body.

The box is the authority. The buffer's geometry is read once, when the Mantle is built and on refit(), and the buffer is placed so that geometry fills the box according to the fit mode. The placement is a geometry transform source on every render processor the buffer has, so it follows set_bounds, and with it bind_bounds, without being pushed. It is the reverse of Hull, where the buffer is the authority and the region follows it.

The fit modes are Portal::Graphics::FitMode read for a box. STRETCH scales each axis independently. CONTAIN scales uniformly until the geometry fits inside the box, COVER until it covers the box, and CENTER does not scale. Tiling has no meaning for geometry and is treated as STRETCH.

The buffer is neither registered nor written to. Releasing the Mantle gives each processor back the transform it had. Two placements on one buffer stack, as two attachments do. Only the box is encoded, so a decoded Mantle is a plain boxed Expanse and the look must be made again.

Definition at line 33 of file Mantle.hpp.


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