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

Agent that perceives the world from a navigation state and influences how the things it touches are viewed. More...

#include <Locus.hpp>

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

Public Member Functions

void add_view_target (std::shared_ptr< Buffers::RenderProcessor > proc)
 Add a render processor whose view transform this Locus drives.
 
float aspect () const
 Current aspect ratio.
 
const Kinesis::ViewTransformcurrent_view () const
 The ViewTransform produced by the most recent perceive().
 
void invoke_influence (const InfluenceContext &ctx) const override
 Influence: run the user influence callable, then push the current view to every view target.
 
void invoke_perception (const PerceptionContext &ctx) override
 Perceive: run the user perception callable, then integrate the view.
 
 Locus (const Kinesis::NavigationConfig &config, float query_radius, PerceptionFn perception, InfluenceFn influence)
 Construct from a NavigationConfig with perception and influence functions.
 
 Locus (const Kinesis::NavigationConfig &config, float query_radius, std::string perception_fn_name, PerceptionFn perception, std::string influence_fn_name, InfluenceFn influence)
 Construct from a NavigationConfig with named perception and influence functions.
 
Kinesis::NavigationStatenav ()
 Mutable access to the navigation lens.
 
const Kinesis::NavigationStatenav () const
 Read-only access to the navigation lens.
 
void remove_view_target (const std::shared_ptr< Buffers::RenderProcessor > &proc)
 Stop driving a render processor's view transform.
 
void set_aspect (float aspect)
 Aspect ratio used when integrating the view.
 
const std::vector< std::shared_ptr< Buffers::RenderProcessor > > & view_targets () const
 All render processors currently driven by this Locus.
 
- Public Member Functions inherited from MayaFlux::Nexus::Agent
void add_influence_target (std::shared_ptr< Buffers::RenderProcessor > proc)
 Add a render processor to receive GPU-side influence data.
 
 Agent (float query_radius, PerceptionFn perception, InfluenceFn influence)
 Construct with query radius, perception function, and influence function.
 
 Agent (float query_radius, std::string perception_fn_name, PerceptionFn perception, std::string influence_fn_name, InfluenceFn influence)
 Construct with named perception and influence functions.
 
const std::vector< AudioSink > & audio_sinks () const
 
void clear_color ()
 Clear the color, resetting it to an unset state.
 
void clear_influence_targets ()
 Unbind and remove all influence targets and free the UBO.
 
void clear_position ()
 Clear the position, removing this object from spatial operations.
 
void clear_size ()
 Clear the size, resetting it to an unset state.
 
const std::optional< glm::vec3 > & color () const
 Get the current color, if set.
 
std::shared_ptr< Buffers::RenderProcessorget_render_processor (const std::shared_ptr< Core::Window > &window) const
 
uint32_t id () const
 Return the stable object id assigned by Fabric.
 
const InfluenceFninfluence_fn () const
 The influence function itself.
 
const std::string & influence_fn_name () const
 Identifier assigned to the influence function, empty if anonymous.
 
const std::vector< std::shared_ptr< Buffers::RenderProcessor > > & influence_targets () const
 All render processors currently receiving influence data.
 
float intensity () const
 Get the current intensity.
 
const PerceptionFnperception_fn () const
 The perception function itself.
 
const std::string & perception_fn_name () const
 Identifier assigned to the perception function, empty if anonymous.
 
const std::optional< glm::vec3 > & position () const
 Return the current position, if set.
 
float query_radius () const
 Return the query radius.
 
float radius () const
 Get the current radius.
 
void remove_audio_sink (Buffers::BufferManager &mgr, uint32_t channel)
 Unregister the audio sink on channel.
 
void remove_influence_target (const std::shared_ptr< Buffers::RenderProcessor > &proc)
 Remove a single influence target and unbind its UBO.
 
void remove_render (Buffers::BufferManager &mgr, const std::shared_ptr< Core::Window > &window)
 Unregister the render sink targeting window.
 
void render (Buffers::BufferManager &mgr, const Portal::Graphics::RenderConfig &config)
 Register a render output targeting window.
 
void render (Buffers::BufferManager &mgr, const Portal::Graphics::RenderConfig &config, std::string fn_name, RenderFn fn)
 Register a render output targeting window with a producer function.
 
const std::vector< RenderSink > & render_sinks () const
 
void set_audio_data (std::span< const double > samples)
 Push samples to all registered audio sinks.
 
void set_color (const glm::vec3 &c)
 Set the color, a general-purpose parameter for influence functions.
 
void set_influence_fn_name (std::string name)
 Set or replace the influence function's identifier.
 
void set_intensity (float i)
 Set the intensity, a general-purpose parameter for influence functions.
 
void set_perception_fn_name (std::string name)
 Set or replace the perception function's identifier.
 
void set_position (const glm::vec3 &p)
 Set the position, enabling spatial indexing and queries for this object.
 
void set_query_radius (float r)
 Set the query radius.
 
void set_radius (float r)
 Set the radius, a general-purpose parameter for influence functions.
 
void set_size (float s)
 Set the size, a general-purpose parameter for influence functions.
 
void set_vertices (const void *data, size_t byte_count)
 Set pre-packed interleaved vertex bytes to all registered render sinks.
 
template<typename T >
void set_vertices (std::span< const T > vertices)
 Set typed vertex data to all registered render sinks.
 
void sink_audio (Buffers::BufferManager &mgr, uint32_t channel)
 Register an audio output on channel.
 
void sink_audio (Buffers::BufferManager &mgr, uint32_t channel, std::function< Kakshya::DataVariant(const InfluenceContext &)> fn, std::string fn_name="")
 Register an audio output on channel with a producer function.
 
const std::optional< float > & size () const
 Get the current size, if set.
 
virtual ~Agent ()=default
 

Private Attributes

float m_aspect { 1.0F }
 
Kinesis::NavigationState m_nav
 
Kinesis::ViewTransform m_view {}
 
std::vector< std::shared_ptr< Buffers::RenderProcessor > > m_view_targets
 

Additional Inherited Members

- Public Types inherited from MayaFlux::Nexus::Agent
using InfluenceFn = std::function< void(const InfluenceContext &)>
 
using PerceptionFn = std::function< void(const PerceptionContext &)>
 

Detailed Description

Agent that perceives the world from a navigation state and influences how the things it touches are viewed.

An Agent already carries both a perception function and an influence function. Locus makes both concrete around a Kinesis::NavigationState:

Perception is observation. The navigation state is the lens. Held movement flags, yaw, and pitch advance the eye; the perception path integrates that motion against elapsed time and produces the current ViewTransform. The Locus sees the world from wherever its navigation state currently sits, and its inherited Agent position follows the eye so the spatial index and any PerceptionContext observe the same point.

Influence is re-viewing. A Locus holds a set of view targets: render processors whose view transform it drives. On each influence the current ViewTransform is pushed to every target. The same motion that determines what the Locus perceives determines how everything under its influence is seen. Multiple processors driven by one Locus share its viewpoint; multiple Loci over disjoint targets partition the scene into independently-viewed regions.

The base perception and influence callables still fire. Locus layers its view behaviour on top: the user callables run, then the view is integrated and distributed. A user perception callable can read the freshly produced transform through the Locus; a user influence callable can add domain effects alongside the view push.

The navigation state is plain data, mutated directly through nav() or via the Kinesis free functions (apply_mouse_delta, apply_scroll, snap_ortho). Wiring a Locus with every(1.0/60.0) drives the whole cycle each frame. Because the view push writes a render processor UBO, wire the Locus so its influence fires on the graphics thread when it drives view targets.

Definition at line 48 of file Locus.hpp.


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