|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
A defined region of space with a containment test and crossing actions. More...
#include <Expanse.hpp>
Collaboration diagram for MayaFlux::Nexus::Expanse:Public Types | |
| using | ContainsFn = std::function< bool(const glm::vec3 &)> |
| using | CrossingFn = std::function< void(uint32_t)> |
Public Member Functions | |
| 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. | |
| 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 |
| Stable id assigned by Fabric on registration. | |
| 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. | |
| 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. | |
Private Attributes | |
| ContainsFn | m_contains |
| std::string | m_fn_name |
| uint32_t | m_id { 0 } |
| std::unordered_map< uint32_t, std::unordered_set< uint32_t > > | m_occupants_by_fabric |
| CrossingFn | m_on_enter |
| std::string | m_on_enter_fn_name |
| CrossingFn | m_on_exit |
| std::string | m_on_exit_fn_name |
Friends | |
| class | Fabric |
A defined region of space with a containment test and crossing actions.
An Expanse is an extent, not a point. It holds a containment predicate that answers whether a world position lies within it, and two actions fired when an entity crosses its edge: one on entry, one on exit. The Fabric evaluates the predicate against every indexed position on each commit and diffs membership against the previous commit, firing the actions for the difference. The Expanse does not query; the Fabric drives it, because only the Fabric sees consecutive snapshots.
The containment predicate is a plain function from position to bool. A fixed box, a sphere, a half-space, or an extent driven by an evolving value are all the same kind of thing: the predicate closes over whatever state shapes the region, so an Expanse whose bounds move or breathe is expressed by a predicate that reads that state, with no change to the mechanism.
The entry and exit actions receive the crossing entity id. What crossing means computationally is the action's decision: a tone gated, a parameter written, another entity activated, a value pushed. The Expanse supplies the spatial fact of crossing; the action supplies the consequence.
The id is assigned by Fabric on registration and is stable for the Expanse's lifetime.
Definition at line 31 of file Expanse.hpp.